Package org.jclouds.vcloud.director.v1_5.user

Examples of org.jclouds.vcloud.director.v1_5.user.VCloudDirectorApi


   @Test
   public void testResponse403ForFakeMediaId() {
      URI mediaUri = URI.create(endpoint + "/media/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
      VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
            new VcloudHttpRequestPrimer()
               .apiCommand("GET", "/media/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")
               .acceptAnyMedia()
               .httpRequestBuilder().build(),
            new VcloudHttpResponsePrimer()
               .xmlFilePayload("/media/error403-fake.xml", VCloudDirectorMediaType.ERROR)
               .httpResponseBuilder().statusCode(403).build());
      assertNull(api.getMediaApi().get(mediaUri));
   }
View Full Code Here


  
   @Test
   public void testEditMedia() {
      URI mediaUri = URI.create(endpoint + "/media/794eb334-754e-4917-b5a0-5df85cbd61d1");

      VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
            new VcloudHttpRequestPrimer()
               .apiCommand("PUT", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1")
               .xmlFilePayload("/media/editMedia.xml", VCloudDirectorMediaType.MEDIA)
               .acceptMedia(VCloudDirectorMediaType.TASK)
               .httpRequestBuilder().build(),
            new VcloudHttpResponsePrimer()
               .xmlFilePayload("/media/editMediaTask.xml", VCloudDirectorMediaType.TASK)
               .httpResponseBuilder().build());
     
      Media edit = editMedia();
      Task expected = editMediaTask();
     
      assertEquals(api.getMediaApi().edit(mediaUri, edit), expected);
   }
View Full Code Here

  
   @Test
   public void testRemoveMedia() {
      URI mediaUri = URI.create(endpoint + "/media/794eb334-754e-4917-b5a0-5df85cbd61d1");

      VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
            new VcloudHttpRequestPrimer()
               .apiCommand("DELETE", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1")
               .acceptMedia(VCloudDirectorMediaType.TASK)
               .httpRequestBuilder().build(),
            new VcloudHttpResponsePrimer()
               .xmlFilePayload("/media/removeMediaTask.xml", VCloudDirectorMediaType.TASK)
               .httpResponseBuilder().build());
     
      Task expected = removeMediaTask();

      assertEquals(api.getMediaApi().remove(mediaUri), expected);
   }
View Full Code Here

  
   @Test
   public void testGetMetadata() {
      URI mediaUri = URI.create("https://vcloudbeta.bluelock.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1");
     
      VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
            new VcloudHttpRequestPrimer()
               .apiCommand("GET", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1/metadata")
               .acceptAnyMedia()
               .httpRequestBuilder().build(),
            new VcloudHttpResponsePrimer()
               .xmlFilePayload("/media/metadata.xml", VCloudDirectorMediaType.METADATA)
               .httpResponseBuilder().build());
     
     
      Metadata expected = metadata();

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

  
   @Test
   public void testMergeMetadata() {
      URI mediaUri = URI.create("https://vcloudbeta.bluelock.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1");
     
      VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
            new VcloudHttpRequestPrimer()
               .apiCommand("POST", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1/metadata")
               .xmlFilePayload("/media/mergeMetadata.xml", VCloudDirectorMediaType.METADATA)
               .acceptMedia(VCloudDirectorMediaType.TASK)
               .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

   }
  
   public void testGetMetadataValue() {
      URI mediaUri = URI.create("https://vcloudbeta.bluelock.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1");
     
      VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
            new VcloudHttpRequestPrimer()
               .apiCommand("GET", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1/metadata/key")
               .acceptAnyMedia()
               .httpRequestBuilder().build(),
            new VcloudHttpResponsePrimer()
               .xmlFilePayload("/media/metadataValue.xml", VCloudDirectorMediaType.METADATA_VALUE)
               .httpResponseBuilder().build());
    
      assertEquals(api.getMetadataApi(mediaUri).get("key"), "value");
   }
View Full Code Here

  
   @Test
   public void testSetMetadataValue() {
      URI mediaUri = URI.create("https://vcloudbeta.bluelock.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1");
     
      VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
            new VcloudHttpRequestPrimer()
               .apiCommand("PUT", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1/metadata/key")
               .xmlFilePayload("/media/setMetadataValue.xml", VCloudDirectorMediaType.METADATA_VALUE)
               .acceptMedia(VCloudDirectorMediaType.TASK)
               .httpRequestBuilder().build(),
            new VcloudHttpResponsePrimer()
               .xmlFilePayload("/media/setMetadataValueTask.xml", VCloudDirectorMediaType.TASK)
               .httpResponseBuilder().build());
           
      Task expectedTask = setMetadataEntryTask();

      assertEquals(api.getMetadataApi(mediaUri).put("key", "value"), expectedTask);
   }
View Full Code Here

  
   @Test
   public void testRemoveMetadataValue() {
      URI mediaUri = URI.create("https://vcloudbeta.bluelock.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1");
     
      VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
            new VcloudHttpRequestPrimer()
               .apiCommand("DELETE", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1/metadata/key")
               .acceptMedia(VCloudDirectorMediaType.TASK)
               .httpRequestBuilder().build(),
            new VcloudHttpResponsePrimer()
               .xmlFilePayload("/media/removeMetadataEntryTask.xml", VCloudDirectorMediaType.TASK)
               .httpResponseBuilder().build());
     
      Task expectedTask = removeTask();

      assertEquals(api.getMetadataApi(mediaUri).remove("key"), expectedTask);
   }
View Full Code Here

   public void before() {
   }
  
   @Test(enabled = false)
   public void testEnterMaintenanceMode() {
      VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
         new VcloudHttpRequestPrimer()
            .apiCommand("POST", vAppId + "/action/enterMaintenanceMode")
            .acceptAnyMedia()
            .httpRequestBuilder().build(),
         new VcloudHttpResponsePrimer()
            .httpResponseBuilder().statusCode(204).build());
   
    // TODO how to test?
    api.getVAppApi().enterMaintenanceMode(vAppURI);
   }
View Full Code Here

    api.getVAppApi().enterMaintenanceMode(vAppURI);
   }

   @Test(enabled = false)
   public void testExitMaintenanceMode() {
      VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
         new VcloudHttpRequestPrimer()
            .apiCommand("POST", vAppId + "/action/exitMaintenanceMode")
            .acceptAnyMedia()
            .httpRequestBuilder().build(),
         new VcloudHttpResponsePrimer()
            .httpResponseBuilder().statusCode(204).build());
   
    // TODO how to test?
    api.getVAppApi().exitMaintenanceMode(vAppURI);
   }
View Full Code Here

TOP

Related Classes of org.jclouds.vcloud.director.v1_5.user.VCloudDirectorApi

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.