[java-idp-integration-tests] 01/02: IDP-1006 - Add test StorageServlet in a container-independent way

Tom Zeller tzeller at dragonacea.biz
Tue Jul 12 15:32:49 EDT 2016


This is an automated email from the git hooks/post-receive script.

tzeller pushed a commit to branch master
in repository java-idp-integration-tests.

View the commit online:
http://git.shibboleth.net/view/?p=java-idp-integration-tests.git;a=commit;h=11df5ccbf1b027ca3389ca27f1fb4021d625fb0d

commit 11df5ccbf1b027ca3389ca27f1fb4021d625fb0d
Author: Tom Zeller <tzeller at dragonacea.biz>
AuthorDate: Mon Jul 11 15:36:14 2016 -0500

    IDP-1006 - Add test StorageServlet in a container-independent way
    
    Because Tomcat does not appear to have a way to override web.xml like
    Jetty does, modify WEB-INF/web.xml directly.
---
 pom.xml                                            | 21 -------------
 .../shibboleth/idp/test/BaseIntegrationTest.java   | 36 ++++++++++++++++------
 2 files changed, 27 insertions(+), 30 deletions(-)

diff --git a/pom.xml b/pom.xml
index 08546b9..6386b0e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -398,27 +398,6 @@
                             <outputDirectory>${test-distributions.directory}/shibboleth-identity-provider-${idp.version}/webapp/WEB-INF/lib/</outputDirectory>
                         </configuration>
                     </execution>
-                    <!-- Copy web-override.xml from testbed jar. -->
-                    <execution>
-                        <id>copy-testbed-web-override</id>
-                        <phase>compile</phase>
-                        <goals>
-                            <goal>unpack</goal>
-                        </goals>
-                        <configuration>
-                            <artifactItems>
-                                <artifactItem>
-                                   <groupId>net.shibboleth.idp</groupId>
-                                    <artifactId>idp-testbed</artifactId>
-                                    <version>${testbed.version}</version>
-                                    <type>jar</type>
-                                    <classifier>${testbed.classifier}</classifier>
-                                    <includes>conf/web-override.xml</includes>
-                                </artifactItem>
-                            </artifactItems>
-                            <outputDirectory>${test-distributions.directory}/shibboleth-identity-provider-${idp.version}</outputDirectory>
-                        </configuration>
-                    </execution>
                     <!-- Copy testbed deployment descriptor from testbed jar. -->
                     <execution>
                         <id>copy-testbed-deployment-descriptor</id>
diff --git a/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java b/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java
index 5d2713c..769ce5a 100644
--- a/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java
+++ b/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java
@@ -548,19 +548,37 @@ public abstract class BaseIntegrationTest
     }
 
     /**
-     * Set path to web.xml override descriptor for the IdP to ../conf/web-override.xml.
+     * Add StorageServlet to IdP webapp.
      * 
      * @throws Exception
      */
     @BeforeClass(enabled = true, dependsOnMethods = {"setUpPaths"})
-    public void setUpOverrideDescriptor() throws Exception {
-
-        final Path pathToIdPXML = pathToJettyBase.resolve(Paths.get("webapps", "idp.xml"));
-        Assert.assertTrue(pathToIdPXML.toAbsolutePath().toFile().exists(), "Path to idp.xml not found");
-
-        final String oldText = "</Configure>";
-        final String newText = "<Set name=\"overrideDescriptor\">../conf/web-override.xml</Set></Configure>";
-        replaceFile(pathToIdPXML, oldText, newText);
+    public void setUpStorageServlet() throws Exception {
+
+        final Path pathToIdPWebXML = pathToIdPHome.resolve(Paths.get("webapp", "WEB-INF", "web.xml"));
+        Assert.assertTrue(pathToIdPWebXML.toAbsolutePath().toFile().exists(), "Path to IdP web.xml not found");
+
+        final String oldText = "</web-app>";
+
+        final StringBuilder builder = new StringBuilder();
+        builder.append("\n");
+        builder.append("<!-- The /storage app space. Interact with storage services via HTTP. -->\n");
+        builder.append("<servlet>\n");
+        builder.append("    <servlet-name>storage</servlet-name>\n");
+        builder.append("    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>\n");
+        builder.append("    <init-param>\n");
+        builder.append("        <param-name>contextConfigLocation</param-name>\n");
+        builder.append("        <param-value>classpath:/system/conf/storage-context.xml</param-value>\n");
+        builder.append("     </init-param>\n");
+        builder.append("     <load-on-startup>1</load-on-startup>\n");
+        builder.append("</servlet>\n");
+        builder.append("<servlet-mapping>\n");
+        builder.append("    <servlet-name>storage</servlet-name>\n");
+        builder.append("    <url-pattern>/storage/*</url-pattern>\n");
+        builder.append("</servlet-mapping>\n");
+        builder.append("</web-app>\n");
+
+        replaceFile(pathToIdPWebXML, oldText, builder.toString());
     }
 
     /**

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list