Announcement Announcement Module
Collapse
No announcement yet.
AbstractXmlFlowExecutionTests for inherited flow Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • AbstractXmlFlowExecutionTests for inherited flow

    Is it currently possible to write a unit test for an inherited flow? I'm created a very simple sample one, but it doesn't appear that there's a way to create the correct FlowDefinitionResources in getResource().

    Code:
        @Override
        protected FlowDefinitionResource getResource(FlowDefinitionResourceFactory factory) {
            return factory.createClassPathResource("/com/sample/a.xml, /com/sample/b.xml", getClass());
        }
    .. is invalid.

    while only including the inherited flow causes

    Code:
    org.springframework.webflow.engine.model.registry.FlowModelConstructionException: An exception occurred constructing the flow 'b'
    	at org.springframework.webflow.engine.model.registry.DefaultFlowModelHolder.assembleFlowModel(DefaultFlowModelHolder.java:109)
    	at org.springframework.webflow.engine.model.registry.DefaultFlowModelHolder.getFlowModel(DefaultFlowModelHolder.java:80)
    	at org.springframework.webflow.engine.builder.model.FlowModelFlowBuilder.doInit(FlowModelFlowBuilder.java:114)
    	at org.springframework.webflow.engine.builder.support.AbstractFlowBuilder.init(AbstractFlowBuilder.java:54)
    	at org.springframework.webflow.engine.builder.FlowAssembler.assembleFlow(FlowAssembler.java:90)
    	at org.springframework.webflow.test.execution.AbstractExternalizedFlowExecutionTests.buildFlow(AbstractExternalizedFlowExecutionTests.java:150)
    	at org.springframework.webflow.test.execution.AbstractExternalizedFlowExecutionTests.getFlowDefinition(AbstractExternalizedFlowExecutionTests.java:131)
    	at org.springframework.webflow.test.execution.AbstractFlowExecutionTests.startFlow(AbstractFlowExecutionTests.java:105)
    	at com.sample.BFlowTest.testStartFlow(BFlowTest.java:13)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at junit.framework.TestCase.runTest(TestCase.java:164)
    	at junit.framework.TestCase.runBare(TestCase.java:130)
    	at junit.framework.TestResult$1.protect(TestResult.java:106)
    	at junit.framework.TestResult.runProtected(TestResult.java:124)
    	at junit.framework.TestResult.run(TestResult.java:109)
    	at junit.framework.TestCase.run(TestCase.java:120)
    	at junit.framework.TestSuite.runTest(TestSuite.java:230)
    	at junit.framework.TestSuite.run(TestSuite.java:225)
    	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
    	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
    Caused by: org.springframework.webflow.engine.model.builder.FlowModelBuilderException: Unable to find flow 'a' to inherit from
    	at org.springframework.webflow.engine.model.builder.xml.XmlFlowModelBuilder.build(XmlFlowModelBuilder.java:132)
    	at org.springframework.webflow.engine.model.registry.DefaultFlowModelHolder.assembleFlowModel(DefaultFlowModelHolder.java:106)
    	... 26 more
    Caused by: org.springframework.webflow.engine.model.registry.NoSuchFlowModelException: No flow model 'a' found
    	at org.springframework.webflow.engine.model.registry.FlowModelRegistryImpl.getFlowModelHolder(FlowModelRegistryImpl.java:94)
    	at org.springframework.webflow.engine.model.registry.FlowModelRegistryImpl.getFlowModel(FlowModelRegistryImpl.java:61)
    	at org.springframework.webflow.engine.model.builder.xml.XmlFlowModelBuilder.build(XmlFlowModelBuilder.java:130)
    	... 27 more
    As I see it, we should have something like

    Code:
        protected FlowDefinitionResource[] getResources(FlowDefinitionResourceFactory factory) {
            return new FlowDefinitionResource[] {
                    factory.createClassPathResource("/com/sample/a.xml", getClass()),
                    factory.createClassPathResource("/com/sample/b.xml", getClass())
            };
        }
    Am I correct on this one, or just way off base?

  • #2
    http://jira.springframework.org/browse/SWF-553

    Patch included.

    Comment

    Working...
    X