diff options
author | Manuel Bentele | 2021-04-30 09:05:24 +0200 |
---|---|---|
committer | Manuel Bentele | 2021-04-30 09:05:24 +0200 |
commit | 4073fa2a38d5e73ec2a89eaea84e5183b0e599e5 (patch) | |
tree | cc78e5c92743cf6909556677666c24d5bdeaf073 /src/test | |
parent | Add unit tests for transformation logic (dozmod-client --> dozmod-server) (diff) | |
download | master-sync-shared-4073fa2a38d5e73ec2a89eaea84e5183b0e599e5.tar.gz master-sync-shared-4073fa2a38d5e73ec2a89eaea84e5183b0e599e5.tar.xz master-sync-shared-4073fa2a38d5e73ec2a89eaea84e5183b0e599e5.zip |
Add unit tests for transformation logic (dozmod-server --> dozmod-client)
Diffstat (limited to 'src/test')
7 files changed, 421 insertions, 34 deletions
diff --git a/src/test/java/org/openslx/virtualization/configuration/VirtualizationConfigurationQemuTest.java b/src/test/java/org/openslx/virtualization/configuration/VirtualizationConfigurationQemuTest.java index 93f3750..b59a86d 100644 --- a/src/test/java/org/openslx/virtualization/configuration/VirtualizationConfigurationQemuTest.java +++ b/src/test/java/org/openslx/virtualization/configuration/VirtualizationConfigurationQemuTest.java @@ -68,14 +68,11 @@ public class VirtualizationConfigurationQemuTest File file = LibvirtXmlTestResources.getLibvirtXmlFile( "qemu-kvm_default-archlinux-vm.xml" ); VirtualizationConfigurationQemu vmConfig = new VirtualizationConfigurationQemu( null, file ); - final Domain vmLibvirtDomainConfig = VirtualizationConfigurationQemuTest - .getPrivateDomainFromQemuMetaData( vmConfig ); - final String displayName = vmConfig.getDisplayName(); assertEquals( "archlinux", displayName ); - assertDoesNotThrow( () -> vmLibvirtDomainConfig.validateXml() ); + assertDoesNotThrow( () -> vmConfig.validate() ); } @Test @@ -87,14 +84,11 @@ public class VirtualizationConfigurationQemuTest File file = LibvirtXmlTestResources.getLibvirtXmlFile( "qemu-kvm_default-archlinux-vm.xml" ); VirtualizationConfigurationQemu vmConfig = new VirtualizationConfigurationQemu( null, file ); - final Domain vmLibvirtDomainConfig = VirtualizationConfigurationQemuTest - .getPrivateDomainFromQemuMetaData( vmConfig ); - final boolean isVmSnapshot = vmConfig.isMachineSnapshot(); assertEquals( false, isVmSnapshot ); - assertDoesNotThrow( () -> vmLibvirtDomainConfig.validateXml() ); + assertDoesNotThrow( () -> vmConfig.validate() ); } @Test @@ -106,9 +100,6 @@ public class VirtualizationConfigurationQemuTest File file = LibvirtXmlTestResources.getLibvirtXmlFile( "qemu-kvm_default-archlinux-vm.xml" ); VirtualizationConfigurationQemu vmConfig = new VirtualizationConfigurationQemu( null, file ); - final Domain vmLibvirtDomainConfig = VirtualizationConfigurationQemuTest - .getPrivateDomainFromQemuMetaData( vmConfig ); - final List<DiskImage.ImageFormat> supportedImageFormats = vmConfig.getVirtualizer().getSupportedImageFormats(); assertNotNull( supportedImageFormats ); @@ -116,7 +107,7 @@ public class VirtualizationConfigurationQemuTest assertEquals( true, supportedImageFormats .containsAll( Arrays.asList( ImageFormat.QCOW2, ImageFormat.VMDK, ImageFormat.VDI ) ) ); - assertDoesNotThrow( () -> vmLibvirtDomainConfig.validateXml() ); + assertDoesNotThrow( () -> vmConfig.validate() ); } @Test @@ -128,16 +119,13 @@ public class VirtualizationConfigurationQemuTest File file = LibvirtXmlTestResources.getLibvirtXmlFile( "qemu-kvm_default-archlinux-vm.xml" ); VirtualizationConfigurationQemu vmConfig = new VirtualizationConfigurationQemu( null, file ); - final Domain vmLibvirtDomainConfig = VirtualizationConfigurationQemuTest - .getPrivateDomainFromQemuMetaData( vmConfig ); - final List<VirtualizationConfiguration.HardDisk> hdds = vmConfig.getHdds(); assertNotNull( hdds ); assertEquals( 1, hdds.size() ); assertEquals( "/var/lib/libvirt/images/archlinux.qcow2", hdds.get( 0 ).diskImage ); - assertDoesNotThrow( () -> vmLibvirtDomainConfig.validateXml() ); + assertDoesNotThrow( () -> vmConfig.validate() ); } @Test @@ -149,9 +137,6 @@ public class VirtualizationConfigurationQemuTest File file = LibvirtXmlTestResources.getLibvirtXmlFile( "qemu-kvm_default-archlinux-vm.xml" ); VirtualizationConfigurationQemu vmConfig = new VirtualizationConfigurationQemu( null, file ); - final Domain vmLibvirtDomainConfig = VirtualizationConfigurationQemuTest - .getPrivateDomainFromQemuMetaData( vmConfig ); - final String unfilteredXmlConfig = new String( vmConfig.getConfigurationAsByteArray(), StandardCharsets.UTF_8 ); final String originalXmlConfig = FileUtils.readFileToString( file, StandardCharsets.UTF_8 ); @@ -162,7 +147,7 @@ public class VirtualizationConfigurationQemuTest assertEquals( lengthOriginalXmlConfig, lengthUnfilteredXmlConfig ); - assertDoesNotThrow( () -> vmLibvirtDomainConfig.validateXml() ); + assertDoesNotThrow( () -> vmConfig.validate() ); } @ParameterizedTest @@ -204,7 +189,7 @@ public class VirtualizationConfigurationQemuTest DiskStorage addedStorageDevice = vmLibvirtDomainConfig.getDiskStorageDevices().get( 0 ); assertEquals( diskFile.getAbsolutePath(), addedStorageDevice.getStorageSource() ); - assertDoesNotThrow( () -> vmLibvirtDomainConfig.validateXml() ); + assertDoesNotThrow( () -> vmConfig.validate() ); } @ParameterizedTest @@ -233,7 +218,7 @@ public class VirtualizationConfigurationQemuTest DiskCdrom addedCdromDevice = vmLibvirtDomainConfig.getDiskCdromDevices().get( 0 ); assertEquals( diskFile.getAbsolutePath(), addedCdromDevice.getStorageSource() ); - assertDoesNotThrow( () -> vmLibvirtDomainConfig.validateXml() ); + assertDoesNotThrow( () -> vmConfig.validate() ); } @ParameterizedTest @@ -261,7 +246,7 @@ public class VirtualizationConfigurationQemuTest DiskCdrom addedCdromDevice = vmLibvirtDomainConfig.getDiskCdromDevices().get( 0 ); assertEquals( VirtualizationConfigurationQemu.CDROM_DEFAULT_PHYSICAL_DRIVE, addedCdromDevice.getStorageSource() ); - assertDoesNotThrow( () -> vmLibvirtDomainConfig.validateXml() ); + assertDoesNotThrow( () -> vmConfig.validate() ); } @ParameterizedTest @@ -291,7 +276,7 @@ public class VirtualizationConfigurationQemuTest assertTrue( addedFloppyDevice.isReadOnly() ); assertEquals( diskFile.getAbsolutePath(), addedFloppyDevice.getStorageSource() ); - assertDoesNotThrow( () -> vmLibvirtDomainConfig.validateXml() ); + assertDoesNotThrow( () -> vmConfig.validate() ); } @ParameterizedTest @@ -311,7 +296,7 @@ public class VirtualizationConfigurationQemuTest assertEquals( coreCount, vmLibvirtDomainConfig.getVCpu() ); - assertDoesNotThrow( () -> vmLibvirtDomainConfig.validateXml() ); + assertDoesNotThrow( () -> vmConfig.validate() ); } @ParameterizedTest @@ -335,7 +320,7 @@ public class VirtualizationConfigurationQemuTest assertEquals( SoundCardType.HD_AUDIO, soundCardType ); } - assertDoesNotThrow( () -> vmLibvirtDomainConfig.validateXml() ); + assertDoesNotThrow( () -> vmConfig.validate() ); } @ParameterizedTest @@ -363,7 +348,7 @@ public class VirtualizationConfigurationQemuTest Sound addedSoundDevice = vmLibvirtDomainConfig.getSoundDevices().get( 0 ); assertEquals( Sound.Model.SB16, addedSoundDevice.getModel() ); - assertDoesNotThrow( () -> vmLibvirtDomainConfig.validateXml() ); + assertDoesNotThrow( () -> vmConfig.validate() ); } @ParameterizedTest @@ -387,7 +372,7 @@ public class VirtualizationConfigurationQemuTest assertEquals( EthernetDevType.PARAVIRT, ethernetDeviceType ); } - assertDoesNotThrow( () -> vmLibvirtDomainConfig.validateXml() ); + assertDoesNotThrow( () -> vmConfig.validate() ); } @ParameterizedTest @@ -410,7 +395,7 @@ public class VirtualizationConfigurationQemuTest assertEquals( Interface.Model.E1000E, addedEthernetDevice.getModel() ); } - assertDoesNotThrow( () -> vmLibvirtDomainConfig.validateXml() ); + assertDoesNotThrow( () -> vmConfig.validate() ); } @ParameterizedTest @@ -434,7 +419,7 @@ public class VirtualizationConfigurationQemuTest assertEquals( UsbSpeed.USB3_0, maxUsbSpeed ); } - assertDoesNotThrow( () -> vmLibvirtDomainConfig.validateXml() ); + assertDoesNotThrow( () -> vmConfig.validate() ); } @ParameterizedTest @@ -462,7 +447,7 @@ public class VirtualizationConfigurationQemuTest ControllerUsb addedUsbControllerDevice = vmLibvirtDomainConfig.getUsbControllerDevices().get( 0 ); assertEquals( ControllerUsb.Model.ICH9_EHCI1, addedUsbControllerDevice.getModel() ); - assertDoesNotThrow( () -> vmLibvirtDomainConfig.validateXml() ); + assertDoesNotThrow( () -> vmConfig.validate() ); } static Stream<Arguments> configAndEthernetTypeProvider() @@ -518,7 +503,7 @@ public class VirtualizationConfigurationQemuTest break; } - assertDoesNotThrow( () -> vmLibvirtDomainConfig.validateXml() ); + assertDoesNotThrow( () -> vmConfig.validate() ); } @ParameterizedTest @@ -542,7 +527,7 @@ public class VirtualizationConfigurationQemuTest assertEquals( new Version( Short.valueOf( "3" ), Short.valueOf( "1" ) ), machineVersion ); } - assertDoesNotThrow( () -> vmLibvirtDomainConfig.validateXml() ); + assertDoesNotThrow( () -> vmConfig.validate() ); } @ParameterizedTest @@ -574,6 +559,6 @@ public class VirtualizationConfigurationQemuTest assertEquals( "pc-q35-4.1", modifiedOsMachine ); } - assertDoesNotThrow( () -> vmLibvirtDomainConfig.validateXml() ); + assertDoesNotThrow( () -> vmConfig.validate() ); } } diff --git a/src/test/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicDozModClientToDozModServerTest.java b/src/test/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicDozModClientToDozModServerTest.java index 4654957..68a39c6 100644 --- a/src/test/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicDozModClientToDozModServerTest.java +++ b/src/test/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicDozModClientToDozModServerTest.java @@ -1,5 +1,6 @@ package org.openslx.virtualization.configuration.logic; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; @@ -41,6 +42,7 @@ public class ConfigurationLogicDozModClientToDozModServerTest final String expectedTransformedConfig = ConfigurationLogicTestUtils.readFileToString( expectedConfig ); assertTrue( ConfigurationLogicTestUtils.isContentEqual( expectedTransformedConfig, transformedConfig ) ); + assertDoesNotThrow( () -> config.validate() ); } @Test @@ -61,6 +63,7 @@ public class ConfigurationLogicDozModClientToDozModServerTest final String expectedTransformedConfig = ConfigurationLogicTestUtils.readFileToString( expectedConfig ); assertTrue( ConfigurationLogicTestUtils.isContentEqual( expectedTransformedConfig, transformedConfig ) ); + assertDoesNotThrow( () -> config.validate() ); } @Test @@ -81,5 +84,6 @@ public class ConfigurationLogicDozModClientToDozModServerTest final String expectedTransformedConfig = ConfigurationLogicTestUtils.readFileToString( expectedConfig ); assertTrue( ConfigurationLogicTestUtils.isContentEqual( expectedTransformedConfig, transformedConfig ) ); + assertDoesNotThrow( () -> config.validate() ); } } diff --git a/src/test/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicDozModServerToDozModClientTest.java b/src/test/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicDozModServerToDozModClientTest.java new file mode 100644 index 0000000..b3cbd8a --- /dev/null +++ b/src/test/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicDozModServerToDozModClientTest.java @@ -0,0 +1,104 @@ +package org.openslx.virtualization.configuration.logic; + +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.io.File; + +import org.apache.log4j.Level; +import org.apache.log4j.LogManager; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.openslx.bwlp.thrift.iface.OperatingSystem; +import org.openslx.libvirt.xml.LibvirtXmlTestResources; +import org.openslx.virtualization.configuration.VirtualizationConfiguration; +import org.openslx.virtualization.configuration.data.ConfigurationDataDozModServerToDozModClient; +import org.openslx.virtualization.configuration.transformation.TransformationException; +import org.openslx.vm.disk.DiskImageTestResources; + +public class ConfigurationLogicDozModServerToDozModClientTest +{ + private static final String DEFAULT_DISPLAY_NAME = "Test"; + private static final File DEFAULT_DISK_IMAGE = DiskImageTestResources.getDiskFile( "image-default.vmdk" ); + private static final OperatingSystem DEFAULT_GUEST_OS = null; + private static final String DEFAULT_VIRTUALIZER_ID = null; + private static final int DEFAULT_TOTAL_MEMORY = 4096; + + private static final ConfigurationDataDozModServerToDozModClient DEFAULT_CONFIG_DATA = new ConfigurationDataDozModServerToDozModClient( + ConfigurationLogicDozModServerToDozModClientTest.DEFAULT_DISPLAY_NAME, + ConfigurationLogicDozModServerToDozModClientTest.DEFAULT_DISK_IMAGE, + ConfigurationLogicDozModServerToDozModClientTest.DEFAULT_GUEST_OS, + ConfigurationLogicDozModServerToDozModClientTest.DEFAULT_VIRTUALIZER_ID, + ConfigurationLogicDozModServerToDozModClientTest.DEFAULT_TOTAL_MEMORY ); + + @BeforeAll + public static void setUp() + { + // disable logging with log4j + LogManager.getRootLogger().setLevel( Level.OFF ); + } + + @Test + @DisplayName( "Test transformation logic between a dozmod-server and a dozmod-client for Libvirt/QEMU configuration" ) + public void testConfigurationLogicDozModServerToDozModClientLibvirt() throws TransformationException + { + final String inputConfigFileName = "qemu-kvm_default-ubuntu-20-04-vm_transform-privacy.xml"; + final String expectedConfigFileName = "qemu-kvm_default-ubuntu-20-04-vm_transform-editable.xml"; + final File inputConfig = LibvirtXmlTestResources.getLibvirtXmlFile( inputConfigFileName ); + final File expectedConfig = LibvirtXmlTestResources.getLibvirtXmlFile( expectedConfigFileName ); + final VirtualizationConfiguration<?, ?, ?, ?> config; + config = ConfigurationLogicTestUtils.newVirtualizationConfigurationInstance( inputConfig ); + final ConfigurationLogicDozModServerToDozModClient logic = new ConfigurationLogicDozModServerToDozModClient(); + + logic.apply( config, ConfigurationLogicDozModServerToDozModClientTest.DEFAULT_CONFIG_DATA ); + + final String transformedConfig = config.getConfigurationAsString(); + final String expectedTransformedConfig = ConfigurationLogicTestUtils.readFileToString( expectedConfig ); + + assertDoesNotThrow( () -> config.validate() ); + assertTrue( ConfigurationLogicTestUtils.isContentEqual( expectedTransformedConfig, transformedConfig ) ); + } + + @Test + @DisplayName( "Test transformation logic between a dozmod-server and a dozmod-client for VirtualBox configuration" ) + public void testConfigurationLogicDozModServerToDozModClientVirtualBox() throws TransformationException + { + final String inputConfigFileName = "virtualbox_default-ubuntu_transform-privacy.vbox"; + final String expectedConfigFileName = "virtualbox_default-ubuntu_transform-editable.vbox"; + final File inputConfig = ConfigurationLogicTestResources.getVirtualBoxXmlFile( inputConfigFileName ); + final File expectedConfig = ConfigurationLogicTestResources.getVirtualBoxXmlFile( expectedConfigFileName ); + final VirtualizationConfiguration<?, ?, ?, ?> config; + config = ConfigurationLogicTestUtils.newVirtualizationConfigurationInstance( inputConfig ); + final ConfigurationLogicDozModServerToDozModClient logic = new ConfigurationLogicDozModServerToDozModClient(); + + logic.apply( config, ConfigurationLogicDozModServerToDozModClientTest.DEFAULT_CONFIG_DATA ); + + final String transformedConfig = config.getConfigurationAsString(); + final String expectedTransformedConfig = ConfigurationLogicTestUtils.readFileToString( expectedConfig ); + + assertTrue(ConfigurationLogicTestUtils.isVirtualBoxContentEqual( expectedTransformedConfig, transformedConfig ) ); + assertDoesNotThrow( () -> config.validate() ); + } + + @Test + @DisplayName( "Test transformation logic between dozmod-server and a dozmod-client for VMware configuration" ) + public void testConfigurationLogicDozModServerToDozModClientVmware() throws TransformationException + { + final String inputConfigFileName = "vmware-player_default-ubuntu_transform-privacy.vmx"; + final String expectedConfigFileName = "vmware-player_default-ubuntu_transform-editable.vmx"; + final File inputConfig = ConfigurationLogicTestResources.getVmwareVmxFile( inputConfigFileName ); + final File expectedConfig = ConfigurationLogicTestResources.getVmwareVmxFile( expectedConfigFileName ); + final VirtualizationConfiguration<?, ?, ?, ?> config; + config = ConfigurationLogicTestUtils.newVirtualizationConfigurationInstance( inputConfig ); + final ConfigurationLogicDozModServerToDozModClient logic = new ConfigurationLogicDozModServerToDozModClient(); + + logic.apply( config, ConfigurationLogicDozModServerToDozModClientTest.DEFAULT_CONFIG_DATA ); + + final String transformedConfig = config.getConfigurationAsString(); + final String expectedTransformedConfig = ConfigurationLogicTestUtils.readFileToString( expectedConfig ); + + assertTrue( ConfigurationLogicTestUtils.isContentEqual( expectedTransformedConfig, transformedConfig ) ); + assertDoesNotThrow( () -> config.validate() ); + } +} diff --git a/src/test/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicTestUtils.java b/src/test/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicTestUtils.java index 32aa344..4f85719 100644 --- a/src/test/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicTestUtils.java +++ b/src/test/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicTestUtils.java @@ -10,6 +10,8 @@ import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.Collections; import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import java.util.stream.Collectors; import org.apache.commons.io.FileUtils; @@ -33,6 +35,8 @@ public class ConfigurationLogicTestUtils new OperatingSystem( 11, "Windows 2000 Professional", null, "x86", 4096, 4 ) ) ); // @formatter:on + private static final String REGEX_UUID = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"; + public static VirtualizationConfiguration<?, ?, ?, ?> newVirtualizationConfigurationInstance( File configFile ) { VirtualizationConfiguration<?, ?, ?, ?> config = null; @@ -75,4 +79,22 @@ public class ConfigurationLogicTestUtils return linesContent1.equals( linesContent2 ); } + + public static String removeUuid( String content ) + { + final Pattern patternUuid = Pattern.compile( ConfigurationLogicTestUtils.REGEX_UUID ); + final Matcher matcherUuidContent = patternUuid.matcher( content ); + + // replace all UUIDs with the empty String + return matcherUuidContent.replaceAll( "" ); + } + + public static boolean isVirtualBoxContentEqual( String content1, String content2 ) + { + // replace all UUIDs with the empty String + final String filteredContent1 = ConfigurationLogicTestUtils.removeUuid( content1 ); + final String filteredContent2 = ConfigurationLogicTestUtils.removeUuid( content2 ); + + return ConfigurationLogicTestUtils.isContentEqual( filteredContent1, filteredContent2 ); + } } diff --git a/src/test/resources/libvirt/xml/qemu-kvm_default-ubuntu-20-04-vm_transform-editable.xml b/src/test/resources/libvirt/xml/qemu-kvm_default-ubuntu-20-04-vm_transform-editable.xml new file mode 100644 index 0000000..ca09cf6 --- /dev/null +++ b/src/test/resources/libvirt/xml/qemu-kvm_default-ubuntu-20-04-vm_transform-editable.xml @@ -0,0 +1,170 @@ +<domain type="kvm"> + <name>Test</name> + <uuid>8dc5433c-0228-49e4-b019-fa2b606aa544</uuid> + <title>Ubuntu 20.04</title> + <description>Ubuntu 20.04 desktop installation</description> + <metadata> + <libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0"> + <libosinfo:os id="http://ubuntu.com/ubuntu/20.04"/> + </libosinfo:libosinfo> + </metadata> + <memory unit="KiB">1572864</memory> + <currentMemory unit="KiB">1572864</currentMemory> + <vcpu placement="static">1</vcpu> + <os> + <type arch="x86_64" machine="pc-q35-5.1">hvm</type> + </os> + <features> + <acpi/> + <apic/> + <vmport state="off"/> + </features> + <cpu check="partial" mode="host-model"/> + <clock offset="utc"> + <timer name="rtc" tickpolicy="catchup"/> + <timer name="pit" tickpolicy="delay"/> + <timer name="hpet" present="no"/> + </clock> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <pm> + <suspend-to-mem enabled="no"/> + <suspend-to-disk enabled="no"/> + </pm> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <disk device="disk" type="file"> + <driver cache="none" io="native" name="qemu" type="raw"/> + <target bus="virtio" dev="vda"/> + <address bus="0x03" domain="0x0000" function="0x0" slot="0x00" type="pci"/> + <source file="/home/archlinux/Git/master-sync-shared/target/test-classes/disk/image-default.vmdk"/> + </disk> + <disk device="cdrom" type="block"> + <driver name="qemu" type="raw"/> + <target bus="sata" dev="sda"/> + <readonly/> + <address bus="0" controller="0" target="0" type="drive" unit="0"/> + <source dev="/dev/sr0"/> + </disk> + <disk device="floppy" type="file"> + <driver name="qemu" type="raw"/> + <target bus="fdc" dev="fda"/> + <address bus="0" controller="0" target="0" type="drive" unit="0"/> + <readonly/> + </disk> + <controller index="0" model="ich9-ehci1" type="usb"> + <address bus="0x00" domain="0x0000" function="0x7" slot="0x1d" type="pci"/> + </controller> + <controller index="0" model="ich9-ehci1" type="usb"> + <master startport="0"/> + <address bus="0x00" domain="0x0000" function="0x0" multifunction="on" slot="0x1d" type="pci"/> + </controller> + <controller index="0" model="ich9-ehci1" type="usb"> + <master startport="2"/> + <address bus="0x00" domain="0x0000" function="0x1" slot="0x1d" type="pci"/> + </controller> + <controller index="0" model="ich9-ehci1" type="usb"> + <master startport="4"/> + <address bus="0x00" domain="0x0000" function="0x2" slot="0x1d" type="pci"/> + </controller> + <controller index="0" type="sata"> + <address bus="0x00" domain="0x0000" function="0x2" slot="0x1f" type="pci"/> + </controller> + <controller index="0" model="pcie-root" type="pci"/> + <controller index="1" model="pcie-root-port" type="pci"> + <model name="pcie-root-port"/> + <target chassis="1" port="0x10"/> + <address bus="0x00" domain="0x0000" function="0x0" multifunction="on" slot="0x02" type="pci"/> + </controller> + <controller index="2" model="pcie-root-port" type="pci"> + <model name="pcie-root-port"/> + <target chassis="2" port="0x11"/> + <address bus="0x00" domain="0x0000" function="0x1" slot="0x02" type="pci"/> + </controller> + <controller index="3" model="pcie-root-port" type="pci"> + <model name="pcie-root-port"/> + <target chassis="3" port="0x12"/> + <address bus="0x00" domain="0x0000" function="0x2" slot="0x02" type="pci"/> + </controller> + <controller index="4" model="pcie-root-port" type="pci"> + <model name="pcie-root-port"/> + <target chassis="4" port="0x13"/> + <address bus="0x00" domain="0x0000" function="0x3" slot="0x02" type="pci"/> + </controller> + <controller index="5" model="pcie-root-port" type="pci"> + <model name="pcie-root-port"/> + <target chassis="5" port="0x14"/> + <address bus="0x00" domain="0x0000" function="0x4" slot="0x02" type="pci"/> + </controller> + <controller index="6" model="pcie-root-port" type="pci"> + <model name="pcie-root-port"/> + <target chassis="6" port="0x15"/> + <address bus="0x00" domain="0x0000" function="0x5" slot="0x02" type="pci"/> + </controller> + <controller index="0" type="virtio-serial"> + <address bus="0x02" domain="0x0000" function="0x0" slot="0x00" type="pci"/> + </controller> + <controller index="0" model="virtio-scsi" type="scsi"> + <address bus="0x06" domain="0x0000" function="0x0" slot="0x00" type="pci"/> + </controller> + <controller index="0" type="fdc"/> + <interface type="bridge"> + <mac address="52:54:00:0d:90:0c"/> + <source bridge=""/> + <model type="virtio"/> + <address bus="0x01" domain="0x0000" function="0x0" slot="0x00" type="pci"/> + </interface> + <serial type="pty"> + <target port="0" type="isa-serial"> + <model name="isa-serial"/> + </target> + </serial> + <console type="pty"> + <target port="0" type="serial"/> + </console> + <channel type="unix"> + <target name="org.qemu.guest_agent.0" type="virtio"/> + <address bus="0" controller="0" port="1" type="virtio-serial"/> + </channel> + <channel type="spicevmc"> + <target name="com.redhat.spice.0" type="virtio"/> + <address bus="0" controller="0" port="2" type="virtio-serial"/> + </channel> + <input bus="usb" type="tablet"> + <address bus="0" port="1" type="usb"/> + </input> + <input bus="ps2" type="mouse"/> + <input bus="ps2" type="keyboard"/> + <graphics autoport="yes" type="spice"> + <listen type="address"/> + <image compression="off"/> + </graphics> + <sound model="ich9"> + <address bus="0x00" domain="0x0000" function="0x0" slot="0x1b" type="pci"/> + </sound> + <video> + <model heads="1" primary="yes" ram="65536" type="qxl" vgamem="16384" vram="65536"/> + <address bus="0x00" domain="0x0000" function="0x0" slot="0x01" type="pci"/> + </video> + <redirdev bus="usb" type="spicevmc"> + <address bus="0" port="2" type="usb"/> + </redirdev> + <redirdev bus="usb" type="spicevmc"> + <address bus="0" port="3" type="usb"/> + </redirdev> + <memballoon model="virtio"> + <address bus="0x04" domain="0x0000" function="0x0" slot="0x00" type="pci"/> + </memballoon> + <rng model="virtio"> + <backend model="random">/dev/urandom</backend> + <address bus="0x05" domain="0x0000" function="0x0" slot="0x00" type="pci"/> + </rng> + <disk device="floppy"> + <target bus="fdc" dev="fdb"/> + <readonly/> + </disk> + </devices> +</domain> + + diff --git a/src/test/resources/virtualbox/xml/virtualbox_default-ubuntu_transform-editable.vbox b/src/test/resources/virtualbox/xml/virtualbox_default-ubuntu_transform-editable.vbox new file mode 100644 index 0000000..9bfffcd --- /dev/null +++ b/src/test/resources/virtualbox/xml/virtualbox_default-ubuntu_transform-editable.vbox @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?><VirtualBox xmlns="http://www.virtualbox.org/" version="1.16-linux"> + <Machine OSType="Ubuntu_64" lastStateChange="2021-04-28T09:11:13Z" name="Test" snapshotFolder="Snapshots" uuid="{4fa19ba0-f15c-465a-939d-42524c4d133c}"> + <MediaRegistry> + <HardDisks> + <HardDisk format="VDI" location="image-default.vmdk" type="Normal" uuid="{ef093a53-6d50-454f-afca-aed47e9f97f9}"/> + </HardDisks> + </MediaRegistry> + <Hardware uuid="{b36f101a-a45d-41cb-8bd4-3908e75e081b}"> + <CPU count="1"> + <PAE enabled="false"/> + <LongMode enabled="true"/> + <X2APIC enabled="true"/> + <HardwareVirtExLargePages enabled="false"/> + </CPU> + <Memory RAMSize="1536"/> + <Display VRAMSize="16" controller="VMSVGA"/> + <BIOS> + <IOAPIC enabled="true"/> + <SmbiosUuidLittleEndian enabled="true"/> + </BIOS> + <Network> + <Adapter MACAddress="080027B86D12" enabled="true" slot="0" type="82540EM"> + <NAT/> + </Adapter> + </Network> + <AudioAdapter codec="AD1980" driver="Pulse" enabled="true" enabledIn="false"/> + <RTC localOrUTC="UTC"/> + <Clipboard/> + <USB> + <Controllers> + <Controller name="OHCI" type="OHCI"/> + </Controllers> + </USB> + </Hardware> + <StorageControllers> + <StorageController Bootable="true" PortCount="2" name="IDE" type="PIIX4" useHostIOCache="true"/> + <StorageController Bootable="true" IDE0MasterEmulationPort="0" IDE0SlaveEmulationPort="1" IDE1MasterEmulationPort="2" IDE1SlaveEmulationPort="3" PortCount="1" name="SATA" type="AHCI" useHostIOCache="false"> + <AttachedDevice device="0" hotpluggable="false" port="0" type="HardDisk"> + <Image uuid="{ef093a53-6d50-454f-afca-aed47e9f97f9}"/> + </AttachedDevice> + </StorageController> + <StorageController Bootable="false" PortCount="1" name="Floppy" type="I82078" useHostIOCache="true"> + <AttachedDevice device="0" hotpluggable="false" port="0" type="Floppy"/> + <AttachedDevice device="1" hotpluggable="false" port="0" type="Floppy"/> + </StorageController> + </StorageControllers> + </Machine> +</VirtualBox> diff --git a/src/test/resources/vmware/vmx/vmware-player_default-ubuntu_transform-editable.vmx b/src/test/resources/vmware/vmx/vmware-player_default-ubuntu_transform-editable.vmx new file mode 100644 index 0000000..9d1ad5e --- /dev/null +++ b/src/test/resources/vmware/vmx/vmware-player_default-ubuntu_transform-editable.vmx @@ -0,0 +1,54 @@ +.encoding = "UTF-8" +config.version = "8" +displayName = "Test" +ehci.present = "TRUE" +ethernet0.connectionType = "nat" +ethernet0.present = "TRUE" +ethernet0.virtualDev = "e1000" +floppy0.autodetect = "TRUE" +floppy0.fileType = "device" +floppy0.present = "TRUE" +floppy0.startConnected = "FALSE" +floppy1.autodetect = "TRUE" +floppy1.fileType = "device" +floppy1.present = "TRUE" +floppy1.startConnected = "FALSE" +guestOS = "ubuntu-64" +gui.applyHostDisplayScalingToGuest = "FALSE" +hpet0.present = "TRUE" +ide0:0.deviceType = "cdrom-image" +ide0:0.fileName = "" +ide0:0.present = "TRUE" +ide0:1.autodetect = "TRUE" +ide0:1.deviceType = "cdrom-raw" +ide0:1.present = "TRUE" +memsize = "1536" +mks.enable3d = "TRUE" +pciBridge0.present = "TRUE" +pciBridge4.functions = "8" +pciBridge4.present = "TRUE" +pciBridge4.virtualDev = "pcieRootPort" +pciBridge5.functions = "8" +pciBridge5.present = "TRUE" +pciBridge5.virtualDev = "pcieRootPort" +pciBridge6.functions = "8" +pciBridge6.present = "TRUE" +pciBridge6.virtualDev = "pcieRootPort" +pciBridge7.functions = "8" +pciBridge7.present = "TRUE" +pciBridge7.virtualDev = "pcieRootPort" +sata0:1.deviceType = "cdrom-raw" +scsi0.present = "TRUE" +scsi0.virtualDev = "lsilogic" +scsi0:0.deviceType = "disk" +scsi0:0.fileName = "image-default.vmdk" +scsi0:0.present = "TRUE" +sound.autoDetect = "TRUE" +sound.fileName = "-1" +sound.present = "TRUE" +tools.syncTime = "FALSE" +usb.mangleUsb3Speed = "TRUE" +usb.present = "TRUE" +usb.vbluetooth.startConnected = "TRUE" +virtualHW.productCompatibility = "hosted" +virtualHW.version = "18" |