From 07dad1cd558f9f14d3520018c0da20dd0e6e81e5 Mon Sep 17 00:00:00 2001 From: Kevin Earls Date: Fri, 6 Jun 2014 16:09:52 +0200 Subject: [PATCH] Fixed config file paths for Windows AMQ-5216 --- .../activemq/config/BrokerXmlConfigStartTest.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/assembly/src/test/java/org/apache/activemq/config/BrokerXmlConfigStartTest.java b/assembly/src/test/java/org/apache/activemq/config/BrokerXmlConfigStartTest.java index 5f83154539..ef54c052fc 100755 --- a/assembly/src/test/java/org/apache/activemq/config/BrokerXmlConfigStartTest.java +++ b/assembly/src/test/java/org/apache/activemq/config/BrokerXmlConfigStartTest.java @@ -19,6 +19,7 @@ package org.apache.activemq.config; import java.io.File; import java.io.FileFilter; import java.io.FileInputStream; +import java.io.IOException; import java.net.URI; import java.util.ArrayList; import java.util.Collection; @@ -55,19 +56,26 @@ public class BrokerXmlConfigStartTest { private String shortName; @Parameterized.Parameters(name = "{1}") - public static Collection getTestParameters() { + public static Collection getTestParameters() throws IOException { List configUrls = new ArrayList(); configUrls.add(new String[]{"xbean:src/release/conf/activemq.xml", "activemq.xml"}); + String osName=System.getProperty("os.name"); + LOG.info("os.name {} ", osName); File sampleConfDir = new File("target/conf"); + String sampleConfDirPath = sampleConfDir.getAbsolutePath(); + if (osName.toLowerCase().contains("windows")) { + sampleConfDirPath = sampleConfDirPath.substring(2); // Chop off drive letter and : + sampleConfDirPath = sampleConfDirPath.replace("\\", "/"); + } + for (File xmlFile : sampleConfDir.listFiles(new FileFilter() { public boolean accept(File pathname) { return pathname.isFile() && pathname.getName().startsWith("activemq-") && pathname.getName().endsWith("xml"); }})) { - - configUrls.add(new String[]{"xbean:" + sampleConfDir.getAbsolutePath() + "/" + xmlFile.getName(), xmlFile.getName()}); + configUrls.add(new String[]{"xbean:" + sampleConfDirPath + "/" + xmlFile.getName(), xmlFile.getName()}); } return configUrls;