435086 - ${jetty.base}/resources not on classpath when using --module=resources

+ Adding test case for resource.mod
+ Fixing java.nio.file.PathMatcher use to not include trailing slash for
  directory matches.
This commit is contained in:
Joakim Erdfelt 2014-05-16 09:55:36 -07:00
parent 5b009dbe15
commit 69e6701106
14 changed files with 98 additions and 2 deletions

View File

@ -287,6 +287,7 @@ public class BaseHome
PathFinder finder = new PathFinder();
finder.setFileMatcher(matcher);
finder.setBase(dir);
finder.setIncludeDirsInResults(true);
Files.walkFileTree(dir,SEARCH_VISIT_OPTIONS,searchDepth,finder);
hits.addAll(finder.getHits());
Collections.sort(hits,new NaturalSort.Paths());

View File

@ -73,10 +73,19 @@ public class PathMatchers
return new File(test).toPath();
}
public static PathMatcher getMatcher(String pattern)
public static PathMatcher getMatcher(final String rawpattern)
{
FileSystem fs = FileSystems.getDefault();
String pattern = rawpattern;
// Strip trailing slash (if present)
int lastchar = pattern.charAt(pattern.length() - 1);
if (lastchar == '/' || lastchar == '\\')
{
pattern = pattern.substring(0,pattern.length() - 1);
}
// If using FileSystem.getPathMatcher() with "glob:" or "regex:"
// use FileSystem default pattern behavior
if (pattern.startsWith("glob:") || pattern.startsWith("regex:"))

View File

@ -82,7 +82,7 @@ public class ModulesTest
String expected[] = { "jmx", "client", "stats", "spdy", "deploy", "debug", "security", "npn", "ext", "websocket", "rewrite", "ipaccess", "xinetd",
"proxy", "webapp", "jndi", "lowresources", "https", "plus", "requestlog", "jsp", "monitor", "xml", "servlet", "jaas", "http", "base", "server",
"annotations" };
"annotations", "resources", "loggging" };
Assert.assertThat("Module count: " + moduleNames,moduleNames.size(),is(expected.length));
}

View File

@ -61,6 +61,12 @@ public class TestUseCases
assertUseCase("home","base.jmx","assert-jmx.txt");
}
@Test
public void testWithLogging() throws Exception
{
assertUseCase("home","base.logging","assert-logging.txt");
}
@Test
public void testWithIncludeJettyDir_Logging() throws Exception
{

View File

@ -1,5 +1,6 @@
# The XMLs we expect (order is important)
XML|${jetty.home}/etc/jetty-jmx.xml
XML|${maven-test-resources}/extra-jetty-dirs/logging/etc/jetty-logging.xml
XML|${jetty.home}/etc/jetty.xml
XML|${jetty.home}/etc/jetty-http.xml
@ -13,6 +14,11 @@ LIB|${jetty.home}/lib/jetty-server-TEST.jar
LIB|${jetty.home}/lib/jetty-util-TEST.jar
LIB|${jetty.home}/lib/jetty-xml-TEST.jar
LIB|${jetty.home}/lib/servlet-api-3.1.jar
LIB|${jetty.home}/resources
LIB|${maven-test-resources}/extra-jetty-dirs/logging/lib/logging/logback.jar
# The Properties we expect (order is irrelevant)
PROP|jetty.port=9090
# Files
FILE|logs/

View File

@ -0,0 +1,26 @@
# The XMLs we expect (order is important)
XML|${jetty.home}/etc/jetty-logging.xml
XML|${jetty.home}/etc/jetty.xml
XML|${jetty.home}/etc/jetty-http.xml
# The LIBs we expect (order is irrelevant)
LIB|${jetty.home}/lib/jetty-continuation-TEST.jar
LIB|${jetty.home}/lib/jetty-http-TEST.jar
LIB|${jetty.home}/lib/jetty-io-TEST.jar
LIB|${jetty.home}/lib/jetty-schemas-3.1.jar
LIB|${jetty.home}/lib/jetty-server-TEST.jar
LIB|${jetty.home}/lib/jetty-util-TEST.jar
LIB|${jetty.home}/lib/jetty-xml-TEST.jar
LIB|${jetty.home}/lib/servlet-api-3.1.jar
LIB|${jetty.base}/lib/logging/slf4j-api.jar
LIB|${jetty.base}/lib/logging/jul-to-slf4j.jar
LIB|${jetty.base}/lib/logging/logback-core.jar
LIB|${jetty.base}/lib/logging/logback-classic.jar
LIB|${jetty.base}/resources
# The Properties we expect (order is irrelevant)
PROP|jetty.port=9090
# Other File References
FILE|logs/
FILE|resources/

View File

@ -0,0 +1,7 @@
--module=server
--module=http
--module=logging
--module=resources
jetty.port=9090

View File

@ -0,0 +1,31 @@
#
# Jetty std err/out logging
#
[xml]
etc/jetty-logging.xml
[files]
logs/
[lib]
lib/logging/**.jar
resources/
[ini-template]
## Logging Configuration
# Configure jetty logging for default internal behavior STDERR output
# -Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
# Configure jetty logging for slf4j
# -Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.Slf4jLog
# Configure jetty logging for java.util.logging
# -Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.JavaUtilLog
# STDERR / STDOUT Logging
# Number of days to retain logs
# jetty.log.retain=90
# Directory for logging output
# Either a path relative to ${jetty.base} or an absolute path
# jetty.logs=logs

View File

@ -0,0 +1,10 @@
#
# Module to add resources directory to classpath
#
[lib]
resources/
[files]
resources/