You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Andreas Held <hl...@bbp.ch> on 2006/07/25 08:24:26 UTC
Problem with Beanflow
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
Re: Problem with Beanflow
Posted by James Strachan <ja...@gmail.com>.
I think Guillaume fixed it the other day BTW :)
On 7/28/06, AndreasH <hl...@bbp.ch> wrote:
>
> Hi Guillaume
>
> Done in SM-504; sorry no patch available so far.
>
> Regards
>
> Andreas
>
> --
> View this message in context: http://www.nabble.com/Problem-with-Beanflow-tf1996591.html#a5537662
> Sent from the ServiceMix - User forum at Nabble.com.
>
>
--
James
-------
http://radio.weblogs.com/0112098/
Re: Problem with Beanflow
Posted by AndreasH <hl...@bbp.ch>.
Hi Guillaume
Done in SM-504; sorry no patch available so far.
Regards
Andreas
--
View this message in context: http://www.nabble.com/Problem-with-Beanflow-tf1996591.html#a5537662
Sent from the ServiceMix - User forum at Nabble.com.
Re: Problem with Beanflow
Posted by Guillaume Nodet <gn...@gmail.com>.
Could you please raise a JIRA and attach your test case ?
If you have time to find a pacth, that would be great also ... ;)
Cheers,
Guillaume Nodet
On 7/28/06, AndreasH <hl...@bbp.ch> wrote:
>
>
> James,
>
> Any news on this issue?
>
> Regards
>
> Andreas
>
>
> --
> View this message in context:
> http://www.nabble.com/Problem-with-Beanflow-tf1996591.html#a5536962
> Sent from the ServiceMix - User forum at Nabble.com.
>
>
--
Cheers,
Guillaume Nodet
Re: Problem with Beanflow
Posted by AndreasH <hl...@bbp.ch>.
James,
Any news on this issue?
Regards
Andreas
--
View this message in context: http://www.nabble.com/Problem-with-Beanflow-tf1996591.html#a5536962
Sent from the ServiceMix - User forum at Nabble.com.
Re: Problem with Beanflow
Posted by AndreasH <hl...@bbp.ch>.
Hi James,
Here is my JUnit test, stripped down to the bare essentials:
public class WorkflowTest extends TestCase {
public WorkflowTest(String s) {
super(s);
}
protected void setUp() {
}
protected void tearDown() {
}
public void testTest() throws Exception {
TestWorkflow workflow = new TestWorkflow();
workflow.start();
Thread.sleep(2000);
assertEquals(3, workflow.count);
}
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTest(new WorkflowTest("testTest"));
return suite;
}
}
I forgot to mention, I am using servicemix SVN trunk! Thanks for your help.
Regards
Andreas
--
View this message in context: http://www.nabble.com/Problem-with-Beanflow-tf1996591.html#a5480649
Sent from the ServiceMix - User forum at Nabble.com.
Re: Problem with Beanflow
Posted by James Strachan <ja...@gmail.com>.
Could you attach the JUnit test case you are using too so we can try
out your code too?
On 7/25/06, Andreas Held <hl...@bbp.ch> wrote:
> 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
>
>
>
>
--
James
-------
http://radio.weblogs.com/0112098/