[java-identity-provider] branch main updated: Fix Java20 Tesys This was due to Oddness in the test's use of thread local storage that only J20 flushed.

Rod Widdowson rdw at steadingsoftware.com
Wed Mar 8 13:25:51 UTC 2023


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

rdw pushed a commit to branch main
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=355911209791576417f42d72621e351a7d796303

The following commit(s) were added to refs/heads/main by this push:
     new 355911209 Fix Java20 Tesys This was due to Oddness in the test's use of thread local storage that only J20 flushed.
355911209 is described below

commit 355911209791576417f42d72621e351a7d796303
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Wed Mar 8 13:25:44 2023 +0000

    Fix Java20 Tesys
    This was due to Oddness in the test's use of thread local storage that only J20 flushed.
    
    Who knows why
---
 .../shibboleth/idp/session/impl/PopulateSessionContextTest.java  | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/idp-session-impl/src/test/java/net/shibboleth/idp/session/impl/PopulateSessionContextTest.java b/idp-session-impl/src/test/java/net/shibboleth/idp/session/impl/PopulateSessionContextTest.java
index f0909b7a8..a40483078 100644
--- a/idp-session-impl/src/test/java/net/shibboleth/idp/session/impl/PopulateSessionContextTest.java
+++ b/idp-session-impl/src/test/java/net/shibboleth/idp/session/impl/PopulateSessionContextTest.java
@@ -17,6 +17,8 @@
 
 package net.shibboleth.idp.session.impl;
 
+import static org.testng.Assert.assertEquals;
+
 import org.opensaml.profile.context.ProfileRequestContext;
 import org.springframework.mock.web.MockHttpServletRequest;
 import org.springframework.mock.web.MockHttpServletResponse;
@@ -127,18 +129,23 @@ public class PopulateSessionContextTest extends SessionManagerBaseTestCase {
     }
     
     @Test public void testAddressLookup() throws ComponentInitializationException, SessionException {
+        final MockHttpServletRequest theRequest = new MockHttpServletRequest();
+        final MockHttpServletResponse theResponse = new MockHttpServletResponse();
+        HttpServletRequestResponseContext.loadCurrent(theRequest, theResponse);
         action = new PopulateSessionContext();
         action.setHttpServletRequestSupplier(new ThreadLocalHttpServletRequestSupplier());
         action.setHttpServletResponseSupplier(new ThreadLocalHttpServletResponseSupplier());
         action.setSessionResolver(sessionManager);
         final HttpServletRequest req = action.getHttpServletRequest();
         assert req != null;
+        assertEquals(req,  theRequest);
         action.setAddressLookupStrategy(input -> req.getHeader("User-Agent"));
         action.initialize();
         
         Cookie cookie = createSession("joe");
+        // CreateSession Cleared this
+        HttpServletRequestResponseContext.loadCurrent(theRequest, theResponse);
         
-        HttpServletRequestResponseContext.loadCurrent(new MockHttpServletRequest(), new MockHttpServletResponse());
         getRequest().setCookies(cookie);
         getRequest().addHeader("User-Agent", "UnitTest-Client");
         

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


More information about the commits mailing list