Package org.jclouds.vcloud.director.v1_5.predicates

Examples of org.jclouds.vcloud.director.v1_5.predicates.LinkPredicates


   @AfterClass(alwaysRun = true)
   public void cleanUp() throws Exception {
      if (metadataKey != null) {
         try {
            Task task = metadataApi.remove(metadataKey);
            taskDoneEventually(task);
         } catch (VCloudDirectorException e) {
            logger.warn(e, "Error deleting metadata-value (perhaps it doesn't exist?); continuing...");
         }
      }
View Full Code Here


      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...");
               throw exception;
View Full Code Here

   // TODO insufficient permissions to test
   @Test(description = "DELETE /admin/vdc/{id}", enabled = false)
   public void testRemoveVdc() throws Exception {
      // TODO Need to have a VDC that we're happy to remove!
      Task task = vdcApi.remove(vdcUrn);
      assertTaskSucceeds(task);

      try {
         vdcApi.get(vdcUrn);
      } catch (VCloudDirectorException e) {
View Full Code Here

   @Test(description = "PUT /admin/vdc/{id}/metadata", enabled = false)
   public void testSetMetadata() throws Exception {
      metadataKey = name("key-");
      metadataValue = name("value-");

      Task task = metadataApi.putAll(ImmutableMap.of(metadataKey, metadataValue));
     
      assertTaskSucceeds(task);

      String modified = metadataApi.get(metadataKey);
      assertEquals(modified, metadataValue);
View Full Code Here

   // TODO insufficient permissions to test
   @Test(description = "PUT /admin/vdc/{id}/metadata/{key}", dependsOnMethods = { "testGetMetadataValue" }, enabled = false)
   public void testSetMetadataValue() throws Exception {
      metadataValue = name("value-");

      Task task = metadataApi.put(metadataKey, metadataValue);
      assertTaskSucceeds(task);

      String retrievedMetadataValue = metadataApi.get(metadataKey);
      assertEquals(retrievedMetadataValue, metadataValue);
   }
View Full Code Here

   // TODO insufficient permissions to test
   @Test(description = "DELETE /admin/vdc/{id}/metadata/{key}", dependsOnMethods = { "testSetMetadataValue" }, enabled = false)
   public void testRemoveMetadataValue() throws Exception {
      // TODO Remove dependency on other tests; make cleanUp remove a list of metadata entries?

      Task task = metadataApi.remove(metadataKey);
      assertTaskSucceeds(task);

      assertNull(metadataApi.get(metadataKey));
   }
View Full Code Here

      return networkCards;
   }

   public static Task editVirtualHardwareSectionNetworkCardsTask() {
      Task task = Task.builder()
            .build();

      return task;
   }
View Full Code Here

      return task("id", "name", "description", "status", "operation", "operationName", "startTime");
   }

   /** Used by other methods to add a custom {@link Task} object. */
   private static Task task(String taskId, String name, String description, String status, String operation, String operationName, String startTime) {
      Task task = Task.builder()
            .error(Error.builder().build())
            .org(Reference.builder().build())
            .owner(Reference.builder().build())
            .user(Reference.builder().build())
            .params(null)
View Full Code Here

      }
   }
  
   @Test(description = "POST /admin/org/{id}/users")
   public void testAddUser() {
      User newUser = randomTestUser("testAddUser");
      user = userApi.addUserToOrg(newUser, org.getId());
      checkUser(newUser);
   }
View Full Code Here

      checkUser(user);
   }
   @Test(description = "PUT /admin/user/{id}", dependsOnMethods = { "testGetUser" })
   public void testEditUser() {
      User oldUser = user.toBuilder().build();
      User newUser = user.toBuilder()
         .fullName("new"+oldUser.getFullName())
         .emailAddress("new"+oldUser.getEmailAddress())
         .telephone("1-"+oldUser.getTelephone())
         .isEnabled(true)
         .im("new"+oldUser.getIM())
         .isAlertEnabled(true)
         .alertEmailPrefix("new"+oldUser.getAlertEmailPrefix())
         .alertEmail("new"+oldUser.getAlertEmail())
         .storedVmQuota(1)
         .deployedVmQuota(1)
         .password("newPassword")
         // TODO test setting other fields?
//         .name("new"+oldUser.getName())
         .role(getRoleReferenceFor(DefaultRoles.AUTHOR.value()))
         .build();
     
      userApi.edit(user.getHref(), newUser);
      user = userApi.get(user.getHref());
     
      checkUser(user);
      assertTrue(equal(user.getFullName(), newUser.getFullName()),
            String.format(OBJ_FIELD_UPDATABLE, USER, "fullName"));
      assertTrue(equal(user.getEmailAddress(), newUser.getEmailAddress()),
            String.format(OBJ_FIELD_UPDATABLE, USER, "emailAddress"));
      assertTrue(equal(user.getTelephone(), newUser.getTelephone()),
            String.format(OBJ_FIELD_UPDATABLE, USER, "telephone"));
      assertTrue(equal(user.isEnabled(), newUser.isEnabled()),
            String.format(OBJ_FIELD_UPDATABLE, USER, "isEnabled"));
      assertTrue(equal(user.getIM(), newUser.getIM()),
            String.format(OBJ_FIELD_UPDATABLE, USER, "im"));
      assertTrue(equal(user.isAlertEnabled(), newUser.isAlertEnabled()),
            String.format(OBJ_FIELD_UPDATABLE, USER, "isAlertEnabled"));
      assertTrue(equal(user.getAlertEmailPrefix(), newUser.getAlertEmailPrefix()),
            String.format(OBJ_FIELD_UPDATABLE, USER, "alertEmailPrefix"));
      assertTrue(equal(user.getAlertEmail(), newUser.getAlertEmail()),
            String.format(OBJ_FIELD_UPDATABLE, USER, "alertEmail"));
//         assertTrue(equal(user.getRole(), newUser.getRole()),
//               String.format(OBJ_FIELD_UPDATABLE, USER, "role"));
      assertTrue(equal(user.getStoredVmQuota(), newUser.getStoredVmQuota()),
            String.format(OBJ_FIELD_UPDATABLE, USER, "storedVmQuota"));
      assertTrue(equal(user.getDeployedVmQuota(), newUser.getDeployedVmQuota()),
            String.format(OBJ_FIELD_UPDATABLE, USER, "deployedVmQuota"));
          
      // session api isn't typically exposed to the user, as it is implicit
      SessionApi sessionApi = context.utils().injector().getInstance(SessionApi.class);
View Full Code Here

TOP

Related Classes of org.jclouds.vcloud.director.v1_5.predicates.LinkPredicates

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.