Skip to content

Instantly share code, notes, and snippets.

@serac
Created July 21, 2014 16:59
Show Gist options
  • Save serac/67a99189bf6e91712c37 to your computer and use it in GitHub Desktop.
Save serac/67a99189bf6e91712c37 to your computer and use it in GitHub Desktop.
User-Defined Flow Test
Index: idp-conf/src/test/java/net/shibboleth/idp/test/flows/ExtensionFlowTest.java
===================================================================
--- idp-conf/src/test/java/net/shibboleth/idp/test/flows/ExtensionFlowTest.java (revision 0)
+++ idp-conf/src/test/java/net/shibboleth/idp/test/flows/ExtensionFlowTest.java (working copy)
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements. See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID licenses this file to You under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.shibboleth.idp.test.flows;
+
+import org.springframework.webflow.executor.FlowExecutionResult;
+import org.testng.annotations.Test;
+
+import javax.annotation.Nonnull;
+
+/**
+ * Tests a user-defined flow that calls into system flows.
+ */
+public class ExtensionFlowTest extends AbstractFlowTest {
+
+ /** Flow id. */
+ @Nonnull public final static String FLOW_ID = "test-extension";
+
+ @Test
+ public void testExtensionFlow() {
+ final FlowExecutionResult result = flowExecutor.launchExecution(FLOW_ID, null, externalContext);
+ assertFlowExecutionResult(result, FLOW_ID);
+ }
+}
Index: idp-conf/src/test/resources/flows/test-extension/test-extension-flow.xml
===================================================================
--- idp-conf/src/test/resources/flows/test-extension/test-extension-flow.xml (revision 0)
+++ idp-conf/src/test/resources/flows/test-extension/test-extension-flow.xml (working copy)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ ~ Licensed to the University Corporation for Advanced Internet Development,
+ ~ Inc. (UCAID) under one or more contributor license agreements. See the
+ ~ NOTICE file distributed with this work for additional information regarding
+ ~ copyright ownership. The UCAID licenses this file to You under the Apache
+ ~ License, Version 2.0 (the "License"); you may not use this file except in
+ ~ compliance with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<flow xmlns="http://www.springframework.org/schema/webflow" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springframework.org/schema/webflow http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd">
+
+ <on-start>
+ <set name="flowScope.currentProfile" value="'test-extension'" />
+ <evaluate expression="'proceed'" />
+ </on-start>
+
+ <subflow-state id="authenticate" subflow="authn">
+ <input name="calledAsSubflow" value="true" />
+ </subflow-state>
+
+ <end-state id="end" />
+</flow>
\ No newline at end of file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment