summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorManuel Bentele2022-02-03 11:41:00 +0100
committerManuel Bentele2022-02-03 11:41:00 +0100
commitae86250d55872ea4fa30625f8885d9b503284fc0 (patch)
tree4e9ab54f49cdd1348edd745303bd1e6163581c9e /src/test
parentDowngrade Maven assembly plugin for Java 8 compatibility (diff)
downloadmaster-sync-shared-ae86250d55872ea4fa30625f8885d9b503284fc0.tar.gz
master-sync-shared-ae86250d55872ea4fa30625f8885d9b503284fc0.tar.xz
master-sync-shared-ae86250d55872ea4fa30625f8885d9b503284fc0.zip
Fix path separator for resource URLs on Windows platforms
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/openslx/firmware/QemuFirmwareTestResources.java11
-rw-r--r--src/test/java/org/openslx/libvirt/xml/LibvirtXmlTestResources.java12
2 files changed, 14 insertions, 9 deletions
diff --git a/src/test/java/org/openslx/firmware/QemuFirmwareTestResources.java b/src/test/java/org/openslx/firmware/QemuFirmwareTestResources.java
index e4c1aa7..05397e6 100644
--- a/src/test/java/org/openslx/firmware/QemuFirmwareTestResources.java
+++ b/src/test/java/org/openslx/firmware/QemuFirmwareTestResources.java
@@ -14,11 +14,12 @@ import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import org.apache.commons.io.FileUtils;
+import org.openslx.util.Resources;
public class QemuFirmwareTestResources
{
- private static final String QEMU_PREFIX_PATH = File.separator + "qemu";
- private static final String QEMU_PREFIX_PATH_FW = QEMU_PREFIX_PATH + File.separator + "firmware";
+ private static final String QEMU_PREFIX_PATH = Resources.PATH_SEPARATOR + "qemu";
+ private static final String QEMU_PREFIX_PATH_FW = QEMU_PREFIX_PATH + Resources.PATH_SEPARATOR + "firmware";
private static final String QEMU_TEMP_PREFIX = "qemu-";
@@ -37,7 +38,7 @@ public class QemuFirmwareTestResources
private static String getResourceDirectory( Class<?> clazz, String resourceDir ) throws IOException
{
- final String fwDirPath = resourceDir.substring( 1 ).concat( File.separator );
+ final String fwDirPath = resourceDir.substring( 1 ).concat( Resources.PATH_SEPARATOR );
final URL fwResource = clazz.getResource( resourceDir );
final File fwDirectory;
String fwDirectoryPath = null;
@@ -65,7 +66,7 @@ public class QemuFirmwareTestResources
// copy each file from the Jar to the temporary directory
fileNames.forEach( fileName -> {
- final String resourceFileName = resourceDir + File.separator + fileName;
+ final String resourceFileName = resourceDir + Resources.PATH_SEPARATOR + fileName;
final File tempFile = new File( fwDirectory.getPath() + File.separator + fileName );
final InputStream fileInput = QemuFirmwareTestResources.class.getResourceAsStream( resourceFileName );
try {
@@ -93,7 +94,7 @@ public class QemuFirmwareTestResources
public static File getQemuFirmwareSpecFile( String fileName )
{
- final String fwSpecFilePath = QEMU_PREFIX_PATH_FW + File.separator + fileName;
+ final String fwSpecFilePath = QEMU_PREFIX_PATH_FW + Resources.PATH_SEPARATOR + fileName;
final URL fwSpecFileUrl = QemuFirmwareTestResources.class.getResource( fwSpecFilePath );
return new File( fwSpecFileUrl.getFile() );
}
diff --git a/src/test/java/org/openslx/libvirt/xml/LibvirtXmlTestResources.java b/src/test/java/org/openslx/libvirt/xml/LibvirtXmlTestResources.java
index 693a442..20d2376 100644
--- a/src/test/java/org/openslx/libvirt/xml/LibvirtXmlTestResources.java
+++ b/src/test/java/org/openslx/libvirt/xml/LibvirtXmlTestResources.java
@@ -5,24 +5,28 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
+import org.openslx.util.Resources;
+
public final class LibvirtXmlTestResources
{
- private static final String LIBVIRT_PREFIX_PATH = File.separator + "libvirt";
- private static final String LIBVIRT_PREFIX_PATH_XML = LIBVIRT_PREFIX_PATH + File.separator + "xml";
+ private static final String LIBVIRT_PREFIX_PATH = Resources.PATH_SEPARATOR + "libvirt";
+ private static final String LIBVIRT_PREFIX_PATH_XML = LIBVIRT_PREFIX_PATH + Resources.PATH_SEPARATOR + "xml";
private static final String LIBVIRT_TEMP_PREFIX = "libvirt-";
private static final String LIBVIRT_TEMP_SUFFIX = ".xml";
public static File getLibvirtXmlFile( String libvirtXmlFileName )
{
- String libvirtXmlPath = LibvirtXmlTestResources.LIBVIRT_PREFIX_PATH_XML + File.separator + libvirtXmlFileName;
+ String libvirtXmlPath = LibvirtXmlTestResources.LIBVIRT_PREFIX_PATH_XML + Resources.PATH_SEPARATOR
+ + libvirtXmlFileName;
URL libvirtXml = LibvirtXmlTestResources.class.getResource( libvirtXmlPath );
return new File( libvirtXml.getFile() );
}
public static InputStream getLibvirtXmlStream( String libvirtXmlFileName )
{
- String libvirtXmlPath = LibvirtXmlTestResources.LIBVIRT_PREFIX_PATH_XML + File.separator + libvirtXmlFileName;
+ String libvirtXmlPath = LibvirtXmlTestResources.LIBVIRT_PREFIX_PATH_XML + Resources.PATH_SEPARATOR
+ + libvirtXmlFileName;
return LibvirtXmlTestResources.class.getResourceAsStream( libvirtXmlPath );
}