Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse McConnell2011-05-18 20:01:09 +0000
committerJesse McConnell2011-05-18 20:01:09 +0000
commita85e00f3ff200c42352c07f1f3d57420873e756b (patch)
tree7d944cc9ba18baccc63d4197b847d74d73d84688 /jetty-deploy/src/test
parentd722830f0b386d7f6af2ecc8453283cac5aa2900 (diff)
downloadorg.eclipse.jetty.project-a85e00f3ff200c42352c07f1f3d57420873e756b.tar.gz
org.eclipse.jetty.project-a85e00f3ff200c42352c07f1f3d57420873e756b.tar.xz
org.eclipse.jetty.project-a85e00f3ff200c42352c07f1f3d57420873e756b.zip
Bug 345729 remove previous solution in lew of more general approach allowing for the application of a jetty-web.xml type file to all contexts in the binding phase
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@3208 7e9141cc-0065-0410-87d8-b60c137991c4
Diffstat (limited to 'jetty-deploy/src/test')
-rw-r--r--jetty-deploy/src/test/java/org/eclipse/jetty/deploy/bindings/GlobalJettyXmlBindingTest.java (renamed from jetty-deploy/src/test/java/org/eclipse/jetty/deploy/bindings/WebappClasspathPatternBindingTest.java)56
-rw-r--r--jetty-deploy/src/test/resources/binding-test-contexts-1.xml10
-rw-r--r--jetty-deploy/src/test/resources/binding-test-contexts-2.xml63
-rw-r--r--jetty-deploy/src/test/resources/context-binding-test-1.xml27
4 files changed, 38 insertions, 118 deletions
diff --git a/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/bindings/WebappClasspathPatternBindingTest.java b/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/bindings/GlobalJettyXmlBindingTest.java
index 4583a3576f..26fa919281 100644
--- a/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/bindings/WebappClasspathPatternBindingTest.java
+++ b/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/bindings/GlobalJettyXmlBindingTest.java
@@ -15,21 +15,26 @@
// ========================================================================
package org.eclipse.jetty.deploy.bindings;
+import java.io.File;
+
import junit.framework.Assert;
import org.eclipse.jetty.deploy.providers.ScanningAppProvider;
import org.eclipse.jetty.deploy.test.XmlConfiguredJetty;
+import org.eclipse.jetty.toolchain.test.IO;
+import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
import org.eclipse.jetty.toolchain.test.TestingDir;
import org.eclipse.jetty.webapp.WebAppContext;
import org.junit.After;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
/**
* Tests {@link ScanningAppProvider} as it starts up for the first time.
*/
-public class WebappClasspathPatternBindingTest
+public class GlobalJettyXmlBindingTest
{
@Rule
public TestingDir testdir = new TestingDir();
@@ -40,17 +45,11 @@ public class WebappClasspathPatternBindingTest
{
jetty = new XmlConfiguredJetty(testdir);
jetty.addConfiguration("jetty.xml");
-// jetty.addConfiguration("jetty-deploymgr-contexts.xml");
// Setup initial context
jetty.copyContext("foo.xml","foo.xml");
jetty.copyWebapp("foo-webapp-1.war","foo.war");
- // Should not throw an Exception
- // jetty.load();
-
- // Start it
- // jetty.start();
}
@After
@@ -63,6 +62,8 @@ public class WebappClasspathPatternBindingTest
@Test
public void testServerAndSystemClassesOverride() throws Exception
{
+ IO.copy(MavenTestingUtils.getTestResourceFile("context-binding-test-1.xml"), new File(jetty.getJettyHome(), "context-binding-test-1.xml"));
+
jetty.addConfiguration("binding-test-contexts-1.xml");
jetty.load();
jetty.start();
@@ -100,46 +101,5 @@ public class WebappClasspathPatternBindingTest
Assert.assertFalse(jndiPackage);
}
-
- @Test
- public void testServerAndSystemClassesModification() throws Exception
- {
- jetty.addConfiguration("binding-test-contexts-2.xml");
- jetty.load();
- jetty.start();
-
- WebAppContext context = jetty.getWebAppContexts().get(0);
-
- Assert.assertNotNull(context);
- Assert.assertEquals(context.getDefaultServerClasses().length,context.getServerClasses().length - 1); // added a pattern
- Assert.assertEquals(context.getDefaultSystemClasses().length,context.getSystemClasses().length - 1); // added a pattern
-
- boolean testPackageServer = false;
-
-
- for (String entry : context.getSystemClasses())
- {
- if ("com.foo.test.".equals(entry))
- {
- testPackageServer = true;
- }
- }
-
- Assert.assertTrue(testPackageServer);
-
- boolean testPackageSystem = false;
-
-
- for (String entry : context.getSystemClasses())
- {
- if ("com.foo.test.".equals(entry))
- {
- testPackageSystem = true;
- }
- }
-
- Assert.assertTrue(testPackageSystem);
- }
-
}
diff --git a/jetty-deploy/src/test/resources/binding-test-contexts-1.xml b/jetty-deploy/src/test/resources/binding-test-contexts-1.xml
index 940b880f94..17cbb75a37 100644
--- a/jetty-deploy/src/test/resources/binding-test-contexts-1.xml
+++ b/jetty-deploy/src/test/resources/binding-test-contexts-1.xml
@@ -30,17 +30,13 @@
<New id="DeploymentManager" class="org.eclipse.jetty.deploy.DeploymentManager">
<Set name="contexts">
<Ref id="Contexts" />
- </Set>
-
-
+ </Set>
<Ref id="DeploymentManager">
<Call name="addLifeCycleBinding">
<Arg>
- <New class="org.eclipse.jetty.deploy.bindings.WebappClasspathPatternBinding">
- <Set name="override">true</Set>
- <Set name="serverClasses"><Ref id="serverClasses"/></Set>
- <Set name="systemClasses"><Ref id="systemClasses"/></Set>
+ <New class="org.eclipse.jetty.deploy.bindings.GlobalJettyXmlBinding">
+ <Set name="jettyXml">file://<SystemProperty name="jetty.home" />/context-binding-test-1.xml</Set>
</New>
</Arg>
</Call>
diff --git a/jetty-deploy/src/test/resources/binding-test-contexts-2.xml b/jetty-deploy/src/test/resources/binding-test-contexts-2.xml
deleted file mode 100644
index 665fd4ab31..0000000000
--- a/jetty-deploy/src/test/resources/binding-test-contexts-2.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
-
-<Configure id="Server" class="org.eclipse.jetty.server.Server">
-
- <Array id="serverClasses" type="java.lang.String">
- <Item>org.foo.test.</Item>
- </Array>
-
- <Array id="systemClasses" type="java.lang.String">
- <Item>com.foo.test.</Item>
- </Array>
-
- <Call name="addLifeCycle">
- <Arg>
- <New id="DeploymentManager" class="org.eclipse.jetty.deploy.DeploymentManager">
- <Set name="contexts">
- <Ref id="Contexts" />
- </Set>
-
-
-
- <Ref id="DeploymentManager">
- <Call name="addLifeCycleBinding">
- <Arg>
- <New class="org.eclipse.jetty.deploy.bindings.WebappClasspathPatternBinding">
- <Set name="serverClasses"><Ref id="serverClasses"/></Set>
- <Set name="systemClasses"><Ref id="systemClasses"/></Set>
- </New>
- </Arg>
- </Call>
- </Ref>
-
- <!-- Providers of Apps -->
- <Set name="appProviders">
- <Array type="org.eclipse.jetty.deploy.AppProvider">
- <Item>
- <New class="org.eclipse.jetty.deploy.providers.ContextProvider">
- <Set name="monitoredDirName"><SystemProperty name="jetty.home" />/contexts</Set>
- <Set name="scanInterval">1</Set>
- <Set name="configurationManager">
- <New class="org.eclipse.jetty.deploy.FileConfigurationManager">
- <Set name="file">
- <Property name="test.targetdir" default="target" />/xml-configured-jetty.properties
- </Set>
- </New>
- </Set>
- </New>
- </Item>
- <Item>
- <New class="org.eclipse.jetty.deploy.providers.WebAppProvider">
- <Set name="monitoredDirName"><SystemProperty name="jetty.home" />/webapps</Set>
- <Set name="scanInterval">1</Set>
- <Set name="contextXmlDir"><SystemProperty name="jetty.home" />/contexts</Set>
- </New>
- </Item>
- </Array>
- </Set>
- </New>
- </Arg>
- </Call>
-
-</Configure>
diff --git a/jetty-deploy/src/test/resources/context-binding-test-1.xml b/jetty-deploy/src/test/resources/context-binding-test-1.xml
new file mode 100644
index 0000000000..846208e641
--- /dev/null
+++ b/jetty-deploy/src/test/resources/context-binding-test-1.xml
@@ -0,0 +1,27 @@
+<Configure class="org.eclipse.jetty.webapp.WebAppContext">
+
+ <Array id="serverClasses" type="java.lang.String">
+ <Item>-org.eclipse.jetty.continuation.</Item>
+ <Item>-org.eclipse.jetty.jndi.</Item>
+ <Item>-org.eclipse.jetty.plus.jaas.</Item>
+ <Item>-org.eclipse.jetty.websocket.</Item>
+ <Item>-org.eclipse.jetty.servlet.DefaultServlet</Item>
+ <Item>org.eclipse.jetty.</Item>
+ <Item>org.eclipse.foo.</Item>
+ </Array>
+
+ <Array id="systemClasses" type="java.lang.String">
+ <Item>java.</Item>
+ <Item>javax.</Item>
+ <Item>org.xml.</Item>
+ <Item>org.w3c.</Item>
+ <Item>org.apache.commons.logging</Item>
+ <Item>org.eclipse.jetty.continuation</Item>
+ <Item>org.eclipse.jetty.plus.jaas.</Item>
+ <Item>org.eclipse.jetty.websocket</Item>
+ <Item>org.eclipse.jetty.servlet.DefaultServlet</Item>
+ </Array>
+
+ <Set name="serverClasses"><Ref id="serverClasses"/></Set>
+ <Set name="systemClasses"><Ref id="systemClasses"/></Set>
+</Configure>

Back to the top