Package org.jclouds.trmk.vcloud_0_8.domain

Examples of org.jclouds.trmk.vcloud_0_8.domain.VApp


   /**
    * Power on a {@link VApp}.
    */
   protected VApp powerOnVApp(String vAppUrn) {
      VApp test = vAppApi.get(vAppUrn);
      Status status = test.getStatus();
      if (status != Status.POWERED_ON) {
         Task powerOn = vAppApi.powerOn(vAppUrn);
         assertTaskSucceedsLong(powerOn);
      }
      test = vAppApi.get(vAppUrn);
View Full Code Here


   /**
    * Power off a {@link VApp}.
    */
   protected VApp powerOffVApp(String vAppUrn) {
      VApp test = vAppApi.get(vAppUrn);
      Status status = test.getStatus();
      if (status != Status.POWERED_OFF) {
         Task powerOff = vAppApi.powerOff(vAppUrn);
         assertTaskSucceedsLong(powerOff);
      }
      test = vAppApi.get(vAppUrn);
View Full Code Here

   /**
    * Suspend a {@link VApp}.
    */
   protected VApp suspendVApp(String vAppUrn) {
      VApp test = vAppApi.get(vAppUrn);
      Status status = test.getStatus();
      if (status != Status.SUSPENDED) {
         Task suspend = vAppApi.suspend(vAppUrn);
         assertTaskSucceedsLong(suspend);
      }
      test = vAppApi.get(vAppUrn);
View Full Code Here

   /**
    * Check the {@link VApp}s current status.
    */
   protected void assertVAppStatus(final String vAppUrn, final Status status) {
      VApp testVApp = vAppApi.get(vAppUrn);
      assertStatus(VAPP, testVApp, status);
   }
View Full Code Here

      InstantiateVAppTemplateParams instantiate = InstantiateVAppTemplateParams.builder().name(name).notDeploy()
               .notPowerOn().description("Test VApp").instantiationParams(instantiationParams())
               .source(Reference.builder().href(lazyGetVAppTemplate().getHref()).build()).build();

      VdcApi vdcApi = context.getApi().getVdcApi();
      VApp vAppInstantiated = vdcApi.instantiateVApp(vdcUrn, instantiate);
      assertNotNull(vAppInstantiated, String.format(ENTITY_NON_NULL, VAPP));

      Task instantiationTask = getFirst(vAppInstantiated.getTasks(), null);
      if (instantiationTask != null)
         assertTaskSucceedsLong(instantiationTask);

      // Save VApp name for cleanUp
      vAppNames.add(name);
View Full Code Here

    * @see VmApi#remove(String)
    */
   @Test(description = "DELETE /vApp/{id}")
   public void testRemoveVm() {
      // Create a temporary VApp to remove
      VApp remove = instantiateVApp();
      DeployVAppParams params = DeployVAppParams.builder()
               .deploymentLeaseSeconds((int) TimeUnit.SECONDS.convert(1L, TimeUnit.HOURS)).notForceCustomization()
               .powerOn().build();
      Task deployVApp = vAppApi.deploy(remove.getId(), params);
      assertTaskSucceedsLong(deployVApp);

      // Get the edited VApp and the Vm
      remove = vAppApi.get(remove.getId());
      List<Vm> vms = remove.getChildren().getVms();
      Vm temp = Iterables.get(vms, 0);

      // otherwise it's impossible to stop a running vApp with no vms
      if (vms.size() == 1) {
         UndeployVAppParams undeployParams = UndeployVAppParams.builder().build();
         Task shutdownVapp = vAppApi.undeploy(remove.getId(), undeployParams);
         assertTaskSucceedsLong(shutdownVapp);
      } else {
         powerOffVm(temp.getId());
      }
      // The method under test
View Full Code Here

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

   public static VApp getVApp() {
      // FIXME Does not match XML
      VApp vApp = VApp.builder()
            .href(URI.create("https://mycloud.greenhousedata.com/api/vApp/vapp-d0e2b6b9-4381-4ddc-9572-cdfae54059be"))
//            .link(Link.builder()
//                     .href(URI.create())
//                     .build())
            .build();
View Full Code Here

   @Test(description = "POST /vApp/{id}/action/enterMaintenanceMode", groups = { "systemAdmin" })
   public void testEnterMaintenanceMode() {

      // Do this to a new vApp, so don't mess up subsequent tests by making the vApp read-only
      VApp temp = instantiateVApp();
      DeployVAppParams params = DeployVAppParams.builder()
               .deploymentLeaseSeconds((int) TimeUnit.SECONDS.convert(1L, TimeUnit.HOURS)).notForceCustomization()
               .notPowerOn().build();
      Task deployVApp = vAppApi.deploy(temp.getId(), params);
      assertTaskSucceedsLong(deployVApp);

      try {
         // Method under test
         vAppApi.enterMaintenanceMode(temp.getId());

         temp = vAppApi.get(temp.getId());
         assertTrue(temp.isInMaintenanceMode(),
                  String.format(CONDITION_FMT, "InMaintenanceMode", "TRUE", temp.isInMaintenanceMode()));

         // Exit maintenance mode
         vAppApi.exitMaintenanceMode(temp.getId());
      } finally {
         cleanUpVApp(temp);
      }
   }
View Full Code Here

   }

   @Test(description = "POST /vApp/{id}/action/exitMaintenanceMode", dependsOnMethods = { "testEnterMaintenanceMode" }, groups = { "systemAdmin" })
   public void testExitMaintenanceMode() {
      // Do this to a new vApp, so don't mess up subsequent tests by making the vApp read-only
      VApp temp = instantiateVApp();
      DeployVAppParams params = DeployVAppParams.builder()
               .deploymentLeaseSeconds((int) TimeUnit.SECONDS.convert(1L, TimeUnit.HOURS)).notForceCustomization()
               .notPowerOn().build();
      Task deployVApp = vAppApi.deploy(temp.getId(), params);
      assertTaskSucceedsLong(deployVApp);

      try {
         // Enter maintenance mode
         vAppApi.enterMaintenanceMode(temp.getId());

         // Method under test
         vAppApi.exitMaintenanceMode(temp.getId());

         temp = vAppApi.get(temp.getId());
         assertFalse(temp.isInMaintenanceMode(),
                  String.format(CONDITION_FMT, "InMaintenanceMode", "FALSE", temp.isInMaintenanceMode()));
      } finally {
         cleanUpVApp(temp);
      }
   }
View Full Code Here

               .httpRequestBuilder().build(),
            new VcloudHttpResponsePrimer()
               .xmlFilePayload("/vdc/cloneVApp.xml", VCloudDirectorMediaType.VAPP)
               .httpResponseBuilder().build());
     
      VApp expected = cloneVApp();

      // TODO: configure params
      CloneVAppParams params = CloneVAppParams.builder()
        
         .build();
View Full Code Here

TOP

Related Classes of org.jclouds.trmk.vcloud_0_8.domain.VApp

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.