@Test public void getCapacityTest() { OvfDefinition ovfDocument = OVFUtils.getOvfDefinition(threeTierWebAppWithUpperLimitsString); String diskId = OVFUtils.getDiskId(ovfDocument.getVirtualSystemCollection().getVirtualSystemAtIndex(0).getVirtualHardwareSection()); int capacity = OVFUtils.getCapacity(ovfDocument, diskId); assertEquals(20, capacity); }
public static int getCapacity(OvfDefinition ovfDocument, String diskId) { int capacity = 0; Disk[] diskList = ovfDocument.getDiskSection().getDiskArray(); if (diskList != null && diskList.length>0) { for (int k = 0; k<diskList.length; k++) { Disk disk = diskList[k]; if (disk.getDiskId().equalsIgnoreCase(diskId)) { String units = disk.getCapacityAllocationUnits(); capacity = Integer.parseInt(disk.getCapacity()); capacity = OVFUtils.getDiskCapacityInGb(capacity, units); } } } return capacity; }
OVFUtils { public static int getCapacity(OvfDefinition ovfDocument, String diskId) { int capacity = 0; Disk[] diskList = ovfDocument.getDiskSection().getDiskArray(); if (diskList != null && diskList.length>0) { for (int k = 0; k<diskList.length; k++) { Disk disk = diskList[k]; if (disk.getDiskId().equalsIgnoreCase(diskId)) { String units = disk.getCapacityAllocationUnits(); capacity = Integer.parseInt(disk.getCapacity()); capacity = OVFUtils.getDiskCapacityInGb(capacity, units); } } } return capacity; } }
OVFUtils { public static int getCapacity(OvfDefinition ovfDocument, String diskId) { int capacity = 0; Disk[] diskList = ovfDocument.getDiskSection().getDiskArray(); if (diskList != null && diskList.length>0) { for (int k = 0; k<diskList.length; k++) { Disk disk = diskList[k]; if (disk.getDiskId().equalsIgnoreCase(diskId)) { String units = disk.getCapacityAllocationUnits(); capacity = Integer.parseInt(disk.getCapacity()); capacity = OVFUtils.getDiskCapacityInGb(capacity, units); } } } return capacity; }  }
OVFUtils { public static int getCapacity(OvfDefinition ovfDocument, String diskId) { int capacity = 0; Disk[] diskList = ovfDocument.getDiskSection().getDiskArray(); if (diskList != null && diskList.length>0) { for (int k = 0; k<diskList.length; k++) { Disk disk = diskList[k]; if (disk.getDiskId().equalsIgnoreCase(diskId)) { String units = disk.getCapacityAllocationUnits(); capacity = Integer.parseInt(disk.getCapacity()); capacity = OVFUtils.getDiskCapacityInGb(capacity, units); } } } return capacity; }  static String getApplicationName(String ovf); static String getDeploymentName(String ovf); static OvfDefinition getOvfDefinition(String ovf); static int getDiskCapacityInGb(int capacity, String units); static String getIsoPathFromVm(VirtualHardwareSection virtHwSection, OvfDefinition ovfDocument); static boolean usesACacheImage(VirtualSystem virtualSystem1); static boolean containsVMWithThatOvfId(String ovf, String ovfId); static VMLimits getUpperAndLowerVMlimits(VirtualSystem virtualSystem); static int getPriceSchema(ProductSection productSection); static ProductSection getProductionSectionForOvfID(String ovf, String ovfId); static VirtualSystem getVirtualSystemForOvfId(String ovf, String ovfId); static String getDiskId(VirtualHardwareSection virtualHardwareSection); static int getCapacity(OvfDefinition ovfDocument, String diskId); static String getFileId(String diskId, Disk[] diskList); static String getUrlImg(OvfDefinition ovfDocument, String fileId); static AsceticSLAInfo getVMSlaInfo(OvfDefinition ovfDocument, String slaInfoTerm, String ovfId); static AsceticSLAInfo getAppSlaInfo(OvfDefinition ovfDocument, String slaInfoTerm); static List<AsceticTermMeasurement> getVMTermMeasurement(OvfDefinition ovfDocument, String ovfId); static List<String> getOVFVMIds(OvfDefinition ovfDocument); }
OVFUtils { public static int getCapacity(OvfDefinition ovfDocument, String diskId) { int capacity = 0; Disk[] diskList = ovfDocument.getDiskSection().getDiskArray(); if (diskList != null && diskList.length>0) { for (int k = 0; k<diskList.length; k++) { Disk disk = diskList[k]; if (disk.getDiskId().equalsIgnoreCase(diskId)) { String units = disk.getCapacityAllocationUnits(); capacity = Integer.parseInt(disk.getCapacity()); capacity = OVFUtils.getDiskCapacityInGb(capacity, units); } } } return capacity; }  static String getApplicationName(String ovf); static String getDeploymentName(String ovf); static OvfDefinition getOvfDefinition(String ovf); static int getDiskCapacityInGb(int capacity, String units); static String getIsoPathFromVm(VirtualHardwareSection virtHwSection, OvfDefinition ovfDocument); static boolean usesACacheImage(VirtualSystem virtualSystem1); static boolean containsVMWithThatOvfId(String ovf, String ovfId); static VMLimits getUpperAndLowerVMlimits(VirtualSystem virtualSystem); static int getPriceSchema(ProductSection productSection); static ProductSection getProductionSectionForOvfID(String ovf, String ovfId); static VirtualSystem getVirtualSystemForOvfId(String ovf, String ovfId); static String getDiskId(VirtualHardwareSection virtualHardwareSection); static int getCapacity(OvfDefinition ovfDocument, String diskId); static String getFileId(String diskId, Disk[] diskList); static String getUrlImg(OvfDefinition ovfDocument, String fileId); static AsceticSLAInfo getVMSlaInfo(OvfDefinition ovfDocument, String slaInfoTerm, String ovfId); static AsceticSLAInfo getAppSlaInfo(OvfDefinition ovfDocument, String slaInfoTerm); static List<AsceticTermMeasurement> getVMTermMeasurement(OvfDefinition ovfDocument, String ovfId); static List<String> getOVFVMIds(OvfDefinition ovfDocument);  }