You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by "Andreas Held (JIRA)" <ji...@apache.org> on 2006/07/28 13:12:23 UTC

[jira] Created: (SM-504) Beanflow: Multiple execution of beanflow steps

Beanflow: Multiple execution of beanflow steps
----------------------------------------------

                 Key: SM-504
                 URL: https://issues.apache.org/activemq/browse/SM-504
             Project: ServiceMix
          Issue Type: Bug
    Affects Versions: incubation
         Environment: Windows2K, running ServiceMix under JBoss4.0.3SP1
            Reporter: Andreas Held


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! 

JUnit Testcase :

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;
        }
} 


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (SM-504) Beanflow: Multiple execution of beanflow steps

Posted by "Andreas Held (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SM-504?page=comments#action_36665 ] 
            
Andreas Held commented on SM-504:
---------------------------------

To add some more information:
The first time, the steps are being executed from Workflow.java:102, I believe that this is the problem, as this calls DefaultState.set and SynchronousNotifier.run. This then exexcutes all the listeners and calls Workflow.run again. o be honest, I do not quite understand line DefaultState.java:73. What is the meaning fo the notifiers?

Regards

Andreas. 

> Beanflow: Multiple execution of beanflow steps
> ----------------------------------------------
>
>                 Key: SM-504
>                 URL: https://issues.apache.org/activemq/browse/SM-504
>             Project: ServiceMix
>          Issue Type: Bug
>    Affects Versions: incubation
>         Environment: Windows2K, running ServiceMix under JBoss4.0.3SP1
>            Reporter: Andreas Held
>         Assigned To: james strachan
>
> 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! 
> JUnit Testcase :
> 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;
>         }
> } 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Resolved: (SM-504) Beanflow: Multiple execution of beanflow steps

Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SM-504?page=all ]

Guillaume Nodet resolved SM-504.
--------------------------------

    Fix Version/s: 3.0-M3
       Resolution: Fixed

Author: gnodet
Date: Mon Jul 31 12:08:25 2006
New Revision: 427214

URL: http://svn.apache.org/viewvc?rev=427214&view=rev
Log:
SM-504: Beanflow: Multiple execution of beanflow steps

Added:
    incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/CountWorkflow.java
    incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/CountWorkflowTest.java
Modified:
    incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/Workflow.java



> Beanflow: Multiple execution of beanflow steps
> ----------------------------------------------
>
>                 Key: SM-504
>                 URL: https://issues.apache.org/activemq/browse/SM-504
>             Project: ServiceMix
>          Issue Type: Bug
>    Affects Versions: incubation
>         Environment: Windows2K, running ServiceMix under JBoss4.0.3SP1
>            Reporter: Andreas Held
>         Assigned To: Guillaume Nodet
>             Fix For: 3.0-M3
>
>
> 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! 
> JUnit Testcase :
> 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;
>         }
> } 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Assigned: (SM-504) Beanflow: Multiple execution of beanflow steps

Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SM-504?page=all ]

Guillaume Nodet reassigned SM-504:
----------------------------------

    Assignee: Guillaume Nodet  (was: james strachan)

> Beanflow: Multiple execution of beanflow steps
> ----------------------------------------------
>
>                 Key: SM-504
>                 URL: https://issues.apache.org/activemq/browse/SM-504
>             Project: ServiceMix
>          Issue Type: Bug
>    Affects Versions: incubation
>         Environment: Windows2K, running ServiceMix under JBoss4.0.3SP1
>            Reporter: Andreas Held
>         Assigned To: Guillaume Nodet
>
> 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! 
> JUnit Testcase :
> 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;
>         }
> } 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Assigned: (SM-504) Beanflow: Multiple execution of beanflow steps

Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SM-504?page=all ]

Guillaume Nodet reassigned SM-504:
----------------------------------

    Assignee: james strachan

> Beanflow: Multiple execution of beanflow steps
> ----------------------------------------------
>
>                 Key: SM-504
>                 URL: https://issues.apache.org/activemq/browse/SM-504
>             Project: ServiceMix
>          Issue Type: Bug
>    Affects Versions: incubation
>         Environment: Windows2K, running ServiceMix under JBoss4.0.3SP1
>            Reporter: Andreas Held
>         Assigned To: james strachan
>
> 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! 
> JUnit Testcase :
> 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;
>         }
> } 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira