KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > webflow > test > execution > AbstractXmlFlowExecutionTests


1 /*
2  * Copyright 2002-2006 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.springframework.webflow.test.execution;
17
18 import org.springframework.core.io.Resource;
19 import org.springframework.webflow.engine.builder.FlowBuilder;
20 import org.springframework.webflow.engine.builder.FlowServiceLocator;
21 import org.springframework.webflow.engine.builder.xml.XmlFlowBuilder;
22
23 /**
24  * Base class for flow integration tests that verify an XML flow definition
25  * executes as expected.
26  * <p>
27  * Example usage:
28  *
29  * <pre>
30  * public class SearchFlowExecutionTests extends AbstractXmlFlowExecutionTests {
31  *
32  * protected FlowDefinitionResource getFlowDefinitionResource() {
33  * return createFlowDefinitionResource("src/main/webapp/WEB-INF/flows/search-flow.xml");
34  * }
35  *
36  * public void testStartFlow() {
37  * startFlow();
38  * assertCurrentStateEquals(&quot;displaySearchCriteria&quot;);
39  * }
40  *
41  * public void testDisplayCriteriaSubmitSuccess() {
42  * startFlow();
43  * MockParameterMap parameters = new MockParameterMap();
44  * parameters.put(&quot;firstName&quot;, &quot;Keith&quot;);
45  * parameters.put(&quot;lastName&quot;, &quot;Donald&quot;);
46  * ViewSelection view = signalEvent(&quot;search&quot;, parameters);
47  * assertCurrentStateEquals(&quot;displaySearchResults&quot;);
48  * assertModelAttributeCollectionSize(1, &quot;results&quot;, view);
49  * }
50  * }
51  * </pre>
52  *
53  * @author Keith Donald
54  */

55 public abstract class AbstractXmlFlowExecutionTests extends AbstractExternalizedFlowExecutionTests {
56     
57     protected final FlowBuilder createFlowBuilder(Resource resource, FlowServiceLocator flowServiceLocator) {
58         return new XmlFlowBuilder(resource, flowServiceLocator);
59     }
60 }
Popular Tags