Hi

Consider the following simple Beanflow example:

public class TestWorkflow extends Workflow<String> {
        private static Logger log = 
Logger.getLogger(TestWorkflow.class.getName());
        public static int count = 0;

        public TestWorkflow() {
                super("startStep");
        }
        public String startStep() {
                count += 1;
                log.info("Workflow: Validation");
                // next step
                return "persistenceStep";
        }
        public String persistenceStep() {
                count += 1;
                log.info("Workflow: Persistence");
                //       next step
                return "transferStep";
        }
        public String transferStep() {
                count += 1;
                log.info("Workflow: Transfer");
                //       next step      
                return "stop";
        }
}

If I write a JUnit test case with assertEquals(workflow.count, 3); then this will fail, as count has a value of 5. Looking at the log shows the following output: 08:19:26,335 DEBUG [org.apache.servicemix.beanflow.Workflow.run()] About to execute step: startStep 08:19:26,351 INFO [ch.bbp.igt.comm.ServiceMix.TestWorkflow.startStep()] FileActWorkflow: Validation 08:19:26,351 DEBUG [org.apache.servicemix.beanflow.Workflow.run()] About to execute step: persistenceStep 08:19:26,351 INFO [ch.bbp.igt.comm.ServiceMix.TestWorkflow.persistenceStep()] FileActWorkflow: Persistence 08:19:26,351 DEBUG [org.apache.servicemix.beanflow.Workflow.run()] About to execute step: persistenceStep 08:19:26,351 INFO [ch.bbp.igt.comm.ServiceMix.TestWorkflow.persistenceStep()] FileActWorkflow: Persistence 08:19:26,351 DEBUG [org.apache.servicemix.beanflow.Workflow.run()] About to execute step: transferStep 08:19:26,351 INFO [ch.bbp.igt.comm.ServiceMix.TestWorkflow.transferStep()] FileActWorkflow: Transfer 08:19:26,351 DEBUG [org.apache.servicemix.beanflow.Workflow.run()] About to execute step: transferStep 08:19:26,351 INFO [ch.bbp.igt.comm.ServiceMix.TestWorkflow.transferStep()] FileActWorkflow: Transfer 08:19:26,351 DEBUG [org.apache.servicemix.beanflow.Workflow.run()] About to execute step: stop 08:19:26,367 DEBUG [org.apache.servicemix.beanflow.Workflow.run()] About to execute step: stop

This means, all steps but the start step are executed twice! This corresponds to count being 5 in the end! Am I missing something here?

Regards

Andreas



Reply via email to