[java-idp-integration-tests] branch main updated: Update installation for IdP V5

Tom Zeller tzeller at dragonacea.biz
Thu Jun 29 21:35:06 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=4775533bf544a1935a212bd32a288f64ba54d481

The following commit(s) were added to refs/heads/main by this push:
     new 4775533  Update installation for IdP V5
4775533 is described below

commit 4775533bf544a1935a212bd32a288f64ba54d481
Author: Tom Zeller <tzeller at dragonacea.biz>
AuthorDate: Thu Jun 29 16:34:55 2023 -0500

    Update installation for IdP V5
---
 .../idp/integration/tests/BaseIntegrationTest.java | 96 ++++++++++++++++------
 1 file changed, 71 insertions(+), 25 deletions(-)

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 14e1e25..a29b4df 100644
--- a/src/test/java/net/shibboleth/idp/integration/tests/BaseIntegrationTest.java
+++ b/src/test/java/net/shibboleth/idp/integration/tests/BaseIntegrationTest.java
@@ -87,7 +87,6 @@ import org.opensaml.core.xml.config.XMLObjectProviderRegistrySupport;
 import org.opensaml.core.xml.io.UnmarshallerFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.core.io.ClassPathResource;
 import org.springframework.core.io.FileSystemResource;
 import org.springframework.core.io.Resource;
 import org.springframework.util.FileSystemUtils;
@@ -456,30 +455,7 @@ public abstract class BaseIntegrationTest {
         Assert.assertTrue(idpHome.exists(), "Path to idp.home not found");
 
         // Run installer from idp distribution directory
-        final ProcessBuilder installerBuilder = new ProcessBuilder();
-        installerBuilder.directory(pathToIdPDist.toFile());
-        installerBuilder.redirectErrorStream();
-        final List<String> installerCommands = new ArrayList<String>();
-        if (isWindows()) {
-            final Path pathToInstallBat = pathToIdPDist.resolve(Paths.get("bin", "install.bat"));
-            Assert.assertTrue(pathToInstallBat.toFile().exists());
-            installerCommands.add(pathToInstallBat.toAbsolutePath().toString());
-        } else {
-            installerCommands.add("bin/install.sh");
-            
-        }
-        // installerCommands.add("-h");
-        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");
-        installerBuilder.command(installerCommands);
-        // Run installer
-        final Process installerProcess = installerBuilder.start();
-        logProcess(installerProcess, "install :");
+        installIdP();
 
         pathToBuildCLI = pathToIdPHome.resolve(Paths.get("bin", isWindows() ? "build.bat" : "build.sh"));
         Assert.assertTrue(pathToBuildCLI.toFile().exists());
@@ -2596,4 +2572,74 @@ public abstract class BaseIntegrationTest {
         log.debug("Path to messages.properties '{}'", messagesPropertiesResource);
     }
 
+    /**
+     * Install the IdP using the command line installer.
+     * 
+     * @throws IOException
+     *             if an error occurs
+     */
+    public void installIdP() 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>();
+        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());
+        }
+
+        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("idp");
+            // 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");
+        }
+
+        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 String commandToInstallIdP = "(\nset -x\n" + pathToIdPDist.toAbsolutePath() + "/"
+                    + String.join(" \\\n", installerCommands) + "\n)";
+            Files.write(fileToInstallIdP.toPath(), commandToInstallIdP.getBytes());
+            fileToInstallIdP.setExecutable(true);
+        }
+
+        // Run installer
+        final Process installerProcess = installerBuilder.start();
+        logProcess(installerProcess, "install :");
+    }
+
 }

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


More information about the commits mailing list