[jboss-svn-commits] JBL Code SVN: r28842 - labs/jbosstm/trunk/XTS/localjunit/src/com/arjuna/qa/junit.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Aug 5 10:33:15 EDT 2009


Author: adinn
Date: 2009-08-05 10:33:15 -0400 (Wed, 05 Aug 2009)
New Revision: 28842

Modified:
   labs/jbosstm/trunk/XTS/localjunit/src/com/arjuna/qa/junit/LocalJUnitRunner.java
Log:
modified local junit test runner so it gives up waiting for a test to complete after asking for the results some fixed number of times -- fixes JBTM-601

Modified: labs/jbosstm/trunk/XTS/localjunit/src/com/arjuna/qa/junit/LocalJUnitRunner.java
===================================================================
--- labs/jbosstm/trunk/XTS/localjunit/src/com/arjuna/qa/junit/LocalJUnitRunner.java	2009-08-05 14:31:30 UTC (rev 28841)
+++ labs/jbosstm/trunk/XTS/localjunit/src/com/arjuna/qa/junit/LocalJUnitRunner.java	2009-08-05 14:33:15 UTC (rev 28842)
@@ -20,6 +20,7 @@
     private String serverUrl    = null;
     private String outfile      = null;
 
+    private final static int LOOP_RETRY_MAX = 30;
     protected void setUp() throws Exception
     {
         serverUrl   = System.getProperty("serverUrl");
@@ -57,17 +58,24 @@
 
                 response = request.getResponseBodyAsString();
             }
-            while (response != null && response.indexOf("finished") == -1);
+            while (response != null && response.indexOf("finished") == -1 && index < LOOP_RETRY_MAX);
 
-            System.err.println("======================================================");
-            System.err.println("====================   RESULT    =====================");
-            System.err.println("======================================================");
-            System.err.println(response);
-
-            // writes response to the outfile
-            BufferedWriter writer = new BufferedWriter(new FileWriter(outfile));
-            writer.write(response);
-            writer.close();
+            if (response != null && response.indexOf("finished") == -1)
+            {
+                System.err.println("======================================================");
+                System.err.println("====================  TIMED OUT  =====================");
+                System.err.println("======================================================");
+                result = false;
+            } else {
+                System.err.println("======================================================");
+                System.err.println("====================   RESULT    =====================");
+                System.err.println("======================================================");
+                System.err.println(response);
+                // writes response to the outfile
+                BufferedWriter writer = new BufferedWriter(new FileWriter(outfile));
+                writer.write(response);
+                writer.close();
+            }
         }
         catch (Exception e)
         {



More information about the jboss-svn-commits mailing list