qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kp...@apache.org
Subject [2/2] qpid-interop-test git commit: QPIDIT-79: Fixed threading issues in shims, ctl+c now stops shims as they should. QPIDIT-110: Also added check for sender shim failure, if so, signals receiver shim to stop
Date Thu, 01 Feb 2018 15:21:52 GMT
QPIDIT-79: Fixed threading issues in shims, ctl+c now stops shims as they should. QPIDIT-110: Also added check for sender shim failure, if so, signals receiver shim to stop


Project: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/commit/f93886f5
Tree: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/tree/f93886f5
Diff: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/diff/f93886f5

Branch: refs/heads/master
Commit: f93886f54aae1b085164f59e60397fb166fdf984
Parents: aea8108
Author: Kim van der Riet <kvdr@localhost.localdomain>
Authored: Thu Feb 1 10:21:30 2018 -0500
Committer: Kim van der Riet <kvdr@localhost.localdomain>
Committed: Thu Feb 1 10:21:30 2018 -0500

----------------------------------------------------------------------
 shims/qpid-proton-python/src/_compat.py         |  31 +--
 .../src/amqp_large_content_test/Receiver.py     |  35 ++--
 .../src/amqp_large_content_test/Sender.py       |  47 +++--
 .../src/amqp_types_test/Receiver.py             |  45 +++--
 .../src/amqp_types_test/Sender.py               |  91 +++++----
 .../src/jms_hdrs_props_test/Receiver.py         | 100 ++++++----
 .../src/jms_hdrs_props_test/Sender.py           | 173 ++++++++--------
 .../src/jms_messages_test/Receiver.py           |  82 ++++----
 .../src/jms_messages_test/Sender.py             | 157 ++++++++-------
 .../amqp_large_content_test.py                  |  36 ++--
 src/python/qpid_interop_test/amqp_types_test.py |  30 +--
 .../qpid_interop_test/jms_hdrs_props_test.py    |  80 ++++----
 .../qpid_interop_test/jms_messages_test.py      |  60 +++---
 src/python/qpid_interop_test/qit_common.py      |  16 +-
 src/python/qpid_interop_test/shims.py           | 200 +++++--------------
 15 files changed, 588 insertions(+), 595 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/f93886f5/shims/qpid-proton-python/src/_compat.py
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-python/src/_compat.py b/shims/qpid-proton-python/src/_compat.py
index 133ba2a..7f39e9a 100644
--- a/shims/qpid-proton-python/src/_compat.py
+++ b/shims/qpid-proton-python/src/_compat.py
@@ -29,26 +29,27 @@ import types
 IS_PY3 = sys.version_info[0] == 3
 
 if IS_PY3:
-    def _decode_hex(s):
+    def decode_hex(s):
         return bytes.fromhex(s)
-    def _letters():
+    def letters():
         return string.ascii_letters
-    def _long(i, r):
+    def long(i, r):
         return int(i, r)
-    def _unichr(i):
-        return chr(i)       
-    def _unicode(i):
+    def unichr(i):
+        return chr(i)
+    def unicode(i):
         return str(i)
 
 else:
-    def _decode_hex(s):
+    import __builtin__
+
+    def decode_hex(s):
         return s.decode('hex')
-    def _letters():
+    def letters():
         return string.letters
-    def _long(i, r):
-        return long(i, r)
-    def _unichr(i):
-        return unichr(i)       
-    def _unicode(i):
-        return unicode(i)
-
+    def long(i, r):
+        return __builtin__.long(i, r)
+    def unichr(i):
+        return __builtin__.unichr(i)
+    def unicode(i):
+        return __builtin__.unicode(i)

http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/f93886f5/shims/qpid-proton-python/src/amqp_large_content_test/Receiver.py
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-python/src/amqp_large_content_test/Receiver.py b/shims/qpid-proton-python/src/amqp_large_content_test/Receiver.py
index 3870e5d..9fd785a 100755
--- a/shims/qpid-proton-python/src/amqp_large_content_test/Receiver.py
+++ b/shims/qpid-proton-python/src/amqp_large_content_test/Receiver.py
@@ -23,18 +23,18 @@ AMQP large content test receiver shim for qpid-interop-test
 # under the License.
 #
 
-from json import dumps
+import json
 import os.path
+import signal
 import sys
-from traceback import format_exc
-
-from proton import symbol
-from proton.handlers import MessagingHandler
-from proton.reactor import Container
+import traceback
 
+import proton
+import proton.handlers
+import proton.reactor
 import _compat
 
-class AmqpLargeContentTestReceiver(MessagingHandler):
+class AmqpLargeContentTestReceiver(proton.handlers.MessagingHandler):
     """
     Reciver shim for AMQP dtx test
     ...
@@ -47,6 +47,8 @@ class AmqpLargeContentTestReceiver(MessagingHandler):
         self.received_value_list = []
         self.expected = int(num_expected_messages_str)
         self.received = 0
+        signal.signal(signal.SIGINT, self.signal_handler)
+        signal.signal(signal.SIGTERM, self.signal_handler)
 
     def get_received_value_list(self):
         """Return the received list of AMQP values"""
@@ -87,10 +89,10 @@ class AmqpLargeContentTestReceiver(MessagingHandler):
     def get_str_message_size(message):
         """Find the size of a bytes, unicode or symbol message in MB"""
         if _compat.IS_PY3:
-            if isinstance(message, (bytes, str, symbol)):
+            if isinstance(message, (bytes, str, proton.symbol)):
                 return int(len(message) / 1024 / 1024) # in MB
         else:
-            if isinstance(message, (bytes, unicode, symbol)):
+            if isinstance(message, (bytes, unicode, proton.symbol)):
                 return len(str(message)) / 1024 / 1024 # in MB
         return None
 
@@ -119,6 +121,14 @@ class AmqpLargeContentTestReceiver(MessagingHandler):
             return (int(elt_size * num_elts / 1024 / 1024), num_elts)
         return None
 
+    @staticmethod
+    def signal_handler(signal_number, _):
+        """Signal handler"""
+        if signal_number in [signal.SIGTERM, signal.SIGINT]:
+            print('Sender: received signal %d, terminating' % signal_number)
+            sys.exit(1)
+
+
 # --- main ---
 # Args: 1: Broker address (ip-addr:port)
 #       2: Queue name
@@ -126,11 +136,12 @@ class AmqpLargeContentTestReceiver(MessagingHandler):
 #       4: Expected number of test values to receive
 try:
     RECEIVER = AmqpLargeContentTestReceiver(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4])
-    Container(RECEIVER).run()
+    proton.reactor.Container(RECEIVER).run()
     print(sys.argv[3])
-    print(dumps(RECEIVER.get_received_value_list()))
+    print(json.dumps(RECEIVER.get_received_value_list()))
 except KeyboardInterrupt:
     pass
 except Exception as exc:
     print(os.path.basename(sys.argv[0]), 'EXCEPTION', exc)
-    print(format_exc())
+    print(traceback.format_exc())
+    sys.exit(1)

http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/f93886f5/shims/qpid-proton-python/src/amqp_large_content_test/Sender.py
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-python/src/amqp_large_content_test/Sender.py b/shims/qpid-proton-python/src/amqp_large_content_test/Sender.py
index 2a9375b..5508ee0 100755
--- a/shims/qpid-proton-python/src/amqp_large_content_test/Sender.py
+++ b/shims/qpid-proton-python/src/amqp_large_content_test/Sender.py
@@ -23,18 +23,18 @@ AMQP large content test sender shim for qpid-interop-test
 # under the License.
 #
 
-from json import loads
+import json
 import os.path
+import signal
 import sys
-from traceback import format_exc
-
-from proton import Message, symbol
-from proton.handlers import MessagingHandler
-from proton.reactor import Container
+import traceback
 
+import proton
+import proton.handlers
+import proton.reactor
 import _compat
 
-class AmqpLargeContentTestSender(MessagingHandler):
+class AmqpLargeContentTestSender(proton.handlers.MessagingHandler):
     """
     Sender shim for AMQP dtx test
     ...
@@ -48,6 +48,8 @@ class AmqpLargeContentTestSender(MessagingHandler):
         self.sent = 0
         self.confirmed = 0
         self.total = len(self.test_value_list)
+        signal.signal(signal.SIGINT, self.signal_handler)
+        signal.signal(signal.SIGTERM, self.signal_handler)
 
     def on_start(self, event):
         """Event callback for when the client starts"""
@@ -79,15 +81,15 @@ class AmqpLargeContentTestSender(MessagingHandler):
         AMQP value.
         """
         if self.amqp_type == 'binary':
-            return Message(body=AmqpLargeContentTestSender.create_test_string(tot_size_bytes).encode('utf-8'))
+            return proton.Message(body=AmqpLargeContentTestSender.create_test_string(tot_size_bytes).encode('utf-8'))
         if self.amqp_type == 'string':
-            return Message(body=_compat._unicode(AmqpLargeContentTestSender.create_test_string(tot_size_bytes)))
+            return proton.Message(body=_compat.unicode(AmqpLargeContentTestSender.create_test_string(tot_size_bytes)))
         if self.amqp_type == 'symbol':
-            return Message(body=symbol(AmqpLargeContentTestSender.create_test_string(tot_size_bytes)))
+            return proton.Message(body=proton.symbol(AmqpLargeContentTestSender.create_test_string(tot_size_bytes)))
         if self.amqp_type == 'list':
-            return Message(body=AmqpLargeContentTestSender.create_test_list(tot_size_bytes, num_elts))
+            return proton.Message(body=AmqpLargeContentTestSender.create_test_list(tot_size_bytes, num_elts))
         if self.amqp_type == 'map':
-            return Message(body=AmqpLargeContentTestSender.create_test_map(tot_size_bytes, num_elts))
+            return proton.Message(body=AmqpLargeContentTestSender.create_test_map(tot_size_bytes, num_elts))
         return None
 
     @staticmethod
@@ -104,7 +106,7 @@ class AmqpLargeContentTestSender(MessagingHandler):
         size_per_elt_bytes = int(tot_size_bytes / num_elts)
         test_list = []
         for _ in range(num_elts):
-            test_list.append(_compat._unicode(AmqpLargeContentTestSender.create_test_string(size_per_elt_bytes)))
+            test_list.append(_compat.unicode(AmqpLargeContentTestSender.create_test_string(size_per_elt_bytes)))
         return test_list
 
     @staticmethod
@@ -113,8 +115,8 @@ class AmqpLargeContentTestSender(MessagingHandler):
         size_per_elt_bytes = int(tot_size_bytes / num_elts)
         test_map = {}
         for elt_no in range(num_elts):
-            test_map[_compat._unicode('elt_%06d' % elt_no)] = \
-                _compat._unicode(AmqpLargeContentTestSender.create_test_string(size_per_elt_bytes))
+            test_map[_compat.unicode('elt_%06d' % elt_no)] = \
+                _compat.unicode(AmqpLargeContentTestSender.create_test_string(size_per_elt_bytes))
         return test_map
 
     def on_accepted(self, event):
@@ -127,6 +129,13 @@ class AmqpLargeContentTestSender(MessagingHandler):
         """Event callback for when the broker disconnects with the client"""
         self.sent = self.confirmed
 
+    @staticmethod
+    def signal_handler(signal_number, _):
+        """Signal handler"""
+        if signal_number in [signal.SIGTERM, signal.SIGINT]:
+            print('Sender: received signal %d, terminating' % signal_number)
+            sys.exit(1)
+
 
 # --- main ---
 # Args: 1: Broker address (ip-addr:port)
@@ -134,11 +143,11 @@ class AmqpLargeContentTestSender(MessagingHandler):
 #       3: AMQP type
 #       4: Test value(s) as JSON string
 try:
-    SENDER = AmqpLargeContentTestSender(sys.argv[1], sys.argv[2], sys.argv[3], loads(sys.argv[4]))
-    Container(SENDER).run()
+    SENDER = AmqpLargeContentTestSender(sys.argv[1], sys.argv[2], sys.argv[3], json.loads(sys.argv[4]))
+    proton.reactor.Container(SENDER).run()
 except KeyboardInterrupt:
     pass
 except Exception as exc:
     print(os.path.basename(sys.argv[0]), 'EXCEPTION:', exc)
-    print(format_exc())
-        
\ No newline at end of file
+    print(traceback.format_exc())
+    sys.exit(1)

http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/f93886f5/shims/qpid-proton-python/src/amqp_types_test/Receiver.py
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-python/src/amqp_types_test/Receiver.py b/shims/qpid-proton-python/src/amqp_types_test/Receiver.py
index 289fb06..519033d 100755
--- a/shims/qpid-proton-python/src/amqp_types_test/Receiver.py
+++ b/shims/qpid-proton-python/src/amqp_types_test/Receiver.py
@@ -23,23 +23,20 @@ AMQP type test receiver shim for qpid-interop-test
 # under the License.
 #
 
-# Issues:
-# * Capturing errors from client or broker
-
-from json import dumps
+import json
 import os.path
-#from string import digits, letters, punctuation
+import signal
 import string
-from struct import pack, unpack
+import struct
 import sys
-from traceback import format_exc
-
-from proton.handlers import MessagingHandler
-from proton.reactor import Container
+import traceback
 
+import proton
+import proton.handlers
+import proton.reactor
 import _compat
 
-class AmqpTypesTestReceiver(MessagingHandler):
+class AmqpTypesTestReceiver(proton.handlers.MessagingHandler):
     """
     Reciver shim for AMQP types test
     This shim receives the number of messages supplied on the command-line and checks that they contain message
@@ -53,6 +50,8 @@ class AmqpTypesTestReceiver(MessagingHandler):
         self.amqp_type = amqp_type
         self.expected = int(num_expected_messages_str)
         self.received = 0
+        signal.signal(signal.SIGINT, self.signal_handler)
+        signal.signal(signal.SIGTERM, self.signal_handler)
 
     def get_received_value_list(self):
         """Return the received list of AMQP values"""
@@ -88,9 +87,11 @@ class AmqpTypesTestReceiver(MessagingHandler):
                 else:
                     self.received_value_list.append(hex_str)
             elif self.amqp_type == 'float':
-                self.received_value_list.append('0x%08x' % unpack('!L', pack('!f', event.message.body))[0])
+                self.received_value_list.append('0x%08x' % struct.unpack('!L',
+                                                                         struct.pack('!f', event.message.body))[0])
             elif self.amqp_type == 'double':
-                self.received_value_list.append('0x%016x' % unpack('!Q', pack('!d', event.message.body))[0])
+                self.received_value_list.append('0x%016x' % struct.unpack('!Q',
+                                                                          struct.pack('!d', event.message.body))[0])
             elif self.amqp_type == 'decimal32':
                 self.received_value_list.append('0x%08x' % event.message.body)
             elif self.amqp_type == 'decimal64':
@@ -99,7 +100,7 @@ class AmqpTypesTestReceiver(MessagingHandler):
                 self.received_value_list.append('0x' + ''.join(['%02x' % ord(c) for c in event.message.body]).strip())
             elif self.amqp_type == 'char':
                 if ord(event.message.body) < 0x80 and event.message.body in \
-                   string.digits + _compat._letters + string.punctuation + " ":
+                   string.digits + _compat.letters + string.punctuation + " ":
                     self.received_value_list.append(event.message.body)
                 else:
                     self.received_value_list.append(hex(ord(event.message.body)))
@@ -119,6 +120,15 @@ class AmqpTypesTestReceiver(MessagingHandler):
             event.receiver.close()
             event.connection.close()
 
+    @staticmethod
+    def signal_handler(signal_number, _):
+        """Signal handler"""
+        if signal_number in [signal.SIGTERM, signal.SIGINT]:
+            print('Receiver: received signal %d, terminating' % signal_number)
+            sys.exit(1)
+
+
+
 # --- main ---
 # Args: 1: Broker address (ip-addr:port)
 #       2: Queue name
@@ -126,11 +136,12 @@ class AmqpTypesTestReceiver(MessagingHandler):
 #       4: Expected number of test values to receive
 try:
     RECEIVER = AmqpTypesTestReceiver(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4])
-    Container(RECEIVER).run()
+    proton.reactor.Container(RECEIVER).run()
     print(sys.argv[3])
-    print(dumps(RECEIVER.get_received_value_list()))
+    print(json.dumps(RECEIVER.get_received_value_list()))
 except KeyboardInterrupt:
     pass
 except Exception as exc:
     print(os.path.basename(sys.argv[0]), 'EXCEPTION', exc)
-    print(format_exc())
+    print(traceback.format_exc())
+    sys.exit(1)

http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/f93886f5/shims/qpid-proton-python/src/amqp_types_test/Sender.py
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-python/src/amqp_types_test/Sender.py b/shims/qpid-proton-python/src/amqp_types_test/Sender.py
index 3fc96a1..07bdb4e 100755
--- a/shims/qpid-proton-python/src/amqp_types_test/Sender.py
+++ b/shims/qpid-proton-python/src/amqp_types_test/Sender.py
@@ -23,24 +23,20 @@ AMQP type test sender shim for qpid-interop-test
 # under the License.
 #
 
-# Issues:
-# * Capturing errors from client or broker
-
-from json import loads
+import json
 import os.path
-from struct import unpack
+import signal
+import struct
 import sys
-from traceback import format_exc
-from uuid import UUID
-
-from proton import byte, char, decimal32, decimal64, decimal128, float32, int32, Message, short, symbol, timestamp, \
-                   ubyte, uint, ulong, ushort
-from proton.handlers import MessagingHandler
-from proton.reactor import Container
+import traceback
+import uuid
 
+import proton
+import proton.handlers
+import proton.reactor
 import _compat
 
-class AmqpTypesTestSender(MessagingHandler):
+class AmqpTypesTestSender(proton.handlers.MessagingHandler):
     """
     Sender shim for AMQP types test
     This shim receives the AMQP type and a list of test values. Each value is sent in a message body of the appropriate
@@ -55,6 +51,8 @@ class AmqpTypesTestSender(MessagingHandler):
         self.sent = 0
         self.confirmed = 0
         self.total = len(test_value_list)
+        signal.signal(signal.SIGINT, self.signal_handler)
+        signal.signal(signal.SIGTERM, self.signal_handler)
 
     def on_start(self, event):
         """Event callback for when the client starts"""
@@ -80,55 +78,56 @@ class AmqpTypesTestSender(MessagingHandler):
         AMQP value (set in self.amqp_type).
         """
         if self.amqp_type == 'null':
-            return Message(id=(self.sent+1), body=None)
+            return proton.Message(id=(self.sent+1), body=None)
         if self.amqp_type == 'boolean':
-            return Message(id=(self.sent+1), body=True if test_value == 'True' else False)
+            return proton.Message(id=(self.sent+1), body=True if test_value == 'True' else False)
         if self.amqp_type == 'ubyte':
-            return Message(id=(self.sent+1), body=ubyte(int(test_value, 16)))
+            return proton.Message(id=(self.sent+1), body=proton.ubyte(int(test_value, 16)))
         if self.amqp_type == 'ushort':
-            return Message(id=(self.sent+1), body=ushort(int(test_value, 16)))
+            return proton.Message(id=(self.sent+1), body=proton.ushort(int(test_value, 16)))
         if self.amqp_type == 'uint':
-            return Message(id=(self.sent+1), body=uint(int(test_value, 16)))
+            return proton.Message(id=(self.sent+1), body=proton.uint(int(test_value, 16)))
         if self.amqp_type == 'ulong':
-            return Message(id=(self.sent+1), body=ulong(int(test_value, 16)))
+            return proton.Message(id=(self.sent+1), body=proton.ulong(int(test_value, 16)))
         if self.amqp_type == 'byte':
-            return Message(id=(self.sent+1), body=byte(int(test_value, 16)))
+            return proton.Message(id=(self.sent+1), body=proton.byte(int(test_value, 16)))
         if self.amqp_type == 'short':
-            return Message(id=(self.sent+1), body=short(int(test_value, 16)))
+            return proton.Message(id=(self.sent+1), body=proton.short(int(test_value, 16)))
         if self.amqp_type == 'int':
-            return Message(id=(self.sent+1), body=int32(int(test_value, 16)))
+            return proton.Message(id=(self.sent+1), body=proton.int32(int(test_value, 16)))
         if self.amqp_type == 'long':
-            return Message(id=(self.sent+1), body=_compat._long(test_value, 16))
+            return proton.Message(id=(self.sent+1), body=_compat.long(test_value, 16))
         if self.amqp_type == 'float':
-            return Message(id=(self.sent+1), body=float32(unpack('!f', _compat._decode_hex(test_value[2:]))[0]))
+            return proton.Message(id=(self.sent+1),
+                                  body=proton.float32(struct.unpack('!f', _compat.decode_hex(test_value[2:]))[0]))
         if self.amqp_type == 'double':
-            return Message(id=(self.sent+1), body=unpack('!d', _compat._decode_hex(test_value[2:]))[0])
+            return proton.Message(id=(self.sent+1), body=struct.unpack('!d', _compat.decode_hex(test_value[2:]))[0])
         if self.amqp_type == 'decimal32':
-            return Message(id=(self.sent+1), body=decimal32(int(test_value[2:], 16)))
+            return proton.Message(id=(self.sent+1), body=proton.decimal32(int(test_value[2:], 16)))
         if self.amqp_type == 'decimal64':
-            l64 = _compat._long(test_value[2:], 16)
-            return Message(id=(self.sent+1), body=decimal64(l64))
+            l64 = _compat.long(test_value[2:], 16)
+            return proton.Message(id=(self.sent+1), body=proton.decimal64(l64))
         if self.amqp_type == 'decimal128':
-            return Message(id=(self.sent+1), body=decimal128(_compat._decode_hex(test_value[2:])))
+            return proton.Message(id=(self.sent+1), body=proton.decimal128(_compat.decode_hex(test_value[2:])))
         if self.amqp_type == 'char':
             if len(test_value) == 1: # Format 'a'
-                return Message(id=(self.sent+1), body=char(test_value))
+                return proton.Message(id=(self.sent+1), body=proton.char(test_value))
             val = int(test_value, 16)
-            return Message(id=(self.sent+1), body=char(_compat._unichr(val)))
+            return proton.Message(id=(self.sent+1), body=proton.char(_compat.unichr(val)))
         if self.amqp_type == 'timestamp':
-            return Message(id=(self.sent+1), body=timestamp(int(test_value, 16)))
+            return proton.Message(id=(self.sent+1), body=proton.timestamp(int(test_value, 16)))
         if self.amqp_type == 'uuid':
-            return Message(id=(self.sent+1), body=UUID(test_value))
+            return proton.Message(id=(self.sent+1), body=uuid.UUID(test_value))
         if self.amqp_type == 'binary':
-            return Message(id=(self.sent+1), body=test_value.encode('utf-8'))
+            return proton.Message(id=(self.sent+1), body=test_value.encode('utf-8'))
         if self.amqp_type == 'string':
-            return Message(id=(self.sent+1), body=_compat._unicode(test_value))
+            return proton.Message(id=(self.sent+1), body=_compat.unicode(test_value))
         if self.amqp_type == 'symbol':
-            return Message(id=(self.sent+1), body=symbol(test_value))
+            return proton.Message(id=(self.sent+1), body=proton.symbol(test_value))
         if self.amqp_type == 'list':
-            return Message(id=(self.sent+1), body=test_value)
+            return proton.Message(id=(self.sent+1), body=test_value)
         if self.amqp_type == 'map':
-            return Message(id=(self.sent+1), body=test_value)
+            return proton.Message(id=(self.sent+1), body=test_value)
         print('send: Unsupported AMQP type "%s"' % self.amqp_type)
         return None
 
@@ -142,6 +141,14 @@ class AmqpTypesTestSender(MessagingHandler):
         """Event callback for when the broker disconnects with the client"""
         self.sent = self.confirmed
 
+    @staticmethod
+    def signal_handler(signal_number, _):
+        """Signal handler"""
+        if signal_number in [signal.SIGTERM, signal.SIGINT]:
+            print('Sender: received signal %d, terminating' % signal_number)
+            sys.exit(1)
+
+
 
 # --- main ---
 # Args: 1: Broker address (ip-addr:port)
@@ -149,11 +156,11 @@ class AmqpTypesTestSender(MessagingHandler):
 #       3: AMQP type
 #       4...n: Test value(s) as strings
 try:
-    SENDER = AmqpTypesTestSender(sys.argv[1], sys.argv[2], sys.argv[3], loads(sys.argv[4]))
-    Container(SENDER).run()
+    SENDER = AmqpTypesTestSender(sys.argv[1], sys.argv[2], sys.argv[3], json.loads(sys.argv[4]))
+    proton.reactor.Container(SENDER).run()
 except KeyboardInterrupt:
     pass
 except Exception as exc:
     print(os.path.basename(sys.argv[0]), 'EXCEPTION:', exc)
-    print(format_exc())
-        
\ No newline at end of file
+    print(traceback.format_exc())
+    sys.exit(1)

http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/f93886f5/shims/qpid-proton-python/src/jms_hdrs_props_test/Receiver.py
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-python/src/jms_hdrs_props_test/Receiver.py b/shims/qpid-proton-python/src/jms_hdrs_props_test/Receiver.py
index 00d8ffb..20e4534 100755
--- a/shims/qpid-proton-python/src/jms_hdrs_props_test/Receiver.py
+++ b/shims/qpid-proton-python/src/jms_hdrs_props_test/Receiver.py
@@ -23,22 +23,23 @@ JMS message headers and properties test receiver shim for qpid-interop-test
 # under the License.
 #
 
-from struct import pack, unpack
-from subprocess import check_output
+import json
+import signal
+import struct
+import subprocess
 import sys
-from time import strftime, time
-from traceback import format_exc
-from json import dumps, loads
+import time
+import traceback
 
-from proton import byte
-from proton.handlers import MessagingHandler
-from proton.reactor import Container
+import proton
+import proton.handlers
+import proton.reactor
 from qpid_interop_test.jms_types import QPID_JMS_TYPE_ANNOTATION_NAME
 from qpid_interop_test.interop_test_errors import InteropTestError
 import _compat
 
 
-class JmsHdrsPropsTestReceiver(MessagingHandler):
+class JmsHdrsPropsTestReceiver(proton.handlers.MessagingHandler):
     """
     Receiver shim: This shim receives JMS messages sent by the Sender shim and prints the contents of the received
     messages onto the terminal in JSON format for retrieval by the test harness. The JMS messages type and, where
@@ -60,6 +61,8 @@ class JmsHdrsPropsTestReceiver(MessagingHandler):
         self.current_subtype_msg_list = None
         self.jms_header_map = {}
         self.jms_property_map = {}
+        signal.signal(signal.SIGINT, self.signal_handler)
+        signal.signal(signal.SIGTERM, self.signal_handler)
 
     def get_received_value_map(self):
         """"Return the collected message values received"""
@@ -137,7 +140,7 @@ class JmsHdrsPropsTestReceiver(MessagingHandler):
     def _receive_jms_message(self, message):
         """"Receives a JMS message (without a body)"""
         assert self.jms_msg_type == 'JMS_MESSAGE_TYPE'
-        assert message.annotations[QPID_JMS_TYPE_ANNOTATION_NAME] == byte(0)
+        assert message.annotations[QPID_JMS_TYPE_ANNOTATION_NAME] == proton.byte(0)
         if message.body is not None:
             raise InteropTestError('_receive_jms_message: Invalid body for type JMS_MESSAGE_TYPE: %s' %
                                    str(message.body))
@@ -146,7 +149,7 @@ class JmsHdrsPropsTestReceiver(MessagingHandler):
     def _receive_jms_bytesmessage(self, message):
         """"Receives a JMS bytes message"""
         assert self.jms_msg_type == 'JMS_BYTESMESSAGE_TYPE'
-        assert message.annotations[QPID_JMS_TYPE_ANNOTATION_NAME] == byte(3)
+        assert message.annotations[QPID_JMS_TYPE_ANNOTATION_NAME] == proton.byte(3)
         if self.current_subtype == 'boolean':
             if message.body == b'\x00':
                 return 'False'
@@ -155,30 +158,29 @@ class JmsHdrsPropsTestReceiver(MessagingHandler):
             raise InteropTestError('_receive_jms_bytesmessage: Invalid encoding for subtype boolean: %s' %
                                    str(message.body))
         if self.current_subtype == 'byte':
-            return hex(unpack('b', message.body)[0])
+            return hex(struct.unpack('b', message.body)[0])
         if self.current_subtype == 'bytes':
             return message.body.decode('utf-8')
         if self.current_subtype == 'char':
             if len(message.body) == 2: # format 'a' or '\xNN'
                 if _compat.IS_PY3:
                     return chr(message.body[1]) # strip leading '\x00' char
-                else:
-                    return str(message.body[1]) # strip leading '\x00' char
+                return str(message.body[1]) # strip leading '\x00' char
             raise InteropTestError('Unexpected strring length for type char: %d' % len(message.body))
         if self.current_subtype == 'double':
-            return '0x%016x' % unpack('!Q', message.body)[0]
+            return '0x%016x' % struct.unpack('!Q', message.body)[0]
         if self.current_subtype == 'float':
-            return '0x%08x' % unpack('!L', message.body)[0]
+            return '0x%08x' % struct.unpack('!L', message.body)[0]
         if self.current_subtype == 'int':
-            return hex(unpack('!i', message.body)[0])
+            return hex(struct.unpack('!i', message.body)[0])
         if self.current_subtype == 'long':
-            return hex(unpack('!q', message.body)[0])
+            return hex(struct.unpack('!q', message.body)[0])
         if self.current_subtype == 'short':
-            return hex(unpack('!h', message.body)[0])
+            return hex(struct.unpack('!h', message.body)[0])
         if self.current_subtype == 'string':
             # NOTE: first 2 bytes are string length, must be present
             if len(message.body) >= 2:
-                str_len = unpack('!H', message.body[:2])[0]
+                str_len = struct.unpack('!H', message.body[:2])[0]
                 str_body = str(message.body[2:])
                 if len(str_body) != str_len:
                     raise InteropTestError('String length mismatch: size=%d, but len(\'%s\')=%d' %
@@ -193,7 +195,7 @@ class JmsHdrsPropsTestReceiver(MessagingHandler):
     def _recieve_jms_mapmessage(self, message):
         """"Receives a JMS map message"""
         assert self.jms_msg_type == 'JMS_MAPMESSAGE_TYPE'
-        assert message.annotations[QPID_JMS_TYPE_ANNOTATION_NAME] == byte(2)
+        assert message.annotations[QPID_JMS_TYPE_ANNOTATION_NAME] == proton.byte(2)
         key, value = message.body.items()[0]
         assert key[:-3] == self.current_subtype
         if self.current_subtype == 'boolean':
@@ -205,9 +207,9 @@ class JmsHdrsPropsTestReceiver(MessagingHandler):
         if self.current_subtype == 'char':
             return str(value)
         if self.current_subtype == 'double':
-            return '0x%016x' % unpack('!Q', pack('!d', value))[0]
+            return '0x%016x' % struct.unpack('!Q', struct.pack('!d', value))[0]
         if self.current_subtype == 'float':
-            return '0x%08x' % unpack('!L', pack('!f', value))[0]
+            return '0x%08x' % struct.unpack('!L', struct.pack('!f', value))[0]
         if self.current_subtype == 'int':
             return hex(value)
         if self.current_subtype == 'long':
@@ -222,7 +224,7 @@ class JmsHdrsPropsTestReceiver(MessagingHandler):
     def _recieve_jms_objectmessage(self, message):
         """"Receives a JMS Object message"""
         assert self.jms_msg_type == 'JMS_OBJECTMESSAGE_TYPE'
-        assert message.annotations[QPID_JMS_TYPE_ANNOTATION_NAME] == byte(1)
+        assert message.annotations[QPID_JMS_TYPE_ANNOTATION_NAME] == proton.byte(1)
         return self._get_java_obj(message.body)
 
     def _get_java_obj(self, java_obj_bytes):
@@ -234,11 +236,11 @@ class JmsHdrsPropsTestReceiver(MessagingHandler):
         returns: string containing Java class value as returned by the toString() method
         """
         java_obj_bytes_str = ''.join(["%02x" % ord(x) for x in java_obj_bytes]).strip()
-        out_str = check_output(['java',
-                                '-cp',
-                                'target/JavaObjUtils.jar',
-                                'org.apache.qpid.interop_test.obj_util.BytesToJavaObj',
-                                java_obj_bytes_str])
+        out_str = subprocess.check_output(['java',
+                                           '-cp',
+                                           'target/JavaObjUtils.jar',
+                                           'org.apache.qpid.interop_test.obj_util.BytesToJavaObj',
+                                           java_obj_bytes_str])
         out_str_list = out_str.split('\n')[:-1] # remove trailing \n
         if len(out_str_list) > 1:
             raise InteropTestError('Unexpected return from JavaObjUtils: %s' % out_str)
@@ -255,7 +257,7 @@ class JmsHdrsPropsTestReceiver(MessagingHandler):
     def _receive_jms_streammessage(self, message):
         """Receives a JMS stream message"""
         assert self.jms_msg_type == 'JMS_STREAMMESSAGE_TYPE'
-        assert message.annotations[QPID_JMS_TYPE_ANNOTATION_NAME] == byte(4)
+        assert message.annotations[QPID_JMS_TYPE_ANNOTATION_NAME] == proton.byte(4)
         # Every message is a list with one item [value]
         assert len(message.body) == 1
         value = message.body[0]
@@ -268,9 +270,9 @@ class JmsHdrsPropsTestReceiver(MessagingHandler):
         if self.current_subtype == 'char':
             return str(value)
         if self.current_subtype == 'double':
-            return '0x%016x' % unpack('!Q', pack('!d', value))[0]
+            return '0x%016x' % struct.unpack('!Q', struct.pack('!d', value))[0]
         if self.current_subtype == 'float':
-            return '0x%08x' % unpack('!L', pack('!f', value))[0]
+            return '0x%08x' % struct.unpack('!L', struct.pack('!f', value))[0]
         if self.current_subtype == 'int':
             return hex(value)
         if self.current_subtype == 'long':
@@ -286,7 +288,7 @@ class JmsHdrsPropsTestReceiver(MessagingHandler):
     def _receive_jms_textmessage(self, message):
         """"Receives a JMS text message"""
         assert self.jms_msg_type == 'JMS_TEXTMESSAGE_TYPE'
-        assert message.annotations[QPID_JMS_TYPE_ANNOTATION_NAME] == byte(5)
+        assert message.annotations[QPID_JMS_TYPE_ANNOTATION_NAME] == proton.byte(5)
         return message.body
 
     def _process_jms_headers(self, message):
@@ -347,12 +349,12 @@ class JmsHdrsPropsTestReceiver(MessagingHandler):
             #    raise InteropTestError('JMS_PRIORITY header is not default (4): found %d' % message.priority)
             # 6. Message timestamp
             time_stamp = message.creation_time
-            current_time = time()
+            current_time = time.time()
             if current_time - time_stamp > 60 * 1000: # More than 1 minute old
                 raise InteropTestError('JMS_TIMESTAMP header contains suspicious value: ' + \
                                        'found %d (%s) is not within 1 minute of now %d (%s)' %
-                                       (time_stamp, strftime('%m/%d/%Y %H:%M:%S %Z', time_stamp),
-                                        current_time, strftime('%m/%d/%Y %H:%M:%S %Z', current_time)))
+                                       (time_stamp, time.strftime('%m/%d/%Y %H:%M:%S %Z', time_stamp),
+                                        current_time, time.strftime('%m/%d/%Y %H:%M:%S %Z', current_time)))
 
     def _process_jms_properties(self, message):
         """"Checks the supplied message for JMS message properties and decodes them"""
@@ -368,11 +370,11 @@ class JmsHdrsPropsTestReceiver(MessagingHandler):
                     elif jms_property_type == 'byte':
                         self.jms_property_map[jms_property_name] = {'byte': hex(value)}
                     elif jms_property_type == 'double':
-                        self.jms_property_map[jms_property_name] = {'double': '0x%016x' %
-                                                                              unpack('!Q', pack('!d', value))[0]}
+                        self.jms_property_map[jms_property_name] = {'double': '0x%016x' % \
+                                                                    struct.unpack('!Q', struct.pack('!d', value))[0]}
                     elif jms_property_type == 'float':
-                        self.jms_property_map[jms_property_name] = {'float': '0x%08x' %
-                                                                             unpack('!L', pack('!f', value))[0]}
+                        self.jms_property_map[jms_property_name] = {'float': '0x%08x' % \
+                                                                    struct.unpack('!L', struct.pack('!f', value))[0]}
                     elif jms_property_type == 'int':
                         self.jms_property_map[jms_property_name] = {'int': hex(value)}
                     elif jms_property_type == 'long':
@@ -384,6 +386,13 @@ class JmsHdrsPropsTestReceiver(MessagingHandler):
                     else:
                         pass # Ignore any other properties, brokers can add them and we don't know what they may be
 
+    @staticmethod
+    def signal_handler(signal_number, _):
+        """Signal handler"""
+        if signal_number in [signal.SIGTERM, signal.SIGINT]:
+            print('Sender: received signal %d, terminating' % signal_number)
+            sys.exit(1)
+
 
 # --- main ---
 # Args: 1: Broker address (ip-addr:port)
@@ -392,12 +401,15 @@ class JmsHdrsPropsTestReceiver(MessagingHandler):
 #       4: JSON Test parameters containing 2 maps: [testValuesMap, flagMap]
 #print('#### sys.argv=%s' % sys.argv)
 try:
-    RECEIVER = JmsHdrsPropsTestReceiver(sys.argv[1], sys.argv[2], sys.argv[3], loads(sys.argv[4]))
-    Container(RECEIVER).run()
+    RECEIVER = JmsHdrsPropsTestReceiver(sys.argv[1], sys.argv[2], sys.argv[3], json.loads(sys.argv[4]))
+    proton.reactor.Container(RECEIVER).run()
     print(sys.argv[3])
-    print(dumps([RECEIVER.get_received_value_map(), RECEIVER.get_jms_header_map(), RECEIVER.get_jms_property_map()]))
+    print(json.dumps([RECEIVER.get_received_value_map(),
+                      RECEIVER.get_jms_header_map(),
+                      RECEIVER.get_jms_property_map()]))
 except KeyboardInterrupt:
     pass
 except Exception as exc:
     print('jms-receiver-shim EXCEPTION:', exc)
-    print(format_exc())
+    print(traceback.format_exc())
+    exit(1)

http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/f93886f5/shims/qpid-proton-python/src/jms_hdrs_props_test/Sender.py
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-python/src/jms_hdrs_props_test/Sender.py b/shims/qpid-proton-python/src/jms_hdrs_props_test/Sender.py
index 8e889d0..9a05490 100755
--- a/shims/qpid-proton-python/src/jms_hdrs_props_test/Sender.py
+++ b/shims/qpid-proton-python/src/jms_hdrs_props_test/Sender.py
@@ -24,23 +24,23 @@ JMS message headers and properties test sender shim for qpid-interop-test
 #
 
 import os.path
-from struct import pack, unpack
-from subprocess import check_output
+import signal
+import struct
+import subprocess
 import sys
-from traceback import format_exc
-from json import loads
+import traceback
+import json
 
-from proton import byte, char, float32, int32, Message, short, symbol
-from proton.handlers import MessagingHandler
-from proton.reactor import Container
+import proton
+import proton.handlers
+import proton.reactor
 from qpid_interop_test.interop_test_errors import InteropTestError
 from qpid_interop_test.jms_types import create_annotation
 from qpid_interop_test.test_type_map import TestTypeMap
-
 import _compat
 
 
-class JmsHdrsPropsTestSender(MessagingHandler):
+class JmsHdrsPropsTestSender(proton.handlers.MessagingHandler):
     """
     This shim sends JMS messages of a particular JMS message type according to the test parameters list. This list
     contains three maps:
@@ -62,6 +62,8 @@ class JmsHdrsPropsTestSender(MessagingHandler):
         self.sent = 0
         self.confirmed = 0
         self.total = self._get_total_num_msgs()
+        signal.signal(signal.SIGINT, self.signal_handler)
+        signal.signal(signal.SIGTERM, self.signal_handler)
 
     def on_start(self, event):
         """Event callback for when the client starts"""
@@ -150,11 +152,11 @@ class JmsHdrsPropsTestSender(MessagingHandler):
         if test_value is not None:
             raise InteropTestError('JmsSenderShim._create_jms_message: Invalid value "%s" for subtype "%s"' %
                                    (test_value, test_value_type))
-        return Message(id=(self.sent+1),
-                       content_type='application/octet-stream',
-                       annotations=TestTypeMap.merge_dicts(create_annotation('JMS_MESSAGE_TYPE'),
-                                                           hdr_annotations),
-                       **hdr_kwargs)
+        return proton.Message(id=(self.sent+1),
+                              content_type='application/octet-stream',
+                              annotations=TestTypeMap.merge_dicts(create_annotation('JMS_MESSAGE_TYPE'),
+                                                                  hdr_annotations),
+                              **hdr_kwargs)
 
     def _create_jms_bytesmessage(self, test_value_type, test_value, hdr_kwargs, hdr_annotations):
         """Create a JMS bytes message"""
@@ -163,7 +165,7 @@ class JmsHdrsPropsTestSender(MessagingHandler):
         if test_value_type == 'boolean':
             body_bytes = b'\x01' if test_value == 'True' else b'\x00'
         elif test_value_type == 'byte':
-            body_bytes = pack('b', int(test_value, 16))
+            body_bytes = struct.pack('b', int(test_value, 16))
         elif test_value_type == 'bytes':
             body_bytes = test_value.encode('utf-8')
         elif test_value_type == 'char':
@@ -172,77 +174,77 @@ class JmsHdrsPropsTestSender(MessagingHandler):
         elif test_value_type == 'double' or test_value_type == 'float':
             body_bytes = test_value[2:].decode('hex')
         elif test_value_type == 'int':
-            body_bytes = pack('!i', int(test_value, 16))
+            body_bytes = struct.pack('!i', int(test_value, 16))
         elif test_value_type == 'long':
-            body_bytes = pack('!q', _compat._long(test_value, 16))
+            body_bytes = struct.pack('!q', _compat.long(test_value, 16))
         elif test_value_type == 'short':
-            body_bytes = pack('!h', short(test_value, 16))
+            body_bytes = struct.pack('!h', proton.short(test_value, 16))
         elif test_value_type == 'string':
             # NOTE: First two bytes must be string length
             test_value_str = str(test_value) # remove unicode
-            body_bytes = pack('!H', len(test_value_str)) + test_value_str
+            body_bytes = struct.pack('!H', len(test_value_str)) + test_value_str
         else:
             raise InteropTestError('JmsSenderShim._create_jms_bytesmessage: Unknown or unsupported subtype "%s"' %
                                    test_value_type)
-        return Message(id=(self.sent+1),
-                       body=body_bytes,
-                       inferred=True,
-                       content_type='application/octet-stream',
-                       annotations=TestTypeMap.merge_dicts(create_annotation('JMS_BYTESMESSAGE_TYPE'),
-                                                           hdr_annotations),
-                       **hdr_kwargs)
+        return proton.Message(id=(self.sent+1),
+                              body=body_bytes,
+                              inferred=True,
+                              content_type='application/octet-stream',
+                              annotations=TestTypeMap.merge_dicts(create_annotation('JMS_BYTESMESSAGE_TYPE'),
+                                                                  hdr_annotations),
+                              **hdr_kwargs)
 
     def _create_jms_mapmessage(self, test_value_type, test_value, name, hdr_kwargs, hdr_annotations):
         """Create a JMS map message"""
         if test_value_type == 'boolean':
             value = test_value == 'True'
         elif test_value_type == 'byte':
-            value = byte(int(test_value, 16))
+            value = proton.byte(int(test_value, 16))
         elif test_value_type == 'bytes':
             value = test_value.encode('utf-8')
         elif test_value_type == 'char':
-            value = char(test_value)
+            value = proton.char(test_value)
         elif test_value_type == 'double':
-            value = unpack('!d', test_value[2:].decode('hex'))[0]
+            value = struct.unpack('!d', test_value[2:].decode('hex'))[0]
         elif test_value_type == 'float':
-            value = float32(unpack('!f', test_value[2:].decode('hex'))[0])
+            value = proton.float32(struct.unpack('!f', test_value[2:].decode('hex'))[0])
         elif test_value_type == 'int':
-            value = int32(int(test_value, 16))
+            value = proton.int32(int(test_value, 16))
         elif test_value_type == 'long':
-            value = _compat._long(test_value, 16)
+            value = _compat.long(test_value, 16)
         elif test_value_type == 'short':
-            value = short(int(test_value, 16))
+            value = proton.short(int(test_value, 16))
         elif test_value_type == 'string':
             value = test_value
         else:
             raise InteropTestError('JmsSenderShim._create_jms_mapmessage: Unknown or unsupported subtype "%s"' %
                                    test_value_type)
-        return Message(id=(self.sent+1),
-                       body={name: value},
-                       inferred=False,
-                       annotations=TestTypeMap.merge_dicts(create_annotation('JMS_MAPMESSAGE_TYPE'),
-                                                           hdr_annotations),
-                       **hdr_kwargs)
+        return proton.Message(id=(self.sent+1),
+                              body={name: value},
+                              inferred=False,
+                              annotations=TestTypeMap.merge_dicts(create_annotation('JMS_MAPMESSAGE_TYPE'),
+                                                                  hdr_annotations),
+                              **hdr_kwargs)
 
     def _create_jms_objectmessage(self, test_value, hdr_kwargs, hdr_annotations):
         """Create a JMS object message"""
         java_binary = self._s_get_java_obj_binary(test_value)
-        return Message(id=(self.sent+1),
-                       body=java_binary,
-                       inferred=True,
-                       content_type='application/x-java-serialized-object',
-                       annotations=TestTypeMap.merge_dicts(create_annotation('JMS_MAPMESSAGE_TYPE'),
-                                                           hdr_annotations),
-                       **hdr_kwargs)
+        return proton.Message(id=(self.sent+1),
+                              body=java_binary,
+                              inferred=True,
+                              content_type='application/x-java-serialized-object',
+                              annotations=TestTypeMap.merge_dicts(create_annotation('JMS_MAPMESSAGE_TYPE'),
+                                                                  hdr_annotations),
+                              **hdr_kwargs)
 
     @staticmethod
     def _s_get_java_obj_binary(java_class_str):
         """Call external utility to create Java object and stringify it, returning the string representation"""
-        out_str = check_output(['java',
-                                '-cp',
-                                'target/JavaObjUtils.jar',
-                                'org.apache.qpid.interop_test.obj_util.JavaObjToBytes',
-                                java_class_str])
+        out_str = subprocess.check_output(['java',
+                                           '-cp',
+                                           'target/JavaObjUtils.jar',
+                                           'org.apache.qpid.interop_test.obj_util.JavaObjToBytes',
+                                           java_class_str])
         out_str_list = out_str.split('\n')[:-1] # remove trailing \n
         if out_str_list[0] != java_class_str:
             raise InteropTestError('JmsSenderShim._s_get_java_obj_binary(): Call to JavaObjToBytes failed\n%s' %
@@ -254,40 +256,40 @@ class JmsHdrsPropsTestSender(MessagingHandler):
         if test_value_type == 'boolean':
             body_list = [test_value == 'True']
         elif test_value_type == 'byte':
-            body_list = [byte(int(test_value, 16))]
+            body_list = [proton.byte(int(test_value, 16))]
         elif test_value_type == 'bytes':
             body_list = [test_value.encode('utf-8')]
         elif test_value_type == 'char':
-            body_list = [char(test_value)]
+            body_list = [proton.char(test_value)]
         elif test_value_type == 'double':
-            body_list = [unpack('!d', test_value[2:].decode('hex'))[0]]
+            body_list = [struct.unpack('!d', test_value[2:].decode('hex'))[0]]
         elif test_value_type == 'float':
-            body_list = [float32(unpack('!f', test_value[2:].decode('hex'))[0])]
+            body_list = [proton.float32(struct.unpack('!f', test_value[2:].decode('hex'))[0])]
         elif test_value_type == 'int':
-            body_list = [int32(int(test_value, 16))]
+            body_list = [proton.int32(int(test_value, 16))]
         elif test_value_type == 'long':
-            body_list = [_compat._long(test_value, 16)]
+            body_list = [_compat.long(test_value, 16)]
         elif test_value_type == 'short':
-            body_list = [short(int(test_value, 16))]
+            body_list = [proton.short(int(test_value, 16))]
         elif test_value_type == 'string':
             body_list = [test_value]
         else:
             raise InteropTestError('JmsSenderShim._create_jms_streammessage: Unknown or unsupported subtype "%s"' %
                                    test_value_type)
-        return Message(id=(self.sent+1),
-                       body=body_list,
-                       inferred=True,
-                       annotations=TestTypeMap.merge_dicts(create_annotation('JMS_STREAMMESSAGE_TYPE'),
-                                                           hdr_annotations),
-                       **hdr_kwargs)
+        return proton.Message(id=(self.sent+1),
+                              body=body_list,
+                              inferred=True,
+                              annotations=TestTypeMap.merge_dicts(create_annotation('JMS_STREAMMESSAGE_TYPE'),
+                                                                  hdr_annotations),
+                              **hdr_kwargs)
 
     def _create_jms_textmessage(self, test_value_text, hdr_kwargs, hdr_annotations):
         """Create a JMS text message"""
-        return Message(id=(self.sent+1),
-                       body=_compat._unicode(test_value_text),
-                       annotations=TestTypeMap.merge_dicts(create_annotation('JMS_TEXTMESSAGE_TYPE'),
-                                                           hdr_annotations),
-                       **hdr_kwargs)
+        return proton.Message(id=(self.sent+1),
+                              body=_compat.unicode(test_value_text),
+                              annotations=TestTypeMap.merge_dicts(create_annotation('JMS_TEXTMESSAGE_TYPE'),
+                                                                  hdr_annotations),
+                              **hdr_kwargs)
 
     def _get_jms_message_header_kwargs(self):
         hdr_kwargs = {}
@@ -312,14 +314,14 @@ class JmsHdrsPropsTestSender(MessagingHandler):
                     raise InteropTestError('JmsSenderShim._get_jms_message_header_kwargs(): ' +
                                            'JMS_CORRELATIONID_HEADER requires value type "string" or "bytes", ' +
                                            'type "%s" found' % value_type)
-                hdr_annotations[symbol(u'x-opt-app-correlation-id')] = True
+                hdr_annotations[proton.symbol(u'x-opt-app-correlation-id')] = True
             elif jms_header == 'JMS_REPLYTO_HEADER':
                 if value_type == 'queue':
                     hdr_kwargs['reply_to'] = value
-                    hdr_annotations[symbol(u'x-opt-jms-reply-to')] = byte(0)
+                    hdr_annotations[proton.symbol(u'x-opt-jms-reply-to')] = proton.byte(0)
                 elif value_type == 'topic':
                     hdr_kwargs['reply_to'] = value
-                    hdr_annotations[symbol(u'x-opt-jms-reply-to')] = byte(1)
+                    hdr_annotations[proton.symbol(u'x-opt-jms-reply-to')] = proton.byte(1)
                 elif value_type == 'temp_queue' or value_type == 'temp_topic':
                     raise InteropTestError('JmsSenderShim._get_jms_message_header_kwargs(): ' +
                                            'JMS_REPLYTO_HEADER type "temp_queue" or "temp_topic" not handled')
@@ -343,23 +345,31 @@ class JmsHdrsPropsTestSender(MessagingHandler):
             if value_type == 'boolean':
                 message.properties[property_name] = value == 'True'
             elif value_type == 'byte':
-                message.properties[property_name] = byte(int(value, 16))
+                message.properties[property_name] = proton.byte(int(value, 16))
             elif value_type == 'double':
-                message.properties[property_name] = unpack('!d', _compat._decode_hex(value[2:]))[0]
+                message.properties[property_name] = struct.unpack('!d', _compat.decode_hex(value[2:]))[0]
             elif value_type == 'float':
-                message.properties[property_name] = float32(unpack('!f', _compat._decode_hex(value[2:]))[0])
+                message.properties[property_name] = proton.float32(struct.unpack('!f',
+                                                                                 _compat.decode_hex(value[2:]))[0])
             elif value_type == 'int':
-                message.properties[property_name] = int32(int(value, 16))
+                message.properties[property_name] = proton.int32(int(value, 16))
             elif value_type == 'long':
-                message.properties[property_name] = _compat._long(value, 16)
+                message.properties[property_name] = _compat.long(value, 16)
             elif value_type == 'short':
-                message.properties[property_name] = short(int(value, 16))
+                message.properties[property_name] = proton.short(int(value, 16))
             elif value_type == 'string':
                 message.properties[property_name] = value
             else:
                 raise InteropTestError('JmsSenderShim._add_jms_message_properties: ' +
                                        'Unknown or unhandled message property type ?%s"' % value_type)
 
+    @staticmethod
+    def signal_handler(signal_number, _):
+        """Signal handler"""
+        if signal_number in [signal.SIGTERM, signal.SIGINT]:
+            print('Sender: received signal %d, terminating' % signal_number)
+            sys.exit(1)
+
 
 
 # --- main ---
@@ -370,10 +380,11 @@ class JmsHdrsPropsTestSender(MessagingHandler):
 #print('#### sys.argv=%s' % sys.argv)
 #print('>>> test_values=%s' % loads(sys.argv[4]))
 try:
-    SENDER = JmsHdrsPropsTestSender(sys.argv[1], sys.argv[2], sys.argv[3], loads(sys.argv[4]))
-    Container(SENDER).run()
+    SENDER = JmsHdrsPropsTestSender(sys.argv[1], sys.argv[2], sys.argv[3], json.loads(sys.argv[4]))
+    proton.reactor.Container(SENDER).run()
 except KeyboardInterrupt:
     pass
 except Exception as exc:
     print(os.path.basename(sys.argv[0]), 'EXCEPTION:', exc)
-    print(format_exc())
+    print(traceback.format_exc())
+    sys.exit(1)

http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/f93886f5/shims/qpid-proton-python/src/jms_messages_test/Receiver.py
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-python/src/jms_messages_test/Receiver.py b/shims/qpid-proton-python/src/jms_messages_test/Receiver.py
index 494906f..c6dd7d2 100755
--- a/shims/qpid-proton-python/src/jms_messages_test/Receiver.py
+++ b/shims/qpid-proton-python/src/jms_messages_test/Receiver.py
@@ -23,20 +23,21 @@ JMS receiver shim for qpid-interop-test
 # under the License.
 #
 
-from json import dumps, loads
-from struct import pack, unpack
-from subprocess import check_output
+import json
+import signal
+import struct
+import subprocess
 import sys
-from traceback import format_exc
+import traceback
 
-from proton import byte
-from proton.handlers import MessagingHandler
-from proton.reactor import Container
+import proton
+import proton.handlers
+import proton.reactor
 from qpid_interop_test.interop_test_errors import InteropTestError
 from qpid_interop_test.jms_types import QPID_JMS_TYPE_ANNOTATION_NAME
 import _compat
 
-class JmsMessagesTestReceiver(MessagingHandler):
+class JmsMessagesTestReceiver(proton.handlers.MessagingHandler):
     """
     Receiver shim: This shim receives JMS messages sent by the Sender shim and prints the contents of the received
     messages onto the terminal in JSON format for retrieval by the test harness. The JMS messages type and, where
@@ -55,6 +56,8 @@ class JmsMessagesTestReceiver(MessagingHandler):
         self.received_value_map = {}
         self.current_subtype = None
         self.current_subtype_msg_list = None
+        signal.signal(signal.SIGINT, self.signal_handler)
+        signal.signal(signal.SIGTERM, self.signal_handler)
 
     def get_received_value_map(self):
         """Return the collected message values received"""
@@ -122,7 +125,7 @@ class JmsMessagesTestReceiver(MessagingHandler):
     def _receive_jms_message(self, message):
         """Receives a JMS message (without a body)"""
         assert self.jms_msg_type == 'JMS_MESSAGE_TYPE'
-        assert message.annotations[QPID_JMS_TYPE_ANNOTATION_NAME] == byte(0)
+        assert message.annotations[QPID_JMS_TYPE_ANNOTATION_NAME] == proton.byte(0)
         if message.body is not None:
             raise InteropTestError('_receive_jms_message: Invalid body for type JMS_MESSAGE_TYPE: %s' %
                                    str(message.body))
@@ -131,7 +134,7 @@ class JmsMessagesTestReceiver(MessagingHandler):
     def _receive_jms_bytesmessage(self, message):
         """Receives a JMS bytes message"""
         assert self.jms_msg_type == 'JMS_BYTESMESSAGE_TYPE'
-        assert message.annotations[QPID_JMS_TYPE_ANNOTATION_NAME] == byte(3)
+        assert message.annotations[QPID_JMS_TYPE_ANNOTATION_NAME] == proton.byte(3)
         if self.current_subtype == 'boolean':
             if message.body == b'\x00':
                 return 'False'
@@ -140,30 +143,29 @@ class JmsMessagesTestReceiver(MessagingHandler):
             raise InteropTestError('_receive_jms_bytesmessage: Invalid encoding for subtype boolean: %s' %
                                    str(message.body))
         if self.current_subtype == 'byte':
-            return hex(unpack('b', message.body)[0])
+            return hex(struct.unpack('b', message.body)[0])
         if self.current_subtype == 'bytes':
             return message.body.decode('utf-8')
         if self.current_subtype == 'char':
             if len(message.body) == 2: # format 'a' or '\xNN'
                 if _compat.IS_PY3:
                     return chr(message.body[1]) # strip leading '\x00' char
-                else:
-                    return str(message.body[1]) # strip leading '\x00' char
+                return str(message.body[1]) # strip leading '\x00' char
             raise InteropTestError('Unexpected string length for type char: %d' % len(message.body))
         if self.current_subtype == 'double':
-            return '0x%016x' % unpack('!Q', message.body)[0]
+            return '0x%016x' % struct.unpack('!Q', message.body)[0]
         if self.current_subtype == 'float':
-            return '0x%08x' % unpack('!L', message.body)[0]
+            return '0x%08x' % struct.unpack('!L', message.body)[0]
         if self.current_subtype == 'int':
-            return hex(unpack('!i', message.body)[0])
+            return hex(struct.unpack('!i', message.body)[0])
         if self.current_subtype == 'long':
-            return hex(unpack('!q', message.body)[0])
+            return hex(struct.unpack('!q', message.body)[0])
         if self.current_subtype == 'short':
-            return hex(unpack('!h', message.body)[0])
+            return hex(struct.unpack('!h', message.body)[0])
         if self.current_subtype == 'string':
             # NOTE: first 2 bytes are string length, must be present
             if len(message.body) >= 2:
-                str_len = unpack('!H', message.body[:2])[0]
+                str_len = struct.unpack('!H', message.body[:2])[0]
                 str_body = message.body[2:].decode('utf-8')
                 if len(str_body) != str_len:
                     raise InteropTestError('String length mismatch: size=%d, but len(\'%s\')=%d' %
@@ -178,7 +180,7 @@ class JmsMessagesTestReceiver(MessagingHandler):
     def _recieve_jms_mapmessage(self, message):
         """Receives a JMS map message"""
         assert self.jms_msg_type == 'JMS_MAPMESSAGE_TYPE'
-        assert message.annotations[QPID_JMS_TYPE_ANNOTATION_NAME] == byte(2)
+        assert message.annotations[QPID_JMS_TYPE_ANNOTATION_NAME] == proton.byte(2)
         key, value = list(message.body.items())[0]
         assert key[:-3] == self.current_subtype
         if self.current_subtype == 'boolean':
@@ -190,9 +192,9 @@ class JmsMessagesTestReceiver(MessagingHandler):
         if self.current_subtype == 'char':
             return str(value)
         if self.current_subtype == 'double':
-            return '0x%016x' % unpack('!Q', pack('!d', value))[0]
+            return '0x%016x' % struct.unpack('!Q', struct.pack('!d', value))[0]
         if self.current_subtype == 'float':
-            return '0x%08x' % unpack('!L', pack('!f', value))[0]
+            return '0x%08x' % struct.unpack('!L', struct.pack('!f', value))[0]
         if self.current_subtype == 'int':
             return hex(value)
         if self.current_subtype == 'long':
@@ -207,7 +209,7 @@ class JmsMessagesTestReceiver(MessagingHandler):
     def _recieve_jms_objectmessage(self, message):
         """Receives a JMS Object message"""
         assert self.jms_msg_type == 'JMS_OBJECTMESSAGE_TYPE'
-        assert message.annotations[QPID_JMS_TYPE_ANNOTATION_NAME] == byte(1)
+        assert message.annotations[QPID_JMS_TYPE_ANNOTATION_NAME] == proton.byte(1)
         return self._get_java_obj(message.body)
 
     def _get_java_obj(self, java_obj_bytes):
@@ -219,11 +221,11 @@ class JmsMessagesTestReceiver(MessagingHandler):
         returns: string containing Java class value as returned by the toString() method
         """
         java_obj_bytes_str = ''.join(["%02x" % ord(x) for x in java_obj_bytes]).strip()
-        out_str = check_output(['java',
-                                '-cp',
-                                'target/JavaObjUtils.jar',
-                                'org.apache.qpid.interop_test.obj_util.BytesToJavaObj',
-                                java_obj_bytes_str])
+        out_str = subprocess.check_output(['java',
+                                           '-cp',
+                                           'target/JavaObjUtils.jar',
+                                           'org.apache.qpid.interop_test.obj_util.BytesToJavaObj',
+                                           java_obj_bytes_str])
         out_str_list = out_str.split('\n')[:-1] # remove trailing \n
         if len(out_str_list) > 1:
             raise InteropTestError('Unexpected return from JavaObjUtils: %s' % out_str)
@@ -240,7 +242,7 @@ class JmsMessagesTestReceiver(MessagingHandler):
     def _receive_jms_streammessage(self, message):
         """Receives a JMS stream message"""
         assert self.jms_msg_type == 'JMS_STREAMMESSAGE_TYPE'
-        assert message.annotations[QPID_JMS_TYPE_ANNOTATION_NAME] == byte(4)
+        assert message.annotations[QPID_JMS_TYPE_ANNOTATION_NAME] == proton.byte(4)
         # Every message is a list with one item [value]
         assert len(message.body) == 1
         value = message.body[0]
@@ -253,9 +255,9 @@ class JmsMessagesTestReceiver(MessagingHandler):
         if self.current_subtype == 'char':
             return str(value)
         if self.current_subtype == 'double':
-            return '0x%016x' % unpack('!Q', pack('!d', value))[0]
+            return '0x%016x' % struct.unpack('!Q', struct.pack('!d', value))[0]
         if self.current_subtype == 'float':
-            return '0x%08x' % unpack('!L', pack('!f', value))[0]
+            return '0x%08x' % struct.unpack('!L', struct.pack('!f', value))[0]
         if self.current_subtype == 'int':
             return hex(value)
         if self.current_subtype == 'long':
@@ -271,9 +273,16 @@ class JmsMessagesTestReceiver(MessagingHandler):
     def _receive_jms_textmessage(self, message):
         """Receives a JMS text message"""
         assert self.jms_msg_type == 'JMS_TEXTMESSAGE_TYPE'
-        assert message.annotations[QPID_JMS_TYPE_ANNOTATION_NAME] == byte(5)
+        assert message.annotations[QPID_JMS_TYPE_ANNOTATION_NAME] == proton.byte(5)
         return message.body
 
+    @staticmethod
+    def signal_handler(signal_number, _):
+        """Signal handler"""
+        if signal_number in [signal.SIGTERM, signal.SIGINT]:
+            print('Receiver: received signal %d, terminating' % signal_number)
+            sys.exit(1)
+
 
 
 # --- main ---
@@ -283,12 +292,13 @@ class JmsMessagesTestReceiver(MessagingHandler):
 #       4: JSON Test parameters containing 2 maps: [testValuesMap, flagMap]
 #print('#### sys.argv=%s' % sys.argv)
 try:
-    RECEIVER = JmsMessagesTestReceiver(sys.argv[1], sys.argv[2], sys.argv[3], loads(sys.argv[4]))
-    Container(RECEIVER).run()
+    RECEIVER = JmsMessagesTestReceiver(sys.argv[1], sys.argv[2], sys.argv[3], json.loads(sys.argv[4]))
+    proton.reactor.Container(RECEIVER).run()
     print(sys.argv[3])
-    print(dumps(RECEIVER.get_received_value_map()))
+    print(json.dumps(RECEIVER.get_received_value_map()))
 except KeyboardInterrupt:
     pass
 except Exception as exc:
     print('jms-receiver-shim EXCEPTION:', exc)
-    print(format_exc())
+    print(traceback.format_exc())
+    sys.exit(1)

http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/f93886f5/shims/qpid-proton-python/src/jms_messages_test/Sender.py
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-python/src/jms_messages_test/Sender.py b/shims/qpid-proton-python/src/jms_messages_test/Sender.py
index 6815dc5..418d612 100755
--- a/shims/qpid-proton-python/src/jms_messages_test/Sender.py
+++ b/shims/qpid-proton-python/src/jms_messages_test/Sender.py
@@ -23,20 +23,21 @@ JMS sender shim for qpid-interop-test
 # under the License.
 #
 
-from json import loads
-from subprocess import check_output
-from struct import pack, unpack
+import json
+import signal
+import subprocess
+import struct
 import sys
-from traceback import format_exc
+import traceback
 
-from proton import byte, char, float32, int32, Message, short
-from proton.handlers import MessagingHandler
-from proton.reactor import Container
+import proton
+import proton.handlers
+import proton.reactor
 from qpid_interop_test.interop_test_errors import InteropTestError
 from qpid_interop_test.jms_types import create_annotation
 import _compat
 
-class JmsMessagesTestSender(MessagingHandler):
+class JmsMessagesTestSender(proton.handlers.MessagingHandler):
     """
     This shim sends JMS messages of a particular JMS message type according to the test parameters list. This list
     contains three maps:
@@ -56,6 +57,8 @@ class JmsMessagesTestSender(MessagingHandler):
         self.sent = 0
         self.confirmed = 0
         self.total = self._get_total_num_msgs()
+        signal.signal(signal.SIGINT, self.signal_handler)
+        signal.signal(signal.SIGTERM, self.signal_handler)
 
     def on_start(self, event):
         """Event callback for when the client starts"""
@@ -135,14 +138,14 @@ class JmsMessagesTestSender(MessagingHandler):
     def _create_jms_message(self, test_value_type, test_value):
         """Create a JMS message type (without message body)"""
         if test_value_type != 'none':
-            raise InteropTestError('JmsMessagesTestSender._create_jms_message: Unknown or unsupported subtype "%s"' %
-                                   test_value_type)
+            raise InteropTestError('JmsMessagesTestSender._create_jms_message: ' \
+                                   'Unknown or unsupported subtype "%s"' % test_value_type)
         if test_value is not None:
-            raise InteropTestError('JmsMessagesTestSender._create_jms_message: Invalid value "%s" for subtype "%s"' %
-                                   (test_value, test_value_type))
-        return Message(id=(self.sent+1),
-                       content_type='application/octet-stream',
-                       annotations=create_annotation('JMS_MESSAGE_TYPE'))
+            raise InteropTestError('JmsMessagesTestSender._create_jms_message: ' \
+                                   'Invalid value "%s" for subtype "%s"' % (test_value, test_value_type))
+        return proton.Message(id=(self.sent+1),
+                              content_type='application/octet-stream',
+                              annotations=create_annotation('JMS_MESSAGE_TYPE'))
 
     def _create_jms_bytesmessage(self, test_value_type, test_value):
         """Create a JMS bytes message"""
@@ -151,121 +154,130 @@ class JmsMessagesTestSender(MessagingHandler):
         if test_value_type == 'boolean':
             body_bytes = b'\x01' if test_value == 'True' else b'\x00'
         elif test_value_type == 'byte':
-            body_bytes = pack('b', int(test_value, 16))
+            body_bytes = struct.pack('b', int(test_value, 16))
         elif test_value_type == 'bytes':
             body_bytes = test_value.encode('utf-8')
         elif test_value_type == 'char':
             # JMS expects two-byte chars, ASCII chars can be prefixed with '\x00'
             body_bytes = b'\x00' + test_value.encode('utf-8')
         elif test_value_type == 'double' or test_value_type == 'float':
-            body_bytes = _compat._decode_hex(test_value[2:])
+            body_bytes = _compat.decode_hex(test_value[2:])
         elif test_value_type == 'int':
-            body_bytes = pack('!i', int(test_value, 16))
+            body_bytes = struct.pack('!i', int(test_value, 16))
         elif test_value_type == 'long':
-            body_bytes = pack('!q', _compat._long(test_value, 16))
+            body_bytes = struct.pack('!q', _compat.long(test_value, 16))
         elif test_value_type == 'short':
-            body_bytes = pack('!h', short(test_value, 16))
+            body_bytes = struct.pack('!h', proton.short(test_value, 16))
         elif test_value_type == 'string':
             # NOTE: First two bytes must be string length
             test_value_str = str(test_value) # remove unicode
-            body_bytes = pack('!H', len(test_value_str)) + test_value_str.encode('utf-8')
+            body_bytes = struct.pack('!H', len(test_value_str)) + test_value_str.encode('utf-8')
         else:
-            raise InteropTestError('JmsMessagesTestSender._create_jms_bytesmessage: Unknown or unsupported subtype "%s"' %
+            raise InteropTestError('JmsMessagesTestSender._create_jms_bytesmessage: ' \
+                                   'Unknown or unsupported subtype "%s"' %
                                    test_value_type)
-        return Message(id=(self.sent+1),
-                       body=body_bytes,
-                       inferred=True,
-                       content_type='application/octet-stream',
-                       annotations=create_annotation('JMS_BYTESMESSAGE_TYPE'))
+        return proton.Message(id=(self.sent+1),
+                              body=body_bytes,
+                              inferred=True,
+                              content_type='application/octet-stream',
+                              annotations=create_annotation('JMS_BYTESMESSAGE_TYPE'))
 
     def _create_jms_mapmessage(self, test_value_type, test_value, name):
         """Create a JMS map message"""
         if test_value_type == 'boolean':
             value = test_value == 'True'
         elif test_value_type == 'byte':
-            value = byte(int(test_value, 16))
+            value = proton.byte(int(test_value, 16))
         elif test_value_type == 'bytes':
             value = test_value.encode('utf-8')
         elif test_value_type == 'char':
-            value = char(test_value)
+            value = proton.char(test_value)
         elif test_value_type == 'double':
-            value = unpack('!d', _compat._decode_hex(test_value[2:]))[0]
+            value = struct.unpack('!d', _compat.decode_hex(test_value[2:]))[0]
         elif test_value_type == 'float':
-            value = float32(unpack('!f', _compat._decode_hex(test_value[2:]))[0])
+            value = proton.float32(struct.unpack('!f', _compat.decode_hex(test_value[2:]))[0])
         elif test_value_type == 'int':
-            value = int32(int(test_value, 16))
+            value = proton.int32(int(test_value, 16))
         elif test_value_type == 'long':
-            value = _compat._long(test_value, 16)
+            value = _compat.long(test_value, 16)
         elif test_value_type == 'short':
-            value = short(int(test_value, 16))
+            value = proton.short(int(test_value, 16))
         elif test_value_type == 'string':
             value = test_value
         else:
-            raise InteropTestError('JmsMessagesTestSender._create_jms_mapmessage: Unknown or unsupported subtype "%s"' %
-                                   test_value_type)
-        return Message(id=(self.sent+1),
-                       body={name: value},
-                       inferred=False,
-                       annotations=create_annotation('JMS_MAPMESSAGE_TYPE'))
+            raise InteropTestError('JmsMessagesTestSender._create_jms_mapmessage: ' \
+                                   'Unknown or unsupported subtype "%s"' % test_value_type)
+        return proton.Message(id=(self.sent+1),
+                              body={name: value},
+                              inferred=False,
+                              annotations=create_annotation('JMS_MAPMESSAGE_TYPE'))
 
     def _create_jms_objectmessage(self, test_value):
         """Create a JMS object message"""
         java_binary = self._s_get_java_obj_binary(test_value)
-        return Message(id=(self.sent+1),
-                       body=java_binary,
-                       inferred=True,
-                       content_type='application/x-java-serialized-object',
-                       annotations=create_annotation('JMS_OBJECTMESSAGE_TYPE'))
+        return proton.Message(id=(self.sent+1),
+                              body=java_binary,
+                              inferred=True,
+                              content_type='application/x-java-serialized-object',
+                              annotations=create_annotation('JMS_OBJECTMESSAGE_TYPE'))
 
     @staticmethod
     def _s_get_java_obj_binary(java_class_str):
         """Call external utility to create Java object and stringify it, returning the string representation"""
-        out_str = check_output(['java',
-                                '-cp',
-                                'target/JavaObjUtils.jar',
-                                'org.apache.qpid.interop_test.obj_util.JavaObjToBytes',
-                                java_class_str])
+        out_str = subprocess.check_output(['java',
+                                           '-cp',
+                                           'target/JavaObjUtils.jar',
+                                           'org.apache.qpid.interop_test.obj_util.JavaObjToBytes',
+                                           java_class_str])
         out_str_list = out_str.split('\n')[:-1] # remove trailing \n
         if out_str_list[0] != java_class_str:
-            raise InteropTestError('JmsMessagesTestSender._s_get_java_obj_binary(): Call to JavaObjToBytes failed\n%s' %
-                                   out_str)
-        return _compat._decode_hex(out_str_list[1])
+            raise InteropTestError('JmsMessagesTestSender._s_get_java_obj_binary(): ' \
+                                   'Call to JavaObjToBytes failed\n%s' % out_str)
+        return _compat.decode_hex(out_str_list[1])
 
     def _create_jms_streammessage(self, test_value_type, test_value):
         """Create a JMS stream message"""
         if test_value_type == 'boolean':
             body_list = [test_value == 'True']
         elif test_value_type == 'byte':
-            body_list = [byte(int(test_value, 16))]
+            body_list = [proton.byte(int(test_value, 16))]
         elif test_value_type == 'bytes':
             body_list = [test_value.encode('utf-8')]
         elif test_value_type == 'char':
-            body_list = [char(test_value)]
+            body_list = [proton.char(test_value)]
         elif test_value_type == 'double':
-            body_list = [unpack('!d', _compat._decode_hex(test_value[2:]))[0]]
+            body_list = [struct.unpack('!d', _compat.decode_hex(test_value[2:]))[0]]
         elif test_value_type == 'float':
-            body_list = [float32(unpack('!f', _compat._decode_hex(test_value[2:]))[0])]
+            body_list = [proton.float32(struct.unpack('!f', _compat.decode_hex(test_value[2:]))[0])]
         elif test_value_type == 'int':
-            body_list = [int32(int(test_value, 16))]
+            body_list = [proton.int32(int(test_value, 16))]
         elif test_value_type == 'long':
-            body_list = [_compat._long(test_value, 16)]
+            body_list = [_compat.long(test_value, 16)]
         elif test_value_type == 'short':
-            body_list = [short(int(test_value, 16))]
+            body_list = [proton.short(int(test_value, 16))]
         elif test_value_type == 'string':
             body_list = [test_value]
         else:
-            raise InteropTestError('JmsMessagesTestSender._create_jms_streammessage: Unknown or unsupported subtype "%s"' %
+            raise InteropTestError('JmsMessagesTestSender._create_jms_streammessage: ' \
+                                   'Unknown or unsupported subtype "%s"' %
                                    test_value_type)
-        return Message(id=(self.sent+1),
-                       body=body_list,
-                       inferred=True,
-                       annotations=create_annotation('JMS_STREAMMESSAGE_TYPE'))
+        return proton.Message(id=(self.sent+1),
+                              body=body_list,
+                              inferred=True,
+                              annotations=create_annotation('JMS_STREAMMESSAGE_TYPE'))
 
     def _create_jms_textmessage(self, test_value_text):
         """Create a JMS text message"""
-        return Message(id=(self.sent+1),
-                       body=_compat._unicode(test_value_text),
-                       annotations=create_annotation('JMS_TEXTMESSAGE_TYPE'))
+        return proton.Message(id=(self.sent+1),
+                              body=_compat.unicode(test_value_text),
+                              annotations=create_annotation('JMS_TEXTMESSAGE_TYPE'))
+
+    @staticmethod
+    def signal_handler(signal_number, _):
+        """Signal handler"""
+        if signal_number in [signal.SIGTERM, signal.SIGINT]:
+            print('Receiver: received signal %d, terminating' % signal_number)
+            sys.exit(1)
 
 
 
@@ -275,13 +287,12 @@ class JmsMessagesTestSender(MessagingHandler):
 #       2: Queue name
 #       3: JMS message type
 #       4: JSON Test parameters containing 3 maps: [testValueMap, testHeadersMap, testPropertiesMap]
-#print('#### sys.argv=%s' % sys.argv)
-#print('>>> test_values=%s' % loads(sys.argv[4]))
 try:
-    SENDER = JmsMessagesTestSender(sys.argv[1], sys.argv[2], sys.argv[3], loads(sys.argv[4]))
-    Container(SENDER).run()
+    SENDER = JmsMessagesTestSender(sys.argv[1], sys.argv[2], sys.argv[3], json.loads(sys.argv[4]))
+    proton.reactor.Container(SENDER).run()
 except KeyboardInterrupt:
     pass
 except Exception as exc:
     print('jms-sender-shim EXCEPTION:', exc)
-    print(format_exc())
+    print(traceback.format_exc())
+    sys.exit(1)

http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/f93886f5/src/python/qpid_interop_test/amqp_large_content_test.py
----------------------------------------------------------------------
diff --git a/src/python/qpid_interop_test/amqp_large_content_test.py b/src/python/qpid_interop_test/amqp_large_content_test.py
index 3e82f65..f6a5f94 100755
--- a/src/python/qpid_interop_test/amqp_large_content_test.py
+++ b/src/python/qpid_interop_test/amqp_large_content_test.py
@@ -23,6 +23,7 @@ Module to test AMQP messages with large content (bodies and headers/properties)
 # under the License.
 #
 
+import signal
 import sys
 import unittest
 
@@ -32,6 +33,7 @@ from json import dumps
 import qpid_interop_test.broker_properties
 import qpid_interop_test.qit_common
 import qpid_interop_test.shims
+from qpid_interop_test.interop_test_errors import InteropTestError
 
 
 class AmqpVariableSizeTypes(qpid_interop_test.qit_common.QitTestTypeMap):
@@ -88,28 +90,27 @@ class AmqpLargeContentTestCase(qpid_interop_test.qit_common.QitTestCase):
             # Start the receive shim first (for queueless brokers/dispatch)
             receiver = receive_shim.create_receiver(receiver_addr, queue_name, amqp_type,
                                                     str(self.get_num_messages(amqp_type, test_value_list)))
-            receiver.start()
 
             # Start the send shim
-            sender = send_shim.create_sender(sender_addr, queue_name, amqp_type,
-                                             dumps(test_value_list))
-            sender.start()
-
-            # Wait for both shims to finish
-            sender.join_or_kill(qpid_interop_test.shims.THREAD_TIMEOUT)
-            receiver.join_or_kill(qpid_interop_test.shims.THREAD_TIMEOUT)
-
-            # Process return string from sender
-            send_obj = sender.get_return_object()
+            sender = send_shim.create_sender(sender_addr, queue_name, amqp_type, dumps(test_value_list))
+
+            # Wait for sender, process return string
+            try:
+                send_obj = sender.wait_for_completion()
+            except KeyboardInterrupt as err:
+                receiver.send_signal(signal.SIGINT)
+                raise err
             if send_obj is not None:
                 if isinstance(send_obj, str):
                     if send_obj: # len > 0
-                        self.fail('Send shim \'%s\':\n%s' % (send_shim.NAME, send_obj))
+                        receiver.send_signal(signal.SIGINT)
+                        raise InteropTestError('Send shim \'%s\':\n%s' % (send_shim.NAME, send_obj))
                 else:
-                    self.fail('Sender error: %s' % str(send_obj))
+                    receiver.send_signal(signal.SIGINT)
+                    raise InteropTestError('Send shim \'%s\':\n%s' % (send_shim.NAME, send_obj))
 
-            # Process return string from receiver
-            receive_obj = receiver.get_return_object()
+            # Wait for receiver, process return string
+            receive_obj = receiver.wait_for_completion()
             if isinstance(receive_obj, tuple):
                 if len(receive_obj) == 2:
                     return_amqp_type, return_test_value_list = receive_obj
@@ -119,9 +120,10 @@ class AmqpLargeContentTestCase(qpid_interop_test.qit_common.QitTestCase):
                     self.assertEqual(return_test_value_list, test_value_list, msg='\n    sent:%s\nreceived:%s' % \
                                      (test_value_list, return_test_value_list))
                 else:
-                    self.fail('Received incorrect tuple format: %s' % str(receive_obj))
+                    raise InteropTestError('Receive shim \'%s\':\n%s' % (receive_shim.NAME, receive_obj))
             else:
-                self.fail('Received non-tuple: %s' % str(receive_obj))
+                raise InteropTestError('Receive shim \'%s\':\n%s' % (receive_shim.NAME, receive_obj))
+
 
     @staticmethod
     def get_num_messages(amqp_type, test_value_list):

http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/f93886f5/src/python/qpid_interop_test/amqp_types_test.py
----------------------------------------------------------------------
diff --git a/src/python/qpid_interop_test/amqp_types_test.py b/src/python/qpid_interop_test/amqp_types_test.py
index 8f46f5e..8fe6cd8 100755
--- a/src/python/qpid_interop_test/amqp_types_test.py
+++ b/src/python/qpid_interop_test/amqp_types_test.py
@@ -23,6 +23,7 @@ Module to test AMQP primitive types across different clients
 # under the License.
 #
 
+import signal
 import sys
 import unittest
 
@@ -34,6 +35,7 @@ from uuid import UUID, uuid4
 import qpid_interop_test.broker_properties
 import qpid_interop_test.qit_common
 import qpid_interop_test.shims
+from qpid_interop_test.interop_test_errors import InteropTestError
 
 
 class AmqpPrimitiveTypes(qpid_interop_test.qit_common.QitTestTypeMap):
@@ -318,27 +320,27 @@ class AmqpTypeTestCase(qpid_interop_test.qit_common.QitTestCase):
 
             # Start the receive shim first (for queueless brokers/dispatch)
             receiver = receive_shim.create_receiver(receiver_addr, queue_name, amqp_type, str(len(test_value_list)))
-            receiver.start()
 
             # Start the send shim
             sender = send_shim.create_sender(sender_addr, queue_name, amqp_type, dumps(test_value_list))
-            sender.start()
 
-            # Wait for both shims to finish
-            sender.join_or_kill(qpid_interop_test.shims.THREAD_TIMEOUT)
-            receiver.join_or_kill(qpid_interop_test.shims.THREAD_TIMEOUT)
-
-            # Process return string from sender
-            send_obj = sender.get_return_object()
+            # Wait for sender, process return string
+            try:
+                send_obj = sender.wait_for_completion()
+            except KeyboardInterrupt as err:
+                receiver.send_signal(signal.SIGINT)
+                raise err
             if send_obj is not None:
                 if isinstance(send_obj, str):
                     if send_obj: # len > 0
-                        self.fail('Send shim \'%s\':\n%s' % (send_shim.NAME, send_obj))
+                        receiver.send_signal(signal.SIGINT)
+                        raise InteropTestError('Send shim \'%s\':\n%s' % (send_shim.NAME, send_obj))
                 else:
-                    self.fail('Sender error: %s' % str(send_obj))
+                    receiver.send_signal(signal.SIGINT)
+                    raise InteropTestError('Send shim \'%s\':\n%s' % (send_shim.NAME, send_obj))
 
-            # Process return string from receiver
-            receive_obj = receiver.get_return_object()
+            # Wait for receiver, process return string
+            receive_obj = receiver.wait_for_completion()
             if isinstance(receive_obj, tuple):
                 if len(receive_obj) == 2:
                     return_amqp_type, return_test_value_list = receive_obj
@@ -348,9 +350,9 @@ class AmqpTypeTestCase(qpid_interop_test.qit_common.QitTestCase):
                     self.assertEqual(return_test_value_list, test_value_list, msg='\n    sent:%s\nreceived:%s' % \
                                      (test_value_list, return_test_value_list))
                 else:
-                    self.fail('Received incorrect tuple format: %s' % str(receive_obj))
+                    raise InteropTestError('Receive shim \'%s\':\n%s' % (receive_shim.NAME, receive_obj))
             else:
-                self.fail('Received non-tuple: %s' % str(receive_obj))
+                raise InteropTestError('Receive shim \'%s\':\n%s' % (receive_shim.NAME, receive_obj))
 
 
 class TestOptions(qpid_interop_test.qit_common.QitCommonTestOptions):


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


Mime
View raw message