[java-idp-testbed COMMIT] in /trunk/src/test/java/idp: AbstractFlowTest.java AbstractSAML1FlowTest.java saml1/SAML1At...

noreply at shibboleth.net noreply at shibboleth.net
Thu Apr 24 13:03:02 EDT 2014


Author: tzeller
Date: Thu Apr 24 13:03:02 2014
New Revision: 197

URL: http://svn.shibboleth.net/view/java-idp-testbed?rev=197&view=rev
Log:
Flow test cleanup and javadoc.

Modified:
    trunk/src/test/java/idp/AbstractFlowTest.java
    trunk/src/test/java/idp/AbstractSAML1FlowTest.java
    trunk/src/test/java/idp/saml1/SAML1AttributeQueryTest.java
    trunk/src/test/java/idp/saml1/SAML1UnsolicitedFlowTest.java

Modified: trunk/src/test/java/idp/AbstractFlowTest.java
URL: http://svn.shibboleth.net/view/java-idp-testbed/trunk/src/test/java/idp/AbstractFlowTest.java?rev=197&r1=196&r2=197&view=diff
==============================================================================
--- trunk/src/test/java/idp/AbstractFlowTest.java (original)
+++ trunk/src/test/java/idp/AbstractFlowTest.java Thu Apr 24 13:03:02 2014
@@ -26,11 +26,14 @@
 import net.shibboleth.utilities.java.support.net.HttpServletRequestResponseContext;
 import net.shibboleth.utilities.java.support.xml.ParserPool;
 
+import org.opensaml.core.xml.XMLObject;
 import org.opensaml.core.xml.XMLObjectBuilderFactory;
 import org.opensaml.core.xml.config.XMLObjectProviderRegistrySupport;
 import org.opensaml.core.xml.io.MarshallerFactory;
 import org.opensaml.core.xml.io.UnmarshallerFactory;
 import org.opensaml.profile.context.ProfileRequestContext;
+import org.opensaml.soap.soap11.Body;
+import org.opensaml.soap.soap11.Envelope;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.mock.web.MockHttpServletRequest;
@@ -75,7 +78,7 @@
 
     /** The IDP entity ID. */
     @Nonnull public final static String IDP_ENTITY_ID = "https://idp.example.org";
-    
+
     /** The SP entity ID. */
     @Nonnull public final static String SP_ENTITY_ID = "https://sp.example.org";
 
@@ -175,7 +178,7 @@
      * 
      * Always run this method to avoid starting the server multiple times when tests fail.
      */
-    @AfterTest(alwaysRun=true) public void teardownDirectoryServer() {
+    @AfterTest(alwaysRun = true) public void teardownDirectoryServer() {
         if (directoryServer != null) {
             directoryServer.stop();
         }
@@ -206,4 +209,23 @@
         Assert.assertTrue(outcome.getOutput().get(OUTPUT_ATTR_NAME) instanceof ProfileRequestContext);
     }
 
+    /**
+     * Build a SOAP11 {@link Envelope} with the given payload.
+     * 
+     * @param payload the payload
+     * @return the SOAP11 envelop
+     */
+    @Nonnull public static Envelope buildSOAP11Envelope(@Nonnull final XMLObject payload) {
+        final Envelope envelope =
+                (Envelope) builderFactory.getBuilder(Envelope.DEFAULT_ELEMENT_NAME).buildObject(
+                        Envelope.DEFAULT_ELEMENT_NAME);
+        final Body body =
+                (Body) builderFactory.getBuilder(Body.DEFAULT_ELEMENT_NAME).buildObject(Body.DEFAULT_ELEMENT_NAME);
+
+        body.getUnknownXMLObjects().add(payload);
+        envelope.setBody(body);
+
+        return envelope;
+    }
+
 }

Modified: trunk/src/test/java/idp/AbstractSAML1FlowTest.java
URL: http://svn.shibboleth.net/view/java-idp-testbed/trunk/src/test/java/idp/AbstractSAML1FlowTest.java?rev=197&r1=196&r2=197&view=diff
==============================================================================
--- trunk/src/test/java/idp/AbstractSAML1FlowTest.java (original)
+++ trunk/src/test/java/idp/AbstractSAML1FlowTest.java Thu Apr 24 13:03:02 2014
@@ -52,7 +52,28 @@
 @ContextConfiguration({"/system/conf/testbed-beans.xml", "file:src/main/webapp/WEB-INF/idp/testbed.xml"})
 public abstract class AbstractSAML1FlowTest extends AbstractFlowTest {
 
-    public void validateResult(@Nullable final FlowExecutionResult result, String flowId) {
+    /**
+     * Top level validation of the {@link FlowExecutionResult}.
+     * <p>
+     * Calls validate methods :
+     * <ul>
+     * <li>{@link #validateConditions(Assertion)}</li>
+     * <li>{@link #validateAuthenticationStatements(Assertion)}</li>
+     * <li>{@link #validateAttributeStatements(Assertion)}</li>
+     * </ul>
+     * Calls assert methods :
+     * <ul>
+     * <li>{@link AbstractFlowTest#assertFlowExecutionResult(FlowExecutionResult, String)}</li>
+     * <li>{@link #assertProfileRequestContext(ProfileRequestContext)}</li>
+     * <li>{@link #assertResponse(Response)}</li>
+     * <li>{@link #assertAssertions(List)}</li>
+     * <li>{@link #assertAssertion(Assertion)}</li>
+     * </ul>
+     * 
+     * @param result the flow execution result
+     * @param flowId the flow ID
+     */
+    public void validateResult(@Nullable final FlowExecutionResult result, @Nonnull final String flowId) {
 
         assertFlowExecutionResult(result, flowId);
 
@@ -80,6 +101,18 @@
         // TODO signing, encoding
     }
 
+    /**
+     * Validate the assertion conditions.
+     * <p>
+     * Calls assert methods :
+     * <ul>
+     * <li>{@link #assertConditions(Conditions)}</li>
+     * <li>{@link #assertAudienceRestrictionConditions(List)}</li>
+     * <li>{@link #assertAudiences(List)}</li>
+     * </ul>
+     * 
+     * @param assertion the assertion
+     */

[... 412 lines stripped ...]


More information about the commits mailing list