Package org.jclouds.savvis.vpdc.domain

Examples of org.jclouds.savvis.vpdc.domain.VM


      if (task.getError() != null)
         throw new RuntimeException("cloud not add vm: " + task.getError().toString());

      if (taskTester.apply(task.getId())) {
         try {
            VM returnVal = this.getNode(task.getResult().getHref().toASCIIString());
            return new NodeAndInitialCredentials<VM>(returnVal, returnVal.getId(), null);
         } finally {
            // TODO: get the credentials relevant to the billingSiteId/Org
            // credentialStore.put(id, new Credentials(orgId, orgUser));
         }
      } else {
View Full Code Here


               public boolean apply(Resource arg0) {
                  return VCloudMediaType.VAPP_XML.equals(arg0.getType());
               }

            })) {
               VM response = api.getVMInVDC(org.getId(), vdc.getId(), vApp.getId());
               assertNotNull(response);
               assertNotNull(response.getId());
               assertNotNull(response.getHref());
               assertNotNull(response.getName());
               assertEquals(response.getType(), "application/vnd.vmware.vcloud.vApp+xml");
               assert (response.getNetworkConnectionSections().size() > 0) : response;
               for (NetworkConnectionSection networkConnection : response.getNetworkConnectionSections())
                  assertNotNull(networkConnection.getIpAddress());
               assertNotNull(response.getStatus());
               assertNotNull(response.getOperatingSystemSection().getDescription());
               assertNotNull(response.getOperatingSystemSection().getId());
               assertNotNull(response.getNetworkSection());
               assertNotNull(response.getVirtualHardwareSections());
               // power state is the only thing that should change
               assertEquals(api.getVMInVDC(org.getId(), vdc.getId(), response.getId(), withPowerState()).toString()
                        .replaceFirst("status=[A-Z]+", ""), response.toString().replaceFirst("status=[A-Z]+", ""));

               // check one ip is valid
               String ip = Iterables.get(response.getNetworkConnectionSections(), 0).getIpAddress();
               assert HostSpecifier.isValid(ip) : response;
               if (InetAddresses2.isPrivateIPAddress(ip)) {
                 // get public ip
                  ip = Iterables.get(response.getNetworkConfigSections(), 0).getInternalToExternalNATRules().get(ip);
                  // could be null
                  if(ip != null){
                    assert HostSpecifier.isValid(ip) : response;
                  }
               }
View Full Code Here

public class VMHandlerTest {
   public void testVCloud1_0() {
      InputStream is = getClass().getResourceAsStream("/vm.xml");
      Injector injector = Guice.createInjector(new SaxParserModule());
      Factory factory = injector.getInstance(ParseSax.Factory.class);
      VM result = factory.create(injector.getInstance(VMHandler.class)).parse(is);

      VM expected = VM
               .builder()
               .id("1001")
               .status(VM.Status.ON)
               .name("znHost2")
               .type("application/vnd.vmware.vcloud.vApp+xml")
View Full Code Here

public class VMHandlerTest {
   public void testVCloud1_0() {
      InputStream is = getClass().getResourceAsStream("/vm.xml");
      Injector injector = Guice.createInjector(new SaxParserModule());
      Factory factory = injector.getInstance(ParseSax.Factory.class);
      VM result = factory.create(injector.getInstance(VMHandler.class)).parse(is);

      VM expected = VM
               .builder()
               .id("1001")
               .status(VM.Status.ON)
               .name("znHost2")
               .type("application/vnd.vmware.vcloud.vApp+xml")
View Full Code Here

            })) {
             
               Task powerOffTask = api.powerOffVM(vmHandle.getHref());
               assert taskTester.apply(powerOffTask.getId());

               VM vm = restContext.getApi().getBrowsingApi().getVM(vmHandle.getHref(), withPowerState());
               assertEquals(vm.getStatus(), VM.Status.OFF);
              
               Task powerOnTask = api.powerOnVM(vmHandle.getHref());
               assert taskTester.apply(powerOnTask.getId());

               vm = restContext.getApi().getBrowsingApi().getVM(vmHandle.getHref(), withPowerState());

               assertEquals(vm.getStatus(), VM.Status.ON);
              
               break VDC_LOOP;
            }
         }
      }
View Full Code Here

         assert this.taskTester.apply(task.getId());
        
         // fetch the task again, in savvis, task.getOwner is populated with vApp after task has finished
         task = restContext.getApi().getBrowsingApi().getTask(task.getId());
        
         VM newVM = restContext.getApi().getBrowsingApi().getVM(task.getOwner().getHref(), GetVMOptions.NONE);
         assert newVM.getHref() != null : newVM;
      }
   }
View Full Code Here

       assert this.taskTester.apply(task.getId());
      
       // fetch the task again, in savvis, task.getOwner is populated with vApp after task has finished
       task = restContext.getApi().getBrowsingApi().getTask(task.getId());
      
       VM clonedVM = restContext.getApi().getBrowsingApi().getVM(task.getOwner().getHref(), GetVMOptions.NONE);
       assert clonedVM.getHref() != null : clonedVM;
   }
View Full Code Here

               public boolean apply(Resource arg0) {
                  return VCloudMediaType.VAPP_XML.equals(arg0.getType());
               }

            })) {
               VM response = api.getVMInVDC(org.getId(), vdc.getId(), vApp.getId());
               assertNotNull(response);
               assertNotNull(response.getId());
               assertNotNull(response.getHref());
               assertNotNull(response.getName());
               assertEquals(response.getType(), "application/vnd.vmware.vcloud.vApp+xml");
               assert (response.getNetworkConnectionSections().size() > 0) : response;
               for (NetworkConnectionSection networkConnection : response.getNetworkConnectionSections())
                  assertNotNull(networkConnection.getIpAddress());
               assertNotNull(response.getStatus());
               assertNotNull(response.getOperatingSystemSection().getDescription());
               assertNotNull(response.getOperatingSystemSection().getId());
               assertNotNull(response.getNetworkSection());
               assertNotNull(response.getVirtualHardwareSections());
               // power state is the only thing that should change
               assertEquals(api.getVMInVDC(org.getId(), vdc.getId(), response.getId(), withPowerState()).toString()
                        .replaceFirst("status=[A-Z]+", ""), response.toString().replaceFirst("status=[A-Z]+", ""));

               // check one ip is valid
               String ip = Iterables.get(response.getNetworkConnectionSections(), 0).getIpAddress();
               assert HostSpecifier.isValid(ip) : response;
               if (InetAddresses2.isPrivateIPAddress(ip)) {
                 // get public ip
                  ip = Iterables.get(response.getNetworkConfigSections(), 0).getInternalToExternalNATRules().get(ip);
                  // could be null
                  if (ip != null){
                    assert HostSpecifier.isValid(ip) : response;
                  }
               }
View Full Code Here

      if (task.getError() != null)
         throw new RuntimeException("cloud not add vm: " + task.getError().toString());

      if (taskTester.apply(task.getId())) {
         try {
            VM returnVal = this.getNode(task.getResult().getHref().toASCIIString());
            return new NodeAndInitialCredentials<VM>(returnVal, returnVal.getId(), null);
         } finally {
            // TODO: get the credentials relevant to the billingSiteId/Org
            // credentialStore.put(id, new Credentials(orgId, orgUser));
         }
      } else {
View Full Code Here

TOP

Related Classes of org.jclouds.savvis.vpdc.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.