[java-identity-provider] branch master updated: IDP-1263 - migrate away from legacy xmlunit API

Scott Cantor cantor.2 at osu.edu
Thu Apr 2 11:32:49 EDT 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=4eeb896a78bf7a0f9ef6aab272c91b7feeb4aec7

The following commit(s) were added to refs/heads/master by this push:
       new  4eeb896   IDP-1263 - migrate away from legacy xmlunit API
4eeb896 is described below

commit 4eeb896a78bf7a0f9ef6aab272c91b7feeb4aec7
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Apr 2 11:32:45 2020 -0400

    IDP-1263 - migrate away from legacy xmlunit API
    
    https://issues.shibboleth.net/jira/browse/IDP-1263
---
 ...atementToAssertionFromInboundAssertionTokenTest.java | 17 +++++++++++------
 .../delegation/impl/DecorateDelegatedAssertionTest.java | 15 ++++++++++++---
 2 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/AddAuthnStatementToAssertionFromInboundAssertionTokenTest.java b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/AddAuthnStatementToAssertionFromInboundAssertionTokenTest.java
index 79eb358..5c7db93 100644
--- a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/AddAuthnStatementToAssertionFromInboundAssertionTokenTest.java
+++ b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/AddAuthnStatementToAssertionFromInboundAssertionTokenTest.java
@@ -30,6 +30,8 @@ import org.springframework.webflow.execution.RequestContext;
 import org.testng.Assert;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
+import org.xmlunit.builder.DiffBuilder;
+import org.xmlunit.diff.Diff;
 
 import com.google.common.base.Predicates;
 
@@ -40,10 +42,9 @@ import net.shibboleth.idp.saml.saml2.profile.SAML2ActionTestingSupport;
 import net.shibboleth.idp.saml.saml2.profile.delegation.LibertySSOSContext;
 import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
 import net.shibboleth.utilities.java.support.logic.FunctionSupport;
-import net.shibboleth.utilities.java.support.xml.XMLAssertTestNG;
 
 /**
- *
+ * Unit test for {@link AddAuthnStatementToAssertionFromInboundAssertionToken} action.
  */
 public class AddAuthnStatementToAssertionFromInboundAssertionTokenTest extends OpenSAMLInitBaseTestCase {
     
@@ -83,11 +84,15 @@ public class AddAuthnStatementToAssertionFromInboundAssertionTokenTest extends O
         final Event result = action.execute(rc);
         ActionTestingSupport.assertProceedEvent(result);
         
-        Assertion newAssertion = ((Response)prc.getOutboundMessageContext().getMessage()).getAssertions().get(0);
+        final Assertion newAssertion = ((Response)prc.getOutboundMessageContext().getMessage()).getAssertions().get(0);
         Assert.assertFalse(newAssertion.getAuthnStatements().isEmpty());
-        XMLAssertTestNG.assertXMLEqual(
-                XMLObjectSupport.marshall(delegatedAuthnStatement).getOwnerDocument(),
-                XMLObjectSupport.marshall(newAssertion.getAuthnStatements().get(0)).getOwnerDocument());
+        
+        final Diff diff = DiffBuilder.compare(
+                XMLObjectSupport.marshall(delegatedAuthnStatement)).withTest(
+                        XMLObjectSupport.marshall(newAssertion.getAuthnStatements().get(0)))
+                .checkForIdentical()
+                .build();
+        Assert.assertFalse(diff.hasDifferences(), diff.toString());
     }
     
     @Test
diff --git a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/DecorateDelegatedAssertionTest.java b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/DecorateDelegatedAssertionTest.java
index 3904793..d2e78e1 100644
--- a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/DecorateDelegatedAssertionTest.java
+++ b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/DecorateDelegatedAssertionTest.java
@@ -41,7 +41,6 @@ import net.shibboleth.utilities.java.support.component.ComponentInitializationEx
 import net.shibboleth.utilities.java.support.component.UninitializedComponentException;
 import net.shibboleth.utilities.java.support.logic.FunctionSupport;
 import net.shibboleth.utilities.java.support.xml.SerializeSupport;
-import net.shibboleth.utilities.java.support.xml.XMLAssertTestNG;
 
 import org.openliberty.xmltooling.disco.MetadataAbstract;
 import org.openliberty.xmltooling.disco.ProviderID;
@@ -79,6 +78,8 @@ import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 import org.w3c.dom.Element;
+import org.xmlunit.builder.DiffBuilder;
+import org.xmlunit.diff.Diff;
 
 import com.google.common.base.Predicates;
 
@@ -361,7 +362,11 @@ public class DecorateDelegatedAssertionTest extends OpenSAMLInitBaseTestCase {
         assertion.releaseDOM();
         assertion.releaseChildrenDOM(true);
         Assert.assertNotSame(origAssertionDOM.getOwnerDocument(), currentAssertionDOM.getOwnerDocument());
-        XMLAssertTestNG.assertXMLEqual(origAssertionDOM.getOwnerDocument(), currentAssertionDOM.getOwnerDocument());
+        
+        final Diff diff = DiffBuilder.compare(origAssertionDOM).withTest(currentAssertionDOM)
+                .checkForIdentical()
+                .build();
+        Assert.assertFalse(diff.hasDifferences(), diff.toString());
     }
     
     private void testDecoratedAssertion() throws MarshallingException {
@@ -369,7 +374,11 @@ public class DecorateDelegatedAssertionTest extends OpenSAMLInitBaseTestCase {
         assertion.releaseDOM();
         assertion.releaseChildrenDOM(true);
         Assert.assertNotSame(origAssertionDOM.getOwnerDocument(), currentAssertionDOM.getOwnerDocument());
-        XMLAssertTestNG.assertXMLNotEqual(origAssertionDOM.getOwnerDocument(), currentAssertionDOM.getOwnerDocument());
+
+        final Diff diff = DiffBuilder.compare(origAssertionDOM).withTest(currentAssertionDOM)
+                .checkForIdentical()
+                .build();
+        Assert.assertTrue(diff.hasDifferences(), diff.toString());
         
         // SubjectConfirmation
         Assert.assertNotNull(assertion.getSubject().getSubjectConfirmations());

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


More information about the commits mailing list