| author | Violeta Georgieva | 2010-11-26 08:57:16 (EST) |
|---|---|---|
| committer | Glyn Normington | 2010-11-26 08:57:16 (EST) |
| commit | 00a04f39aedc9d93832e38796af2922ba810f300 (patch) (side-by-side diff) | |
| tree | 36b04100eb6f064b006eefb3b494277f1123089a | |
| parent | b17713189998e42388b71de77b1a98b6c3ce09d1 (diff) | |
| download | org.eclipse.gemini.web.gemini-web-container-00a04f39aedc9d93832e38796af2922ba810f300.zip org.eclipse.gemini.web.gemini-web-container-00a04f39aedc9d93832e38796af2922ba810f300.tar.gz org.eclipse.gemini.web.gemini-web-container-00a04f39aedc9d93832e38796af2922ba810f300.tar.bz2 | |
bug 329979: integration test for supplying web.xml in a fragment
12 files changed, 122 insertions, 0 deletions
diff --git a/build-web-container/build.xml b/build-web-container/build.xml index 6974a2c..06b856b 100644 --- a/build-web-container/build.xml +++ b/build-web-container/build.xml @@ -29,6 +29,8 @@ <pathelement location="../test-bundles/war-with-jsp"/> <pathelement location="../test-bundles/war-with-servlet"/> <pathelement location="../test-bundles/war-with-tld"/> + <pathelement location="../test-bundles/fragment-provides-web-xml"/> + <pathelement location="../test-bundles/war-with-web-xml-from-fragment"/> </path> <target name="test" depends="build-test-apps, quality-multi-bundle.test" description="Rebuild all the test apps before running the test suites"> diff --git a/org.eclipse.gemini.web.test/src/test/java/org/eclipse/gemini/web/test/tomcat/TomcatServletContainerTests.java b/org.eclipse.gemini.web.test/src/test/java/org/eclipse/gemini/web/test/tomcat/TomcatServletContainerTests.java index 0c2587a..0c677c1 100644 --- a/org.eclipse.gemini.web.test/src/test/java/org/eclipse/gemini/web/test/tomcat/TomcatServletContainerTests.java +++ b/org.eclipse.gemini.web.test/src/test/java/org/eclipse/gemini/web/test/tomcat/TomcatServletContainerTests.java @@ -86,6 +86,10 @@ public class TomcatServletContainerTests { private static final String LOCATION_WAR_WITH_CONTEXT_XML_CROSS_CONTEXT = LOCATION_PREFIX + "../org.eclipse.gemini.web.test/src/test/resources/war-with-context-xml-cross-context.war?Web-ContextPath=/war-with-context-xml-cross-context"; + private static final String LOCATION_WAR_WITH_WEB_XML_FROM_FRAGMENT = "file:../org.eclipse.gemini.web.test/target/resources/war-with-web-xml-from-fragment.war"; + + private static final String LOCATION_FRAGMENT_PROVIDES_WEB_XML = "file:../org.eclipse.gemini.web.test/target/resources/fragment-provides-web-xml.jar"; + private BundleContext bundleContext; private ServletContainer container; @@ -444,6 +448,24 @@ public class TomcatServletContainerTests { } } + @Test + public void testWarWithWebXmlFromFragment() throws Exception { + Bundle bundle = this.bundleContext.installBundle(LOCATION_WAR_WITH_WEB_XML_FROM_FRAGMENT); + Bundle fragment = this.bundleContext.installBundle(LOCATION_FRAGMENT_PROVIDES_WEB_XML); + + bundle.start(); + + WebApplicationHandle handle = this.container.createWebApplication("/war-with-web-xml-from-fragment", bundle); + this.container.startWebApplication(handle); + try { + validateURL("http://localhost:8080/war-with-web-xml-from-fragment"); + } finally { + this.container.stopWebApplication(handle); + bundle.uninstall(); + fragment.uninstall(); + } + } + private void createFileWithContent(File file, String content) throws Exception { file.getParentFile().mkdirs(); FileWriter fWriter = null; diff --git a/test-bundles/fragment-provides-web-xml/build.xml b/test-bundles/fragment-provides-web-xml/build.xml new file mode 100755 index 0000000..ff11bb5 --- a/dev/null +++ b/test-bundles/fragment-provides-web-xml/build.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project name="fragment-provides-web-xml"> + + <property file="${basedir}/../build.properties"/> + <property file="${basedir}/../../build.versions"/> + <property name="jar.output.dir" value="${basedir}/../../org.eclipse.gemini.web.test/target/resources"/> + <import file="${basedir}/../../virgo-build/standard/default.xml"/> + +</project> diff --git a/test-bundles/fragment-provides-web-xml/ivy.xml b/test-bundles/fragment-provides-web-xml/ivy.xml new file mode 100755 index 0000000..d377163 --- a/dev/null +++ b/test-bundles/fragment-provides-web-xml/ivy.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="http://ivyrep.jayasoft.org/ivy-doc.xsl"?> +<ivy-module + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="http://incubator.apache.org/ivy/schemas/ivy.xsd" + version="1.3"> + + <info organisation="org.eclipse.gemini.web" module="${ant.project.name}"/> + + <configurations> + <include file="${virgo.build.dir}/common/default-ivy-configurations.xml"/> + </configurations> + + <publications> + <artifact name="${ant.project.name}"/> + <artifact name="${ant.project.name}-sources" type="src" ext="jar"/> + </publications> + + <dependencies> + </dependencies> + +</ivy-module> diff --git a/test-bundles/fragment-provides-web-xml/src/main/java/.gitignore b/test-bundles/fragment-provides-web-xml/src/main/java/.gitignore new file mode 100755 index 0000000..e69de29 --- a/dev/null +++ b/test-bundles/fragment-provides-web-xml/src/main/java/.gitignore diff --git a/test-bundles/fragment-provides-web-xml/src/main/resources/META-INF/MANIFEST.MF b/test-bundles/fragment-provides-web-xml/src/main/resources/META-INF/MANIFEST.MF new file mode 100755 index 0000000..836ff38 --- a/dev/null +++ b/test-bundles/fragment-provides-web-xml/src/main/resources/META-INF/MANIFEST.MF @@ -0,0 +1,8 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: fragment-provides-web-xml +Fragment-Host: war-with-web-xml-from-fragment;bundle-version=1.0.0 +Bundle-Version: 1.0.0 +Bundle-Description: Fragment that provides web.xml + + diff --git a/test-bundles/fragment-provides-web-xml/src/main/resources/WEB-INF/web.xml b/test-bundles/fragment-provides-web-xml/src/main/resources/WEB-INF/web.xml new file mode 100755 index 0000000..17fffb2 --- a/dev/null +++ b/test-bundles/fragment-provides-web-xml/src/main/resources/WEB-INF/web.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> + <welcome-file-list> + <welcome-file>welcome.jsp</welcome-file> + </welcome-file-list> +</web-app> diff --git a/test-bundles/war-with-web-xml-from-fragment/build.xml b/test-bundles/war-with-web-xml-from-fragment/build.xml new file mode 100755 index 0000000..3112703 --- a/dev/null +++ b/test-bundles/war-with-web-xml-from-fragment/build.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project name="war-with-web-xml-from-fragment"> + + <property file="${basedir}/../build.properties"/> + <property file="${basedir}/../../build.versions"/> + <property name="war.output.dir" value="${basedir}/../../org.eclipse.gemini.web.test/target/resources"/> + <import file="${basedir}/../../virgo-build/war/default.xml"/> + +</project> diff --git a/test-bundles/war-with-web-xml-from-fragment/ivy.xml b/test-bundles/war-with-web-xml-from-fragment/ivy.xml new file mode 100755 index 0000000..6b5a9c8 --- a/dev/null +++ b/test-bundles/war-with-web-xml-from-fragment/ivy.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="http://ivyrep.jayasoft.org/ivy-doc.xsl"?> +<ivy-module + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="http://incubator.apache.org/ivy/schemas/ivy.xsd" + version="1.3"> + + <info organisation="org.eclipse.gemini.web" module="${ant.project.name}"/> + + <configurations> + <include file="${virgo.build.dir}/common/default-ivy-configurations.xml"/> + </configurations> + + <publications> + <artifact name="${ant.project.name}" type="war" ext="war"/> + <artifact name="${ant.project.name}-sources" type="src" ext="jar"/> + </publications> + + <dependencies> + </dependencies> + +</ivy-module> diff --git a/test-bundles/war-with-web-xml-from-fragment/src/main/java/.gitignore b/test-bundles/war-with-web-xml-from-fragment/src/main/java/.gitignore new file mode 100755 index 0000000..e69de29 --- a/dev/null +++ b/test-bundles/war-with-web-xml-from-fragment/src/main/java/.gitignore diff --git a/test-bundles/war-with-web-xml-from-fragment/src/main/webapp/META-INF/MANIFEST.MF b/test-bundles/war-with-web-xml-from-fragment/src/main/webapp/META-INF/MANIFEST.MF new file mode 100755 index 0000000..bb9ea79 --- a/dev/null +++ b/test-bundles/war-with-web-xml-from-fragment/src/main/webapp/META-INF/MANIFEST.MF @@ -0,0 +1,14 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: war-with-web-xml-from-fragment +Bundle-Version: 1.0.0 +Web-ContextPath: /war-with-web-xml-from-fragment +Import-Packages: javax.servlet, + javax.servlet.http, + javax.servlet.jsp, + javax.servlet.jsp.el, + javax.servlet.jsp.tagext, + javax.el +Bundle-Description: Web application without web.xml + + diff --git a/test-bundles/war-with-web-xml-from-fragment/src/main/webapp/welcome.jsp b/test-bundles/war-with-web-xml-from-fragment/src/main/webapp/welcome.jsp new file mode 100755 index 0000000..e51ff7a --- a/dev/null +++ b/test-bundles/war-with-web-xml-from-fragment/src/main/webapp/welcome.jsp @@ -0,0 +1,8 @@ +<html> + <head> + <title>web.xml provided by a fragment</title> + </head> + <body> + Hello World! + </body> +</html>
\ No newline at end of file |

