[java-plugin-shibd-saml] branch main updated: Adjust flow tests to allow layering on SP base class for tests.
Codeberg
noreply at shibboleth.net
Fri Nov 21 01:06:23 UTC 2025
This is an automated email from the git hooks/post-receive script.
codeberg pushed a commit to branch main
in repository java-plugin-shibd-saml.
View the commit online:
https://codeberg.org/Shibboleth/java-plugin-shibd-saml/commit/0451bd70c236087f688464ab487fefb0abf98974
The following commit(s) were added to refs/heads/main by this push:
new 0451bd7 Adjust flow tests to allow layering on SP base class for tests.
0451bd7 is described below
commit 0451bd70c236087f688464ab487fefb0abf98974
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Nov 20 20:06:10 2025 -0500
Adjust flow tests to allow layering on SP base class for tests.
---
.../flows/saml2/SAML2SessionInitiatorFlowTest.java | 10 +++++++--
.../flows/saml2/SAML2TokenConsumerFlowTest.java | 10 +++++++--
...MLEnvironmentApplicationContextInitializer.java | 25 +++++-----------------
.../shibboleth/idp/module/conf/sp/sp.properties | 2 +-
4 files changed, 22 insertions(+), 25 deletions(-)
diff --git a/sp-saml-conf-impl/src/test/java/net/shibboleth/sp/saml/flows/saml2/SAML2SessionInitiatorFlowTest.java b/sp-saml-conf-impl/src/test/java/net/shibboleth/sp/saml/flows/saml2/SAML2SessionInitiatorFlowTest.java
index 7834367..157354d 100644
--- a/sp-saml-conf-impl/src/test/java/net/shibboleth/sp/saml/flows/saml2/SAML2SessionInitiatorFlowTest.java
+++ b/sp-saml-conf-impl/src/test/java/net/shibboleth/sp/saml/flows/saml2/SAML2SessionInitiatorFlowTest.java
@@ -44,6 +44,8 @@ import org.testng.Assert;
import org.testng.annotations.Test;
import net.shibboleth.idp.authn.AuthnEventIds;
+import net.shibboleth.idp.spring.IdPPropertiesApplicationContextInitializer;
+import net.shibboleth.idp.test.PreferFileSystemApplicationContextInitializer;
import net.shibboleth.shared.collection.Pair;
import net.shibboleth.shared.component.ComponentInitializationException;
import net.shibboleth.shared.net.URISupport;
@@ -63,10 +65,14 @@ import net.shibboleth.sp.saml.saml2.profile.SAML2InitiatorConstants;
*/
@ContextConfiguration(
locations = {
- "classpath:/net/shibboleth/sp/saml-test-beans.xml", },
+ "classpath:/net/shibboleth/sp/saml-test-beans.xml",
+ },
initializers = {
TestSPSAMLEnvironmentApplicationContextInitializer.class,
- }
+ PreferFileSystemApplicationContextInitializer.class,
+ IdPPropertiesApplicationContextInitializer.class
+ },
+ inheritInitializers = false
)
@WebAppConfiguration
public class SAML2SessionInitiatorFlowTest extends AbstractSPFlowTest {
diff --git a/sp-saml-conf-impl/src/test/java/net/shibboleth/sp/saml/flows/saml2/SAML2TokenConsumerFlowTest.java b/sp-saml-conf-impl/src/test/java/net/shibboleth/sp/saml/flows/saml2/SAML2TokenConsumerFlowTest.java
index 3a2df85..c0ea127 100644
--- a/sp-saml-conf-impl/src/test/java/net/shibboleth/sp/saml/flows/saml2/SAML2TokenConsumerFlowTest.java
+++ b/sp-saml-conf-impl/src/test/java/net/shibboleth/sp/saml/flows/saml2/SAML2TokenConsumerFlowTest.java
@@ -65,6 +65,8 @@ import org.testng.annotations.Test;
import net.shibboleth.idp.authn.AuthnEventIds;
import net.shibboleth.idp.profile.IdPEventIds;
+import net.shibboleth.idp.spring.IdPPropertiesApplicationContextInitializer;
+import net.shibboleth.idp.test.PreferFileSystemApplicationContextInitializer;
import net.shibboleth.shared.codec.Base64Support;
import net.shibboleth.shared.codec.DecodingException;
import net.shibboleth.shared.codec.EncodingException;
@@ -86,10 +88,14 @@ import net.shibboleth.sp.profile.ConsumerConstants;
*/
@ContextConfiguration(
locations = {
- "classpath:/net/shibboleth/sp/saml-test-beans.xml", },
+ "classpath:/net/shibboleth/sp/saml-test-beans.xml",
+ },
initializers = {
TestSPSAMLEnvironmentApplicationContextInitializer.class,
- }
+ PreferFileSystemApplicationContextInitializer.class,
+ IdPPropertiesApplicationContextInitializer.class
+ },
+ inheritInitializers = false
)
@WebAppConfiguration
public class SAML2TokenConsumerFlowTest extends AbstractSPFlowTest {
diff --git a/sp-saml-conf-impl/src/test/java/net/shibboleth/sp/saml/flows/saml2/TestSPSAMLEnvironmentApplicationContextInitializer.java b/sp-saml-conf-impl/src/test/java/net/shibboleth/sp/saml/flows/saml2/TestSPSAMLEnvironmentApplicationContextInitializer.java
index 32d8394..6531d2a 100644
--- a/sp-saml-conf-impl/src/test/java/net/shibboleth/sp/saml/flows/saml2/TestSPSAMLEnvironmentApplicationContextInitializer.java
+++ b/sp-saml-conf-impl/src/test/java/net/shibboleth/sp/saml/flows/saml2/TestSPSAMLEnvironmentApplicationContextInitializer.java
@@ -16,40 +16,25 @@ package net.shibboleth.sp.saml.flows.saml2;
import javax.annotation.Nonnull;
-import org.slf4j.Logger;
import org.springframework.context.ApplicationContextInitializer;
-import org.springframework.context.ConfigurableApplicationContext;
-import org.springframework.core.Ordered;
-import org.springframework.core.annotation.Order;
import org.springframework.mock.env.MockPropertySource;
-import net.shibboleth.shared.primitive.LoggerFactory;
+import net.shibboleth.sp.flows.TestSPEnvironmentApplicationContextInitializer;
/**
* An {@link ApplicationContextInitializer} which prepends properties.
- *
- * <p>This needs to include the original IdP-test-layer properties and has to be
- * set to {@link Ordered#LOWEST_PRECEDENCE} or things blow up.</p>
*/
- at Order(Ordered.LOWEST_PRECEDENCE)
-public class TestSPSAMLEnvironmentApplicationContextInitializer
- implements ApplicationContextInitializer<ConfigurableApplicationContext> {
-
- /** Class logger. */
- @Nonnull private final Logger log = LoggerFactory.getLogger(TestSPSAMLEnvironmentApplicationContextInitializer.class);
+public class TestSPSAMLEnvironmentApplicationContextInitializer extends TestSPEnvironmentApplicationContextInitializer {
/** {@inheritDoc} */
- @Override public void initialize(@Nonnull final ConfigurableApplicationContext applicationContext) {
- final MockPropertySource mock = new MockPropertySource();
- mock.setProperty("idp.home", "classpath:/net/shibboleth/idp/module");
- mock.setProperty("idp.webflows", "classpath*:/flows");
+ @Override
+ protected void addProperties(@Nonnull final MockPropertySource mock) {
+ super.addProperties(mock);
mock.setProperty("sp.service.agents.resources", "test.sp.saml.AgentResolverResources");
mock.setProperty("sp.stateToken.Manager","shibboleth.sp.CookieStateTokenManager");
mock.setProperty("sp.agent.authn.method", "basic");
mock.setProperty("idp.additionalProperties",
"/conf/ldap.properties, /conf/saml-nameid.properties, /conf/services.properties, /conf/admin/admin.properties, /conf/authn/authn.properties, /conf/c14n/subject-c14n.properties, /credentials/secrets.properties, /conf/sp/sp.properties, /conf/sp/saml.properties");
- applicationContext.getEnvironment().getPropertySources().addFirst(mock);
- log.info("Prepending properties '{}'", mock.getSource());
}
}
\ No newline at end of file
diff --git a/sp-saml-conf-impl/src/test/resources/net/shibboleth/idp/module/conf/sp/sp.properties b/sp-saml-conf-impl/src/test/resources/net/shibboleth/idp/module/conf/sp/sp.properties
index 406b3a6..70de031 100644
--- a/sp-saml-conf-impl/src/test/resources/net/shibboleth/idp/module/conf/sp/sp.properties
+++ b/sp-saml-conf-impl/src/test/resources/net/shibboleth/idp/module/conf/sp/sp.properties
@@ -19,7 +19,7 @@ sp.service.agents.checkInterval = PT5M
#sp.agent.authn.cacheDuration = PT1H
# Set to StorageService to use for remoted storage data if in use.
-#sp.storageService = shibboleth.StorageService
+#sp.storageService =
# Set to DataSealer to use for remoted data encryption.
#sp.dataSealer = shibboleth.DataSealer
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list