Fixed config file paths for Windows AMQ-5216

This commit is contained in:
Kevin Earls 2014-06-06 16:09:52 +02:00
parent b8830ddab1
commit 07dad1cd55
1 changed files with 11 additions and 3 deletions

View File

@ -19,6 +19,7 @@ package org.apache.activemq.config;
import java.io.File; import java.io.File;
import java.io.FileFilter; import java.io.FileFilter;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
@ -55,19 +56,26 @@ public class BrokerXmlConfigStartTest {
private String shortName; private String shortName;
@Parameterized.Parameters(name = "{1}") @Parameterized.Parameters(name = "{1}")
public static Collection<String[]> getTestParameters() { public static Collection<String[]> getTestParameters() throws IOException {
List<String[]> configUrls = new ArrayList<String[]>(); List<String[]> configUrls = new ArrayList<String[]>();
configUrls.add(new String[]{"xbean:src/release/conf/activemq.xml", "activemq.xml"}); 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"); 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() { for (File xmlFile : sampleConfDir.listFiles(new FileFilter() {
public boolean accept(File pathname) { public boolean accept(File pathname) {
return pathname.isFile() && return pathname.isFile() &&
pathname.getName().startsWith("activemq-") && pathname.getName().startsWith("activemq-") &&
pathname.getName().endsWith("xml"); pathname.getName().endsWith("xml");
}})) { }})) {
configUrls.add(new String[]{"xbean:" + sampleConfDirPath + "/" + xmlFile.getName(), xmlFile.getName()});
configUrls.add(new String[]{"xbean:" + sampleConfDir.getAbsolutePath() + "/" + xmlFile.getName(), xmlFile.getName()});
} }
return configUrls; return configUrls;