private void testPutAndGet(PluginType type, String pluginName, String resourceType) throws Exception {
String contents = RandomStringUtils.randomAlphanumeric(8 * Constants.PLUGIN_RESOURCE_CHUNK_SIZE);
ResourceType pluginResourceType = new ResourceType(type, pluginName, resourceType);
ResourceMeta meta = new ResourceMeta("hello", 1, ResourceStatus.INACTIVE);
assertSendContents(contents, type, pluginName, resourceType, "hello");
HttpResponse response = doGetExternalAPI(getNamePath(pluginResourceType, meta.getName()), ADMIN_HEADERS);
assertResponseStatus(response, HttpResponseStatus.OK);
Assert.assertEquals(ImmutableSet.of(meta), bodyToMetaSet(response));
String typeStr = type.name().toLowerCase() + "types";
String path = Joiner.on('/').join(
"/tenants",
ADMIN_ACCOUNT.getTenantId(),
typeStr,
pluginName,
resourceType,
meta.getName(),
"versions",
meta.getVersion()
);
response = doGetInternalAPI(path);
assertResponseStatus(response, HttpResponseStatus.OK);
Assert.assertEquals(contents, bodyToString(response));
}