summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualboxFileFormat.java2
-rw-r--r--src/test/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicTestUtils.java20
-rw-r--r--src/test/resources/virtualbox/xml/virtualbox_default-ubuntu_transform-editable.vbox8
-rw-r--r--src/test/resources/virtualbox/xml/virtualbox_default-ubuntu_transform-non-persistent.vbox8
4 files changed, 12 insertions, 26 deletions
diff --git a/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualboxFileFormat.java b/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualboxFileFormat.java
index 570b597..5446ddb 100644
--- a/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualboxFileFormat.java
+++ b/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualboxFileFormat.java
@@ -342,7 +342,7 @@ public class VirtualizationConfigurationVirtualboxFileFormat
NodeList hwNodes = findNodes( "/VirtualBox/Machine/Hardware" );
int count = hwNodes.getLength();
if ( count != 1 ) {
- throw new VirtualizationConfigurationException( "Zero or more '/VirtualBox/Machine/Hardware' node were found, should never happen!" );
+ throw new VirtualizationConfigurationException( "Zero or > 1 '/VirtualBox/Machine/Hardware' node were found, should never happen!" );
}
Element hw = (Element)hwNodes.item( 0 );
String hwUuid = hw.getAttribute( "uuid" );
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 4f82097..466a1d6 100644
--- a/src/test/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicTestUtils.java
+++ b/src/test/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicTestUtils.java
@@ -38,7 +38,6 @@ 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}";
private static final String REGEX_SOURCE_FILE_PATHS = "(<source.*file=\")(.*)(\".*>)";
public static VirtualizationConfiguration newVirtualizationConfigurationInstance( File configFile )
@@ -73,10 +72,10 @@ public class ConfigurationLogicTestUtils
public static void assertXmlEqual( String expectedXml, String actualXml ) throws AssertionError
{
- XmlAssert.assertThat( expectedXml ).and( actualXml ).ignoreComments().areIdentical();
+ XmlAssert.assertThat( actualXml ).and( expectedXml ).ignoreComments().areIdentical();
}
- public static String removeSourceFilePaths( String content )
+ private static String removeSourceFilePaths( String content )
{
final Pattern patternSourceFilePaths = Pattern.compile( ConfigurationLogicTestUtils.REGEX_SOURCE_FILE_PATHS );
final Matcher matcherSourceFilePathsContent = patternSourceFilePaths.matcher( content );
@@ -85,15 +84,6 @@ public class ConfigurationLogicTestUtils
return matcherSourceFilePathsContent.replaceAll( "$1$3" );
}
- 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 void assertXmlLibvirtEqual( String expectedXml, String actualXml ) throws AssertionError
{
// replace all source file paths with the empty String
@@ -105,11 +95,7 @@ public class ConfigurationLogicTestUtils
public static void assertXmlVirtualBoxEqual( String expectedXml, String actualXml ) throws AssertionError
{
- // replace all UUIDs with the empty String
- final String filteredXml1 = ConfigurationLogicTestUtils.removeUuid( expectedXml );
- final String filteredXml2 = ConfigurationLogicTestUtils.removeUuid( actualXml );
-
- ConfigurationLogicTestUtils.assertXmlEqual( filteredXml1, filteredXml2 );
+ ConfigurationLogicTestUtils.assertXmlEqual( expectedXml, actualXml );
}
public static void assertVmxVmwareEqual( String expectedVmx, String actualVmx ) throws AssertionError
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
index f00c72e..572f389 100644
--- a/src/test/resources/virtualbox/xml/virtualbox_default-ubuntu_transform-editable.vbox
+++ b/src/test/resources/virtualbox/xml/virtualbox_default-ubuntu_transform-editable.vbox
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?><VirtualBox xmlns="http://www.virtualbox.org/" version="1.16-linux">
- <Machine xmlns="http://www.virtualbox.org/" OSType="Ubuntu_64" lastStateChange="2021-04-28T09:11:13Z" name="Test" snapshotFolder="[dummy]" uuid="{}">
+ <Machine xmlns="http://www.virtualbox.org/" OSType="Ubuntu_64" lastStateChange="2021-04-28T09:11:13Z" name="Test" snapshotFolder="[dummy]" uuid="{f6f806e9-21e3-4238-9e4a-48057a4ab885}">
<MediaRegistry>
<HardDisks>
- <HardDisk format="VDI" location="image-default.vmdk" type="Normal" uuid="{}"/>
+ <HardDisk format="VDI" location="image-default.vmdk" type="Normal" uuid="{8eb78aa6-39bf-4eeb-8afc-02af8297d230}"/>
</HardDisks>
</MediaRegistry>
- <Hardware uuid="{}">
+ <Hardware uuid="{b36f101a-a45d-41cb-8bd4-3908e75e081b}">
<CPU count="1">
<PAE enabled="false"/>
<LongMode enabled="true"/>
@@ -36,7 +36,7 @@
<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="{}"/>
+ <Image uuid="{8eb78aa6-39bf-4eeb-8afc-02af8297d230}"/>
</AttachedDevice>
</StorageController>
<StorageController Bootable="false" PortCount="1" name="Floppy" type="I82078" useHostIOCache="true">
diff --git a/src/test/resources/virtualbox/xml/virtualbox_default-ubuntu_transform-non-persistent.vbox b/src/test/resources/virtualbox/xml/virtualbox_default-ubuntu_transform-non-persistent.vbox
index 2717246..d046b82 100644
--- a/src/test/resources/virtualbox/xml/virtualbox_default-ubuntu_transform-non-persistent.vbox
+++ b/src/test/resources/virtualbox/xml/virtualbox_default-ubuntu_transform-non-persistent.vbox
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?><VirtualBox xmlns="http://www.virtualbox.org/" version="1.16-linux">
- <Machine xmlns="http://www.virtualbox.org/" OSType="Ubuntu_64" lastStateChange="2021-04-28T09:11:13Z" name="Test" snapshotFolder="[dummy]" uuid="{}">
+ <Machine xmlns="http://www.virtualbox.org/" OSType="Ubuntu_64" lastStateChange="2021-04-28T09:11:13Z" name="Test" snapshotFolder="[dummy]" uuid="{b36f101a-a45d-41cb-8bd4-3908e75e081b}">
<MediaRegistry>
<HardDisks>
- <HardDisk format="VDI" location="[dummy]" type="Normal" uuid="{}"/>
+ <HardDisk format="VDI" location="[dummy]" type="Normal" uuid="{46282ce8-090a-4219-87f2-c1700bd0ce6a}"/>
</HardDisks>
</MediaRegistry>
- <Hardware uuid="{}">
+ <Hardware uuid="{b36f101a-a45d-41cb-8bd4-3908e75e081b}">
<CPU>
<PAE enabled="false"/>
<LongMode enabled="true"/>
@@ -36,7 +36,7 @@
<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="{}"/>
+ <Image uuid="{46282ce8-090a-4219-87f2-c1700bd0ce6a}"/>
</AttachedDevice>
</StorageController>
</StorageControllers>