[java-idp-integration-tests] 02/02: Tomcat updates

Tom Zeller tzeller at dragonacea.biz
Sat Jan 7 18:43:31 UTC 2023


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

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

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

commit 07ee74b1fbd6496076fc40bfe0e219d0be0b2d31
Author: Tom Zeller <tzeller at dragonacea.biz>
AuthorDate: Sat Jan 7 12:43:22 2023 -0600

    Tomcat updates
---
 pom.xml                                            | 29 +++++++++++++++++++---
 .../idp/integration/tests/BaseIntegrationTest.java | 26 +++++++++++++------
 2 files changed, 43 insertions(+), 12 deletions(-)

diff --git a/pom.xml b/pom.xml
index 0a2e83a..8c28a75 100644
--- a/pom.xml
+++ b/pom.xml
@@ -31,7 +31,7 @@
 
         <!-- Tomcat -->
         <idp-tomcat-base.version>9.0.0-SNAPSHOT</idp-tomcat-base.version>
-        <tomcat.version>9.0.58</tomcat.version>
+        <tomcat.version>9.0.70</tomcat.version>
 
         <!-- Testbed -->
         <testbed.version>5.0.0-SNAPSHOT</testbed.version>
@@ -375,7 +375,7 @@
                             </execution>
                             <!-- Copy credentials to jetty-base. -->
                             <execution>
-                                <id>copy-idp-userfacing.p12</id>
+                                <id>copy-credentials-to-jetty-base</id>
                                 <phase>compile</phase>
                                 <goals>
                                     <goal>unpack</goal>
@@ -484,7 +484,7 @@
                                             <type>tar.gz</type>
                                         </artifactItem>
                                     </artifactItems>
-                                    <outputDirectory>${idp-to-be-tested.directory}</outputDirectory>
+                                    <outputDirectory>${test-distributions.directory}</outputDirectory>
                                 </configuration>
                             </execution>
                             <!-- Copy testbed context descriptor from testbed jar to Tomcat. -->
@@ -505,7 +505,28 @@
                                             <includes>conf/Catalina/localhost/ROOT.xml</includes>
                                         </artifactItem>
                                     </artifactItems>
-                                    <outputDirectory>${idp-to-be-tested.directory}/tomcat-base/</outputDirectory>
+                                    <outputDirectory>${test-distributions.directory}/tomcat-base/</outputDirectory>
+                                </configuration>
+                            </execution>
+                            <!-- Copy credentials to tomcat-base. -->
+                            <execution>
+                                <id>copy-credentials-to-tomcat-base</id>
+                                <phase>compile</phase>
+                                <goals>
+                                    <goal>unpack</goal>
+                                </goals>
+                                <configuration>
+                                    <artifactItems>
+                                        <artifactItem>
+                                            <groupId>net.shibboleth.idp</groupId>
+                                            <artifactId>idp-conf</artifactId>
+                                            <version>${idp-to-be-tested.version}</version>
+                                            <type>jar</type>
+                                            <classifier>tests</classifier>
+                                            <includes>credentials/idp-userfacing.p12,credentials/idp-backchannel.p12</includes>
+                                        </artifactItem>
+                                    </artifactItems>
+                                    <outputDirectory>${test-distributions.directory}/tomcat-base/</outputDirectory>
                                 </configuration>
                             </execution>
                         </executions>
diff --git a/src/test/java/net/shibboleth/idp/integration/tests/BaseIntegrationTest.java b/src/test/java/net/shibboleth/idp/integration/tests/BaseIntegrationTest.java
index c4c8e6a..c68a0e9 100644
--- a/src/test/java/net/shibboleth/idp/integration/tests/BaseIntegrationTest.java
+++ b/src/test/java/net/shibboleth/idp/integration/tests/BaseIntegrationTest.java
@@ -379,6 +379,9 @@ public abstract class BaseIntegrationTest {
     /** Jetty version determined from distribution name. **/
     @Nullable protected String jettyVersion;
 
+    /** Tomcat version determined from distribution name. **/
+    @Nullable protected String tomcatVersion;
+
     /** Path to build.sh or build.bat. */
     @NonnullAfterInit protected Path pathToBuildCLI;
     
@@ -548,12 +551,24 @@ public abstract class BaseIntegrationTest {
             log.debug("Path to tomcat.home '{}'", pathToTomcatHome.toAbsolutePath());
             Assert.assertTrue(pathToTomcatHome.toAbsolutePath().toFile().exists(), "Path to tomcat.home not found");
 
-            // Copy tomcat-base
-            copyFromIdPDistToIdPHome("tomcat-base");
+            // Determine Tomcat version from distribution name
+            final Pattern pattern = Pattern.compile("apache-tomcat-(.*)");
+            final Matcher matcher = pattern.matcher(pathToTomcatHome.getFileName().toString());
+            if (matcher.find()) {
+                tomcatVersion = matcher.group(1);
+            }
+            log.debug("Testing Tomcat version '{}'", tomcatVersion);
+            if (tomcatVersion == null || tomcatVersion.isBlank()) {
+                log.error("Unable to determine version of Tomcat");
+            }
 
             // Path to tomcat.base
-            pathToTomcatBase = pathToIdPHome.resolve(Paths.get("tomcat-base"));
+            pathToTomcatBase = pathToIdPHome.getParent().resolve(Paths.get("tomcat-base"));
             log.debug("Path to tomcat.base '{}'", pathToTomcatBase.toAbsolutePath());
+            
+            // Copy tomcat-base
+            final Path pathToTomcatBaseDist = buildPath.resolve("tomcat-base");
+            FileSystemUtils.copyRecursively(pathToTomcatBaseDist, pathToTomcatBase);
             Assert.assertNotNull(pathToTomcatBase, "Path to tomcat.base not found");
             Assert.assertTrue(pathToTomcatBase.toAbsolutePath().toFile().exists(), "Path to tomcat.base not found");
 
@@ -569,11 +584,6 @@ public abstract class BaseIntegrationTest {
             final String newTextSetenvSh = "-Didp.home=" + Matcher.quoteReplacement(pathToIdPHome.toAbsolutePath().toString());
             replaceFile(pathToSetenvSh, oldTextSetenvSh, newTextSetenvSh);
             replaceFile(pathToSetenvBat, oldTextSetenvSh, newTextSetenvSh);
-
-            // Modify context descriptor with per-test idp.home directory
-            final Path pathToIdpXML = pathToTomcatBase.resolve(Paths.get("conf", "Catalina", "localhost", "idp.xml"));
-            Assert.assertTrue(pathToIdpXML.toAbsolutePath().toFile().exists(), "Path to idp.xml not found");
-            replaceFile(pathToIdpXML, "/war/idp.war\"", "/webapp/\"");
         }
     }
 

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


More information about the commits mailing list