}
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());
}