Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Erdfelt2014-06-26 22:29:05 +0000
committerJoakim Erdfelt2014-06-26 22:29:05 +0000
commit6faf94e4c1fee00b4fd838135e7da9f37f9392a5 (patch)
tree97c2d592db640c3efc604e9ac4832b6319c50626 /jetty-start
parentd49ecdf1d6e7a1ac880da792735ad995607b7a73 (diff)
downloadorg.eclipse.jetty.project-6faf94e4c1fee00b4fd838135e7da9f37f9392a5.tar.gz
org.eclipse.jetty.project-6faf94e4c1fee00b4fd838135e7da9f37f9392a5.tar.xz
org.eclipse.jetty.project-6faf94e4c1fee00b4fd838135e7da9f37f9392a5.zip
437462 - consistent test failure in jetty-start under windows
+ Fixing up logic to be more lenient for case insensitive nature of microsoft windows (it was tripping up over C:\ vs c:\ difference)
Diffstat (limited to 'jetty-start')
-rw-r--r--jetty-start/src/main/java/org/eclipse/jetty/start/PathMatchers.java12
-rw-r--r--jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java2
-rw-r--r--jetty-start/src/test/java/org/eclipse/jetty/start/ConfigurationAssert.java13
-rw-r--r--jetty-start/src/test/java/org/eclipse/jetty/start/MainTest.java48
4 files changed, 49 insertions, 26 deletions
diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/PathMatchers.java b/jetty-start/src/main/java/org/eclipse/jetty/start/PathMatchers.java
index 05e08f95ed..c7e2e7883a 100644
--- a/jetty-start/src/main/java/org/eclipse/jetty/start/PathMatchers.java
+++ b/jetty-start/src/main/java/org/eclipse/jetty/start/PathMatchers.java
@@ -96,15 +96,11 @@ public class PathMatchers
// If the pattern starts with a root path then its assumed to
// be a full system path
- for (Path root : fs.getRootDirectories())
+ if (isAbsolute(pattern))
{
- StartLog.debug("root: " + root);
- if (pattern.startsWith(root.toString()))
- {
- String pat = "glob:" + pattern;
- StartLog.debug("Using absolute path pattern: " + pat);
- return fs.getPathMatcher(pat);
- }
+ String pat = "glob:" + pattern;
+ StartLog.debug("Using absolute path pattern: " + pat);
+ return fs.getPathMatcher(pat);
}
// Doesn't start with filesystem root, then assume the pattern
diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java b/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java
index 0363f4fa7d..5801421ca5 100644
--- a/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java
+++ b/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java
@@ -664,6 +664,8 @@ public class StartArgs
{
return;
}
+
+ StartLog.debug("parse(\"%s\", \"%s\", %b)",rawarg,source,replaceProps);
final String arg = rawarg.trim();
diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/ConfigurationAssert.java b/jetty-start/src/test/java/org/eclipse/jetty/start/ConfigurationAssert.java
index d822601eec..4baacb4af0 100644
--- a/jetty-start/src/test/java/org/eclipse/jetty/start/ConfigurationAssert.java
+++ b/jetty-start/src/test/java/org/eclipse/jetty/start/ConfigurationAssert.java
@@ -51,7 +51,7 @@ public class ConfigurationAssert
*/
public static void assertConfiguration(BaseHome baseHome, StartArgs args, String filename) throws FileNotFoundException, IOException
{
- File testResourcesDir = MavenTestingUtils.getTestResourcesDir();
+ Path testResourcesDir = MavenTestingUtils.getTestResourcesDir().toPath().toAbsolutePath();
File file = MavenTestingUtils.getTestResourceFile(filename);
TextFile textFile = new TextFile(file.toPath());
@@ -149,12 +149,17 @@ public class ConfigurationAssert
assertContainsUnordered("Files/Dirs",expectedFiles,actualFiles);
}
- private static String shorten(BaseHome baseHome, Path path, File testResourcesDir)
+ private static String shorten(BaseHome baseHome, Path path, Path testResourcesDir)
{
String value = baseHome.toShortForm(path);
- if (value.startsWith(testResourcesDir.getAbsolutePath()))
+ if (value.startsWith("${"))
{
- int len = testResourcesDir.getAbsolutePath().length();
+ return value;
+ }
+
+ if (path.startsWith(testResourcesDir))
+ {
+ int len = testResourcesDir.toString().length();
value = "${maven-test-resources}" + value.substring(len);
}
return value;
diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/MainTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/MainTest.java
index 3ba4137e53..54cb773c50 100644
--- a/jetty-start/src/test/java/org/eclipse/jetty/start/MainTest.java
+++ b/jetty-start/src/test/java/org/eclipse/jetty/start/MainTest.java
@@ -18,20 +18,27 @@
package org.eclipse.jetty.start;
-import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.*;
+import static org.junit.Assert.*;
import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
-import org.junit.Assert;
+import org.eclipse.jetty.toolchain.test.TestTracker;
import org.junit.Before;
import org.junit.Ignore;
+import org.junit.Rule;
import org.junit.Test;
public class MainTest
{
+ @Rule
+ public TestTracker ttracker = new TestTracker();
+
@Before
public void clearSystemProperties()
{
@@ -70,9 +77,9 @@ public class MainTest
System.err.println(args);
// Assert.assertEquals("--stop should not build module tree", 0, args.getEnabledModules().size());
- Assert.assertEquals("--stop missing port","10000",args.getProperties().getString("STOP.PORT"));
- Assert.assertEquals("--stop missing key","foo",args.getProperties().getString("STOP.KEY"));
- Assert.assertEquals("--stop missing wait","300",args.getProperties().getString("STOP.WAIT"));
+ assertEquals("--stop missing port","10000",args.getProperties().getString("STOP.PORT"));
+ assertEquals("--stop missing key","foo",args.getProperties().getString("STOP.KEY"));
+ assertEquals("--stop missing wait","300",args.getProperties().getString("STOP.WAIT"));
}
@Test
@@ -114,9 +121,22 @@ public class MainTest
cmdLineArgs.add("-Xmx1024m");
// Arbitrary Libs
- File extraJar = MavenTestingUtils.getTestResourceFile("extra-libs/example.jar");
- File extraDir = MavenTestingUtils.getTestResourceDir("extra-resources");
- cmdLineArgs.add(String.format("--lib=%s%s%s",extraJar.getAbsolutePath(),File.pathSeparatorChar,extraDir.getAbsolutePath()));
+ Path extraJar = MavenTestingUtils.getTestResourceFile("extra-libs/example.jar").toPath().normalize();
+ Path extraDir = MavenTestingUtils.getTestResourceDir("extra-resources").toPath().normalize();
+
+ extraJar = extraJar.toAbsolutePath();
+ extraDir = extraDir.toAbsolutePath();
+
+ assertThat("Extra Jar exists: " + extraJar,Files.exists(extraJar),is(true));
+ assertThat("Extra Dir exists: " + extraDir,Files.exists(extraDir),is(true));
+
+ StringBuilder lib = new StringBuilder();
+ lib.append("--lib=");
+ lib.append(extraJar.toString());
+ lib.append(File.pathSeparator);
+ lib.append(extraDir.toString());
+
+ cmdLineArgs.add(lib.toString());
// Arbitrary XMLs
cmdLineArgs.add("jetty.xml");
@@ -128,8 +148,8 @@ public class MainTest
StartArgs args = main.processCommandLine(cmdLineArgs.toArray(new String[cmdLineArgs.size()]));
BaseHome baseHome = main.getBaseHome();
- Assert.assertThat("jetty.home",baseHome.getHome(),is(homePath.getAbsolutePath()));
- Assert.assertThat("jetty.base",baseHome.getBase(),is(homePath.getAbsolutePath()));
+ assertThat("jetty.home",baseHome.getHome(),is(homePath.getAbsolutePath()));
+ assertThat("jetty.base",baseHome.getBase(),is(homePath.getAbsolutePath()));
ConfigurationAssert.assertConfiguration(baseHome,args,"assert-home-with-jvm.txt");
}
@@ -154,8 +174,8 @@ public class MainTest
StartArgs args = main.processCommandLine(cmdLineArgs.toArray(new String[cmdLineArgs.size()]));
BaseHome baseHome = main.getBaseHome();
- Assert.assertThat("jetty.home",baseHome.getHome(),is(homePath.getAbsolutePath()));
- Assert.assertThat("jetty.base",baseHome.getBase(),is(homePath.getAbsolutePath()));
+ assertThat("jetty.home",baseHome.getHome(),is(homePath.getAbsolutePath()));
+ assertThat("jetty.base",baseHome.getBase(),is(homePath.getAbsolutePath()));
ConfigurationAssert.assertConfiguration(baseHome,args,"assert-home-with-spdy.txt");
}
@@ -173,8 +193,8 @@ public class MainTest
StartArgs args = main.processCommandLine(cmdLineArgs.toArray(new String[cmdLineArgs.size()]));
BaseHome baseHome = main.getBaseHome();
- Assert.assertThat("jetty.home",baseHome.getHome(),is(homePath.getAbsolutePath()));
- Assert.assertThat("jetty.base",baseHome.getBase(),is(homePath.getAbsolutePath()));
+ assertThat("jetty.home",baseHome.getHome(),is(homePath.getAbsolutePath()));
+ assertThat("jetty.base",baseHome.getBase(),is(homePath.getAbsolutePath()));
ConfigurationAssert.assertConfiguration(baseHome,args,"assert-home-with-spaces.txt");
}

Back to the top