[java-opensaml] 02/10: IDP-1793 Use Suppliers for HttpRequest/Response

Rod Widdowson rdw at steadingsoftware.com
Tue Aug 2 19:34:40 UTC 2022


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

rdw pushed a commit to branch dev/4/IDP-1793
in repository java-opensaml.

View the commit online:
http://git.shibboleth.net/view/?p=java-opensaml.git;a=commit;h=18b19929e39900f56fd0b272f6b2a04fa97eeab4

commit 18b19929e39900f56fd0b272f6b2a04fa97eeab4
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Sat Jul 30 11:11:29 2022 +0100

    IDP-1793  Use Suppliers for HttpRequest/Response
    
    https://shibboleth.atlassian.net/browse/IDP-1793
    
    AbstractProfileAction now has a setter for Suppliers for
    HttpServletRequest and Response
    
    Make the tests use this
---
 .../saml2/profile/impl/AddSubjectConfirmationToSubjectsTest.java   | 7 ++++++-
 .../opensaml/saml/saml2/profile/impl/ValidateAssertionsTest.java   | 5 ++++-
 .../storage/impl/client/LoadClientStorageServicesTest.java         | 2 +-
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/profile/impl/AddSubjectConfirmationToSubjectsTest.java b/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/profile/impl/AddSubjectConfirmationToSubjectsTest.java
index 4e1556fbc..d9b1be826 100644
--- a/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/profile/impl/AddSubjectConfirmationToSubjectsTest.java
+++ b/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/profile/impl/AddSubjectConfirmationToSubjectsTest.java
@@ -20,6 +20,10 @@ package org.opensaml.saml.saml2.profile.impl;
 import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
 import net.shibboleth.utilities.java.support.logic.FunctionSupport;
 
+import java.util.function.Supplier;
+
+import javax.servlet.http.HttpServletRequest;
+
 import org.opensaml.core.testing.OpenSAMLInitBaseTestCase;
 import org.opensaml.profile.action.EventIds;
 import org.opensaml.profile.context.ProfileRequestContext;
@@ -52,7 +56,8 @@ public class AddSubjectConfirmationToSubjectsTest extends OpenSAMLInitBaseTestCa
         prc = new RequestContextBuilder().buildProfileRequestContext();
         
         action = new AddSubjectConfirmationToSubjects();
-        action.setHttpServletRequest(new MockHttpServletRequest());
+        final MockHttpServletRequest request = new MockHttpServletRequest();
+        action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
     }
 
     @Test(expectedExceptions = ComponentInitializationException.class)
diff --git a/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/profile/impl/ValidateAssertionsTest.java b/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/profile/impl/ValidateAssertionsTest.java
index fc8631985..29bcd7980 100644
--- a/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/profile/impl/ValidateAssertionsTest.java
+++ b/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/profile/impl/ValidateAssertionsTest.java
@@ -21,6 +21,9 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.function.Supplier;
+
+import javax.servlet.http.HttpServletResponse;
 
 import org.opensaml.core.testing.OpenSAMLInitBaseTestCase;
 import org.opensaml.profile.context.ProfileRequestContext;
@@ -64,7 +67,7 @@ public class ValidateAssertionsTest extends OpenSAMLInitBaseTestCase {
         
         action = new ValidateAssertions();
         action.setHttpServletRequest(httpRequest);
-        action.setHttpServletResponse(httpResponse);
+        action.setHttpServletResponseSupplier(new Supplier<> () {public HttpServletResponse get() { return httpResponse;}});
         action.setValidationContextBuilder(new MockAssertionValidationContextBuilder());
         action.setAssertionValidator(new MockAssertionValidator(resultsMap));
         
diff --git a/opensaml-storage-impl/src/test/java/org/opensaml/storage/impl/client/LoadClientStorageServicesTest.java b/opensaml-storage-impl/src/test/java/org/opensaml/storage/impl/client/LoadClientStorageServicesTest.java
index 51518129b..10e8ff122 100644
--- a/opensaml-storage-impl/src/test/java/org/opensaml/storage/impl/client/LoadClientStorageServicesTest.java
+++ b/opensaml-storage-impl/src/test/java/org/opensaml/storage/impl/client/LoadClientStorageServicesTest.java
@@ -61,7 +61,7 @@ public class LoadClientStorageServicesTest extends AbstractBaseClientStorageServ
         loadCtx.getStorageKeys().add(STORAGE_NAME);
         
         action = new LoadClientStorageServices();
-        action.setHttpServletRequest(new ThreadLocalHttpServletRequestProxy());
+        action.setHttpServletRequestSupplier(new ThreadLocalHttpServletRequestProxy());
         HttpServletRequestResponseContext.loadCurrent(new MockHttpServletRequest(), new MockHttpServletResponse());
     }
 

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


More information about the commits mailing list