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

noreply at shibboleth.net noreply at shibboleth.net
Thu Nov 6 14:57:08 EST 2014


Author: scantor
Date: Thu Nov  6 14:57:08 2014
New Revision: 6853

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=6853&view=rev
Log:
IDP-506 - Revise test design

Modified:
    trunk/idp-conf/src/test/java/net/shibboleth/idp/test/flows/interceptor/InterceptFlowTest.java
    trunk/idp-conf/src/test/resources/intercept/flows/test-intercept-beans.xml
    trunk/idp-conf/src/test/resources/intercept/flows/test-intercept-flow.xml

Modified: trunk/idp-conf/src/test/java/net/shibboleth/idp/test/flows/interceptor/InterceptFlowTest.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-conf/src/test/java/net/shibboleth/idp/test/flows/interceptor/InterceptFlowTest.java?rev=6853&r1=6852&r2=6853&view=diff
==============================================================================
--- trunk/idp-conf/src/test/java/net/shibboleth/idp/test/flows/interceptor/InterceptFlowTest.java (original)
+++ trunk/idp-conf/src/test/java/net/shibboleth/idp/test/flows/interceptor/InterceptFlowTest.java Thu Nov  6 14:57:08 2014
@@ -20,9 +20,7 @@
 import java.util.List;
 
 import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
 
-import net.shibboleth.idp.profile.context.SpringRequestContext;
 import net.shibboleth.idp.profile.context.ProfileInterceptorContext;
 import net.shibboleth.idp.profile.interceptor.ProfileInterceptorFlowDescriptor;
 import net.shibboleth.idp.test.flows.AbstractFlowTest;
@@ -38,8 +36,6 @@
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import com.google.common.base.Predicate;
-
 /** Tests for the profile interceptor flow. */
 @ContextConfiguration(locations = {"classpath:/intercept/test-webflow-config.xml",})
 public class InterceptFlowTest extends AbstractFlowTest {
@@ -47,8 +43,11 @@
     /** Flow id. */
     @Nonnull public final static String TEST_PROFILE_FLOW_ID = "test-intercept-flow";
 
-    /** Bean ID of user configured intercept flows. */
+    /** Bean ID of configured intercept flows. */
     @Nonnull public final static String INTERCEPT_FLOWS_BEAN_ID = "shibboleth.AvailableInterceptFlows";
+
+    /** Bean ID of activated intercept flows. */
+    @Nonnull public final static String ACTIVATED_FLOWS_BEAN_ID = "ActivatedFlows";
 
     @Nonnull public final static String TEST_FLOW_REGISTRY_ID = "testFlowRegistry";
 
@@ -58,11 +57,28 @@
     /**
      * Clear the list of user configured flows defined in bean with ID {@link #INTERCEPT_FLOWS_BEAN_ID}.
      */
-    @BeforeMethod public void clearUserConfiguredInterceptFlows() {
+    @BeforeMethod public void setUserConfiguredInterceptFlows() {
         final Flow flow = getFlow(TEST_PROFILE_FLOW_ID);
+
+        final List activatedFlows = flow.getApplicationContext().getBean(ACTIVATED_FLOWS_BEAN_ID, List.class);
+        activatedFlows.clear();
+
         final List interceptFlows = flow.getApplicationContext().getBean(INTERCEPT_FLOWS_BEAN_ID, List.class);
         interceptFlows.clear();
-    }
+
+        final ProfileInterceptorFlowDescriptor flowDescriptor1 = new ProfileInterceptorFlowDescriptor();
+        flowDescriptor1.setId(ProfileInterceptorFlowDescriptor.FLOW_ID_PREFIX + "test-proceed-1-flow");
+
+        final ProfileInterceptorFlowDescriptor flowDescriptor2 = new ProfileInterceptorFlowDescriptor();
+        flowDescriptor2.setId(ProfileInterceptorFlowDescriptor.FLOW_ID_PREFIX + "test-proceed-2-flow");
+
+        final ProfileInterceptorFlowDescriptor flowDescriptor3 = new ProfileInterceptorFlowDescriptor();
+        flowDescriptor3.setId(ProfileInterceptorFlowDescriptor.FLOW_ID_PREFIX + "test-error-flow");
+
+        interceptFlows.add(flowDescriptor1);
+        interceptFlows.add(flowDescriptor2);
+        interceptFlows.add(flowDescriptor3);
+}
 
     /**
      * Register test flows in parent registry so they can be called by the 'intercept' flow in the parent registry.
@@ -91,13 +107,9 @@
 
     @Test public void testOneAvailableFlow() {
 
-        final ProfileInterceptorFlowDescriptor flowDescriptor = new ProfileInterceptorFlowDescriptor();
-        flowDescriptor.setId("intercept/test-proceed-1-flow");
-
         final Flow flow = getFlow(TEST_PROFILE_FLOW_ID);
-
-        final List interceptFlows = flow.getApplicationContext().getBean(INTERCEPT_FLOWS_BEAN_ID, List.class);
-        interceptFlows.add(flowDescriptor);
+        final List activatedFlows = flow.getApplicationContext().getBean(ACTIVATED_FLOWS_BEAN_ID, List.class);
+        activatedFlows.add("test-proceed-1-flow");
 
         final FlowExecutionResult result = flowExecutor.launchExecution(TEST_PROFILE_FLOW_ID, null, externalContext);
 
@@ -115,18 +127,11 @@
 
     @Test public void testTwoAvailableFlows() {
 
-        final ProfileInterceptorFlowDescriptor flowDescriptor1 = new ProfileInterceptorFlowDescriptor();
-        flowDescriptor1.setId(ProfileInterceptorFlowDescriptor.FLOW_ID_PREFIX + "test-proceed-1-flow");
-
-        final ProfileInterceptorFlowDescriptor flowDescriptor2 = new ProfileInterceptorFlowDescriptor();

[... 167 lines stripped ...]


More information about the commits mailing list