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()); } }
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()); }
assertEquals(Iterables.get(result.getItems(), 0).toString(), ResourceAllocationSettingData .builder().instanceID("1").elementName("Network adapter 0").description("PCNet32 ethernet adapter") .resourceType(ResourceType.ETHERNET_ADAPTER).resourceSubType("PCNet32").address("00:50:56:8c:00:13") .automaticAllocation(true).connection("vAppNet-vApp Internal").addressOnParent("0").build().toString()); assertEquals(Iterables.get(result.getItems(), 1).toString(), ResourceAllocationSettingData .builder().instanceID("2").elementName("SCSI Controller 0").description("SCSI Controller").resourceType( ResourceType.PARALLEL_SCSI_HBA).resourceSubType("lsilogic").address("0").build().toString()); assertEquals(Iterables.get(result.getItems(), 2).toString(), ResourceAllocationSettingData .builder().instanceID("2000").elementName("Hard disk 1").description("Hard disk").resourceType( ResourceType.DISK_DRIVE).addressOnParent("0").parent("2").build().toString()); assertEquals(Iterables.get(result.getItems(), 3).toString(), ResourceAllocationSettingData .builder().instanceID("3").elementName("IDE Controller 0").description("IDE Controller").resourceType( ResourceType.IDE_CONTROLLER).address("0").build().toString()); assertEquals(Iterables.get(result.getItems(), 4).toString(), ResourceAllocationSettingData .builder().instanceID("3002").elementName("CD/DVD Drive 1").description("CD/DVD Drive").resourceType( ResourceType.CD_DRIVE).addressOnParent("0").parent("3").automaticAllocation(false).build() .toString()); assertEquals(Iterables.get(result.getItems(), 5).toString(), ResourceAllocationSettingData .builder().instanceID("8000").elementName("Floppy Drive 1").description("Floppy Drive").resourceType( ResourceType.FLOPPY_DRIVE).addressOnParent("0").automaticAllocation(false).build().toString()); assertEquals(Iterables.get(result.getItems(), 6).toString(), ResourceAllocationSettingData .builder().instanceID("4").elementName("1 virtual CPU(s)").description("Number of Virtual CPUs") .resourceType(ResourceType.PROCESSOR).virtualQuantity(1l).allocationUnits("hertz * 10^6")
assertEquals(Iterables.get(result.getItems(), 0).toString(), VCloudNetworkAdapter.builder() .instanceID("1").elementName("Network adapter 0").description("PCNet32 ethernet adapter").resourceType( ResourceType.ETHERNET_ADAPTER).resourceSubType("PCNet32").automaticAllocation(true).connection( assertEquals(Iterables.get(result.getItems(), 1).toString(), ResourceAllocationSettingData .builder().instanceID("2").elementName("SCSI Controller 0").description("SCSI Controller").resourceType( ResourceType.PARALLEL_SCSI_HBA).resourceSubType("lsilogic").address("0").build().toString()); assertEquals(Iterables.get(result.getItems(), 2).toString(), VCloudHardDisk.builder().instanceID( "2000").elementName("Hard disk 1").description("Hard disk").resourceType(ResourceType.DISK_DRIVE) .addressOnParent("0").parent("2").capacity(30720).busType(6).busSubType("lsilogic").build().toString()); assertEquals(Iterables.get(result.getItems(), 3).toString(), ResourceAllocationSettingData .builder().instanceID("3").elementName("IDE Controller 0").description("IDE Controller").resourceType( ResourceType.IDE_CONTROLLER).address("0").build().toString()); assertEquals(Iterables.get(result.getItems(), 4).toString(), ResourceAllocationSettingData .builder().instanceID("3002").elementName("CD/DVD Drive 1").description("CD/DVD Drive").resourceType( ResourceType.CD_DRIVE).addressOnParent("0").automaticAllocation(false).parent("3").build() .toString()); assertEquals(Iterables.get(result.getItems(), 5).toString(), ResourceAllocationSettingData .builder().instanceID("8000").elementName("Floppy Drive 1").description("Floppy Drive").resourceType( ResourceType.FLOPPY_DRIVE).addressOnParent("0").automaticAllocation(false).build().toString()); Iterables.get(result.getItems(), 6).toString(), EditableResourceAllocationSettingData .builder()