diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/XmlFlowBuilder.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/XmlFlowBuilder.java index f77362dc..a99944db 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/XmlFlowBuilder.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/XmlFlowBuilder.java @@ -512,18 +512,20 @@ public class XmlFlowBuilder extends BaseFlowBuilder implements ResourceHolder { context.refresh(); return context; } - + /** * Register beans in the bean factory local to the flow definition being built. *
* Subclasses may override this metod to customize the population of the bean factory local to * the flow definition being built; for example, to register mock implementations of services in a test environment. * @param flow the current flow definition being built - * @param beanFactory the bean factory; register local beans with it using {@link ConfigurableBeanFactory#registerSingleton(String, Object)} + * @param beanFactory the bean factory; register local beans with it using + * {@link ConfigurableBeanFactory#registerSingleton(String, Object)} + * @since 1.0.4 */ protected void registerLocalBeans(Flow flow, ConfigurableBeanFactory beanFactory) { } - + private void destroyLocalServiceRegistry() { localFlowServiceLocator.pop(); } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/test/execution/AbstractXmlFlowExecutionTests.java b/spring-webflow/src/main/java/org/springframework/webflow/test/execution/AbstractXmlFlowExecutionTests.java index f00d7429..36c54924 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/test/execution/AbstractXmlFlowExecutionTests.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/test/execution/AbstractXmlFlowExecutionTests.java @@ -27,19 +27,19 @@ import org.springframework.webflow.engine.builder.xml.XmlFlowBuilder; * executes as expected. *
* Example usage: - * + * *
* public class SearchFlowExecutionTests extends AbstractXmlFlowExecutionTests {
- *
+ *
* protected FlowDefinitionResource getFlowDefinitionResource() {
* return createFlowDefinitionResource("src/main/webapp/WEB-INF/flows/search-flow.xml");
* }
- *
+ *
* public void testStartFlow() {
* startFlow();
* assertCurrentStateEquals("displaySearchCriteria");
* }
- *
+ *
* public void testDisplayCriteriaSubmitSuccess() {
* startFlow();
* MockParameterMap parameters = new MockParameterMap();
@@ -48,10 +48,10 @@ import org.springframework.webflow.engine.builder.xml.XmlFlowBuilder;
* ViewSelection view = signalEvent("search", parameters);
* assertCurrentStateEquals("displaySearchResults");
* assertModelAttributeCollectionSize(1, "results", view);
- * }
+ * }
* }
*
- *
+ *
* @author Keith Donald
* @author Erwin Vervaet
*/
@@ -64,7 +64,7 @@ public abstract class AbstractXmlFlowExecutionTests extends AbstractExternalized
public AbstractXmlFlowExecutionTests() {
super();
}
-
+
/**
* Constructs an XML flow execution test with given name.
* @param name the name of the test
@@ -81,13 +81,14 @@ public abstract class AbstractXmlFlowExecutionTests extends AbstractExternalized
}
};
}
-
+
/**
* Template method subclasses may override to register mock implementations of
* services used locally by the flow being tested.
* @param flow the flow to register the services for
* @param beanFactory the local flow service registry; register mock services with it
* using {@link ConfigurableBeanFactory#registerSingleton(String, Object)}
+ * @since 1.0.4
*/
protected void registerLocalMockServices(Flow flow, ConfigurableBeanFactory beanFactory) {
}
diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/impl/FlowExecutionImplTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/impl/FlowExecutionImplTests.java
index d02d8745..406691c4 100644
--- a/spring-webflow/src/test/java/org/springframework/webflow/engine/impl/FlowExecutionImplTests.java
+++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/impl/FlowExecutionImplTests.java
@@ -64,13 +64,13 @@ import org.springframework.webflow.test.MockFlowServiceLocator;
/**
* General flow execution tests.
- *
+ *
* @author Keith Donald
* @author Erwin Vervaet
* @author Ben Hale
*/
public class FlowExecutionImplTests extends TestCase {
-
+
public void testExceptionHandlingWithEvaluateAction() {
FlowBuilder flowBuilder = new XmlFlowBuilder(new ClassPathResource("fooFlow.xml", getClass()));
Flow flow = new FlowAssembler("fooFlow", flowBuilder).assembleFlow();
@@ -79,7 +79,7 @@ public class FlowExecutionImplTests extends TestCase {
assertEquals("showFooException", ((ApplicationView)view).getViewName());
assertFalse(flowExecution.isActive());
}
-
+
public void testExceptionWhileHandlingException() {
MockFlowServiceLocator serviceLocator = new MockFlowServiceLocator();
serviceLocator.registerBean("testAction", new ExceptionThrowingAction());
@@ -254,7 +254,7 @@ public class FlowExecutionImplTests extends TestCase {
execution.refresh(context);
execution.signalEvent("view", context);
}
-
+
public void testUnhandledExceptionThrownBeforeSessionStartup() {
FlowBuilder flowBuilder = new XmlFlowBuilder(new ClassPathResource("runtime-exception.xml",
getClass()));
@@ -269,10 +269,11 @@ public class FlowExecutionImplTests extends TestCase {
try {
flowExecution.start(new LocalAttributeMap(), new MockExternalContext());
fail("Should have thrown a FlowExecutionException, not any other type");
- } catch (FlowExecutionException e) {
- }
+ }
+ catch (FlowExecutionException e) {
+ }
}
-
+
public void testExceptionFromInputMapper() {
FlowBuilder flowBuilder = new XmlFlowBuilder(new ClassPathResource("runtime-exception.xml",
getClass()));
@@ -281,10 +282,11 @@ public class FlowExecutionImplTests extends TestCase {
try {
flowExecution.start(new LocalAttributeMap(), new MockExternalContext());
fail("Should have thrown a FlowExecutionException, not any other type");
- } catch (FlowExecutionException e) {
+ }
+ catch (FlowExecutionException e) {
}
}
-
+
public void testExceptionWithListener() {
FlowBuilder flowBuilder = new XmlFlowBuilder(new ClassPathResource("runtime-exception.xml",
getClass()));
@@ -295,12 +297,13 @@ public class FlowExecutionImplTests extends TestCase {
try {
flowExecution.start(new LocalAttributeMap(), new MockExternalContext());
fail("Should have thrown a FlowExecutionException, not any other type");
- } catch (FlowExecutionException e) {
+ }
+ catch (FlowExecutionException e) {
}
assertTrue("Listener should have been called on exception", listener.getExceptionFired());
}
-
+
public void testExceptionWithHandler() {
FlowBuilder flowBuilder = new XmlFlowBuilder(new ClassPathResource("runtime-exception.xml",
getClass()));
@@ -319,7 +322,7 @@ public class FlowExecutionImplTests extends TestCase {
protected TargetStateResolver toState(String stateId) {
return new DefaultTargetStateResolver(stateId);
}
-
+
public static ViewSelector selectView(String viewName) {
return new ApplicationViewSelector(new StaticExpression(viewName));
}
@@ -358,9 +361,9 @@ public class FlowExecutionImplTests extends TestCase {
}
private class FlowExceptionListener extends FlowExecutionListenerAdapter {
-
+
private boolean exceptionFired = false;
-
+
public boolean getExceptionFired() {
return exceptionFired;
}
@@ -371,9 +374,9 @@ public class FlowExecutionImplTests extends TestCase {
}
private class FlowExceptionHandler implements FlowExecutionExceptionHandler {
-
+
private boolean exceptionHandled = false;
-
+
public boolean getExceptionHandled() {
return exceptionHandled;
}
@@ -386,6 +389,6 @@ public class FlowExecutionImplTests extends TestCase {
public boolean handles(FlowExecutionException exception) {
return true;
}
-
+
}
}
\ No newline at end of file
diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/impl/MiscFlowExecutionTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/impl/MiscFlowExecutionTests.java
index 37955844..12d69fa7 100644
--- a/spring-webflow/src/test/java/org/springframework/webflow/engine/impl/MiscFlowExecutionTests.java
+++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/impl/MiscFlowExecutionTests.java
@@ -69,7 +69,7 @@ public class MiscFlowExecutionTests extends TestCase {
ApplicationView view = (ApplicationView)execution.start(input, new MockExternalContext());
assertEquals(new Long(23), view.getModel().get("id"));
}
-
+
public void testRequiredMappingException() {
XmlFlowBuilder builder = new XmlFlowBuilder(new ClassPathResource("required-mapping.xml", getClass()));
Flow flow = new FlowAssembler("myFlow", builder).assembleFlow();
@@ -77,7 +77,8 @@ public class MiscFlowExecutionTests extends TestCase {
try {
execution.start(null, new MockExternalContext());
fail("Should have thrown a FlowExecutionException");
- } catch (FlowExecutionException e) {
+ }
+ catch (FlowExecutionException e) {
assertTrue("Root cause should have been a RequiredMappingException",
e.getRootCause() instanceof RequiredMappingException);
}