You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by js...@apache.org on 2006/08/24 15:14:50 UTC

svn commit: r434394 - in /incubator/servicemix/trunk/servicemix-beanflow/src: main/java/org/apache/servicemix/beanflow/ main/java/org/apache/servicemix/beanflow/support/ test/java/org/apache/servicemix/beanflow/

Author: jstrachan
Date: Thu Aug 24 06:14:47 2006
New Revision: 434394

URL: http://svn.apache.org/viewvc?rev=434394&view=rev
Log:
added a test case and a fix for SM-439, to avoid forking child activities in the constructor of a JoinSupport() but rather later on when the activity is started. Also did a minor refactor of Enum related helper methods into EnumHelper and also fixed the commented out test cas RunnableStepWorkflowTest

Added:
    incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/support/EnumHelper.java   (with props)
    incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/JoinTest.java   (with props)
Modified:
    incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/AbstractActivity.java
    incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/Activity.java
    incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/JoinSupport.java
    incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/ProxyActivity.java
    incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/Workflow.java
    incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/support/ReflectionInterpreter.java
    incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/BadWorkflowTest.java
    incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/ExampleStringWorkflow.java
    incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/ParallelActivityTest.java
    incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/RunnableStepWorkflowTest.java
    incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/StringWorkflowTest.java
    incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/WorkflowTest.java

Modified: incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/AbstractActivity.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/AbstractActivity.java?rev=434394&r1=434393&r2=434394&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/AbstractActivity.java (original)
+++ incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/AbstractActivity.java Thu Aug 24 06:14:47 2006
@@ -21,6 +21,7 @@
 
 import java.util.Iterator;
 import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
 
 /**
  * A useful base class which allows simple bean activities to be written easily.
@@ -145,12 +146,36 @@
         });
         while (!isStopped()) {
             try {
-                latch.await();
+                latch.await(2, TimeUnit.SECONDS);
             }
             catch (InterruptedException e) {
                 Thread.currentThread().interrupt();
             }
         }
+    }
+    
+    /**
+     * A helper method to block the calling thread up until some maximum timeout until the activity
+     * completes or the timeout expires
+     * 
+     * @return true if the activity stopped within the given time or false if not.
+     */
+    public boolean join(int time, TimeUnit unit) {
+        final CountDownLatch latch = new CountDownLatch(1);
+        onStop(new Runnable() {
+            public void run() {
+                latch.countDown();
+            }
+        });
+        if (!isStopped()) {
+            try {
+                latch.await(time, unit);
+            }
+            catch (InterruptedException e) {
+                Thread.currentThread().interrupt();
+            }
+        }
+        return isStopped();
     }
 
     // Implementation methods

Modified: incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/Activity.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/Activity.java?rev=434394&r1=434393&r2=434394&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/Activity.java (original)
+++ incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/Activity.java Thu Aug 24 06:14:47 2006
@@ -17,6 +17,7 @@
 package org.apache.servicemix.beanflow;
 
 import java.util.Timer;
+import java.util.concurrent.TimeUnit;
 
 /**
  * Represents an activity (step) in a workflow written typically using regular
@@ -105,4 +106,12 @@
      * similar to {@link Thread#join()}
      */
     public void join();
+
+    /**
+     * A helper method to block the calling thread up until some maximum timeout until the activity
+     * completes or the timeout expires
+     * 
+     * @return true if the activity stopped within the given time or false if not.
+     */
+    public boolean join(int time, TimeUnit unit);
 }

Modified: incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/JoinSupport.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/JoinSupport.java?rev=434394&r1=434393&r2=434394&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/JoinSupport.java (original)
+++ incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/JoinSupport.java Thu Aug 24 06:14:47 2006
@@ -34,13 +34,15 @@
 
     public JoinSupport(List<Activity> activities) {
         for (Activity activity : activities) {
-            fork(activity);
+            activity.getState().addRunnable(this);
+            children.add(activity);
         }
     }
 
     public JoinSupport(Activity... activities) {
         for (Activity activity : activities) {
-            fork(activity);
+            activity.getState().addRunnable(this);
+            children.add(activity);
         }
     }
 

Modified: incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/ProxyActivity.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/ProxyActivity.java?rev=434394&r1=434393&r2=434394&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/ProxyActivity.java (original)
+++ incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/ProxyActivity.java Thu Aug 24 06:14:47 2006
@@ -17,6 +17,7 @@
 package org.apache.servicemix.beanflow;
 
 import java.util.Timer;
+import java.util.concurrent.TimeUnit;
 
 /**
  * A simple proxy to an underlying activity making it easy to compose activities
@@ -78,6 +79,10 @@
 
     public void join() {
         getProxy().join();
+    }
+    
+    public boolean join(int time, TimeUnit unit) {
+        return getProxy().join(time, unit);
     }
 
     protected Activity getProxy() {

Modified: incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/Workflow.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/Workflow.java?rev=434394&r1=434393&r2=434394&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/Workflow.java (original)
+++ incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/Workflow.java Thu Aug 24 06:14:47 2006
@@ -18,11 +18,10 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.servicemix.beanflow.support.EnumHelper;
 import org.apache.servicemix.beanflow.support.Interpreter;
 import org.apache.servicemix.beanflow.support.ReflectionInterpreter;
 
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
 import java.util.Timer;
 import java.util.concurrent.Executor;
 import java.util.concurrent.Executors;
@@ -37,9 +36,6 @@
 public class Workflow<T> extends JoinSupport {
     private static final Log log = LogFactory.getLog(Workflow.class);
 
-    private static final Class[] NO_PARAMETER_TYPES = {};
-    private static final Object[] NO_PARAMETER_VALUES = {};
-
     private Executor executor;
     private Interpreter interpreter;
     private State<T> step;
@@ -161,11 +157,11 @@
      * the join
      */
     public void join(JoinSupport joinFlow, T joinedStep, long timeout) {
-        // start the join activity and register the timeout
-        fork(timeout, joinFlow);
-
         // when the join completes move to the next step
         joinFlow.onStop(createGoToStepTask(joinedStep));
+        
+        // start the join activity and register the timeout
+        fork(timeout, joinFlow);
     }
 
     /**
@@ -225,7 +221,7 @@
     protected void validateStepsExist(Class enumType) {
         Object[] values = null;
         try {
-            values = getEnumValues(enumType);
+            values = EnumHelper.getEnumValues(enumType);
         }
         catch (Exception e) {
             fail("Cannot get the values of the enumeration: " + enumType.getName(), e);
@@ -237,7 +233,7 @@
 
     protected static Object getFirstStep(Class enumType) {
         try {
-            Object[] values = getEnumValues(enumType);
+            Object[] values = EnumHelper.getEnumValues(enumType);
             return values[0];
         }
         catch (Exception e) {
@@ -245,8 +241,4 @@
         }
     }
 
-    protected static Object[] getEnumValues(Class enumType) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
-        Method method = enumType.getMethod("values", NO_PARAMETER_TYPES);
-        return (Object[]) method.invoke(null, NO_PARAMETER_VALUES);
-    }
 }

Added: incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/support/EnumHelper.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/support/EnumHelper.java?rev=434394&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/support/EnumHelper.java (added)
+++ incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/support/EnumHelper.java Thu Aug 24 06:14:47 2006
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.beanflow.support;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+/**
+ * A helper class for working with enums
+ * 
+ * @version $Revision$
+ */
+public class EnumHelper {
+    private static final Class[] NO_PARAMETER_TYPES = {};
+    private static final Object[] NO_PARAMETER_VALUES = {};
+
+    public static Object[] getEnumValues(Class enumType) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
+        Method method = enumType.getMethod("values", NO_PARAMETER_TYPES);
+        return (Object[]) method.invoke(null, NO_PARAMETER_VALUES);
+    }
+}

Propchange: incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/support/EnumHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/support/EnumHelper.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/support/ReflectionInterpreter.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/support/ReflectionInterpreter.java?rev=434394&r1=434393&r2=434394&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/support/ReflectionInterpreter.java (original)
+++ incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/support/ReflectionInterpreter.java Thu Aug 24 06:14:47 2006
@@ -69,11 +69,25 @@
      * @param nextStep
      */
     protected void goToNextSequence(T nextStep, Workflow<T> workflow) {
-        //if (!workflow.isNextStepAvailable()) {
-
-            // TODO we could automatically go to the next step in the enum list?
+        if (nextStep instanceof Enum) {
+            Enum step = (Enum) nextStep;
+            try {
+                Object[] enumValues = EnumHelper.getEnumValues(step.getClass());
+                int index = step.ordinal();
+                if (++index < enumValues.length) {
+                    workflow.setNextStep((T) enumValues[index]);
+                }
+                else {
+                    workflow.stop();
+                }
+            }
+            catch (Exception e) {
+                workflow.fail("Could not extract the values of the enum: " + nextStep + " due to: " + e, e);
+            }
+        }
+        else {
             workflow.suspend();
-        //}
+        }
     }
 
     public void executeNamedStep(String step, Workflow<T> workflow) {

Modified: incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/BadWorkflowTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/BadWorkflowTest.java?rev=434394&r1=434393&r2=434394&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/BadWorkflowTest.java (original)
+++ incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/BadWorkflowTest.java Thu Aug 24 06:14:47 2006
@@ -16,8 +16,6 @@
  */
 package org.apache.servicemix.beanflow;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.servicemix.beanflow.util.ActivityTestSupport;
 
 /**
@@ -25,8 +23,6 @@
  * @version $Revision: $
  */
 public class BadWorkflowTest extends ActivityTestSupport {
-
-    private static final Log log = LogFactory.getLog(BadWorkflowTest.class);
 
     public void testWorkflow() throws Exception {
         BadWorkflow workflow = new BadWorkflow();

Modified: incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/ExampleStringWorkflow.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/ExampleStringWorkflow.java?rev=434394&r1=434393&r2=434394&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/ExampleStringWorkflow.java (original)
+++ incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/ExampleStringWorkflow.java Thu Aug 24 06:14:47 2006
@@ -30,7 +30,7 @@
     private static final Log log = LogFactory.getLog(ExampleStringWorkflow.class);
 
     private int loopCount;
-    private long timeout = 500;
+    private long timeout = 1000;
     private String userEmailAddress;
 
     public ExampleStringWorkflow() {

Added: incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/JoinTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/JoinTest.java?rev=434394&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/JoinTest.java (added)
+++ incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/JoinTest.java Thu Aug 24 06:14:47 2006
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.beanflow;
+
+import org.apache.servicemix.beanflow.util.ActivityTestSupport;
+
+import java.util.concurrent.TimeUnit;
+
+import junit.framework.TestCase;
+
+/**
+ * 
+ * @version $Revision$
+ */
+public class JoinTest extends ActivityTestSupport {
+
+    public static class JoinFlow extends Workflow<JoinFlow.Step> {
+
+        public static enum Step {
+            first, stop
+        }
+
+        public JoinFlow() {
+            super(Step.first);
+        }
+
+        public void first() {
+            final Activity a = new TimeoutActivity() {
+                protected void onValidStateChange() {
+                    System.out.println("in a");
+                    stop();
+                    System.out.println("a now stopped");
+                }
+            };
+            final Activity b = new TimeoutActivity() {
+                protected void onValidStateChange() {
+                    System.out.println("in b");
+                    stop();
+                    System.out.println("b now stopped");
+                }
+            };
+            System.out.println("in first");
+            joinAll(Step.stop, 10000, a, b);
+            System.out.println("after join");
+        }
+    }
+
+    public void testJoin() throws Exception {
+        JoinFlow flow = new JoinFlow();
+        flow.start();
+        System.out.println("waiting for top flow to stop");
+        flow.join(20, TimeUnit.SECONDS);
+        assertStopped(flow);
+        System.out.println("complete!");
+    }
+
+}
\ No newline at end of file

Propchange: incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/JoinTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/JoinTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/ParallelActivityTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/ParallelActivityTest.java?rev=434394&r1=434393&r2=434394&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/ParallelActivityTest.java (original)
+++ incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/ParallelActivityTest.java Thu Aug 24 06:14:47 2006
@@ -20,6 +20,7 @@
 
 import java.util.concurrent.Executor;
 import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
 
 /**
  * 
@@ -38,7 +39,8 @@
         activity.startWithTimeout(timer, 20000);
         // END SNIPPET: example
 
-        activity.join();
+        activity.join(10, TimeUnit.SECONDS);
+
         parallelBean.assertCompleted();
         assertStopped(activity);
     }

Modified: incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/RunnableStepWorkflowTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/RunnableStepWorkflowTest.java?rev=434394&r1=434393&r2=434394&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/RunnableStepWorkflowTest.java (original)
+++ incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/RunnableStepWorkflowTest.java Thu Aug 24 06:14:47 2006
@@ -18,6 +18,8 @@
 
 import org.apache.servicemix.beanflow.util.ActivityTestSupport;
 
+import java.util.concurrent.TimeUnit;
+
 /**
  * 
  * @version $Revision: $
@@ -28,9 +30,8 @@
         Workflow<RunnableSteps> workflow = new Workflow<RunnableSteps>(RunnableSteps.class);
         workflow.start();
 
-        Thread.sleep(2000);
-
-        // TODO FIXME
-        //assertStopped(workflow);
+        workflow.join(10, TimeUnit.SECONDS);
+        
+        assertStopped(workflow);
     }
 }

Modified: incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/StringWorkflowTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/StringWorkflowTest.java?rev=434394&r1=434393&r2=434394&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/StringWorkflowTest.java (original)
+++ incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/StringWorkflowTest.java Thu Aug 24 06:14:47 2006
@@ -20,6 +20,8 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.servicemix.beanflow.util.ActivityTestSupport;
 
+import java.util.concurrent.TimeUnit;
+
 /**
  * 
  * @version $Revision: $
@@ -43,7 +45,7 @@
 
         workflow.userEntered("foo@bar.com");
 
-        Thread.sleep(5000);
+        workflow.join(10, TimeUnit.SECONDS);
 
         assertStopped(workflow);
     }

Modified: incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/WorkflowTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/WorkflowTest.java?rev=434394&r1=434393&r2=434394&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/WorkflowTest.java (original)
+++ incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/WorkflowTest.java Thu Aug 24 06:14:47 2006
@@ -20,6 +20,8 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.servicemix.beanflow.util.ActivityTestSupport;
 
+import java.util.concurrent.TimeUnit;
+
 /**
  * 
  * @version $Revision: $
@@ -43,7 +45,7 @@
 
         workflow.userEntered("foo@bar.com");
 
-        Thread.sleep(5000);
+        workflow.join(10, TimeUnit.SECONDS);
 
         assertStopped(workflow);
     }