[java-idp-integration-tests] branch main updated: Wire in attempt to enable Password module against base distribution.

Scott Cantor cantor.2 at osu.edu
Fri Sep 18 16:23:02 UTC 2020


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

scantor 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=42f232865c335ac3a3f5116bae89325311b50a3b

The following commit(s) were added to refs/heads/main by this push:
       new  42f2328   Wire in attempt to enable Password module against base distribution.
42f2328 is described below

commit 42f232865c335ac3a3f5116bae89325311b50a3b
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Fri Sep 18 12:23:00 2020 -0400

    Wire in attempt to enable Password module against base distribution.
---
 .../shibboleth/idp/test/BaseIntegrationTest.java   | 29 ++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java b/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java
index 774593c..f3220f2 100644
--- a/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java
+++ b/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java
@@ -31,9 +31,12 @@ import java.nio.file.StandardCopyOption;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Properties;
+import java.util.ServiceLoader;
 import java.util.SortedSet;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -42,7 +45,11 @@ import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
 import net.shibboleth.idp.installer.PropertiesWithComments;
+import net.shibboleth.idp.module.IdPModule;
+import net.shibboleth.idp.module.ModuleContext;
+import net.shibboleth.idp.module.ModuleException;
 import net.shibboleth.utilities.java.support.annotation.constraint.NonnullAfterInit;
+import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
 import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
 import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
 import net.shibboleth.utilities.java.support.logic.Constraint;
@@ -391,6 +398,8 @@ public abstract class BaseIntegrationTest
             log.error("Unable to determine version of IdP");
         }
 
+        enableModules(Collections.singletonList("idp.authn.Password"), pathToDistIdPHome);
+        
         // Path to per-test idp.home
         final String timestamp = DateTimeFormatter.ofPattern(idpHomePattern).format(LocalDateTime.now());
         pathToIdPHome = pathToDistIdPHome.getParent().resolve(timestamp);
@@ -426,6 +435,26 @@ public abstract class BaseIntegrationTest
         }
         log.debug("Path to message properties '{}'", messagesPropertiesResource);
     }
+    
+    /**
+     * Enable one or more modules.
+     * 
+     * @param modules modules to enable
+     * @param idpHome location of IdP
+     * 
+     * @throws ModuleException if an error occurs
+     */
+    protected void enableModules(@Nonnull @NonnullElements final Collection<String> modules,
+            @Nonnull final Path idpHome) throws ModuleException {
+        
+        final ModuleContext context = new ModuleContext(idpHome);
+        
+        for (final IdPModule module : ServiceLoader.load(IdPModule.class)) {
+            if (modules.contains(module.getId())) {
+                module.enable(context);
+            }
+        }
+    }
 
     /**
      * Set up paths to Tomcat if they exist.

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


More information about the commits mailing list