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

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


            .statusCode(200)
            .build();
     
   @Test
   public void testRemoveUserHref() {
      VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, remove, removeResponse);
      api.getUserApi().remove(userHref);
   }
View Full Code Here


      api.getUserApi().remove(userHref);
   }

   @Test
   public void testRemoveUserUrn() {
      VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, resolveUser, resolveUserResponse, remove, removeResponse);
      api.getUserApi().remove(userUrn);
   }
View Full Code Here

         .href(URI.create(endpoint + "???"))
         .build();
  
   @Test( enabled = false )
   public void testGetVdc() {
      VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse,
         new VcloudHttpRequestPrimer()
            .apiCommand("GET", "/admin/vdc/???")
            .acceptAnyMedia()
            .httpRequestBuilder().build(),
         new VcloudHttpResponsePrimer()
            .xmlFilePayload("/vdc/admin/vdc.xml",
                  VCloudDirectorMediaType.ADMIN_VDC)
            .httpResponseBuilder().build());

      AdminVdc expected = adminVdc();

      assertEquals(api.getVdcApi().get(vdcRef.getHref()), expected);
   }
View Full Code Here

         new VcloudHttpResponsePrimer()
            .xmlFilePayload("/vdc/admin/vdc.xml",
                  VCloudDirectorMediaType.ADMIN_VDC)
            .httpResponseBuilder().build());

      AdminVdc expected = adminVdc();

      assertEquals(api.getVdcApi().get(vdcRef.getHref()), expected);
   }
View Full Code Here

      }
   }

   @Test(description = "GET /admin/vdc/{id}")
   public void testGetVdc() {
      AdminVdc vdc = vdcApi.get(vdcUrn);
      assertNotNull(vdc, String.format(OBJ_REQ_LIVE, VDC));

      // parent type
      Checks.checkAdminVdc(vdc);
   }
View Full Code Here

   public void testEditVdc() throws Exception {
      String origName = lazyGetVdc().getName();
      String newName = name("a");
      Exception exception = null;

      AdminVdc vdc = AdminVdc.builder().name(newName).build();

      try {
         Task task = vdcApi.edit(vdcUrn, vdc);
         assertTaskSucceeds(task);

         AdminVdc modified = vdcApi.get(vdcUrn);
         assertEquals(modified.getName(), newName);

         // parent type
         Checks.checkAdminVdc(vdc);
      } catch (Exception e) {
         exception = e;
      } finally {
         try {
            AdminVdc restorableVdc = AdminVdc.builder().name(origName).build();
            Task task = vdcApi.edit(vdcUrn, restorableVdc);
            assertTaskSucceeds(task);
         } catch (Exception e) {
            if (exception != null) {
               logger.warn(e, "Error resetting adminVdc.name; rethrowing original test exception...");
View Full Code Here

   public void testAddCatalogItem() {
      byte[] iso = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
      Vdc vdc = lazyGetVdc();
      Link addMedia = find(vdc.getLinks(), and(relEquals("add"), typeEquals(VCloudDirectorMediaType.MEDIA)));

      Media sourceMedia = Media.builder().type(VCloudDirectorMediaType.MEDIA).name(name("TestMedia-")).size(iso.length)
               .imageType(Media.ImageType.ISO).description("Test media generated by testAddMedia()").build();
      media = context.getApi().getMediaApi().add(addMedia.getHref(), sourceMedia);

      Checks.checkMediaFor(VCloudDirectorMediaType.MEDIA, media);
View Full Code Here

  @Test(description = "Create Key Pair")
  public void testCreateKeyPair() throws URISyntaxException {
    sshKey = SshKeys.generate();
    String keyPairName = "NewKeyPair";
    Vdc currentVDC = lazyGetVdc();
    Media keyPairsContainer = findOrCreateKeyPairContainerInVDCNamed(currentVDC,
        keyPairContainer, keyPairName);
    String keypairValue = context.getApi().getMetadataApi(
        keyPairsContainer.getId()).get(keyPairName);
    assertEquals(keypairValue, generateKeyPair(keyPairName));
  }
View Full Code Here

  @Test(description = "DeleteKeyPair", dependsOnMethods = { "testCreateKeyPair" })
  public void testDeleteKeyPair() {
    String keyPairName = "NewKeyPair";
    Vdc currentVDC = lazyGetVdc();
    Media keyPairsContainer = findOrCreateKeyPairContainerInVDCNamed(currentVDC,
        keyPairContainer, keyPairName);
    Task removeMedia = mediaApi.remove(keyPairsContainer.getId());
    Checks.checkTask(removeMedia);
    assertTrue(retryTaskSuccess.apply(removeMedia),
        String.format(TASK_COMPLETE_TIMELY, "removeMedia"));

    keyPairsContainer = mediaApi.get(keyPairsContainer.getId());
    assertNull(keyPairsContainer, String.format(OBJ_DEL, MEDIA,
        keyPairsContainer != null ? keyPairsContainer.toString() : ""));
  }
View Full Code Here

        keyPairsContainer != null ? keyPairsContainer.toString() : ""));
  }

  private Media findOrCreateKeyPairContainerInVDCNamed(Vdc currentVDC,
      String keyPairsContainerName, final String keyPairName) {
    Media keyPairsContainer = null;

    Optional<Media> optionalKeyPairsContainer = Iterables.tryFind(
        findAllEmptyMediaInOrg(), new Predicate<Media>() {

          @Override
View Full Code Here

TOP

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

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.