Package org.jclouds.vcloud.director.v1_5.domain

Examples of org.jclouds.vcloud.director.v1_5.domain.Metadata


      // Delete the entry
      Task task = context.getApi().getMetadataApi(vAppUrn).remove(key);
      retryTaskSuccess.apply(task);

      // Confirm the entry has been removed
      Metadata newMetadata = context.getApi().getMetadataApi(vAppUrn).get();

      // Check the retrieved object is well formed
      checkMetadataKeyAbsentFor(VAPP, newMetadata, key);
   }
View Full Code Here


      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);
View Full Code Here

   }

   @Test(description = "GET /vdc/{id}/metadata", dependsOnMethods = { "testGetVdc" })
   public void testGetMetadata() {
      Metadata metadata = context.getApi().getMetadataApi(vdcUrn).get();

      // required for testing
      assertTrue(Iterables.isEmpty(metadata.getMetadataEntries()),
               String.format(OBJ_FIELD_REQ_LIVE, VDC, "metadata.entries"));

      Checks.checkMetadataFor(VDC, metadata);
   }
View Full Code Here

   @Test(description = "GET /vdc/{id}/metadata/{key}", dependsOnMethods = { "testGetMetadata" })
   public void testGetMetadataValue() {
      // setupMetadata();
      // First find a key
      Metadata metadata = context.getApi().getMetadataApi(vdcUrn).get();
      Map<String, String> metadataMap = Checks.metadataToMap(metadata);
      String key = Iterables.getFirst(metadataMap.keySet(), "MadeUpKey!");
      String value = metadataMap.get(key);

      String metadataValue = context.getApi().getMetadataApi(vdcUrn).get(key);
View Full Code Here

      assertNull(catalogItem);
   }

   @Test(description = "GET /catalog/{id}/metadata")
   public void testGetCatalogMetadata() {
      Metadata catalogMetadata = context.getApi().getMetadataApi(catalogUrn).get();
      checkMetadata(catalogMetadata);
   }
View Full Code Here

      Task mergeCatalogMetadata = context.getApi().getMetadataApi(catalogUrn)
            .putAll(ImmutableMap.of("KEY", "MARMALADE"));
      assertTaskSucceedsLong(mergeCatalogMetadata);

      Metadata catalogMetadata = context.getApi().getMetadataApi(catalogUrn).get();

      String metadataValue = context.getApi().getMetadataApi(catalogUrn).get("KEY");
      assertEquals(metadataValue, catalogMetadata.get("KEY"), String.format(CORRECT_VALUE_OBJECT_FMT, "Value",
            "MetadataValue", catalogMetadata.get("KEY"), metadataValue));
   }
View Full Code Here

            "MetadataValue", catalogMetadata.get("KEY"), metadataValue));
   }

   @Test(description = "GET /catalogItem/{id}/metadata", dependsOnMethods = "testAddCatalogItem")
   public void testGetCatalogItemMetadata() {
      Metadata catalogItemMetadata = context.getApi().getMetadataApi(catalogItem.getId()).get();
      checkMetadata(catalogItemMetadata);
   }
View Full Code Here

      checkMetadata(catalogItemMetadata);
   }

   @Test(description = "POST /catalogItem/{id}/metadata", dependsOnMethods = "testAddCatalogItem")
   public void testMergeCatalogItemMetadata() {
      Metadata before = context.getApi().getMetadataApi(catalogItem.getId()).get();

      Task mergeCatalogItemMetadata = context.getApi().getMetadataApi(catalogItem.getId()).putAll(
            ImmutableMap.of("KEY", "MARMALADE", "VEGIMITE", "VALUE"));
      checkTask(mergeCatalogItemMetadata);
      assertTrue(retryTaskSuccess.apply(mergeCatalogItemMetadata),
            String.format(TASK_COMPLETE_TIMELY, "mergeCatalogItemMetadata"));
      Metadata mergedCatalogItemMetadata = context.getApi().getMetadataApi(catalogItem.getId()).get();

      assertTrue(mergedCatalogItemMetadata.getMetadataEntries().size() > before.getMetadataEntries().size(),
            "Should have added at least one other MetadataEntry to the CatalogItem");

      String keyMetadataValue = context.getApi().getMetadataApi(catalogItem.getId()).get("KEY");
      assertEquals(keyMetadataValue, "MARMALADE", "The Value of the MetadataValue for KEY should have changed");
View Full Code Here

      checkLeaseSettingsSection(leaseSettingsSection);
   }

   @Test(description = "GET /vAppTemplate/{id}/metadata", dependsOnMethods = { "testEditMetadataValue" })
   public void testGetVAppTemplateMetadata() {
      Metadata metadata = context.getApi().getMetadataApi(vAppTemplateUrn).get();

      checkMetadata(metadata);
   }
View Full Code Here

   // implicitly tested by testEditVAppTemplateMetadataValue, which first adds the metadata entry;
   // otherwise no entry may exist
   @Test(description = "GET /vAppTemplate/{id}/metadata/{key}", dependsOnMethods = { "testGetVAppTemplateMetadata" })
   public void testGetMetadataValue() {
      Metadata metadata = context.getApi().getMetadataApi(vAppTemplateUrn).get();
      MetadataEntry entry = Iterables.get(metadata.getMetadataEntries(), 0);

      String val = context.getApi().getMetadataApi(vAppTemplateUrn).get(entry.getKey());

      assertEquals(val, entry.getValue());
   }
View Full Code Here

TOP

Related Classes of org.jclouds.vcloud.director.v1_5.domain.Metadata

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.