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)
This commit is contained in:
parent
d49ecdf1d6
commit
6faf94e4c1
|
@ -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
|
||||
|
|
|
@ -664,6 +664,8 @@ public class StartArgs
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
StartLog.debug("parse(\"%s\", \"%s\", %b)",rawarg,source,replaceProps);
|
||||
|
||||
final String arg = rawarg.trim();
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue