[java-identity-provider] branch maint-3.4 updated: Make test immune to Java hash changes.

Ian Young ian at iay.org.uk
Tue Jul 21 10:19:29 UTC 2020


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

iay pushed a commit to branch maint-3.4
in repository java-identity-provider.

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

The following commit(s) were added to refs/heads/maint-3.4 by this push:
       new  4af5c16fd Make test immune to Java hash changes.
4af5c16fd is described below

commit 4af5c16fd8b7b19e5a0fcd81be2666d626a5e626
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Jul 20 08:52:35 2020 -0400

    Make test immune to Java hash changes.
---
 .../impl/LibertyHTTPSOAP11EncoderTest.java         | 29 +++++++++++++++++-----
 1 file changed, 23 insertions(+), 6 deletions(-)

diff --git a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/delegation/messaging/impl/LibertyHTTPSOAP11EncoderTest.java b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/delegation/messaging/impl/LibertyHTTPSOAP11EncoderTest.java
index 507be8062..d54facff4 100644
--- a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/delegation/messaging/impl/LibertyHTTPSOAP11EncoderTest.java
+++ b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/delegation/messaging/impl/LibertyHTTPSOAP11EncoderTest.java
@@ -18,10 +18,13 @@
 package net.shibboleth.idp.saml.saml2.profile.delegation.messaging.impl;
 
 import net.shibboleth.idp.saml.saml2.profile.delegation.impl.LibertyConstants;
-import net.shibboleth.utilities.java.support.testing.TestSupport;
 
 import org.joda.time.DateTime;
+import java.io.ByteArrayInputStream;
+
+import org.opensaml.core.xml.XMLObject;
 import org.opensaml.core.xml.XMLObjectBaseTestCase;
+import org.opensaml.core.xml.util.XMLObjectSupport;
 import org.opensaml.messaging.context.MessageContext;
 import org.opensaml.saml.common.SAMLObject;
 import org.opensaml.saml.common.SAMLObjectBuilder;
@@ -35,6 +38,7 @@ import org.opensaml.saml.saml2.core.StatusCode;
 import org.opensaml.saml.saml2.metadata.AssertionConsumerService;
 import org.opensaml.saml.saml2.metadata.Endpoint;
 import org.opensaml.soap.messaging.SOAPMessagingSupport;
+import org.opensaml.soap.soap11.Envelope;
 import org.opensaml.soap.wsaddressing.Action;
 import org.springframework.mock.web.MockHttpServletResponse;
 import org.testng.Assert;
@@ -102,10 +106,23 @@ public class LibertyHTTPSOAP11EncoderTest extends XMLObjectBaseTestCase {
         Assert.assertEquals("UTF-8", response.getCharacterEncoding(), "Unexpected character encoding");
         Assert.assertEquals(response.getHeader("Cache-control"), "no-cache, no-store", "Unexpected cache controls");
         Assert.assertEquals(response.getHeader("SOAPAction"), LibertyConstants.SSOS_RESPONSE_WSA_ACTION_URI);
-        // TODO: this hashes differently with endorsed Xerces or under Java 9
-        if (TestSupport.isJavaV9OrLater()) {
-            return;
+
+        try (ByteArrayInputStream inputStream = new ByteArrayInputStream(response.getContentAsByteArray())) {
+            XMLObject xmlObject = XMLObjectSupport.unmarshallFromInputStream(parserPool, inputStream);
+            Assert.assertNotNull(xmlObject);
+            Assert.assertTrue(xmlObject instanceof Envelope);
+            Envelope envelope = (Envelope) xmlObject;
+            Assert.assertNotNull(envelope.getHeader());
+            Assert.assertEquals(envelope.getHeader().getUnknownXMLObjects().size(), 1);
+            Action outboundAction = (Action) envelope.getHeader().getUnknownXMLObjects().get(0);
+            Assert.assertNotNull(outboundAction);
+            Assert.assertNotNull(envelope.getBody());
+            Assert.assertEquals(envelope.getBody().getUnknownXMLObjects().size(), 1);
+            Response outboundResponse = (Response) envelope.getBody().getUnknownXMLObjects().get(0);
+            outboundResponse.releaseDOM();
+            outboundResponse.releaseChildrenDOM(true);
+            outboundResponse.setParent(null);
+            assertXMLEquals(XMLObjectSupport.marshall(outboundResponse).getOwnerDocument(), samlMessage);
         }
-        Assert.assertEquals(response.getContentAsString().hashCode(), 1113901725);
     }
-}
\ No newline at end of file
+}

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


More information about the commits mailing list