[java-identity-provider COMMIT] in /trunk/idp-conf/src/test/java/net/shibboleth/idp/test/flows: saml1/SAML1AttributeQ...

noreply at shibboleth.net noreply at shibboleth.net
Tue Apr 5 15:52:09 EDT 2016


Author: scantor
Date: Tue Apr  5 15:52:09 2016
New Revision: 8197

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=8197&view=rev
Log:
IDP-504 - Unit tests should avoid creating XMLObjectBuilders explicitly

https://issues.shibboleth.net/jira/browse/IDP-504

Modified:
    trunk/idp-conf/src/test/java/net/shibboleth/idp/test/flows/saml1/SAML1AttributeQueryFlowTest.java
    trunk/idp-conf/src/test/java/net/shibboleth/idp/test/flows/saml1/SAML1TestResponseValidator.java
    trunk/idp-conf/src/test/java/net/shibboleth/idp/test/flows/saml2/SAML2AttributeQueryFlowTest.java
    trunk/idp-conf/src/test/java/net/shibboleth/idp/test/flows/saml2/SAML2TestResponseValidator.java

Modified: trunk/idp-conf/src/test/java/net/shibboleth/idp/test/flows/saml1/SAML1AttributeQueryFlowTest.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-conf/src/test/java/net/shibboleth/idp/test/flows/saml1/SAML1AttributeQueryFlowTest.java?rev=8197&r1=8196&r2=8197&view=diff
==============================================================================
--- trunk/idp-conf/src/test/java/net/shibboleth/idp/test/flows/saml1/SAML1AttributeQueryFlowTest.java	(original)
+++ trunk/idp-conf/src/test/java/net/shibboleth/idp/test/flows/saml1/SAML1AttributeQueryFlowTest.java	Tue Apr  5 15:52:09 2016
@@ -35,7 +35,6 @@
 import org.opensaml.saml.saml1.core.Request;
 import org.opensaml.saml.saml1.core.StatusCode;
 import org.opensaml.saml.saml1.core.Subject;
-import org.opensaml.saml.saml1.core.impl.NameIdentifierBuilder;
 import org.opensaml.saml.saml1.profile.SAML1ActionTestingSupport;
 import org.opensaml.security.messaging.ServletRequestX509CredentialAdapter;
 import org.opensaml.soap.soap11.Envelope;
@@ -58,7 +57,10 @@
     /** Initialize the SAML 1 Response validator. */
     @BeforeClass void setupValidator() {
 
-        final NameIdentifier nameIdentifier = new NameIdentifierBuilder().buildObject();
+        final SAMLObjectBuilder<NameIdentifier> builder = (SAMLObjectBuilder<NameIdentifier>)
+                XMLObjectProviderRegistrySupport.getBuilderFactory().<NameIdentifier>getBuilderOrThrow(
+                        NameIdentifier.DEFAULT_ELEMENT_NAME);
+        final NameIdentifier nameIdentifier = builder.buildObject();
         nameIdentifier.setValue("jdoe");
         nameIdentifier.setFormat(null);
         nameIdentifier.setNameQualifier(null);

Modified: trunk/idp-conf/src/test/java/net/shibboleth/idp/test/flows/saml1/SAML1TestResponseValidator.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-conf/src/test/java/net/shibboleth/idp/test/flows/saml1/SAML1TestResponseValidator.java?rev=8197&r1=8196&r2=8197&view=diff
==============================================================================
--- trunk/idp-conf/src/test/java/net/shibboleth/idp/test/flows/saml1/SAML1TestResponseValidator.java	(original)
+++ trunk/idp-conf/src/test/java/net/shibboleth/idp/test/flows/saml1/SAML1TestResponseValidator.java	Tue Apr  5 15:52:09 2016
@@ -27,7 +27,9 @@
 
 import net.shibboleth.idp.saml.xml.SAMLConstants;
 
+import org.opensaml.core.xml.config.XMLObjectProviderRegistrySupport;
 import org.opensaml.core.xml.schema.XSAny;
+import org.opensaml.saml.common.SAMLObjectBuilder;
 import org.opensaml.saml.common.SAMLVersion;
 import org.opensaml.saml.saml1.core.Assertion;
 import org.opensaml.saml.saml1.core.Attribute;
@@ -43,7 +45,6 @@
 import org.opensaml.saml.saml1.core.StatusCode;
 import org.opensaml.saml.saml1.core.Subject;
 import org.opensaml.saml.saml1.core.SubjectConfirmation;
-import org.opensaml.saml.saml1.core.impl.NameIdentifierBuilder;
 import org.testng.Assert;
 
 /**
@@ -80,7 +81,10 @@
 
     /** Constructor. */
     public SAML1TestResponseValidator() {
-        nameIdentifier = new NameIdentifierBuilder().buildObject();
+        final SAMLObjectBuilder<NameIdentifier> builder = (SAMLObjectBuilder<NameIdentifier>)
+                XMLObjectProviderRegistrySupport.getBuilderFactory().<NameIdentifier>getBuilderOrThrow(
+                        NameIdentifier.DEFAULT_ELEMENT_NAME);
+        nameIdentifier = builder.buildObject();
         nameIdentifier.setFormat(SAMLConstants.SAML1_NAMEID_TRANSIENT);
         nameIdentifier.setNameQualifier(idpEntityID);
     }

Modified: trunk/idp-conf/src/test/java/net/shibboleth/idp/test/flows/saml2/SAML2AttributeQueryFlowTest.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-conf/src/test/java/net/shibboleth/idp/test/flows/saml2/SAML2AttributeQueryFlowTest.java?rev=8197&r1=8196&r2=8197&view=diff
==============================================================================
--- trunk/idp-conf/src/test/java/net/shibboleth/idp/test/flows/saml2/SAML2AttributeQueryFlowTest.java	(original)
+++ trunk/idp-conf/src/test/java/net/shibboleth/idp/test/flows/saml2/SAML2AttributeQueryFlowTest.java	Tue Apr  5 15:52:09 2016
@@ -37,7 +37,6 @@
 import org.opensaml.saml.saml2.core.StatusCode;
 import org.opensaml.saml.saml2.core.Subject;
 import org.opensaml.saml.saml2.core.SubjectConfirmation;
-import org.opensaml.saml.saml2.core.impl.NameIDBuilder;

[... 110 lines stripped ...]


More information about the commits mailing list