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

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


   @Test(description = "DELETE /vAppTemplate/{id}/metadata/{key}", dependsOnMethods = { "testGetMetadataValue" })
   public void testRemoveVAppTemplateMetadataValue() {
      final Task deletionTask = context.getApi().getMetadataApi(vAppTemplateUrn).remove(key);
      assertTaskSucceeds(deletionTask);

      Metadata newMetadata = context.getApi().getMetadataApi(vAppTemplateUrn).get();
      checkMetadataKeyAbsentFor("vAppTemplate", newMetadata, key);
      key = null;
   }
View Full Code Here


    key = name("key-");
    metadataValue = name("value-");

    context.getApi().getMetadataApi(vmUrn).put(key, metadataValue);
    // Call the method being tested
    Metadata metadata = context.getApi().getMetadataApi(vmUrn).get();

    checkMetadata(metadata);
   
    // Check requirements for this test
    assertTrue(metadata.containsValue(metadataValue), String.format(CORRECT_VALUE_OBJECT_FMT, "Value", "MetadataValue", metadata.get(key), metadataValue));
  }
View Full Code Here

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

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

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

      checkMetadataKeyAbsentFor(VM, newMetadata, key);
   }

   @Test(description = "POST /vApp/{id}/metadata", dependsOnMethods = { "testGetMetadata" })
   public void testMergeMetadata() {
      Metadata oldMetadata = context.getApi().getMetadataApi(vmUrn).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(vmUrn).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(vmUrn).get();
      Map<String, String> expectedMetadataMap = ImmutableMap.<String, String> builder().putAll(oldMetadataMap)
               .put(key, value).build();

      // Check the retrieved object is well formed
      checkMetadataFor(VM, newMetadata, expectedMetadataMap);
View Full Code Here

   public void testGetMetadata() {
      if (adminContext != null) {
         setupMetadata();
      }

      Metadata metadata = context.getApi().getMetadataApi(networkUrn).get();
      // required for testing
      assertFalse(Iterables.isEmpty(metadata.getMetadataEntries()),
               String.format(OBJ_FIELD_REQ_LIVE, NETWORK, "metadata.entries"));

      // parent type
      checkResource(metadata);

      for (MetadataEntry entry : metadata.getMetadataEntries()) {
         // required elements and attributes
         assertNotNull(entry.getKey(),
                  String.format(OBJ_FIELD_ATTRB_REQ, networkApi, "MetadataEntry", entry.getKey(), "key"));
         assertNotNull(entry.getValue(),
                  String.format(OBJ_FIELD_ATTRB_REQ, networkApi, "MetadataEntry", entry.getValue(), "value"));
View Full Code Here

   @Test(description = "GET /org/{id}/metadata", dependsOnMethods = { "testGetOrg" })
   public void testGetOrgMetadata() {

      // Call the method being tested
      Metadata metadata = context.getApi().getMetadataApi(orgUrn).get();

      // NOTE The environment MUST have at one metadata entry for the first organisation configured

      checkMetadata(metadata);

      // Check requirements for this test
      assertFalse(Iterables.isEmpty(metadata.getMetadataEntries()),
               String.format(NOT_EMPTY_OBJECT_FMT, "MetadataEntry", "Org"));
   }
View Full Code Here

            new VcloudHttpRequestPrimer().apiCommand("POST", templateId + "/metadata").xmlFilePayload("/vapptemplate/metadata.xml", METADATA).acceptMedia(TASK).httpRequestBuilder().build(),
            new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build()
      ).getMetadataApi(uri);

      assertNotNull(api);
      Metadata metadata = api.get();

      assertEquals(metadata, exampleMetadata());

      Task task = api.putAll(exampleMetadata());
      assertNotNull(task);
View Full Code Here

                  .httpRequestBuilder().build(),
            new VcloudHttpResponsePrimer()
                  .xmlFilePayload("/vdc/metadata.xml", VCloudDirectorMediaType.METADATA)
                  .httpResponseBuilder().build());
           
      Metadata expected = metadata();

      assertEquals(api.getMetadataApi(vdcUri).get(), expected);
   }
View Full Code Here

            new VcloudHttpResponsePrimer()
               .xmlFilePayload("/media/metadata.xml", VCloudDirectorMediaType.METADATA)
               .httpResponseBuilder().build());
     
     
      Metadata expected = metadata();

      assertEquals(api.getMetadataApi(mediaUri).get(), expected);
   }
View Full Code Here

               .httpRequestBuilder().build(),
            new VcloudHttpResponsePrimer()
               .xmlFilePayload("/media/mergeMetadataTask.xml", VCloudDirectorMediaType.TASK)
               .httpResponseBuilder().build());
     
      Metadata inputMetadata = metadata();
      Task expectedTask = mergeMetadataTask();

      assertEquals(api.getMetadataApi(mediaUri).putAll(inputMetadata), expectedTask);
   }
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.