simplified start
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1223 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
parent
9680fb9b99
commit
8733b438db
|
@ -834,7 +834,6 @@ public class Config
|
|||
|
||||
private List<String> processDynamicSectionIdentifier(String dynamicPathId,List<String> sections) throws IOException
|
||||
{
|
||||
String section=null;
|
||||
String rawPath;
|
||||
boolean deep;
|
||||
|
||||
|
@ -848,12 +847,6 @@ public class Config
|
|||
deep=true;
|
||||
rawPath = fixPath(dynamicPathId.substring(0,dynamicPathId.length() - 2));
|
||||
}
|
||||
else if (dynamicPathId.indexOf('/')>1 && !dynamicPathId.endsWith("/"))
|
||||
{
|
||||
section=dynamicPathId.substring(dynamicPathId.lastIndexOf('/')+1);
|
||||
rawPath=dynamicPathId.substring(0,dynamicPathId.lastIndexOf('/'));
|
||||
deep=true;
|
||||
}
|
||||
else
|
||||
{
|
||||
String msg = "Illegal dynamic path [" + dynamicPathId + "]";
|
||||
|
@ -864,10 +857,8 @@ public class Config
|
|||
if (!parentDir.exists())
|
||||
return sections;
|
||||
debug("dynamic: " + parentDir);
|
||||
|
||||
File dirs[] = section!=null
|
||||
?new File[]{new File(parentDir,section)}
|
||||
:parentDir.listFiles(new FileFilter()
|
||||
|
||||
File dirs[] = parentDir.listFiles(new FileFilter()
|
||||
{
|
||||
public boolean accept(File path)
|
||||
{
|
||||
|
|
|
@ -146,9 +146,9 @@ $(jetty.home)/lib/jetty-client-$(version).jar
|
|||
[All,websocket]
|
||||
$(jetty.home)/lib/jetty-websocket-$(version).jar ! available org.eclipse.jetty.websocket.WebSocket
|
||||
|
||||
|
||||
# Add ext if it exists
|
||||
[All,default,ext,=$(jetty.home)/lib/ext]
|
||||
[Server,All,default,ext]
|
||||
$(jetty.home)/lib/ext/**
|
||||
|
||||
# Add all other sub-directories in /lib/ as options in a dynamic way
|
||||
[All,=$(jetty.home)/lib/**]
|
||||
|
|
|
@ -184,6 +184,9 @@ public class ConfigTest extends TestCase
|
|||
|
||||
File ext = new File(lib,"ext");
|
||||
expected.addComponent(new File(ext,"custom-impl.jar"));
|
||||
File foo = new File(lib,"foo");
|
||||
File bar = new File(foo,"bar");
|
||||
expected.addComponent(new File(bar,"foobar.jar"));
|
||||
|
||||
assertEquals("Components (Deep)",expected,actual);
|
||||
}
|
||||
|
@ -560,11 +563,45 @@ public class ConfigTest extends TestCase
|
|||
assertEquals("Classpath combined 'server,logging'",expectedCombined,cpCombined);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void testDynamicSection() throws IOException
|
||||
{
|
||||
StringBuffer buf = new StringBuffer();
|
||||
buf.append("[All,default,=$(jetty.home)/lib/ext]\n");
|
||||
buf.append("[All,default,=$(jetty.home)/lib/*]\n");
|
||||
|
||||
String jettyHome = getTestableJettyHome();
|
||||
|
||||
Config options = new Config();
|
||||
options.setProperty("jetty.home",jettyHome);
|
||||
options.parse(buf);
|
||||
|
||||
Classpath defaultClasspath = options.getClasspath();
|
||||
assertNotNull("Default Classpath should not be null",defaultClasspath);
|
||||
Classpath foocp = options.getSectionClasspath("foo");
|
||||
assertNotNull("Foo Classpath should not exist",foocp);
|
||||
|
||||
Classpath allcp = options.getSectionClasspath("All");
|
||||
assertNotNull("Classpath section 'All' should exist",allcp);
|
||||
|
||||
Classpath extcp = options.getSectionClasspath("ext");
|
||||
assertNotNull("Classpath section 'ext' should exist", extcp);
|
||||
|
||||
assertEquals("Deep Classpath Section",0,foocp.count());
|
||||
|
||||
Classpath expected = new Classpath();
|
||||
File lib = new File(getJettyHomeDir(),"lib");
|
||||
File ext = new File(lib, "ext");
|
||||
expected = new Classpath();
|
||||
expected.addComponent(new File(ext,"custom-impl.jar"));
|
||||
assertEquals("Single Classpath Section",expected,extcp);
|
||||
|
||||
}
|
||||
|
||||
public void testDeepDynamicSection() throws IOException
|
||||
{
|
||||
StringBuffer buf = new StringBuffer();
|
||||
buf.append("[All,default,=$(jetty.home)/lib/**]\n");
|
||||
|
||||
|
||||
String jettyHome = getTestableJettyHome();
|
||||
|
@ -575,22 +612,26 @@ public class ConfigTest extends TestCase
|
|||
|
||||
Classpath defaultClasspath = options.getClasspath();
|
||||
assertNotNull("Default Classpath should not be null",defaultClasspath);
|
||||
Classpath foocp = options.getSectionClasspath("Foo");
|
||||
assertNull("Foo Classpath should not exist",foocp);
|
||||
Classpath foocp = options.getSectionClasspath("foo");
|
||||
assertNotNull("Foo Classpath should not exist",foocp);
|
||||
|
||||
Classpath allcp = options.getSectionClasspath("All");
|
||||
assertNotNull("Classpath section 'All' should exist",allcp);
|
||||
|
||||
|
||||
Classpath extcp = options.getSectionClasspath("ext");
|
||||
assertNotNull("Classpath section 'ext' should exist", extcp);
|
||||
|
||||
|
||||
File lib = new File(getJettyHomeDir(),"lib");
|
||||
File ext = new File(lib, "ext");
|
||||
|
||||
Classpath expected = new Classpath();
|
||||
File foo = new File(lib, "foo");
|
||||
File bar = new File(foo, "bar");
|
||||
expected.addComponent(new File(bar,"foobar.jar"));
|
||||
assertEquals("Deep Classpath Section",expected,foocp);
|
||||
|
||||
File ext = new File(lib, "ext");
|
||||
expected = new Classpath();
|
||||
expected.addComponent(new File(ext,"custom-impl.jar"));
|
||||
|
||||
assertEquals("Single Classpath Section",expected,extcp);
|
||||
|
||||
}
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue