Examples of LeaseSettingsSection


Examples of org.jclouds.vcloud.director.v1_5.domain.section.LeaseSettingsSection

            .httpRequestBuilder().build(),
         new VcloudHttpResponsePrimer()
            .xmlFilePayload("/vApp/editLeaseSettingsSectionTask.xml", VCloudDirectorMediaType.TASK)
            .httpResponseBuilder().build());

      LeaseSettingsSection section = getLeaseSettingsSection().toBuilder()
            .build();

    Task expected = editLeaseSettingsSectionTask();

    assertEquals(api.getVAppApi().editLeaseSettingsSection(vAppURI, section), expected);
View Full Code Here

Examples of org.jclouds.vcloud.director.v1_5.domain.section.LeaseSettingsSection

      return task;
   }

   public static LeaseSettingsSection getLeaseSettingsSection() {
      LeaseSettingsSection section = LeaseSettingsSection.builder()
            .build();

      return section;
   }
View Full Code Here

Examples of org.jclouds.vcloud.director.v1_5.domain.section.LeaseSettingsSection

   }

   @Test(description = "GET /vApp/{id}/leaseSettingsSection", dependsOnMethods = { "testGetVApp" })
   public void testGetLeaseSettingsSection() {
      // The method under test
      LeaseSettingsSection section = vAppApi.getLeaseSettingsSection(vAppUrn);

      // Check the retrieved object is well formed
      checkLeaseSettingsSection(section);
   }
View Full Code Here

Examples of org.jclouds.vcloud.director.v1_5.domain.section.LeaseSettingsSection

   }

   @Test(groups = { "live", "user" }, description = "PUT /vApp/{id}/leaseSettingsSection", dependsOnMethods = { "testGetLeaseSettingsSection" })
   public void testEditLeaseSettingsSection() {
      // Copy existing section
      LeaseSettingsSection oldSection = vAppApi.getLeaseSettingsSection(vAppUrn);
      Integer twoHours = (int) TimeUnit.SECONDS.convert(2L, TimeUnit.HOURS);
      LeaseSettingsSection newSection = oldSection.toBuilder().deploymentLeaseInSeconds(twoHours).build();

      // The method under test
      Task editLeaseSettingsSection = vAppApi.editLeaseSettingsSection(vAppUrn, newSection);
      assertTrue(retryTaskSuccess.apply(editLeaseSettingsSection),
               String.format(TASK_COMPLETE_TIMELY, "editLeaseSettingsSection"));

      // Retrieve the modified section
      LeaseSettingsSection modified = vAppApi.getLeaseSettingsSection(vAppUrn);

      // Check the retrieved object is well formed
      checkLeaseSettingsSection(modified);

      // Check the date fields
      if (modified.getDeploymentLeaseExpiration() != null && newSection.getDeploymentLeaseExpiration() != null) {
         assertTrue(modified.getDeploymentLeaseExpiration().after(newSection.getDeploymentLeaseExpiration()),
                  String.format("The new deploymentLeaseExpiration timestamp must be later than the original: %s > %s",
                           dateService.iso8601DateFormat(modified.getDeploymentLeaseExpiration()),
                           dateService.iso8601DateFormat(newSection.getDeploymentLeaseExpiration())));
      }
      if (modified.getStorageLeaseExpiration() != null && newSection.getStorageLeaseExpiration() != null) {
         assertTrue(modified.getStorageLeaseExpiration().after(newSection.getStorageLeaseExpiration()), String.format(
                  "The new storageLeaseExpiration timestamp must be later than the original: %s > %s",
                  dateService.iso8601DateFormat(modified.getStorageLeaseExpiration()),
                  dateService.iso8601DateFormat(newSection.getStorageLeaseExpiration())));
      }

      // Reset the date fields
      modified = modified.toBuilder().deploymentLeaseExpiration(null).storageLeaseExpiration(null).build();
      newSection = newSection.toBuilder().deploymentLeaseExpiration(null).storageLeaseExpiration(null).build();

      // Check the section was modified correctly
      assertEquals(
               modified.getDeploymentLeaseInSeconds(),
               twoHours,
               String.format(OBJ_FIELD_EQ, "LeaseSettingsSection", "DeploymentLeaseInSeconds",
                        Integer.toString(twoHours), modified.getDeploymentLeaseInSeconds().toString()));
      assertEquals(modified, newSection, String.format(ENTITY_EQUAL, "LeaseSettingsSection"));
   }
View Full Code Here

Examples of org.jclouds.vcloud.director.v1_5.domain.section.LeaseSettingsSection

   }

   @Test(description = "GET /vApp/{id}/leaseSettingsSection", dependsOnMethods = { "testGetVApp" })
   public void testGetLeaseSettingsSection() {
      // The method under test
      LeaseSettingsSection section = vAppApi.getLeaseSettingsSection(vAppUrn);

      // Check the retrieved object is well formed
      checkLeaseSettingsSection(section);
   }
View Full Code Here

Examples of org.jclouds.vcloud.director.v1_5.domain.section.LeaseSettingsSection

   }

   @Test(groups = { "live", "user" }, description = "PUT /vApp/{id}/leaseSettingsSection", dependsOnMethods = { "testGetLeaseSettingsSection" })
   public void testEditLeaseSettingsSection() {
      // Copy existing section
      LeaseSettingsSection oldSection = vAppApi.getLeaseSettingsSection(vAppUrn);
      Integer twoHours = (int) TimeUnit.SECONDS.convert(2L, TimeUnit.HOURS);
      LeaseSettingsSection newSection = oldSection.toBuilder().deploymentLeaseInSeconds(twoHours).build();

      // The method under test
      Task editLeaseSettingsSection = vAppApi.editLeaseSettingsSection(vAppUrn, newSection);
      assertTrue(retryTaskSuccess.apply(editLeaseSettingsSection),
               String.format(TASK_COMPLETE_TIMELY, "editLeaseSettingsSection"));

      // Retrieve the modified section
      LeaseSettingsSection modified = vAppApi.getLeaseSettingsSection(vAppUrn);

      // Check the retrieved object is well formed
      checkLeaseSettingsSection(modified);

      // Check the date fields
      if (modified.getDeploymentLeaseExpiration() != null && newSection.getDeploymentLeaseExpiration() != null) {
         assertTrue(modified.getDeploymentLeaseExpiration().after(newSection.getDeploymentLeaseExpiration()),
                  String.format("The new deploymentLeaseExpiration timestamp must be later than the original: %s > %s",
                           dateService.iso8601DateFormat(modified.getDeploymentLeaseExpiration()),
                           dateService.iso8601DateFormat(newSection.getDeploymentLeaseExpiration())));
      }
      if (modified.getStorageLeaseExpiration() != null && newSection.getStorageLeaseExpiration() != null) {
         assertTrue(modified.getStorageLeaseExpiration().after(newSection.getStorageLeaseExpiration()), String.format(
                  "The new storageLeaseExpiration timestamp must be later than the original: %s > %s",
                  dateService.iso8601DateFormat(modified.getStorageLeaseExpiration()),
                  dateService.iso8601DateFormat(newSection.getStorageLeaseExpiration())));
      }

      // Reset the date fields
      modified = modified.toBuilder().deploymentLeaseExpiration(null).storageLeaseExpiration(null).build();
      newSection = newSection.toBuilder().deploymentLeaseExpiration(null).storageLeaseExpiration(null).build();

      // Check the section was modified correctly
      assertEquals(
               modified.getDeploymentLeaseInSeconds(),
               twoHours,
               String.format(OBJ_FIELD_EQ, "LeaseSettingsSection", "DeploymentLeaseInSeconds",
                        Integer.toString(twoHours), modified.getDeploymentLeaseInSeconds().toString()));
      assertEquals(modified, newSection, String.format(ENTITY_EQUAL, "LeaseSettingsSection"));
   }
View Full Code Here

Examples of org.jclouds.vcloud.director.v1_5.domain.section.LeaseSettingsSection

      return task;
   }

   public static LeaseSettingsSection getLeaseSettingsSection() {
      LeaseSettingsSection section = LeaseSettingsSection.builder()
            .build();

      return section;
   }
View Full Code Here

Examples of org.jclouds.vcloud.director.v1_5.domain.section.LeaseSettingsSection

      return task;
   }

   public static LeaseSettingsSection getLeaseSettingsSection() {
      LeaseSettingsSection section = LeaseSettingsSection.builder()
            .build();

      return section;
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.