[java-idp-integration-tests] 01/02: Initial work to test the new SP

Codeberg noreply at shibboleth.net
Mon Jun 8 22:38:02 UTC 2026


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

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

View the commit online:
https://codeberg.org/Shibboleth/java-idp-integration-tests/commit/a27b603269d3da5859b67ca47018c7093edbc8c4

commit a27b603269d3da5859b67ca47018c7093edbc8c4
Author: Tom Zeller <tzeller at dragonacea.biz>
AuthorDate: Mon Jun 8 17:08:36 2026 -0500

    Initial work to test the new SP
    
    Test that the latest shibd plugin snapshot can be installed.
    
    Work on more generic installation method in order to test the IdP and SP
    Hub side-by-side.
---
 .../shibboleth/idp/integration/tests/BaseTest.java | 97 ++++++++++++----------
 .../idp/integration/tests/oidc/RPTest.java         | 59 ++-----------
 .../idp/integration/tests/sp/SPHubTest.java        | 76 +++++++++++++++++
 .../integration/tests/util/InstallerOptions.java   | 56 +++++++++++++
 .../tests/util/PluginSnapshotSupport.java          | 41 ++++++++-
 5 files changed, 229 insertions(+), 100 deletions(-)

diff --git a/src/test/java/net/shibboleth/idp/integration/tests/BaseTest.java b/src/test/java/net/shibboleth/idp/integration/tests/BaseTest.java
index b8c82a4..2197126 100644
--- a/src/test/java/net/shibboleth/idp/integration/tests/BaseTest.java
+++ b/src/test/java/net/shibboleth/idp/integration/tests/BaseTest.java
@@ -116,6 +116,7 @@ import org.testng.annotations.BeforeSuite;
 import org.testng.annotations.Listeners;
 
 import net.shibboleth.idp.installer.PropertiesWithComments;
+import net.shibboleth.idp.integration.tests.util.InstallerOptions;
 import net.shibboleth.idp.integration.tests.util.PluginSnapshotSupport;
 import net.shibboleth.idp.integration.tests.util.Route53Helper;
 import net.shibboleth.idp.integration.tests.util.server.AbstractServer;
@@ -491,7 +492,7 @@ public abstract class BaseTest {
         Assert.assertTrue(idpHome.exists(), "Path to idp.home not found");
 
         // Run installer from idp distribution directory
-        installIdP();
+        installIdP(InstallerOptions.getDefault());
 
         pathToBin = pathToIdPHome.resolve("bin");
         Assert.assertTrue(pathToBin.toFile().exists());
@@ -2656,12 +2657,15 @@ public abstract class BaseTest {
      * @throws IOException
      *             if an error occurs
      */
-    public void installIdP() throws IOException {
+    public void installIdP(@Nonnull final InstallerOptions options) throws IOException {
+
         // Run installer from idp distribution directory
         final ProcessBuilder installerBuilder = new ProcessBuilder();
         installerBuilder.directory(pathToIdPDist.toFile());
         installerBuilder.redirectErrorStream(true);
+
         final List<String> installerCommands = new ArrayList<String>();
+
         if (isWindows()) {
             final Path pathToInstallBat = pathToIdPDist.resolve(Paths.get("bin", "install.bat"));
             Assert.assertTrue(pathToInstallBat.toFile().exists());
@@ -2672,51 +2676,42 @@ public abstract class BaseTest {
             installerCommands.add(pathToInstallSh.toAbsolutePath().toString());
         }
 
-        if (idpVersion.startsWith("4")) {
-            installerCommands.add("-Didp.src.dir=" + pathToIdPDist.toAbsolutePath());
-            installerCommands.add("-Didp.target.dir=" + pathToIdPHome.toAbsolutePath());
-            installerCommands.add("-Didp.host.name=idp");
-            installerCommands.add("-Didp.scope=example.org");
-            installerCommands.add("-Didp.entityID=https://idp.example.org");
-            installerCommands.add("-Didp.keystore.password=password");
-            installerCommands.add("-Didp.sealer.password=password");
-        } else {
-            // targetDir
-            installerCommands.add("--targetDir");
-            installerCommands.add(pathToIdPHome.toAbsolutePath().toString());
-            // hostName
-            installerCommands.add("--hostName");
-            installerCommands.add(hostname);
-            // scope
-            installerCommands.add("--scope");
-            installerCommands.add("example.org");
-            // entityID
-            installerCommands.add("--entityID");
-            installerCommands.add("https://idp.example.org");
-            // keystorePassword
-            installerCommands.add("--keystorePassword");
-            installerCommands.add("password");
-            // sealerPassword
-            installerCommands.add("--sealerPassword");
-            installerCommands.add("password");
-            // noPrompt
-            installerCommands.add("--noPrompt");
-        }
+        // targetDir
+        installerCommands.add("--targetDir");
+        // installerCommands.add(pathToIdPHome.toAbsolutePath().toString());
+        installerCommands.add(pathToPerTestDirectory.resolve(options.targetDir).toAbsolutePath().toString());
+        // hostName
+        installerCommands.add("--hostName");
+        installerCommands.add(options.hostName);
+        // scope
+        installerCommands.add("--scope");
+        installerCommands.add(options.scope);
+        // entityID
+        installerCommands.add("--entityID");
+        installerCommands.add(options.entityID);
+        // keystorePassword
+        installerCommands.add("--keystorePassword");
+        installerCommands.add(options.keystorePassword);
+        // sealerPassword
+        installerCommands.add("--sealerPassword");
+        installerCommands.add(options.sealerPassword);
+        // noPrompt
+        installerCommands.add("--noPrompt");
 
         installerBuilder.command(installerCommands);
 
         // Write command used to install the IdP to a file for troubleshooting on Linux
         if (!isWindows()) {
-            final File fileToInstallIdP = pathToPerTestDirectory.resolve("install-idp.sh").toFile();
-            log.debug("Writing command to install the IdP to '{}'", fileToInstallIdP);
+            final File fileToInstall = pathToPerTestDirectory.resolve("install-" + options.name + ".sh").toFile();
+            log.debug("Writing command to install " + options.name + " to '{}'", fileToInstall);
             final String commandToInstallIdP = "(\nset -x\n" + String.join(" \\\n", installerCommands) + "\n)";
-            Files.write(fileToInstallIdP.toPath(), commandToInstallIdP.getBytes());
-            fileToInstallIdP.setExecutable(true);
+            Files.write(fileToInstall.toPath(), commandToInstallIdP.getBytes());
+            fileToInstall.setExecutable(true);
         }
 
         // Run installer
         final Process installerProcess = installerBuilder.start();
-        logProcess(installerProcess, "install :");
+        logProcess(installerProcess, "Install " + options.name + " :");
     }
 
     /**
@@ -3326,11 +3321,25 @@ public abstract class BaseTest {
      */
     public void installPluginSnapshot(@Nonnull final String pluginId, //
             @Nonnull final String pluginSnapshotVersion, @Nonnull final String pluginArtifactId) {
+
+        final PluginSnapshotSupport snapshotSupport = new PluginSnapshotSupport() //
+                .setPluginId(pluginId) //
+                .setPluginVersion(pluginSnapshotVersion) //
+                .setPluginArtifactId(pluginArtifactId);
+
+        installPluginSnapshot(snapshotSupport);
+    }
+
+    /**
+     * Install plugin snapshot.
+     * 
+     * Downloads the Maven distribution artifact for the plugin.
+     * 
+     * @param snapshotSupport
+     */
+    public void installPluginSnapshot(@Nonnull final PluginSnapshotSupport snapshotSupport) {
         try {
-            final PluginSnapshotSupport snapshotSupport = new PluginSnapshotSupport() //
-                    .setPluginId(pluginId)
-                    .setPluginVersion(pluginSnapshotVersion)
-                    .setPluginArtifactId(pluginArtifactId);
+            final String pluginId = snapshotSupport.getPluginId();
 
             final URL baseURL = snapshotSupport.getBaseURL();
 
@@ -3344,11 +3353,7 @@ public abstract class BaseTest {
 
             assertPluginsAreInstalled(pluginId);
 
-        } catch (final URISyntaxException e) {
-            throw new RuntimeException(e);
-        } catch (MalformedURLException e) {
-            throw new RuntimeException(e);
-        } catch (IOException e) {
+        } catch (final IOException | URISyntaxException e) {
             throw new RuntimeException(e);
         }
     }
diff --git a/src/test/java/net/shibboleth/idp/integration/tests/oidc/RPTest.java b/src/test/java/net/shibboleth/idp/integration/tests/oidc/RPTest.java
index df2062c..cc76a28 100644
--- a/src/test/java/net/shibboleth/idp/integration/tests/oidc/RPTest.java
+++ b/src/test/java/net/shibboleth/idp/integration/tests/oidc/RPTest.java
@@ -2,7 +2,6 @@
 package net.shibboleth.idp.integration.tests.oidc;
 
 import java.io.ByteArrayInputStream;
-import java.io.File;
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.lang.ProcessBuilder.Redirect;
@@ -51,6 +50,7 @@ import org.w3c.dom.Element;
 
 import net.shibboleth.idp.integration.tests.BaseTest;
 import net.shibboleth.idp.integration.tests.StatusTest;
+import net.shibboleth.idp.integration.tests.util.InstallerOptions;
 import net.shibboleth.idp.integration.tests.util.server.AbstractServer;
 import net.shibboleth.idp.integration.tests.util.server.JettyServer;
 import net.shibboleth.idp.integration.tests.util.server.TomcatServer;
@@ -201,58 +201,17 @@ public class RPTest extends BaseOPTest {
      */
     protected void installOP() throws IOException {
 
-        // Run installer from idp distribution directory
-        final ProcessBuilder installerBuilder = new ProcessBuilder();
-        installerBuilder.directory(pathToIdPDist.toFile());
-        installerBuilder.redirectErrorStream();
-        final List<String> installerCommands = new ArrayList<String>();
+        final InstallerOptions options = InstallerOptions.getDefault();
 
-        if (isWindows()) {
-            final Path pathToInstallBat = pathToIdPDist.resolve(Paths.get("bin", "install.bat"));
-            Assert.assertTrue(pathToInstallBat.toFile().exists());
-            installerCommands.add(pathToInstallBat.toAbsolutePath().toString());
-        } else {
-            final Path pathToInstallSh = pathToIdPDist.resolve(Paths.get("bin", "install.sh"));
-            Assert.assertTrue(pathToInstallSh.toFile().exists());
-            installerCommands.add(pathToInstallSh.toAbsolutePath().toString());
-        }
+        options.hostName = opHostname;
 
-        // targetDir
-        installerCommands.add("--targetDir");
-        installerCommands.add(pathToIdPHome.toAbsolutePath().toString());
-        // hostName
-        installerCommands.add("--hostName");
-        installerCommands.add(opHostname);
-        // scope
-        installerCommands.add("--scope");
-        installerCommands.add("example.org");
-        // entityID
-        installerCommands.add("--entityID");
-        installerCommands.add("https://op.example.org");
-        // keystorePassword
-        installerCommands.add("--keystorePassword");
-        installerCommands.add("password");
-        // sealerPassword
-        installerCommands.add("--sealerPassword");
-        installerCommands.add("password");
-        // noPrompt
-        installerCommands.add("--noPrompt");
-
-        installerBuilder.command(installerCommands);
-
-        // Write command used to install the IdP to a file for troubleshooting on Linux
-        if (!isWindows()) {
-            final File fileToInstallIdP = pathToPerTestDirectory.resolve("install-op.sh").toFile();
-            log.debug("Writing command to install the OP to '{}'", fileToInstallIdP);
-            final String commandToInstallIdP = "(\nset -x\n" + pathToIdPDist.toAbsolutePath() + "/"
-                    + String.join(" \\\n", installerCommands) + "\n)";
-            Files.write(fileToInstallIdP.toPath(), commandToInstallIdP.getBytes());
-            fileToInstallIdP.setExecutable(true);
-        }
+        options.entityID = "https://op.example.org";
+
+        options.name = "op";
+
+        options.targetDir = "shibboleth-op";
 
-        // Run installer
-        final Process installerProcess = installerBuilder.start();
-        logProcess(installerProcess, "Install OP :");
+        installIdP(options);
     }
 
     /**
diff --git a/src/test/java/net/shibboleth/idp/integration/tests/sp/SPHubTest.java b/src/test/java/net/shibboleth/idp/integration/tests/sp/SPHubTest.java
new file mode 100644
index 0000000..3103f00
--- /dev/null
+++ b/src/test/java/net/shibboleth/idp/integration/tests/sp/SPHubTest.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development, 
+ * Inc. (UCAID) under one or more contributor license agreements.  See the 
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID licenses this file to You under the Apache 
+ * License, Version 2.0 (the "License"); you may not use this file except in 
+ * compliance with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.shibboleth.idp.integration.tests.sp;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import net.shibboleth.idp.integration.tests.BaseTest;
+import net.shibboleth.idp.integration.tests.StatusTest;
+import net.shibboleth.idp.integration.tests.util.PluginSnapshotSupport;
+
+/**
+ * Test the shibd plugin for the IdP.
+ */
+public class SPHubTest extends BaseTest {
+
+    /**
+     * Install the latest snapshot of the shibd plugin.
+     * 
+     * @throws Exception
+     *             if an error occurs
+     */
+    protected void installShibdPluginSnapshot() throws Exception {
+
+        final String pluginId = "net.shibboleth.plugin.shibd";
+
+        final String pluginArtifactId = "sp-dist";
+
+        final String pluginPath = "/net/shibboleth/sp";
+
+        final PluginSnapshotSupport snapshotSupport = new PluginSnapshotSupport() //
+                .setPluginId(pluginId) //
+                .setPluginArtifactId(pluginArtifactId) //
+                .setPluginPath(pluginPath);
+
+        snapshotSupport.setPluginVersion(snapshotSupport.getLatestSnapshotVersion());
+
+        installPluginSnapshot(snapshotSupport);
+
+        assertPluginsAreInstalled(pluginId);
+
+        buildWAR();
+    }
+
+    @Test
+    public void testStatus() throws Exception {
+
+        installShibdPluginSnapshot();
+
+        startServer();
+
+        assertPluginsAreOnStatusPage("net.shibboleth.plugin.shibd");
+
+        startBrowser();
+
+        driver.get(getBaseURL() + StatusTest.statusPath);
+
+        Assert.assertTrue(getPageSource().startsWith(StatusTest.STARTS_WITH));
+    }
+
+}
\ No newline at end of file
diff --git a/src/test/java/net/shibboleth/idp/integration/tests/util/InstallerOptions.java b/src/test/java/net/shibboleth/idp/integration/tests/util/InstallerOptions.java
new file mode 100644
index 0000000..d053ef2
--- /dev/null
+++ b/src/test/java/net/shibboleth/idp/integration/tests/util/InstallerOptions.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.shibboleth.idp.integration.tests.util;
+
+import javax.annotation.Nonnull;
+
+/**
+ * IdP installation options with defaults suitable for IdP tests.
+ * 
+ * @see https://shibboleth.atlassian.net/wiki/spaces/IDP5/pages/3199500577/Installation
+ */
+public class InstallerOptions {
+
+    /** Display name used in logs= */
+    @Nonnull public String name = "idp";
+
+    /** Name of directory to be installed to */
+    @Nonnull public String targetDir = "shibboleth-idp";
+
+    /** Host name */
+    @Nonnull public String hostName = "idp.tests.shibboleth.net";
+
+    /** Scope */
+    @Nonnull public String scope = "example.org";
+
+    /** EntityID */
+    @Nonnull public String entityID = "https://idp.example.org";
+
+    /** Keystore password */
+    @Nonnull public String keystorePassword = "password";
+
+    /** Data sealer password */
+    @Nonnull public String sealerPassword = "password";
+
+    @Nonnull
+    /**
+     * Get default installation options for IdP tests.
+     * 
+     * @return default installation options for IdP tests
+     */
+    public static InstallerOptions getDefault() {
+        return new InstallerOptions();
+    }
+}
diff --git a/src/test/java/net/shibboleth/idp/integration/tests/util/PluginSnapshotSupport.java b/src/test/java/net/shibboleth/idp/integration/tests/util/PluginSnapshotSupport.java
index 36e7f9e..3b798e6 100644
--- a/src/test/java/net/shibboleth/idp/integration/tests/util/PluginSnapshotSupport.java
+++ b/src/test/java/net/shibboleth/idp/integration/tests/util/PluginSnapshotSupport.java
@@ -8,10 +8,12 @@ import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
+import java.util.Objects;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -41,6 +43,10 @@ public class PluginSnapshotSupport {
     /** ArtifactId of the plugin distribution Maven artifact, for example, defaults to "java-plugin-jdbc-storage" */
     private String pluginArtifactId = "java-plugin-jdbc-storage";
 
+    @Nullable
+    /** Path to use instead of pluginId **/
+    private String pluginPath = null;
+
     /**
      * Set the plugin ID.
      * 
@@ -65,6 +71,20 @@ public class PluginSnapshotSupport {
         return this;
     }
 
+    /**
+     * Set the path of the plugin distribution Maven artifact.
+     * 
+     * If not set, the path will be the pluginId with "." replaced with "/".
+     * 
+     * @param pluginPath
+     *            path of the plugin distribution Maven artifact
+     * @return this instance
+     */
+    public PluginSnapshotSupport setPluginPath(@Nonnull final String pluginPath) {
+        this.pluginPath = pluginPath;
+        return this;
+    }
+
     /**
      * Set the version of the plugin distribution Maven artifact.
      * 
@@ -83,6 +103,8 @@ public class PluginSnapshotSupport {
      * For example :
      * "https://build.shibboleth.net/maven/snapshots/net/shibboleth/plugin/storage/jdbc/java-plugin-jdbc-storage/2.0.2-SNAPSHOT/"
      * 
+     * Use the plugin path if not null or default to the pluginId replacing "." with "/".
+     * 
      * @return the base URL of the plugin distribution Maven artifact
      * 
      * @throws MalformedURLException
@@ -91,7 +113,7 @@ public class PluginSnapshotSupport {
      *             if an error occurs
      */
     public URL getBaseURL() throws MalformedURLException, URISyntaxException {
-        final String groupPath = pluginId.replace(".", "/");
+        final String groupPath = Objects.requireNonNullElse(pluginPath, pluginId.replace(".", "/"));
         final String str = String.join("/", snapshotRepositoryBaseURL, groupPath, pluginArtifactId, pluginVersion) + "/";
         return new URI(str).toURL();
     }
@@ -99,7 +121,8 @@ public class PluginSnapshotSupport {
     /**
      * Get the filename of the latest snapshot of the plugin distribution Maven artifact.
      * 
-     * Retrieves the base URL and returns the name of the last artifact ending in .tar.gz.
+     * Retrieves the base URL and returns the name of the last artifact ending in .tar.gz for which there is a
+     * signature.
      * 
      * @return the filename of the latest snapshot of the plugin distribution Maven artifact
      * 
@@ -107,7 +130,7 @@ public class PluginSnapshotSupport {
      *             if an error occurs
      */
     public String getLatestSnapshotFilename() {
-        final Pattern pattern = Pattern.compile("<a href=\".*?\">(.*?\\.tar\\.gz)</a");
+        final Pattern pattern = Pattern.compile("<a href=\".*?\">(.*?\\.tar\\.gz)\\.asc</a");
         try {
             final URL url = getBaseURL();
             String fileName = null;
@@ -141,7 +164,7 @@ public class PluginSnapshotSupport {
      *             if an error occurs
      */
     public String getLatestSnapshotVersion() throws MalformedURLException, URISyntaxException {
-        final String groupPath = pluginId.replace(".", "/");
+        final String groupPath = Objects.requireNonNullElse(pluginPath, pluginId.replace(".", "/"));
         final String str = String.join("/", snapshotRepositoryBaseURL, groupPath, pluginArtifactId) + "/";
         final URL baseUrl = new URI(str).toURL();
 
@@ -162,4 +185,14 @@ public class PluginSnapshotSupport {
         log.debug("Latest snapshot version is '{}' for '{}'", snapshotVersion, pluginArtifactId);
         return snapshotVersion;
     }
+
+    /**
+     * Get the pluginId.
+     * 
+     * @return pluginId
+     */
+    @Nonnull
+    public String getPluginId() {
+        return pluginId;
+    }
 }

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


More information about the commits mailing list