qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raj...@apache.org
Subject svn commit: r885635 - /qpid/trunk/qpid/java/testkit/testkit.py
Date Tue, 01 Dec 2009 00:41:47 GMT
Author: rajith
Date: Tue Dec  1 00:41:44 2009
New Revision: 885635

URL: http://svn.apache.org/viewvc?rev=885635&view=rev
Log:
Added improved error handling
Modified the script to adapt to changes made by Alan in brokertest.py
The testkit can now receive and handle errors published by the JMS sender or receiver via
an error queue.
For example if the test detects and out of order message it will notify the test framework
and it will use that information to throw an exception with the captured java stack trace.

Modified:
    qpid/trunk/qpid/java/testkit/testkit.py

Modified: qpid/trunk/qpid/java/testkit/testkit.py
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/testkit/testkit.py?rev=885635&r1=885634&r2=885635&view=diff
==============================================================================
--- qpid/trunk/qpid/java/testkit/testkit.py (original)
+++ qpid/trunk/qpid/java/testkit/testkit.py Tue Dec  1 00:41:44 2009
@@ -19,7 +19,7 @@
 # under the License.
 #
 
-import time, string
+import time, string, traceback
 from brokertest import *
 from qpid.messaging import *
 
@@ -82,20 +82,22 @@
         for j in range(i):            
             try:   
                 m = err_watcher.fetch(timeout=error_ck_freq)
-                print self.check_for_error() 
+                print "Java process notified of an error"
+                print self.check_for_error(m) 
             except messaging.Empty, e:                
                 pass # do nothing
         ssn.close()
 
-    def check_for_error(msg):
-        raise Exception("Error:%s \ntime:%s\ntrace:%s\n" %
-                         (msg.properties["desc"],
-                          msg.properties["time"],
-                          msg.properties["exception-trace"]
+    def check_for_error(self,msg):
+        raise Exception("Error:%s \nTime:%s\nTrace:%s\n" %
+                         (msg.properties.get("desc"),
+                          msg.properties.get("time"),
+                          msg.properties.get("exception-trace")
                           ))
 
     def terminate_and_capture_logs(self,popen, process_name):
-        popen.terminate()
+        if popen.is_running():          
+            popen.terminate()
         log = os.path.join(self.dir, process_name+".out") 
         f = open(log, 'w')
         f.write(popen.stdout.read())
@@ -124,7 +126,7 @@
         """Tests multiple sessions on a single connection""" 
 
         cluster = Cluster(self, 2)
-        p = cluster[0].port
+        p = cluster[0].port()
      
         self.start_error_watcher(broker=cluster[0])
 
@@ -149,7 +151,7 @@
 
         cluster = Cluster(self,2)
         ssn = cluster[0].connect().session()
-        p = cluster[0].port
+        p = cluster[0].port()
      
         self.start_error_watcher(broker=cluster[0])
 
@@ -176,7 +178,7 @@
 
     def test_failover(self):
         cluster = self.cluster(4, expect=EXPECT_EXIT_FAIL)
-        p = cluster[0].port
+        p = cluster[0].port()
         self.start_error_watcher(broker=cluster[0])
         receiver = self.popen(self.client(receiver=True,
                                           ssn_count=1,
@@ -202,9 +204,10 @@
                 b=cluster.start()
                 self.monitor_clients(broker=b,run_time=30,error_ck_freq=30)
         except ConnectError, e1:
-            error_msg = "Unable to connect to new cluster node"
+            error_msg = "Unable to connect to new cluster node : " + traceback.format_exc(e1)
+
         except SessionError, e2:
-            error_msg = "Session error while connected to new cluster node"        
+            error_msg = "Session error while connected to new cluster node : " + traceback.format_exc(e2)
 
         # verify also captures out/err streams
         self.verify(receiver,sender)



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message