Package org.jclouds.cim

Examples of org.jclouds.cim.ResourceAllocationSettingData


      VirtualSystemSettingData system = VirtualSystemSettingData.builder().instanceID("0").elementName(
               "Virtual Hardware Family").virtualSystemIdentifier("centos-53").virtualSystemType("vmx-07").build();
      assertEquals(result.getSystem().toString(), system.toString());
      assertEquals(result.getNetworkToAddresses().get("Internal"), ImmutableList.<String> of("10.114.34.132"));

      ResourceAllocationSettingData cpu = ResourceAllocationSettingData.builder().instanceID("1").elementName(
               "1 virtual CPU(s)").description("Number of Virtual CPUs").resourceType(ResourceType.PROCESSOR)
               .virtualQuantity(2l).virtualQuantityUnits("hertz * 10^6").build();

      ResourceAllocationSettingData controller = ResourceAllocationSettingData.builder().instanceID("3").elementName(
               "SCSI Controller 0").description("SCSI Controller").resourceType(ResourceType.PARALLEL_SCSI_HBA)
               .resourceSubType("lsilogic").address("0").virtualQuantity(1l).build();
      ResourceAllocationSettingData memory = ResourceAllocationSettingData.builder().instanceID("2").elementName(
               "512MB of memory").description("Memory Size").resourceType(ResourceType.MEMORY).virtualQuantity(512l)
               .virtualQuantityUnits("byte * 2^20").build();
      ResourceAllocationSettingData disk = ResourceAllocationSettingData.builder().instanceID("9").elementName(
               "Hard Disk 1").resourceType(ResourceType.DISK_DRIVE).hostResource("10485760").addressOnParent("0")
               .virtualQuantity(10485760l).virtualQuantityUnits("byte * 2^20").build();
      assertEquals(result.getResourceAllocations(), ImmutableSet.of(cpu, memory, controller, disk));
      assertEquals(find(result.getResourceAllocations(), CIMPredicates.resourceTypeIn(ResourceType.PROCESSOR))
               .getVirtualQuantity().intValue(), 1);
View Full Code Here


               "Virtual Hardware Family").virtualSystemIdentifier("eduardo").virtualSystemType("vmx-07").build();
      assertEquals(vApp.getSystem().toString(), system.toString());

      assertEquals(vApp.getNetworkToAddresses().get("Internal"), ImmutableList.of("10.114.34.131"));

      ResourceAllocationSettingData cpu = ResourceAllocationSettingData.builder().instanceID("1").elementName(
               "2 virtual CPU(s)").description("Number of Virtual CPUs").resourceType(ResourceType.PROCESSOR)
               .virtualQuantity(2l).virtualQuantityUnits("hertz * 10^6").build();

      ResourceAllocationSettingData controller = ResourceAllocationSettingData.builder().instanceID("3").elementName(
               "SCSI Controller 0").description("SCSI Controller").resourceType(ResourceType.PARALLEL_SCSI_HBA)
               .resourceSubType("lsilogic").address("0").virtualQuantity(1l).build();
      ResourceAllocationSettingData memory = ResourceAllocationSettingData.builder().instanceID("2").elementName(
               "1024MB of memory").description("Memory Size").resourceType(ResourceType.MEMORY).virtualQuantity(1024l)
               .virtualQuantityUnits("byte * 2^20").build();
      ResourceAllocationSettingData disk = ResourceAllocationSettingData.builder().instanceID("9").elementName(
               "Hard Disk 1").resourceType(ResourceType.DISK_DRIVE).hostResource("4194304").addressOnParent("0")
               .virtualQuantity(4194304l).virtualQuantityUnits("byte * 2^20").build();
      ResourceAllocationSettingData disk2 = ResourceAllocationSettingData.builder().instanceID("9").elementName(
               "Hard Disk 2").resourceType(ResourceType.DISK_DRIVE).hostResource("26214400").addressOnParent("1")
               .virtualQuantity(26214400l).virtualQuantityUnits("byte * 2^20").build();

      assertEquals(vApp.getResourceAllocations(), ImmutableSet.of(cpu, memory, controller, disk, disk2));
      assertEquals(find(vApp.getResourceAllocations(), CIMPredicates.resourceTypeIn(ResourceType.PROCESSOR))
View Full Code Here

   }

   public void testApplyInputStream() {
      InputStream is = getClass().getResourceAsStream("/item.xml");

      ResourceAllocationSettingData result = factory.create(
               injector.getInstance(ResourceAllocationSettingDataHandler.class)).parse(is);
      assertEquals(result.getAddress(), "0");
      assertEquals(result.getDescription(), "SCSI Controller");
      assertEquals(result.getElementName(), "SCSI Controller 0");
      assertEquals(result.getInstanceID(), "3");
      assertEquals(result.getResourceSubType(), "lsilogic");
      assertEquals(result.getResourceType(), ResourceType.PARALLEL_SCSI_HBA);
   }
View Full Code Here

      outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
      return rootBuilder.asString(outputProperties);
   }

   private void addProcessorItem(XMLBuilder sectionBuilder, VApp vApp, VAppConfiguration configuration) {
      ResourceAllocationSettingData cpu = find(vApp.getResourceAllocations(), CIMPredicates
               .resourceTypeIn(ResourceType.PROCESSOR));
      long quantity = configuration.getProcessorCount() != null ? configuration.getProcessorCount() : cpu
               .getVirtualQuantity();
      addResourceWithQuantity(sectionBuilder, cpu, quantity);
   }
View Full Code Here

               .getVirtualQuantity();
      addResourceWithQuantity(sectionBuilder, cpu, quantity);
   }

   private void addMemoryItem(XMLBuilder sectionBuilder, VApp vApp, VAppConfiguration configuration) {
      ResourceAllocationSettingData memory = find(vApp.getResourceAllocations(), CIMPredicates
               .resourceTypeIn(ResourceType.MEMORY));
      long quantity = configuration.getMemory() != null ? configuration.getMemory() : memory.getVirtualQuantity();
      addResourceWithQuantity(sectionBuilder, memory, quantity);
   }
View Full Code Here

         if (!configuration.getDisksToDelete().contains(Integer.valueOf(disk.getAddressOnParent()))) {
            addDiskWithQuantity(sectionBuilder, disk);
         }
      }
      for (Long quantity : configuration.getDisks()) {
         ResourceAllocationSettingData disk = ResourceAllocationSettingData.builder().instanceID("9").addressOnParent(
                  "-1").elementName("").resourceType(ResourceType.DISK_DRIVE).virtualQuantity(quantity).build();
         addDiskWithQuantity(sectionBuilder, disk);
      }
   }
View Full Code Here

public class ResourceAllocationSettingDataHandlerTest extends BaseHandlerTest {

   public void testNormal() {
      InputStream is = getClass().getResourceAsStream("/resourceallocation.xml");

      ResourceAllocationSettingData result = factory.create(
               injector.getInstance(ResourceAllocationSettingDataHandler.class)).parse(is);

      ResourceAllocationSettingData expects = ResourceAllocationSettingData.builder().allocationUnits("Gigabytes")
               .caption("1234568").description("Hard Disk").elementName("D:\\").hostResource("data").instanceID("6")
               .resourceType(ResourceAllocationSettingData.ResourceType.PARTITIONABLE_UNIT).virtualQuantity(50l)
               .build();
      assertEquals(result.toString(), expects.toString());
   }
View Full Code Here

   }

   public void testHosting() {
      InputStream is = getClass().getResourceAsStream("/resourceallocation-hosting.xml");

      ResourceAllocationSettingData result = factory.create(
               injector.getInstance(ResourceAllocationSettingDataHandler.class)).parse(is);

      ResourceAllocationSettingData expects = ResourceAllocationSettingData.builder().elementName("1 virtual CPU(s)")
               .allocationUnits("hertz * 10^6").instanceID("1").resourceType(ResourceAllocationSettingData.ResourceType.PROCESSOR)
               .virtualQuantity(1l).description("Number of Virtual CPUs").virtualQuantityUnits("count").build();
      assertEquals(result.toString(), expects.toString());

   }
View Full Code Here

   private boolean primaryNetworkConnection;
   private String ipAddressingMode;

   public ResourceAllocationSettingData getResult() {
      try {
         ResourceAllocationSettingData from = super.getResult();
         if (edit != null) {
            return EditableResourceAllocationSettingData.builder().fromResourceAllocationSettingData(from).edit(edit)
                     .build();
         } else if (busSubType != null) {
            return VCloudHardDisk.builder().fromResourceAllocationSettingData(from).capacity(capacity).busType(busType)
View Full Code Here

   private boolean primaryNetworkConnection;
   private String ipAddressingMode;

   public ResourceAllocationSettingData getResult() {
      try {
         ResourceAllocationSettingData from = super.getResult();
         if (edit != null) {
            return EditableResourceAllocationSettingData.builder().fromResourceAllocationSettingData(from).edit(edit)
                     .build();
         } else if (busSubType != null) {
            return VCloudHardDisk.builder().fromResourceAllocationSettingData(from).capacity(capacity).busType(busType)
View Full Code Here

TOP

Related Classes of org.jclouds.cim.ResourceAllocationSettingData

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.