[java-identity-provider] branch master updated: Make test immune to Java hash changes.
Scott Cantor
cantor.2 at osu.edu
Mon Jul 20 12:51:58 UTC 2020
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch master
in repository java-identity-provider.
View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=95c12c13b3d1fc2ee7e377d196a2de30819109a1
The following commit(s) were added to refs/heads/master by this push:
new 95c12c13b Make test immune to Java hash changes.
95c12c13b is described below
commit 95c12c13b3d1fc2ee7e377d196a2de30819109a1
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 | 26 +++++++++++++++++-----
1 file changed, 21 insertions(+), 5 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 dddb4e2c6..8c5041134 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,11 +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 java.io.ByteArrayInputStream;
import java.time.Instant;
+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.SAMLObjectBuilder;
import org.opensaml.saml.common.SAMLVersion;
@@ -35,6 +37,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;
@@ -105,10 +108,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);
}
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list