437395 - Start / Properties in template sections should be default applied for enabled modules

+ Fixing typo in enableModule()
+ Fixing concurrent modification exception during walk of parents in
  enableModule()
This commit is contained in:
Joakim Erdfelt 2014-06-19 10:18:51 -07:00 committed by Simone Bordet
parent 9d44c32c93
commit e48cdb519b
40 changed files with 356 additions and 39 deletions

View File

@ -402,7 +402,10 @@ public class Module
{
StringBuilder str = new StringBuilder();
str.append("Module[").append(logicalName);
str.append(",").append(fileRef);
if (!logicalName.equals(fileRef))
{
str.append(",file=").append(fileRef);
}
if (enabled)
{
str.append(",enabled");

View File

@ -271,13 +271,30 @@ public class Modules implements Iterable<Module>
{
// A regex!
Pattern pat = Pattern.compile(name);
for (Map.Entry<String, Module> entry : modules.entrySet())
List<Module> matching = new ArrayList<>();
do
{
if (pat.matcher(entry.getKey()).matches())
matching.clear();
// find matching entries that are not enabled
for (Map.Entry<String, Module> entry : modules.entrySet())
{
enableModule(entry.getValue(),sources);
if (pat.matcher(entry.getKey()).matches())
{
if (!entry.getValue().isEnabled())
{
matching.add(entry.getValue());
}
}
}
// enable them
for (Module module : matching)
{
enableModule(module,sources);
}
}
while (!matching.isEmpty());
}
else
{
@ -309,10 +326,12 @@ public class Modules implements Iterable<Module>
}
// enable any parents that haven't been enabled (yet)
for(String name: module.getParentNames())
Set<String> parentNames = new HashSet<>();
parentNames.addAll(module.getParentNames());
for(String name: parentNames)
{
Module parent = modules.get(name);
if (name == null)
if (parent == null)
{
// parent module doesn't exist, yet
Path file = baseHome.getPath("modules/" + name + ".mod");

View File

@ -133,6 +133,31 @@ public class MainTest
ConfigurationAssert.assertConfiguration(baseHome,args,"assert-home-with-jvm.txt");
}
@Test
public void testWithSpdy() throws Exception
{
List<String> cmdLineArgs = new ArrayList<>();
File homePath = MavenTestingUtils.getTestResourceDir("usecases/home").getAbsoluteFile();
cmdLineArgs.add("jetty.home=" + homePath);
cmdLineArgs.add("user.dir=" + homePath);
// Modules
cmdLineArgs.add("--module=server");
cmdLineArgs.add("--module=deploy");
cmdLineArgs.add("--module=spdy");
Main main = new Main();
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()));
ConfigurationAssert.assertConfiguration(baseHome,args,"assert-home-with-spdy.txt");
}
@Test
public void testJettyHomeWithSpaces() throws Exception

View File

@ -87,7 +87,6 @@ public class ModulesTest
expected.add("deploy");
expected.add("debug");
expected.add("security");
expected.add("npn");
expected.add("ext");
expected.add("websocket");
expected.add("rewrite");
@ -104,6 +103,8 @@ public class ModulesTest
// (only present if enabled) expected.add("jsp-impl");
expected.add("monitor");
expected.add("xml");
expected.add("ssl");
expected.add("protonego");
expected.add("servlet");
expected.add("jaas");
expected.add("http");
@ -122,7 +123,7 @@ public class ModulesTest
// Test Env
File homeDir = MavenTestingUtils.getTestResourceDir("usecases/home");
File baseDir = testdir.getEmptyDir();
String cmdLine[] = new String[] {"jetty.version=TEST", "java.version=1.7.0_21"};
String cmdLine[] = new String[] {"jetty.version=TEST", "java.version=1.7.0_60"};
// Configuration
CommandLineConfigSource cmdLineSource = new CommandLineConfigSource(cmdLine);
@ -155,8 +156,10 @@ public class ModulesTest
expected.add("server");
// transitive
expected.add("base");
expected.add("npn");
expected.add("npn-boot");
expected.add("ssl");
expected.add("protonego");
expected.add("protonego-boot");
expected.add("protonego-impl");
expected.add("xml");
expected.add("jsp-impl");

View File

@ -77,8 +77,8 @@ public class TestBadUseCases
public void testWithSpdyBadNpnVersion() throws Exception
{
assertBadConfig("home","base.enable.spdy.bad.npn.version",
"Missing referenced dependency: npn/npn-1.7.0_01",
"java.version=1.7.0_01");
"Missing referenced dependency: protonego-impl/npn-1.7.0_01",
"java.version=1.7.0_01", "protonego=npn");
}

View File

@ -106,7 +106,7 @@ public class TestUseCases
@Test
public void testWithSpdy() throws Exception
{
assertUseCase("home","base.enable.spdy","assert-enable-spdy.txt","java.version=1.7.0_21");
assertUseCase("home","base.enable.spdy","assert-enable-spdy.txt","java.version=1.7.0_60");
}
@Test

View File

@ -0,0 +1,71 @@
# The XMLs we expect (order is important)
XML|${jetty.base}/etc/jetty-jmx.xml
XML|${jetty.base}/etc/protonego-alpn.xml
XML|${jetty.base}/etc/jetty.xml
XML|${jetty.base}/etc/jetty-http.xml
XML|${jetty.base}/etc/jetty-ssl.xml
XML|${jetty.base}/etc/jetty-plus.xml
XML|${jetty.base}/etc/jetty-spdy.xml
XML|${jetty.base}/etc/jetty-annotations.xml
XML|${jetty.base}/etc/jetty-deploy.xml
XML|${jetty.base}/etc/jetty-websockets.xml
# The LIBs we expect (order is irrelevant)
LIB|${jetty.base}/lib/annotations/javax.annotation-api-1.2.jar
LIB|${jetty.base}/lib/annotations/org.objectweb.asm-TEST.jar
LIB|${jetty.base}/lib/jetty-annotations-TEST.jar
LIB|${jetty.base}/lib/jetty-continuation-TEST.jar
LIB|${jetty.base}/lib/jetty-http-TEST.jar
LIB|${jetty.base}/lib/jetty-io-TEST.jar
LIB|${jetty.base}/lib/jetty-deploy-TEST.jar
LIB|${jetty.base}/lib/jetty-jmx-TEST.jar
LIB|${jetty.base}/lib/jetty-jndi-TEST.jar
LIB|${jetty.base}/lib/jetty-plus-TEST.jar
LIB|${jetty.base}/lib/jetty-schemas-3.1.jar
LIB|${jetty.base}/lib/jetty-security-TEST.jar
LIB|${jetty.base}/lib/jetty-server-TEST.jar
LIB|${jetty.base}/lib/jetty-servlet-TEST.jar
LIB|${jetty.base}/lib/jetty-util-TEST.jar
LIB|${jetty.base}/lib/jetty-webapp-TEST.jar
LIB|${jetty.base}/lib/jetty-xml-TEST.jar
LIB|${jetty.base}/lib/spdy/spdy-client-TEST.jar
LIB|${jetty.base}/lib/spdy/spdy-core-TEST.jar
LIB|${jetty.base}/lib/spdy/spdy-http-common-TEST.jar
LIB|${jetty.base}/lib/spdy/spdy-http-server-TEST.jar
LIB|${jetty.base}/lib/spdy/spdy-server-TEST.jar
LIB|${jetty.base}/lib/jndi/javax.activation-1.1.jar
LIB|${jetty.base}/lib/jndi/javax.transaction-api-1.2.jar
LIB|${jetty.base}/lib/servlet-api-3.1.jar
LIB|${jetty.base}/lib/websocket/javax.websocket-api-1.0.jar
LIB|${jetty.base}/lib/websocket/javax-websocket-client-impl-TEST.jar
LIB|${jetty.base}/lib/websocket/javax-websocket-server-impl-TEST.jar
LIB|${jetty.base}/lib/websocket/websocket-api-TEST.jar
LIB|${jetty.base}/lib/websocket/websocket-client-TEST.jar
LIB|${jetty.base}/lib/websocket/websocket-common-TEST.jar
LIB|${jetty.base}/lib/websocket/websocket-server-TEST.jar
LIB|${jetty.base}/lib/websocket/websocket-servlet-TEST.jar
# The Properties we expect (order is irrelevant)
PROP|jetty.keymanager.password=OBF:1u2u1wml1z7s1z7a1wnl1u2g
PROP|jetty.keystore=etc/keystore
PROP|jetty.keystore.password=OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4
PROP|jetty.secure.port=8443
PROP|jetty.truststore=etc/keystore
PROP|jetty.truststore.password=OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4
PROP|protonego=alpn
PROP|spdy.port=8443
PROP|spdy.timeout=30000
# JVM Args
JVM|-Xms1024m
JVM|-Xmx1024m
# Downloads
DOWNLOAD|http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/7.0.0.v20140317/alpn-boot-7.0.0.v20140317.jar|lib/alpn/alpn-boot-7.0.0.v20140317.jar
DOWNLOAD|http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/plain/jetty-server/src/main/config/etc/keystore|etc/keystore
# Files
FILE|lib/
FILE|lib/alpn/

View File

@ -1,10 +1,12 @@
# The XMLs we expect (order is important)
XML|${jetty.home}/etc/jetty-jmx.xml
XML|${jetty.home}/etc/protonego-alpn.xml
XML|${jetty.home}/etc/jetty.xml
XML|${jetty.home}/etc/jetty-http.xml
XML|${jetty.home}/etc/jetty-ssl.xml
XML|${jetty.home}/etc/jetty-spdy.xml
# The LIBs we expect (order is irrelevant)
LIB|${jetty.home}/lib/jetty-continuation-TEST.jar
LIB|${jetty.home}/lib/jetty-http-TEST.jar
@ -23,15 +25,25 @@ LIB|${jetty.home}/lib/spdy/spdy-core-TEST.jar
# The Properties we expect (order is irrelevant)
PROP|jetty.port=9090
PROP|jetty.secure.port=8443
PROP|jetty.keystore=etc/keystore
PROP|jetty.keystore.password=friendly
PROP|jetty.keymanager.password=icecream
PROP|jetty.truststore=etc/keystore
PROP|jetty.truststore.password=sundae
PROP|java.version=1.7.0_21
PROP|java.version=1.7.0_60
PROP|protonego=alpn
PROP|spdy.port=8443
PROP|spdy.timeout=30000
# The Downloads
DOWNLOAD|http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar|lib/npn/npn-boot-1.1.5.v20130313.jar
DOWNLOAD|http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/7.0.0.v20140317/alpn-boot-7.0.0.v20140317.jar|lib/alpn/alpn-boot-7.0.0.v20140317.jar
DOWNLOAD|http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/plain/jetty-server/src/main/config/etc/keystore|etc/keystore
# The Bootlib
BOOTLIB|-Xbootclasspath/p:lib/npn/npn-boot-1.1.5.v20130313.jar
BOOTLIB|-Xbootclasspath/p:lib/alpn/alpn-boot-7.0.0.v20140317.jar
# The Files
FILE|lib/
FILE|lib/alpn/

View File

@ -1,4 +0,0 @@
[depend]
npn/npn-${java.version}

View File

@ -0,0 +1,8 @@
[name]
protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/7.0.0.v20140317/alpn-boot-7.0.0.v20140317.jar|lib/alpn/alpn-boot-7.0.0.v20140317.jar
[exec]
-Xbootclasspath/p:lib/alpn/alpn-boot-7.0.0.v20140317.jar

View File

@ -0,0 +1,8 @@
[name]
protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/7.0.0.v20140317/alpn-boot-7.0.0.v20140317.jar|lib/alpn/alpn-boot-7.0.0.v20140317.jar
[exec]
-Xbootclasspath/p:lib/alpn/alpn-boot-7.0.0.v20140317.jar

View File

@ -0,0 +1,8 @@
[name]
protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/7.0.0.v20140317/alpn-boot-7.0.0.v20140317.jar|lib/alpn/alpn-boot-7.0.0.v20140317.jar
[exec]
-Xbootclasspath/p:lib/alpn/alpn-boot-7.0.0.v20140317.jar

View File

@ -0,0 +1,8 @@
[name]
protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/7.0.0.v20140317/alpn-boot-7.0.0.v20140317.jar|lib/alpn/alpn-boot-7.0.0.v20140317.jar
[exec]
-Xbootclasspath/p:lib/alpn/alpn-boot-7.0.0.v20140317.jar

View File

@ -0,0 +1,8 @@
[name]
protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/7.0.0.v20140317/alpn-boot-7.0.0.v20140317.jar|lib/alpn/alpn-boot-7.0.0.v20140317.jar
[exec]
-Xbootclasspath/p:lib/alpn/alpn-boot-7.0.0.v20140317.jar

View File

@ -0,0 +1,8 @@
[name]
protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/8.0.0.v20140317/alpn-boot-8.0.0.v20140317.jar|lib/alpn/alpn-boot-8.0.0.v20140317.jar
[exec]
-Xbootclasspath/p:lib/alpn/alpn-boot-8.0.0.v20140317.jar

View File

@ -0,0 +1,8 @@
[name]
protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/8.0.0.v20140317/alpn-boot-8.0.0.v20140317.jar|lib/alpn/alpn-boot-8.0.0.v20140317.jar
[exec]
-Xbootclasspath/p:lib/alpn/alpn-boot-8.0.0.v20140317.jar

View File

@ -0,0 +1,36 @@
# ALPN is provided via a -Xbootclasspath that modifies the secure connections
# in java to support the ALPN layer needed for SPDY (and eventually HTTP/2)
#
# This modification has a tight dependency on specific recent updates of
# Java 1.7 and Java 1.8
# (Java versions prior to 1.7u40 are not supported)
#
# The alpn protonego module will use an appropriate alpn-boot jar for your
# specific version of Java.
#
# IMPORTANT: Versions of Java that exist after this module was created are
# not guaranteed to work with existing alpn-boot jars, and might
# need a new alpn-boot to be created / tested / deployed by the
# Jetty project in order to provide support for these future
# Java versions.
#
# All versions of alpn-boot can be found at
# http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/
[name]
protonego-impl
[depend]
protonego-impl/alpn-${java.version}
[lib]
lib/jetty-alpn-client-${jetty.version}.jar
lib/jetty-alpn-server-${jetty.version}.jar
[xml]
etc/protonego-alpn.xml
[files]
lib/
lib/alpn/

View File

@ -1,5 +1,5 @@
[name]
npn-boot
protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.0.v20120525/npn-boot-1.1.0.v20120525.jar|lib/npn/npn-boot-1.1.0.v20120525.jar

View File

@ -1,5 +1,5 @@
[name]
npn-boot
protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.0.v20120525/npn-boot-1.1.0.v20120525.jar|lib/npn/npn-boot-1.1.0.v20120525.jar

View File

@ -1,5 +1,5 @@
[name]
npn-boot
protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.1.v20121030/npn-boot-1.1.1.v20121030.jar|lib/npn/npn-boot-1.1.1.v20121030.jar

View File

@ -1,5 +1,5 @@
[name]
npn-boot
protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.1.v20121030/npn-boot-1.1.1.v20121030.jar|lib/npn/npn-boot-1.1.1.v20121030.jar

View File

@ -1,5 +1,5 @@
[name]
npn-boot
protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.3.v20130313/npn-boot-1.1.3.v20130313.jar|lib/npn/npn-boot-1.1.3.v20130313.jar

View File

@ -1,5 +1,5 @@
[name]
npn-boot
protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.3.v20130313/npn-boot-1.1.3.v20130313.jar|lib/npn/npn-boot-1.1.3.v20130313.jar

View File

@ -1,5 +1,5 @@
[name]
npn-boot
protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.3.v20130313/npn-boot-1.1.3.v20130313.jar|lib/npn/npn-boot-1.1.3.v20130313.jar

View File

@ -1,5 +1,5 @@
[name]
npn-boot
protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.4.v20130313/npn-boot-1.1.4.v20130313.jar|lib/npn/npn-boot-1.1.4.v20130313.jar

View File

@ -1,5 +1,5 @@
[name]
npn-boot
protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar|lib/npn/npn-boot-1.1.5.v20130313.jar

View File

@ -1,5 +1,5 @@
[name]
npn-boot
protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar|lib/npn/npn-boot-1.1.5.v20130313.jar

View File

@ -1,5 +1,5 @@
[name]
npn-boot
protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar|lib/npn/npn-boot-1.1.5.v20130313.jar

View File

@ -1,5 +1,5 @@
[name]
npn-boot
protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar|lib/npn/npn-boot-1.1.5.v20130313.jar

View File

@ -1,5 +1,5 @@
[name]
npn-boot
protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.6.v20130911/npn-boot-1.1.6.v20130911.jar|lib/npn/npn-boot-1.1.6.v20130911.jar

View File

@ -1,5 +1,5 @@
[name]
npn-boot
protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.6.v20130911/npn-boot-1.1.6.v20130911.jar|lib/npn/npn-boot-1.1.6.v20130911.jar

View File

@ -1,5 +1,5 @@
[name]
npn-boot
protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.6.v20130911/npn-boot-1.1.6.v20130911.jar|lib/npn/npn-boot-1.1.6.v20130911.jar

View File

@ -1,5 +1,5 @@
[name]
npn-boot
protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.7.v20140316/npn-boot-1.1.7.v20140316.jar|lib/npn/npn-boot-1.1.7.v20140316.jar

View File

@ -1,5 +1,5 @@
[name]
npn-boot
protonego-boot
[files]
http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.7.v20140316/npn-boot-1.1.7.v20140316.jar|lib/npn/npn-boot-1.1.7.v20140316.jar

View File

@ -0,0 +1,31 @@
# NPN is provided via a -Xbootclasspath that modifies the secure connections
# in java to support the NPN layer needed for SPDY.
#
# This modification has a tight dependency on specific updates of Java 1.7.
# (No support for Java 8 exists for npn / npn-boot, use alpn instead)
#
# The npn module will use an appropriate npn-boot jar for your specific
# version of Java.
#
# IMPORTANT: Versions of Java that exist after this module was created are
# not guaranteed to work with existing npn-boot jars, and might
# need a new npn-boot to be created / tested / deployed by the
# Jetty project in order to provide support for these future
# Java versions.
#
# All versions of npn-boot can be found at
# http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/
[name]
protonego-impl
[depend]
protonego-impl/npn-${java.version}
[xml]
etc/protonego-npn.xml
[files]
lib/
lib/npn/

View File

@ -0,0 +1,15 @@
#
# Protocol Negotiatin Selection Module
#
[depend]
protonego-impl/${protonego}
[ini-template]
# Protocol Negotiation Implementation Selection
# choices are:
# 'npn' : original implementation for SPDY (now deprecated)
# 'alpn' : replacement for NPN, in use by current SPDY implementations
# and the future HTTP/2 spec
# Note: java 1.8+ are ALPN only.
protonego=alpn

View File

@ -1,7 +1,10 @@
#
# SPDY Support Module
#
[depend]
server
npn
ssl
protonego
[lib]
lib/spdy/*.jar
@ -9,3 +12,15 @@ lib/spdy/*.jar
[xml]
etc/jetty-ssl.xml
etc/jetty-spdy.xml
[ini-template]
## SPDY Configuration
# Port for SPDY connections
spdy.port=8443
# SPDY idle timeout in milliseconds
spdy.timeout=30000
# Initial Window Size for SPDY
#spdy.initialWindowSize=65536

View File

@ -0,0 +1,35 @@
#
# SSL Keystore module
#
[depend]
server
[xml]
etc/jetty-ssl.xml
[files]
http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/plain/jetty-server/src/main/config/etc/keystore|etc/keystore
[ini-template]
## SSL Keystore Configuration
# define the port to use for secure redirection
jetty.secure.port=8443
# Setup a demonstration keystore and truststore
jetty.keystore=etc/keystore
jetty.truststore=etc/keystore
# Set the demonstration passwords.
# Note that OBF passwords are not secure, just protected from casual observation
# See http://www.eclipse.org/jetty/documentation/current/configuring-security-secure-passwords.html
jetty.keystore.password=OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4
jetty.keymanager.password=OBF:1u2u1wml1z7s1z7a1wnl1u2g
jetty.truststore.password=OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4
# Set the client auth behavior
# Set to true if client certificate authentication is required
# jetty.ssl.needClientAuth=true
# Set to true if client certificate authentication is desired
# jetty.ssl.wantClientAuth=true