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

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


   @Override
   public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
      checkArgument(checkNotNull(request, "request") instanceof GeneratedHttpRequest,
               "this binder is only valid for GeneratedHttpRequests!");
      GeneratedHttpRequest gRequest = (GeneratedHttpRequest) request;
      VApp vApp = checkNotNull(findVAppInArgsOrNull(gRequest), "vApp");
      checkArgument(vApp.getStatus() == Status.OFF, "vApp must be off!");
      VAppConfiguration configuration = checkNotNull(findConfigInArgsOrNull(gRequest), "config");

      try {
         return stringBinder.bindToRequest(request, generateXml(vApp, configuration));
      } catch (ParserConfigurationException e) {
View Full Code Here


         assert node.getProviderId() != null;
         assert node.getLocation() != null;
         assertEquals(node.getType(), ComputeType.NODE);
         NodeMetadata allData = client.getNodeMetadata(node.getId());
         TerremarkECloudClient api = view.utils().injector().getInstance(TerremarkECloudClient.class);
         VApp vApp = api.findVAppInOrgVDCNamed(allData.getLocation().getParent().getDescription(),
               allData.getLocation().getDescription(), allData.getName());
         assertEquals(vApp.getName(), allData.getName());
      }
   }
View Full Code Here

         assert node.getLocation() != null;
         assertEquals(node.getType(), ComputeType.NODE);
         NodeMetadata allData = client.getNodeMetadata(node.getId());
         System.out.println(allData.getHardware());
         TerremarkVCloudExpressClient api = view.utils().injector().getInstance(TerremarkVCloudExpressClient.class);
         VApp vApp = api.findVAppInOrgVDCNamed(null, null, allData.getName());
         assertEquals(vApp.getName(), allData.getName());
      }
   }
View Full Code Here

   }

   public void testInstantiated() throws UnknownHostException {
      InputStream is = getClass().getResourceAsStream("/instantiatedvapp.xml");

      VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);

      VApp expects = new VAppImpl("centos53", URI
               .create("http://10.150.4.49/api/v0.8/vApp/10"), Status.RESOLVED, 123456789l, new ReferenceTypeImpl(null,
               "application/vnd.vmware.vcloud.vdc+xml", URI.create("http://10.150.4.49/api/v0.8/vdc/4")),
               ImmutableListMultimap.<String, String> of(), null, null, null, ImmutableSet
                        .<ResourceAllocationSettingData> of());
      assertEquals(result, expects);
View Full Code Here

   }

   public void testDefault() throws UnknownHostException {
      InputStream is = getClass().getResourceAsStream("/vapp.xml");

      VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);

      ListMultimap<String, String> networkToAddresses = ImmutableListMultimap.<String, String> of("Public Network",
               "10.150.4.93");

      VirtualSystemSettingData system = VirtualSystemSettingData.builder().instanceID("0").elementName(
               "Virtual Hardware Family").virtualSystemIdentifier("centos53").virtualSystemType("vmx-07").build();

      Set<ResourceAllocationSettingData> resourceAllocations = ImmutableSet.<ResourceAllocationSettingData> of(
               ResourceAllocationSettingData.builder().instanceID("1").elementName("1 virtual CPU(s)").description(
                        "Number of Virtual CPUs").resourceType(ResourceType.PROCESSOR).virtualQuantity(1l)
                        .allocationUnits("hertz * 10^6").virtualQuantityUnits("count").build(),

               ResourceAllocationSettingData.builder().instanceID("2").elementName("16MB of memory").description(
                        "Memory Size").resourceType(ResourceType.MEMORY).virtualQuantity(16l).allocationUnits(
                        "byte * 2^20").virtualQuantityUnits("byte * 2^20").build(),

               ResourceAllocationSettingData.builder().instanceID("3").elementName("SCSI Controller 0").description(
                        "SCSI Controller").resourceType(ResourceType.PARALLEL_SCSI_HBA).resourceSubType("lsilogic")
                        .address("0").build(),

               ResourceAllocationSettingData.builder().instanceID("8").elementName("Network Adapter 1").description(
                        "PCNet32 ethernet adapter on \"Internal\" network").resourceType(ResourceType.ETHERNET_ADAPTER)
                        .resourceSubType("PCNet32").addressOnParent("7").connection("Internal").automaticAllocation(
                                 true).build(),

               ResourceAllocationSettingData.builder().instanceID("9").elementName("Hard Disk 1").resourceType(
                        ResourceType.DISK_DRIVE).hostResource("104857").addressOnParent("0").parent("3")
                        .virtualQuantity(104857l).build());

      VApp expects = new VAppImpl("centos53", URI
               .create("http://10.150.4.49/api/v0.8/vApp/10"), Status.ON, Long.valueOf(104857), new ReferenceTypeImpl(null,
               "application/vnd.vmware.vcloud.vdc+xml", URI.create("http://10.150.4.49/api/v0.8/vdc/4")),
               networkToAddresses, null, "Other Linux (32-bit)", system, resourceAllocations);
      assertEquals(result.getHref(), expects.getHref());
      assertEquals(result.getName(), expects.getName());
      assertEquals(result.getNetworkToAddresses(), expects.getNetworkToAddresses());
      assertEquals(result.getOperatingSystemDescription(), expects.getOperatingSystemDescription());
      assertEquals(result.getResourceAllocations().toString(), expects.getResourceAllocations().toString());
      assertEquals(result.getSize(), expects.getSize());
      assertEquals(result.getStatus(), expects.getStatus());
      assertEquals(result.getSystem().toString(), expects.getSystem().toString());
      assertEquals(result.getType(), expects.getType());
      assertEquals(result.getVDC(), expects.getVDC());
   }
View Full Code Here

   }

   public void testLatest() throws UnknownHostException {
      InputStream is = getClass().getResourceAsStream("/vapp2.xml");

      VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);

      ListMultimap<String, String> networkToAddresses = ImmutableListMultimap.<String, String> of("Public Network",
               "10.23.119.221");
      VirtualSystemSettingData system = VirtualSystemSettingData.builder().instanceID("0").elementName(
               "Virtual Hardware Family").virtualSystemIdentifier("m1").virtualSystemType("vmx-07").build();

      Set<ResourceAllocationSettingData> resourceAllocations = ImmutableSet.<ResourceAllocationSettingData> of(
               ResourceAllocationSettingData.builder().instanceID("1").elementName("1 virtual CPU(s)").description(
                        "Number of Virtual CPUs").resourceType(ResourceType.PROCESSOR).virtualQuantity(1l)
                        .allocationUnits("hertz * 10^6").virtualQuantityUnits("count").build(),

               ResourceAllocationSettingData.builder().instanceID("2").elementName("512MB of memory").description(
                        "Memory Size").resourceType(ResourceType.MEMORY).virtualQuantity(512l).allocationUnits(
                        "byte * 2^20").virtualQuantityUnits("byte * 2^20").build(),

               ResourceAllocationSettingData.builder().instanceID("3").elementName("SCSI Controller 0").description(
                        "SCSI Controller").resourceType(ResourceType.PARALLEL_SCSI_HBA).resourceSubType("lsilogic")
                        .address("0").build(),

               ResourceAllocationSettingData.builder().instanceID("8").elementName("Network Adapter 1").description(
                        "PCNet32 ethernet adapter on \"Internal\" network").resourceType(ResourceType.ETHERNET_ADAPTER)
                        .resourceSubType("PCNet32").addressOnParent("7").connection("Internal").automaticAllocation(
                                 true).build(),

               ResourceAllocationSettingData.builder().instanceID("9").elementName("Hard Disk 1").resourceType(
                        ResourceType.DISK_DRIVE).hostResource("10485760").addressOnParent("0").parent("3")
                        .virtualQuantity(10485760l).build());

      VApp expects = new VAppImpl("m1", URI.create("http://localhost:8000/api/v0.8/vApp/80"),
               Status.ON, Long.valueOf(10485760), new ReferenceTypeImpl(null, "application/vnd.vmware.vcloud.vdc+xml", URI
                        .create("http://localhost:8000/api/v0.8/vdc/28")), networkToAddresses, null,
               "Microsoft Windows XP Professional (32-bit)", system, resourceAllocations);
      assertEquals(result.getHref(), expects.getHref());
      assertEquals(result.getName(), expects.getName());
      assertEquals(result.getNetworkToAddresses(), expects.getNetworkToAddresses());
      assertEquals(result.getOperatingSystemDescription(), expects.getOperatingSystemDescription());
      assertEquals(result.getResourceAllocations().toString(), expects.getResourceAllocations().toString());
      assertEquals(result.getSize(), expects.getSize());
      assertEquals(result.getStatus(), expects.getStatus());
      assertEquals(result.getSystem().toString(), expects.getSystem().toString());
      assertEquals(result.getType(), expects.getType());
      assertEquals(result.getVDC(), expects.getVDC());
   }
View Full Code Here

                        .build()).deleteOnStorageLeaseExpiration(false).storageLeaseSeconds(0).build();
   }

   @Test(enabled = false)
   public void testEditOrgVAppTemplateLeaseSettings() {
      VCloudDirectorAdminApi api = requestsSendResponses(
               loginRequest,
               sessionResponse,
               new VcloudHttpRequestPrimer()
                        .apiCommand("PUT",
                                 "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppTemplateLeaseSettings")
                        .xmlFilePayload("/org/admin/editVAppLeaseSettingsSource.xml",
                                 VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS)
                        .acceptMedia(VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS).httpRequestBuilder()
                        .build(),
               new VcloudHttpResponsePrimer()
                        .xmlFilePayload("/org/admin/editVAppLeaseSettings.xml",
                                 VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS).httpResponseBuilder()
                        .build());

      OrgVAppTemplateLeaseSettings expected = editVAppTemplateLeaseSettings();

      assertEquals(api.getOrgApi().editVAppTemplateLeaseSettings(orgRef.getHref(), expected), expected);
   }
View Full Code Here

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

      VApp expected = getVApp();

      assertEquals(api.getVAppApi().get(vAppURI), expected);
   }
View Full Code Here

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

    VApp modified = getVApp();
    modified.setName("new-name");
    modified.setDescription("New Description");

    Task expected = editVAppTask();

    assertEquals(api.getVAppApi().edit(vAppURI, modified), expected);
   }
View Full Code Here

    assertEquals(api.getVAppApi().editStartupSection(vAppURI, section), expected);
   }

   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

TOP

Related Classes of org.jclouds.vcloud.director.v1_5.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.