You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by mc...@apache.org on 2008/04/03 12:41:05 UTC

svn commit: r644255 - /incubator/tuscany/java/sca/itest/oneway/src/test/java/org/apache/tuscany/sca/itest/oneway/OneWayTestCase.java

Author: mcombellack
Date: Thu Apr  3 03:40:56 2008
New Revision: 644255

URL: http://svn.apache.org/viewvc?rev=644255&view=rev
Log:
TUSCANY-2192 Fixed test failure that can occur when computer is heavily loaded and the @OnwWay operations take a little longer to complete

Modified:
    incubator/tuscany/java/sca/itest/oneway/src/test/java/org/apache/tuscany/sca/itest/oneway/OneWayTestCase.java

Modified: incubator/tuscany/java/sca/itest/oneway/src/test/java/org/apache/tuscany/sca/itest/oneway/OneWayTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/oneway/src/test/java/org/apache/tuscany/sca/itest/oneway/OneWayTestCase.java?rev=644255&r1=644254&r2=644255&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/oneway/src/test/java/org/apache/tuscany/sca/itest/oneway/OneWayTestCase.java (original)
+++ incubator/tuscany/java/sca/itest/oneway/src/test/java/org/apache/tuscany/sca/itest/oneway/OneWayTestCase.java Thu Apr  3 03:40:56 2008
@@ -33,6 +33,11 @@
 import org.junit.Test;
 
 public class OneWayTestCase {
+    /**
+     * Maximum period of time that we are prepared to wait for all the @OneWay
+     * method calls to complete in milliseconds.
+     */
+    private static final int MAX_SLEEP_TIME = 10000;
 
     private SCADomain domain;
 
@@ -66,7 +71,17 @@
                // System.out.flush();
                 client.doSomething(count);
 
-                Thread.sleep(2000);
+                // TUSCANY-2192 - We need to sleep to allow the @OneWay method calls to complete.
+                // Note: This can take different periods depending on the speed and load
+                // on the computer where the test is being run.
+                // This loop will wait for the required number of @OneWay method calls to
+                // have taken place or MAX_SLEEP_TIME to have passed.
+                long startSleep = System.currentTimeMillis();
+                while (OneWayClientImpl.callCount != OneWayServiceImpl.callCount 
+                        && System.currentTimeMillis() - startSleep < MAX_SLEEP_TIME) {
+                    Thread.sleep(100);
+                    // System.out.println("" + OneWayClientImpl.callCount + "," + OneWayServiceImpl.callCount);
+                }
 
                 System.out.println("Finished callCount = " + OneWayServiceImpl.callCount);
 



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org