[jboss-svn-commits] JBL Code SVN: r30166 - in labs/jbosstm/trunk/qa: tests/src/org/jboss/jbossts/qa/Utils and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Nov 16 06:47:12 EST 2009


Author: jhalliday
Date: 2009-11-16 06:47:11 -0500 (Mon, 16 Nov 2009)
New Revision: 30166

Modified:
   labs/jbosstm/trunk/qa/run-tests.xml
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/Utils/CrashRecoveryDelays.java
Log:
Tune crash rec tests delay. JBTM-390


Modified: labs/jbosstm/trunk/qa/run-tests.xml
===================================================================
--- labs/jbosstm/trunk/qa/run-tests.xml	2009-11-16 02:39:38 UTC (rev 30165)
+++ labs/jbosstm/trunk/qa/run-tests.xml	2009-11-16 11:47:11 UTC (rev 30166)
@@ -141,13 +141,13 @@
          <antcall target="junit-tests"><param name="tests" value="crashrecovery05_2"/></antcall>
         <!-- crashrecovery06 : 2 tests, 1 minute -->
         <antcall target="junit-tests"><param name="tests" value="crashrecovery06"/></antcall>
-        <!-- crashrecovery07 : 16 tests, 12 minutes -->
+        <!-- crashrecovery07 : 16 tests, 4 minutes -->
         <antcall target="junit-tests"><param name="tests" value="crashrecovery07"/></antcall>
-        <!-- crashrecovery08 : 32 tests, 32 minutes -->
+        <!-- crashrecovery08 : 32 tests, 11 minutes -->
          <antcall target="junit-tests"><param name="tests" value="crashrecovery08"/></antcall>
-        <!-- crashrecovery09 : 6 tests, 4 minutes -->
+        <!-- crashrecovery09 : 6 tests, 2 minutes -->
         <antcall target="junit-tests"><param name="tests" value="crashrecovery09"/></antcall>
-        <!-- crashrecovery10 : 6 tests, 4 minutes -->
+        <!-- crashrecovery10 : 6 tests, 2 minutes -->
         <antcall target="junit-tests"><param name="tests" value="crashrecovery10"/></antcall>
         <!-- crashrecovery12 : 7 tests, 5 minutes -->
         <antcall target="junit-tests"><param name="tests" value="crashrecovery12"/></antcall>
@@ -362,12 +362,14 @@
 ait01_ots_transactionmanager.java
 aitresources01.java
 crashrecovery13.java
+
 jdbclocals01_ibmdb2_jndi.java
 jdbclocals01_ms_sql_jndi.java
 jdbclocals01_mysql_jndi.java
 jdbclocals01_oracle_jndi.java
 jdbclocals01_postgresql_jndi.java
 jdbclocals01_sybase_jndi.java
+
 jdbcresources03_oracle_thin_jndi.java
 jdbcresources04_oracle_thin_jndi.java
 

Modified: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/Utils/CrashRecoveryDelays.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/Utils/CrashRecoveryDelays.java	2009-11-16 02:39:38 UTC (rev 30165)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/Utils/CrashRecoveryDelays.java	2009-11-16 11:47:11 UTC (rev 30166)
@@ -20,9 +20,14 @@
  */
 package org.jboss.jbossts.qa.Utils;
 
-import com.arjuna.ats.arjuna.common.RecoveryEnvironmentBean;
 import com.arjuna.ats.arjuna.common.recoveryPropertyManager;
 
+import java.io.BufferedReader;
+import java.io.PrintStream;
+import java.io.InputStreamReader;
+import java.net.Socket;
+import java.net.InetAddress;
+
 /**
  * Utility class to hold delay functions for crash recovery tests.
  *
@@ -47,6 +52,8 @@
         awaitRecovery(1, 1);
     }
 
+/*
+    // old, slow method - sleep long enough to ensure periodic cr will have occurred.
     private static void awaitRecovery(int num_cycles, int num_clients) throws InterruptedException
     {
         // Note: this assumes the client is running with the same config as the rec mgr process.
@@ -58,7 +65,63 @@
         System.out.println("Sleeping for " + delay + " ms.");
         Thread.sleep(delay);
     }
+*/
 
+    private static void awaitRecovery(int num_cycles, int num_clients) throws InterruptedException
+    {
+        for(int i = 0; i < num_cycles; i++) {
+            doRecovery();
+        }
+    }
+
+    // prod the recovery manager via its socket. This avoid any sleep delay.
+    private static void doRecovery() throws InterruptedException
+    {
+        int port = recoveryPropertyManager.getRecoveryEnvironmentBean().getRecoveryPort();
+
+        BufferedReader in = null;
+        PrintStream out = null;
+        Socket sckt = null;
+
+        try
+        {
+            sckt = new Socket(InetAddress.getLocalHost(),port);
+
+            in = new BufferedReader(new InputStreamReader(sckt.getInputStream()));
+            out = new PrintStream(sckt.getOutputStream());
+
+            // Output ping message
+            out.println("SCAN");
+
+            // Receive pong message
+            String inMessage = in.readLine();
+
+            if(!inMessage.equals("DONE")) {
+                System.err.println("Recovery failed with message: "+inMessage);
+            }
+        }
+        catch (Exception ex)
+        {
+            ex.printStackTrace();
+        }
+        finally
+        {
+            try {
+                if ( in != null )
+                {
+                    in.close();
+                }
+
+                if ( out != null )
+                {
+                    out.close();
+                }
+
+                sckt.close();
+            } catch(Exception e) {}
+        }
+    }
+
     /////////////////
 
     public static void awaitReplayCompletionCR01() throws InterruptedException {



More information about the jboss-svn-commits mailing list