Examples of ResourceAllocationSettingData


Examples of org.jclouds.cim.ResourceAllocationSettingData

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

Examples of org.jclouds.cim.ResourceAllocationSettingData

   }

   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

Examples of org.jclouds.dmtf.cim.ResourceAllocationSettingData

      // Copy existing section and edit fields
      VirtualHardwareSection oldSection = vmApi.getVirtualHardwareSection(vmUrn);
      Set<? extends ResourceAllocationSettingData> oldItems = oldSection.getItems();
      Set<ResourceAllocationSettingData> newItems = Sets.newLinkedHashSet(oldItems);
      ResourceAllocationSettingData oldMemory = Iterables.find(oldItems,
               new Predicate<ResourceAllocationSettingData>() {
                  @Override
                  public boolean apply(ResourceAllocationSettingData rasd) {
                     return rasd.getResourceType() == ResourceAllocationSettingData.ResourceType.MEMORY;
                  }
               });
      ResourceAllocationSettingData newMemory = oldMemory.toBuilder().elementName("1024 MB of memory")
               .virtualQuantity(new BigInteger("1024")).build();
      newItems.remove(oldMemory);
      newItems.add(newMemory);
      VirtualHardwareSection newSection = oldSection.toBuilder().items(newItems).build();

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

      // Retrieve the modified section
      VirtualHardwareSection modifiedSection = vmApi.getVirtualHardwareSection(vmUrn);

      // Check the retrieved object is well formed
      checkVirtualHardwareSection(modifiedSection);

      // Check the modified section fields are set correctly
      ResourceAllocationSettingData modifiedMemory = Iterables.find(modifiedSection.getItems(),
               new Predicate<ResourceAllocationSettingData>() {
                  @Override
                  public boolean apply(ResourceAllocationSettingData rasd) {
                     return rasd.getResourceType() == ResourceAllocationSettingData.ResourceType.MEMORY;
                  }
               });
      assertEquals(modifiedMemory.getVirtualQuantity(), new BigInteger("1024"));
      assertEquals(modifiedMemory, newMemory);
      assertEquals(modifiedSection, newSection);
   }
View Full Code Here

Examples of org.jclouds.dmtf.cim.ResourceAllocationSettingData

      // Copy existing section and edit fields
      VirtualHardwareSection oldSection = vmApi.getVirtualHardwareSection(vmUrn);
      Set<? extends ResourceAllocationSettingData> oldItems = oldSection.getItems();
      Set<ResourceAllocationSettingData> newItems = Sets.newLinkedHashSet(oldItems);
      ResourceAllocationSettingData oldMemory = Iterables.find(oldItems,
               new Predicate<ResourceAllocationSettingData>() {
                  @Override
                  public boolean apply(ResourceAllocationSettingData rasd) {
                     return rasd.getResourceType() == ResourceAllocationSettingData.ResourceType.MEMORY;
                  }
               });
      ResourceAllocationSettingData newMemory = oldMemory.toBuilder().elementName("1024 MB of memory")
               .virtualQuantity(new BigInteger("1024")).build();
      newItems.remove(oldMemory);
      newItems.add(newMemory);
      VirtualHardwareSection newSection = oldSection.toBuilder().items(newItems).build();

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

      // Retrieve the modified section
      VirtualHardwareSection modifiedSection = vmApi.getVirtualHardwareSection(vmUrn);

      // Check the retrieved object is well formed
      checkVirtualHardwareSection(modifiedSection);

      // Check the modified section fields are set correctly
      ResourceAllocationSettingData modifiedMemory = Iterables.find(modifiedSection.getItems(),
               new Predicate<ResourceAllocationSettingData>() {
                  @Override
                  public boolean apply(ResourceAllocationSettingData rasd) {
                     return rasd.getResourceType() == ResourceAllocationSettingData.ResourceType.MEMORY;
                  }
               });
      assertEquals(modifiedMemory.getVirtualQuantity(), new BigInteger("1024"));
      assertEquals(modifiedMemory, newMemory);
      assertEquals(modifiedSection, newSection);
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.