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

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


   /**
    * Power on a {@link Vm}.
    */
   protected Vm powerOnVm(String vmUrn) {
      Vm test = vmApi.get(vmUrn);
      Status status = test.getStatus();
      if (status != Status.POWERED_ON) {
         Task powerOn = vmApi.powerOn(vmUrn);
         assertTaskSucceedsLong(powerOn);
      }
      test = vmApi.get(vmUrn);
View Full Code Here


   /**
    * Power off a {@link Vm}.
    */
   protected Vm powerOffVm(String vmUrn) {
      Vm test = vmApi.get(vmUrn);
      Status status = test.getStatus();
      if (status != Status.POWERED_OFF || test.isDeployed()) {
         UndeployVAppParams undeployParams = UndeployVAppParams.builder().build();
         Task shutdownVapp = vmApi.undeploy(vmUrn, undeployParams);
         assertTaskSucceedsLong(shutdownVapp);
      }
      test = vmApi.get(vmUrn);
View Full Code Here

   /**
    * Suspend a {@link Vm}.
    */
   protected Vm suspendVm(String vmUrn) {
      Vm test = vmApi.get(vmUrn);
      Status status = test.getStatus();
      if (status != Status.SUSPENDED) {
         Task suspend = vmApi.suspend(vmUrn);
         assertTaskSucceedsLong(suspend);
      }
      test = vmApi.get(vmUrn);
View Full Code Here

   /**
    * Check the {@link Vm}s current status.
    */
   protected void assertVmStatus(String vmUrn, final Status status) {
      Vm testVm = vmApi.get(vmUrn);
      assertStatus(VM, testVm, status);
   }
View Full Code Here

   /**
    * @see VmApi#edit(String, Vm)
    */
   @Test(description = "PUT /vApp/{id}", dependsOnMethods = { "testGetVm" })
   public void testEditVm() {
      Vm newVm = Vm.builder().name(name("new-name-")).description("New Description").build();

      // The method under test
      Task editVm = vmApi.edit(vmUrn, newVm);
      assertTrue(retryTaskSuccess.apply(editVm), String.format(TASK_COMPLETE_TIMELY, "editVm"));

      // Get the edited Vm
      vm = vmApi.get(vmUrn);

      // Check the required fields are set
      assertEquals(vm.getName(), newVm.getName(),
               String.format(OBJ_FIELD_EQ, VM, "Name", newVm.getName(), vm.getName()));
      assertEquals(vm.getDescription(), newVm.getDescription(),
               String.format(OBJ_FIELD_EQ, VM, "Description", newVm.getDescription(), vm.getDescription()));
   }
View Full Code Here

      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
      Task removeVm = vmApi.remove(temp.getId());
      assertTrue(retryTaskSuccess.apply(removeVm), String.format(TASK_COMPLETE_TIMELY, "removeVm"));

      Vm removed = vmApi.get(temp.getId());
      assertNull(removed, "The Vm " + temp.getName() + " should have been removed");
   }
View Full Code Here

               .httpRequestBuilder().build(),
            new VcloudHttpResponsePrimer()
               .xmlFilePayload("/vm/vm.xml", VCloudDirectorMediaType.VM)
               .httpResponseBuilder().build());

      Vm expected = getVm();

      assertEquals(api.getVmApi().get(vmURI), expected);
   }
View Full Code Here

            .httpRequestBuilder().build(),
         new VcloudHttpResponsePrimer()
            .xmlFilePayload("/vm/modifiedVm.xml", VCloudDirectorMediaType.VM)
            .httpResponseBuilder().build());

    Vm modified = getVm();
    modified.setName("new-name");
    modified.setDescription("New Description");

    Task expected = editVmTask();

    assertEquals(api.getVmApi().edit(vmURI, modified), expected);
   }
View Full Code Here

         assertEquals(api.getVmApi().editVirtualHardwareSectionSerialPorts(vmURI, serialPorts), expected);
   }

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

   }
  

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

TOP

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

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.