checkMetadataKeyAbsentFor(VAPP, newMetadata, key);
}
@Test(groups = { "live", "user" }, description = "POST /vApp/{id}/metadata", dependsOnMethods = { "testGetMetadata" })
public void testMergeMetadata() {
Metadata oldMetadata = context.getApi().getMetadataApi(vAppUrn).get();
Map<String, String> oldMetadataMap = Checks.metadataToMap(oldMetadata);
// Store a value, to be removed
String key = name("key-");
String value = name("value-");
Task task = context.getApi().getMetadataApi(vAppUrn).putAll(ImmutableMap.of(key, value));
retryTaskSuccess.apply(task);
// Confirm the entry contains everything that was there, and everything that was being added
Metadata newMetadata = context.getApi().getMetadataApi(vAppUrn).get();
Map<String, String> expectedMetadataMap = ImmutableMap.<String, String> builder().putAll(oldMetadataMap)
.put(key, value).build();
// Check the retrieved object is well formed
checkMetadataFor(VAPP, newMetadata, expectedMetadataMap);