private void testGetAndDelete(ResourceType type) throws Exception {
String contents = "some contents";
ResourceMeta meta1 = new ResourceMeta("name1", 1, ResourceStatus.INACTIVE);
ResourceMeta meta2 = new ResourceMeta("name1", 2, ResourceStatus.INACTIVE);
ResourceMeta meta3 = new ResourceMeta("name2", 1, ResourceStatus.INACTIVE);
ResourceMeta meta4 = new ResourceMeta("name3", 1, ResourceStatus.INACTIVE);
assertSendContents(contents, type, meta1.getName());
assertSendContents(contents, type, meta2.getName());
assertSendContents(contents, type, meta3.getName());
assertSendContents(contents, type, meta4.getName());
HttpResponse response = doGetExternalAPI(getTypePath(type), ADMIN_HEADERS);
assertResponseStatus(response, HttpResponseStatus.OK);
Assert.assertEquals(
ImmutableMap.<String, Set<ResourceMeta>>of(
"name1", ImmutableSet.<ResourceMeta>of(meta1, meta2),
"name2", ImmutableSet.<ResourceMeta>of(meta3),
"name3", ImmutableSet.<ResourceMeta>of(meta4)),
bodyToMetaMap(response)
);
assertResponseStatus(doDeleteExternalAPI(getVersionedPath(type, meta3), ADMIN_HEADERS), HttpResponseStatus.OK);
response = doGetExternalAPI(getTypePath(type), ADMIN_HEADERS);
assertResponseStatus(response, HttpResponseStatus.OK);
Assert.assertEquals(
ImmutableMap.<String, Set<ResourceMeta>>of(
"name1", ImmutableSet.<ResourceMeta>of(meta1, meta2),
"name3", ImmutableSet.<ResourceMeta>of(meta4)),
bodyToMetaMap(response)
);
}