[jboss-svn-commits] JBL Code SVN: r28843 - labs/jbosstm/branches/JBOSSTS_4_6_1_GA_CP/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:27 EDT 2009


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

Modified:
   labs/jbosstm/branches/JBOSSTS_4_6_1_GA_CP/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/branches/JBOSSTS_4_6_1_GA_CP/XTS/localjunit/src/com/arjuna/qa/junit/LocalJUnitRunner.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_6_1_GA_CP/XTS/localjunit/src/com/arjuna/qa/junit/LocalJUnitRunner.java	2009-08-05 14:33:15 UTC (rev 28842)
+++ labs/jbosstm/branches/JBOSSTS_4_6_1_GA_CP/XTS/localjunit/src/com/arjuna/qa/junit/LocalJUnitRunner.java	2009-08-05 14:33:27 UTC (rev 28843)
@@ -19,6 +19,7 @@
 {
     private String serverUrl    = null;
     private String outfile      = null;
+    private final static int LOOP_RETRY_MAX = 30;
 
     protected void setUp() throws Exception
     {
@@ -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