EsxCloudVmxGenerator { public static EsxCloudVmx generate(OvfFile ovfFile) throws InvalidOvfException { EsxCloudVmxGenerator esxCloudVmxGenerator = new EsxCloudVmxGenerator(ovfFile); esxCloudVmxGenerator.addDeviceOptions(); esxCloudVmxGenerator.addConfigOptions("", extraConfigurations, ovfFile.getExtraConfig()); return esxCloudVmxGenerator.esxCloudVmx; } EsxCloudVmxGenerator(OvfFile ovfFile); static EsxCloudVmx generate(OvfFile ovfFile); String getVmwScsiControllerName(Device device); String getVmwNetworkAdapterName(Device device); String getVmwSerialPortName(Device device);  }
@Test public void generateECVNimbus() throws Throwable { setUpSimpleOva(OvaTestModule.GOOD_TESTESX_OVF_FILE_CONTENT); EsxCloudVmx ecv = EsxCloudVmxGenerator.generate(ovaFile.getOvf()); assertEquals(ecv.configuration.size(), 8); assertEquals(ecv.configuration.get("scsi0.virtualDev"), "lsilogic"); assertEquals(ecv.configuration.get("scsi1.virtualDev"), "lsisas1068"); assertEquals(ecv.configuration.get("ethernet0.virtualDev"), "e1000"); assertEquals(ecv.configuration.get("ethernet1.virtualDev"), "e1000"); assertEquals(ecv.configuration.get("serial0.fileType"), "network"); assertEquals(ecv.configuration.get("serial0.network.endPoint"), "client"); assertEquals(ecv.configuration.get("serial0.yieldOnMsrRead"), "true"); assertEquals(ecv.configuration.get("bios.bootdeviceclasses"), "deny: cd hd fd usb"); assertEquals(ecv.parameters.size(), 2); assertEquals(ecv.parameters.get(0).name, "serial0.fileName"); assertEquals(ecv.parameters.get(1).name, "serial0.vspc"); }
@Test(dataProvider = "GenerateECVSimpleData") public void generateECVSimple(String label, String content) throws Throwable { setUpSimpleOva(content); EsxCloudVmx ecv = EsxCloudVmxGenerator.generate(ovaFile.getOvf()); assertEquals(ecv.configuration.size(), 6); assertEquals(ecv.configuration.get("scsi0.virtualDev"), "lsilogic"); assertEquals(ecv.configuration.get("scsi1.virtualDev"), "buslogic"); assertEquals(ecv.configuration.get("scsi2.virtualDev"), "lsisas1068"); assertEquals(ecv.configuration.get("scsi3.virtualDev"), "pvscsi"); assertEquals(ecv.configuration.get("ethernet0.virtualDev"), "e1000"); assertEquals(ecv.configuration.get("ethernet1.virtualDev"), "e1000e"); assertEquals(ecv.parameters.size(), 0); }
@Test public void generateECVSimpleTwoDisks() throws Throwable { setUpSimpleOva(OvaTestModule.GOOD_OVF_TWO_DISKS); EsxCloudVmx ecv = EsxCloudVmxGenerator.generate(ovaFile.getOvf()); assertEquals(ecv.configuration.size(), 2); assertEquals(ecv.configuration.get("scsi0.virtualDev"), "lsilogic"); assertEquals(ecv.configuration.get("ethernet0.virtualDev"), "e1000"); assertEquals(ecv.parameters.size(), 0); }
@Test public void generateUnknownDevice() throws Throwable { OvaTestModule ova = OvaTestModule.generateOva(OvaTestModule.BAD_OVF_UNKNOWN_CONTROLLER); inputStream = ova.getOvaStream(); try { EsxCloudVmxGenerator.generate(new OvfFile( new TarFileStreamReader(inputStream).iterator().next().content)); } catch (InvalidOvfException e) { return; } finally { ova.clean(); } fail("Exception expected."); }