You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kp...@apache.org on 2016/09/07 18:54:02 UTC
qpid-interop-test git commit: NO_JIRA: Tidy-up of Python code
Repository: qpid-interop-test
Updated Branches:
refs/heads/master 038afc553 -> ec0e4bbc6
NO_JIRA: Tidy-up of Python code
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/ec0e4bbc
Tree: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/tree/ec0e4bbc
Diff: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/diff/ec0e4bbc
Branch: refs/heads/master
Commit: ec0e4bbc6df2d3f6b216b8dd0c4a80a62998f912
Parents: 038afc5
Author: Kim van der Riet <kp...@apache.org>
Authored: Wed Sep 7 14:53:48 2016 -0400
Committer: Kim van der Riet <kp...@apache.org>
Committed: Wed Sep 7 14:53:48 2016 -0400
----------------------------------------------------------------------
shims/qpid-proton-python/src/JmsReceiverShim.py | 57 +++--
shims/qpid-proton-python/src/JmsSenderShim.py | 70 +++++-
.../qpid-proton-python/src/TypesReceiverShim.py | 19 +-
shims/qpid-proton-python/src/TypesSenderShim.py | 24 +-
.../qpid-interop-test/jms/jms_message_tests.py | 242 +++++++++----------
.../types/simple_type_tests.py | 73 ++++--
6 files changed, 301 insertions(+), 184 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/ec0e4bbc/shims/qpid-proton-python/src/JmsReceiverShim.py
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-python/src/JmsReceiverShim.py b/shims/qpid-proton-python/src/JmsReceiverShim.py
index f068659..7801d3f 100755
--- a/shims/qpid-proton-python/src/JmsReceiverShim.py
+++ b/shims/qpid-proton-python/src/JmsReceiverShim.py
@@ -1,4 +1,9 @@
#!/usr/bin/env python
+
+"""
+JMS receiver shim for qpid-interop-test
+"""
+
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
@@ -33,6 +38,12 @@ from traceback import format_exc
QPID_JMS_TYPE_ANNOTATION_NAME = symbol(u'x-opt-jms-msg-type')
class JmsReceiverShim(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
+ applicable, body values, as well as the combinations of JMS headers and properties which may be attached to
+ the message are received on the command-line in JSON format when this program is launched.
+ """
def __init__(self, url, jms_msg_type, test_parameters_list):
super(JmsReceiverShim, self).__init__()
self.url = url
@@ -49,18 +60,23 @@ class JmsReceiverShim(MessagingHandler):
self.jms_property_map = {}
def get_received_value_map(self):
+ """"Return the collected message values received"""
return self.received_value_map
def get_jms_header_map(self):
+ """Return the collected message headers received"""
return self.jms_header_map
def get_jms_property_map(self):
+ """Return the collected message properties received"""
return self.jms_property_map
def on_start(self, event):
+ """Event callback for when the client starts"""
event.container.create_receiver(self.url)
def on_message(self, event):
+ """Event callback when a message is received by the client"""
if event.message.id and event.message.id < self.received:
return # ignore duplicate message
if self.expected == 0 or self.received < self.expected:
@@ -80,6 +96,7 @@ class JmsReceiverShim(MessagingHandler):
event.connection.close()
def _handle_message(self, message):
+ """Handles the analysis of a received message"""
if self.jms_msg_type == 'JMS_MESSAGE_TYPE':
return self._receive_jms_message(message)
if self.jms_msg_type == 'JMS_BYTESMESSAGE_TYPE':
@@ -96,12 +113,14 @@ class JmsReceiverShim(MessagingHandler):
return None
def _get_tot_num_messages(self):
+ """"Counts up the total number of messages which should be received from the expected message map"""
total = 0
for key in self.expteced_msg_map:
total += int(self.expteced_msg_map[key])
return total
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)
if message.body is not None:
@@ -110,6 +129,7 @@ class JmsReceiverShim(MessagingHandler):
return None
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)
if self.current_subtype == 'boolean':
@@ -153,6 +173,7 @@ class JmsReceiverShim(MessagingHandler):
(self.jms_msg_type, self.current_subtype))
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)
key, value = message.body.items()[0]
@@ -181,18 +202,19 @@ class JmsReceiverShim(MessagingHandler):
(self.jms_msg_type, self.current_subtype))
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)
return self._get_java_obj(message.body)
def _get_java_obj(self, java_obj_bytes):
- '''
+ """
Take bytes from serialized Java object and construct a Java object, then return its toString() value. The
work of 'translating' the bytes to a Java object and obtaining its class and value is done in a Java
utility org.apache.qpid.interop_test.obj_util.BytesToJavaObj located in jar JavaObjUtils.jar.
java_obj_bytes: hex string representation of bytes from Java object (eg 'aced00057372...')
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',
@@ -213,6 +235,7 @@ class JmsReceiverShim(MessagingHandler):
return java_class_value_str
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)
# Every message is a list with one item [value]
@@ -238,20 +261,23 @@ class JmsReceiverShim(MessagingHandler):
return hex(value)
if self.current_subtype == 'string':
return str(value)
- raise InteropTestError('JmsRecieverShim._receive_jms_streammessage(): JMS message type %s: Unknown or unsupported subtype \'%s\'' %
+ raise InteropTestError('JmsRecieverShim._receive_jms_streammessage(): ' +
+ 'JMS message type %s: Unknown or unsupported subtype \'%s\'' %
(self.jms_msg_type, self.current_subtype))
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)
return message.body
def _process_jms_headers(self, message):
+ """"Checks the supplied message for three JMS headers: message type, correlation-id and reply-to"""
# JMS message type header
message_type_header = message._get_subject()
if message_type_header is not None:
self.jms_header_map['JMS_TYPE_HEADER'] = {'string': message_type_header}
-
+
# JMS correlation ID
correlation_id = message._get_correlation_id()
if correlation_id is not None:
@@ -274,25 +300,28 @@ class JmsReceiverShim(MessagingHandler):
self.jms_header_map['JMS_REPLYTO_HEADER'] = {'queue': reply_to}
def _process_jms_properties(self, message):
+ """"Checks the supplied message for JMS message properties and decodes them"""
if message.properties is not None:
for jms_property_name in message.properties:
jms_property_type = jms_property_name[0:jms_property_name.index('_')]
value = message.properties[jms_property_name]
- if (jms_property_type == 'boolean'):
+ if jms_property_type == 'boolean':
self.jms_property_map[jms_property_name] = {'boolean': str(value)}
- elif (jms_property_type == 'byte'):
+ 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]}
- elif (jms_property_type == 'float'):
- self.jms_property_map[jms_property_name] = {'float': '0x%08x' % unpack('!L', pack('!f', value))[0]}
- elif (jms_property_type == 'int'):
+ elif jms_property_type == 'double':
+ self.jms_property_map[jms_property_name] = {'double': '0x%016x' %
+ unpack('!Q', 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]}
+ elif jms_property_type == 'int':
self.jms_property_map[jms_property_name] = {'int': hex(value)}
- elif (jms_property_type == 'long'):
+ elif jms_property_type == 'long':
self.jms_property_map[jms_property_name] = {'long': hex(int(value))}
- elif (jms_property_type == 'short'):
+ elif jms_property_type == 'short':
self.jms_property_map[jms_property_name] = {'short': hex(value)}
- elif (jms_property_type == 'string'):
+ elif jms_property_type == 'string':
self.jms_property_map[jms_property_name] = {'string': str(value)}
else:
pass # Ignore any other properties, brokers can add them and we don't know what they may be
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/ec0e4bbc/shims/qpid-proton-python/src/JmsSenderShim.py
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-python/src/JmsSenderShim.py b/shims/qpid-proton-python/src/JmsSenderShim.py
index 3e1adf2..ab5d429 100755
--- a/shims/qpid-proton-python/src/JmsSenderShim.py
+++ b/shims/qpid-proton-python/src/JmsSenderShim.py
@@ -1,4 +1,9 @@
#!/usr/bin/env python
+
+"""
+JMS sender shim for qpid-interop-test
+"""
+
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
@@ -40,9 +45,20 @@ QPID_JMS_TYPE_ANNOTATIONS = {
'JMS_TEXTMESSAGE_TYPE': byte(5)
}
def create_annotation(jms_msg_type):
+ """Function which creates a message annotation for JMS message type as used by the Qpid JMS client"""
return {QPID_JMS_TYPE_ANNOTATION_NAME: QPID_JMS_TYPE_ANNOTATIONS[jms_msg_type]}
class JmsSenderShim(MessagingHandler):
+ """
+ This shim sends JMS messages of a particular JMS message type according to the test parameters list. This list
+ contains three maps:
+ 0: The test value map, which contains test value types as keys, and lists of values of that type;
+ 1. The test headers map, which contains the JMS headers as keys and a submap conatining types and values;
+ 2. The test proprties map, which contains the name of the properties as keys, and a submap containing types
+ and values
+ This shim takes the combinations of the above map and creates test cases, each of which sends a single message
+ with (or without) JMS headers and properties.
+ """
def __init__(self, broker_ip_addr, queue_name, jms_msg_type, test_parameters_list):
super(JmsSenderShim, self).__init__()
self.broker_ip_addr = broker_ip_addr
@@ -56,9 +72,11 @@ class JmsSenderShim(MessagingHandler):
self.total = self._get_total_num_msgs()
def on_start(self, event):
+ """Event callback for when the client starts"""
event.container.create_sender('%s/%s' % (self.broker_ip_addr, self.queue_name))
def on_sendable(self, event):
+ """Event callback for when send credit is received, allowing the sending of messages"""
if self.sent == 0:
# These types expect a test_values Python string representation of a map: '{type:[val, val, val], ...}'
for sub_type in sorted(self.test_value_map.keys()):
@@ -66,20 +84,26 @@ class JmsSenderShim(MessagingHandler):
return
def on_accepted(self, event):
+ """Event callback for when a sent message is accepted by the broker"""
self.confirmed += 1
if self.confirmed == self.total:
event.connection.close()
def on_disconnected(self, event):
+ """Event callback for when the broker disconnects with the client"""
self.sent = self.confirmed
def _get_total_num_msgs(self):
+ """
+ Calculates the total number of messages to be sent based on the message parameters received on the command-line
+ """
total = 0
for key in self.test_value_map.keys():
total += len(self.test_value_map[key])
return total
def _send_test_values(self, event, test_value_type, test_values):
+ """Method which loops through recieved parameters and sends the corresponding messages"""
value_num = 0
for test_value in test_values:
if event.sender.credit:
@@ -98,6 +122,7 @@ class JmsSenderShim(MessagingHandler):
# TODO: Change this to return a list of messages. That way each test can return more than one message
def _create_message(self, test_value_type, test_value, value_num):
+ """Create a single message of the appropriate JMS message type"""
if self.jms_msg_type == 'JMS_MESSAGE_TYPE':
return self._create_jms_message(test_value_type, test_value)
elif self.jms_msg_type == 'JMS_BYTESMESSAGE_TYPE':
@@ -115,6 +140,7 @@ class JmsSenderShim(MessagingHandler):
return None
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('JmsSenderShim._create_jms_message: Unknown or unsupported subtype "%s"' %
test_value_type)
@@ -126,6 +152,7 @@ class JmsSenderShim(MessagingHandler):
annotations=create_annotation('JMS_MESSAGE_TYPE'))
def _create_jms_bytesmessage(self, test_value_type, test_value):
+ """Create a JMS bytes message"""
# NOTE: test_value contains all unicode strings u'...' as returned by json
body_bytes = None
if test_value_type == 'boolean':
@@ -159,6 +186,7 @@ class JmsSenderShim(MessagingHandler):
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':
@@ -188,7 +216,8 @@ class JmsSenderShim(MessagingHandler):
annotations=create_annotation('JMS_MAPMESSAGE_TYPE'))
def _create_jms_objectmessage(self, test_value):
- java_binary = self._get_java_obj_binary(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,
@@ -196,7 +225,8 @@ class JmsSenderShim(MessagingHandler):
annotations=create_annotation('JMS_OBJECTMESSAGE_TYPE'))
@staticmethod
- def _get_java_obj_binary(java_class_str):
+ 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',
@@ -204,10 +234,12 @@ class JmsSenderShim(MessagingHandler):
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._get_java_obj_binary(): Call to JavaObjToBytes failed\n%s' % out_str)
+ raise InteropTestError('JmsSenderShim._s_get_java_obj_binary(): Call to JavaObjToBytes failed\n%s' %
+ out_str)
return out_str_list[1].decode('hex')
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':
@@ -237,11 +269,13 @@ class JmsSenderShim(MessagingHandler):
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=unicode(test_value_text),
annotations=create_annotation('JMS_TEXTMESSAGE_TYPE'))
def _add_jms_message_headers(self, message):
+ """Add JMS headers to the supplied message from self.test_headers_map"""
for jms_header in self.test_headers_map.iterkeys():
value_map = self.test_headers_map[jms_header]
value_type = value_map.keys()[0] # There is only ever one value in map
@@ -250,37 +284,47 @@ class JmsSenderShim(MessagingHandler):
if value_type == 'string':
self._s_set_jms_type_header(message, value)
else:
- raise InteropTestError('JmsSenderShim._add_jms_message_headers(): JMS_TYPE_HEADER requires value type "string", type "%s" found' % value_type)
+ raise InteropTestError('JmsSenderShim._add_jms_message_headers(): ' +
+ 'JMS_TYPE_HEADER requires value type "string", type "%s" found' %
+ value_type)
elif jms_header == 'JMS_CORRELATIONID_HEADER':
if value_type == 'string':
self._s_set_jms_correlation_id(message, value)
elif value_type == 'bytes':
self._s_set_jms_correlation_id(message, str(value))
else:
- raise InteropTestError('JmsSenderShim._add_jms_message_headers(): JMS_CORRELATIONID_HEADER requires value type "string" or "bytes", type "%s" found' % value_type)
+ raise InteropTestError('JmsSenderShim._add_jms_message_headers(): ' +
+ 'JMS_CORRELATIONID_HEADER requires value type "string" or "bytes", ' +
+ 'type "%s" found' % value_type)
elif jms_header == 'JMS_REPLYTO_HEADER':
if value_type == 'queue' or value_type == 'topic':
self._s_set_jms_reply_to(message, value_type, value)
elif value_type == 'temp_queue' or value_type == 'temp_topic':
- raise InteropTestError('JmsSenderShim._add_jms_message_headers(): JMS_REPLYTO_HEADER type "temp_queue" or "temp_topic" not handled')
+ raise InteropTestError('JmsSenderShim._add_jms_message_headers(): ' +
+ 'JMS_REPLYTO_HEADER type "temp_queue" or "temp_topic" not handled')
else:
- raise InteropTestError('JmsSenderShim._add_jms_message_headers(): JMS_REPLYTO_HEADER requires value type "queue" or "topic", type "%s" found' % value_type)
+ raise InteropTestError('JmsSenderShim._add_jms_message_headers(): ' +
+ 'JMS_REPLYTO_HEADER requires value type "queue" or "topic", ' +
+ 'type "%s" found' % value_type)
else:
raise InteropTestError('JmsSenderShim._add_jms_message_headers(): Invalid JMS message header "%s"' %
- jms_header);
+ jms_header)
@staticmethod
def _s_set_jms_type_header(message, message_type):
+ """Adds a JMS message type header"""
message._set_subject(message_type)
@staticmethod
def _s_set_jms_correlation_id(message, correlation_id):
+ """Adds a JMS correlation id header"""
message._set_correlation_id(correlation_id)
message.annotations[symbol(u'x-opt-app-correlation-id')] = True
@staticmethod
def _s_set_jms_reply_to(message, jms_destination_type_str, destination):
+ """Adds a JMS reply-to header"""
if jms_destination_type_str == 'queue':
message._set_reply_to(destination)
message.annotations[symbol(u'x-opt-jms-reply-to')] = byte(0)
@@ -288,10 +332,11 @@ class JmsSenderShim(MessagingHandler):
message._set_reply_to(destination)
message.annotations[symbol(u'x-opt-jms-reply-to')] = byte(1)
else:
- raise InteropTestError('JmsSenderShim._s_set_jms_reply_to(): Invalid value for jms_destination_type_str "%s"' %
- jms_destination_type_str)
+ raise InteropTestError('JmsSenderShim._s_set_jms_reply_to(): ' +
+ 'Invalid value for jms_destination_type_str "%s"' % jms_destination_type_str)
def _add_jms_message_properties(self, message):
+ """Adds message properties to the supplied message from self.test_properties_map"""
for property_name in self.test_properties_map.iterkeys():
value_map = self.test_properties_map[property_name]
value_type = value_map.keys()[0] # There is only ever one value in map
@@ -315,8 +360,9 @@ class JmsSenderShim(MessagingHandler):
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)
-
+ raise InteropTestError('JmsSenderShim._add_jms_message_properties: ' +
+ 'Unknown or unhandled message property type ?%s"' % value_type)
+
# --- main ---
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/ec0e4bbc/shims/qpid-proton-python/src/TypesReceiverShim.py
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-python/src/TypesReceiverShim.py b/shims/qpid-proton-python/src/TypesReceiverShim.py
index b88dcb8..2876f51 100755
--- a/shims/qpid-proton-python/src/TypesReceiverShim.py
+++ b/shims/qpid-proton-python/src/TypesReceiverShim.py
@@ -1,4 +1,9 @@
#!/usr/bin/env python
+
+"""
+AMQP type test receiver shim for qpid-interop-test
+"""
+
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
@@ -29,9 +34,14 @@ from traceback import format_exc
from string import digits, letters, punctuation
from struct import pack, unpack
-class Receiver(MessagingHandler):
+class AmqpTypesReceiverShim(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
+ bodies of the exptected AMQP type. The values are then aggregated and returned.
+ """
def __init__(self, url, amqp_type, num_expected_messages_str):
- super(Receiver, self).__init__()
+ super(AmqpTypesReceiverShim, self).__init__()
self.url = url
self.received_value_list = []
self.amqp_type = amqp_type
@@ -39,12 +49,15 @@ class Receiver(MessagingHandler):
self.received = 0
def get_received_value_list(self):
+ """Return the received list of AMQP values"""
return self.received_value_list
def on_start(self, event):
+ """Event callback for when the client starts"""
event.container.create_receiver(self.url)
def on_message(self, event):
+ """Event callback when a message is received by the client"""
if event.message.id and event.message.id < self.received:
return # ignore duplicate message
if self.expected == 0 or self.received < self.expected:
@@ -103,7 +116,7 @@ class Receiver(MessagingHandler):
# 3: AMQP type
# 4: Expected number of test values to receive
try:
- RECEIVER = Receiver('%s/%s' % (sys.argv[1], sys.argv[2]), sys.argv[3], sys.argv[4])
+ RECEIVER = AmqpTypesReceiverShim('%s/%s' % (sys.argv[1], sys.argv[2]), sys.argv[3], sys.argv[4])
Container(RECEIVER).run()
print sys.argv[3]
print dumps(RECEIVER.get_received_value_list())
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/ec0e4bbc/shims/qpid-proton-python/src/TypesSenderShim.py
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-python/src/TypesSenderShim.py b/shims/qpid-proton-python/src/TypesSenderShim.py
index dd9920b..19d183f 100755
--- a/shims/qpid-proton-python/src/TypesSenderShim.py
+++ b/shims/qpid-proton-python/src/TypesSenderShim.py
@@ -1,4 +1,9 @@
#!/usr/bin/env python
+
+"""
+AMQP type test sender shim for qpid-interop-test
+"""
+
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
@@ -32,9 +37,14 @@ from struct import unpack
from traceback import format_exc
from uuid import UUID
-class Sender(MessagingHandler):
+class AmqpTypesSenderShim(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
+ AMQP type. There is no returned value.
+ """
def __init__(self, url, amqp_type, test_value_list):
- super(Sender, self).__init__()
+ super(AmqpTypesSenderShim, self).__init__()
self.url = url
self.amqp_type = amqp_type
self.test_value_list = test_value_list
@@ -43,9 +53,11 @@ class Sender(MessagingHandler):
self.total = len(test_value_list)
def on_start(self, event):
+ """Event callback for when the client starts"""
event.container.create_sender(self.url)
def on_sendable(self, event):
+ """Event callback for when send credit is received, allowing the sending of messages"""
if self.sent == 0:
for test_value in self.test_value_list:
if event.sender.credit:
@@ -58,6 +70,10 @@ class Sender(MessagingHandler):
return
def create_message(self, test_value):
+ """
+ Creates a single message with the test value translated from its string representation to the appropriate
+ AMQP value (set in self.amqp_type).
+ """
if self.amqp_type == 'null':
return Message(id=(self.sent+1), body=None)
elif self.amqp_type == 'boolean':
@@ -114,11 +130,13 @@ class Sender(MessagingHandler):
return None
def on_accepted(self, event):
+ """Event callback for when a sent message is accepted by the broker"""
self.confirmed += 1
if self.confirmed == self.total:
event.connection.close()
def on_disconnected(self, event):
+ """Event callback for when the broker disconnects with the client"""
self.sent = self.confirmed
@@ -128,7 +146,7 @@ class Sender(MessagingHandler):
# 3: AMQP type
# 4...n: Test value(s) as strings
try:
- Container(Sender('%s/%s' % (sys.argv[1], sys.argv[2]), sys.argv[3], loads(sys.argv[4]))).run()
+ Container(AmqpTypesSenderShim('%s/%s' % (sys.argv[1], sys.argv[2]), sys.argv[3], loads(sys.argv[4]))).run()
except KeyboardInterrupt:
pass
except Exception as exc:
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/ec0e4bbc/src/python/qpid-interop-test/jms/jms_message_tests.py
----------------------------------------------------------------------
diff --git a/src/python/qpid-interop-test/jms/jms_message_tests.py b/src/python/qpid-interop-test/jms/jms_message_tests.py
index c37463c..4311f86 100755
--- a/src/python/qpid-interop-test/jms/jms_message_tests.py
+++ b/src/python/qpid-interop-test/jms/jms_message_tests.py
@@ -24,24 +24,24 @@ Module to test JMS message types across different APIs
#
import argparse
+import sys
import unittest
from itertools import product
from json import dumps, loads
from os import getenv, path
from subprocess import check_output, CalledProcessError
-from sys import exit
from proton import symbol
from test_type_map import TestTypeMap
import broker_properties
-# TODO - propose a sensible default when installation details are worked out
+# TODO: propose a sensible default when installation details are worked out
QPID_INTEROP_TEST_HOME = getenv('QPID_INTEROP_TEST_HOME')
if QPID_INTEROP_TEST_HOME is None:
print 'ERROR: Environment variable QPID_INTEROP_TEST_HOME is not set'
- exit(1)
+ sys.exit(1)
class JmsMessageTypes(TestTypeMap):
"""
@@ -109,7 +109,7 @@ class JmsMessageTypes(TestTypeMap):
"Charlie's \"peach\"",
'Charlie\'s "peach"',
'The quick brown fox jumped over the lazy dog 0123456789.'# * 100]
- ]
+ ]
}
TYPE_ADDITIONAL_SUBMAP = {
@@ -118,7 +118,7 @@ class JmsMessageTypes(TestTypeMap):
b'Hello, world',
b'\\x01\\x02\\x03\\x04\\x05abcde\\x80\\x81\\xfe\\xff',
b'The quick brown fox jumped over the lazy dog 0123456789.' #* 100],
- ],
+ ],
'char': ['a',
'Z',
'\x01',
@@ -152,15 +152,15 @@ class JmsMessageTypes(TestTypeMap):
"Charlie's \"peach\"",
'Charlie\'s "peach"',
'The quick brown fox jumped over the lazy dog 0123456789.' * 10,
-# #'', # TODO: Re-enable when PROTON-1288 is fixed
- ],
+ #'', # TODO: Re-enable when PROTON-1288 is fixed
+ ],
'bytes': [b'12345\\x006789',
b'Hello, world',
b'"Hello, world"',
b'\\x01\\x02\\x03\\x04\\x05abcde\\x80\\x81\\xfe\\xff',
b'The quick brown fox jumped over the lazy dog 0123456789.' * 10,
#b'', # TODO: Re-enable when PROTON-1288 is fixed
- ],
+ ],
},
'JMS_REPLYTO_HEADER': {'queue': ['q_aaa', 'q_bbb'],
'topic': ['t_aaa', 't_bbb'],
@@ -171,7 +171,7 @@ class JmsMessageTypes(TestTypeMap):
'Charlie\'s "peach"',
'The quick brown fox jumped over the lazy dog 0123456789.' * 10,
#'', # TODO: Re-enable when PROTON-1288 is fixed
- ],
+ ],
},
}
@@ -188,52 +188,54 @@ class JmsMessageTypes(TestTypeMap):
"Charlie's \"peach\"",
'Charlie\'s "peach"',
'The quick brown fox jumped over the lazy dog 0123456789.' * 10
- ]},
-# TODO: Add Object messages when other (non-JMS clients) can generate Java class strings used in this messag type
-# 'JMS_OBJECTMESSAGE_TYPE': {
-# 'java.lang.Boolean': ['true',
-# 'false'],
-# 'java.lang.Byte': ['-128',
-# '0',
-# '127'],
-# 'java.lang.Character': [u'a',
-# u'Z'],
-# 'java.lang.Double': ['0.0',
-# '3.141592654',
-# '-2.71828182846'],
-# 'java.lang.Float': ['0.0',
-# '3.14159',
-# '-2.71828'],
-# 'java.lang.Integer': ['-2147483648',
-# '-129',
-# '-128',
-# '-1',
-# '0',
-# '127',
-# '128',
-# '2147483647'],
-# 'java.lang.Long' : ['-9223372036854775808',
-# '-129',
-# '-128',
-# '-1',
-# '0',
-# '127',
-# '128',
-# '9223372036854775807'],
-# 'java.lang.Short': ['-32768',
-# '-129',
-# '-128',
-# '-1',
-# '0',
-# '127',
-# '128',
-# '32767'],
-# 'java.lang.String': [u'',
-# u'Hello, world',
-# u'"Hello, world"',
-# u"Charlie's \"peach\"",
-# u'Charlie\'s "peach"']
-# },
+ ]
+ },
+ # TODO: Add Object messages when other (non-JMS clients) can generate Java class strings used in this message
+ # type
+ #'JMS_OBJECTMESSAGE_TYPE': {
+ # 'java.lang.Boolean': ['true',
+ # 'false'],
+ # 'java.lang.Byte': ['-128',
+ # '0',
+ # '127'],
+ # 'java.lang.Character': [u'a',
+ # u'Z'],
+ # 'java.lang.Double': ['0.0',
+ # '3.141592654',
+ # '-2.71828182846'],
+ # 'java.lang.Float': ['0.0',
+ # '3.14159',
+ # '-2.71828'],
+ # 'java.lang.Integer': ['-2147483648',
+ # '-129',
+ # '-128',
+ # '-1',
+ # '0',
+ # '127',
+ # '128',
+ # '2147483647'],
+ # 'java.lang.Long' : ['-9223372036854775808',
+ # '-129',
+ # '-128',
+ # '-1',
+ # '0',
+ # '127',
+ # '128',
+ # '9223372036854775807'],
+ # 'java.lang.Short': ['-32768',
+ # '-129',
+ # '-128',
+ # '-1',
+ # '0',
+ # '127',
+ # '128',
+ # '32767'],
+ # 'java.lang.String': [u'',
+ # u'Hello, world',
+ # u'"Hello, world"',
+ # u"Charlie's \"peach\"",
+ # u'Charlie\'s "peach"']
+ # },
}
BROKER_SKIP = {}
@@ -259,7 +261,7 @@ class JmsMessageTypeTestCase(unittest.TestCase):
self.fail('Send shim \'%s\':\n%s' % (send_shim.NAME, send_error_text))
num_test_values_map = {}
- if (len(test_values) > 0):
+ if len(test_values) > 0:
for index in test_values.keys():
num_test_values_map[index] = len(test_values[index])
flags_map = {}
@@ -290,29 +292,6 @@ class JmsMessageTypeTestCase(unittest.TestCase):
(msg_props, return_msg_props))
-def create_msg_hdr_list(hdr_map):
- msg_hdr_list = []
- tot_cnt = 0
- for hdr in hdr_map.iterkeys():
- for hdr_type in hdr_map[hdr].iterkeys():
- for hdr_val in hdr_map[hdr][hdr_type]:
- msg_hdr_list.append({hdr: {hdr_type: hdr_val}})
- tot_cnt += 1
- return tot_cnt, msg_hdr_list
-
-
-def create_msg_props_list(props_map):
- msg_props_list = []
- tot_cnt = 0
- for prop_type in props_map.iterkeys():
- prop_cnt = 0
- for prop in props_map[prop_type]:
- msg_props_list.append({prop_type: {'prop_%s_%04d' % (prop_type, prop_cnt): prop}})
- prop_cnt += 1
- tot_cnt += 1
- return tot_cnt, msg_props_list
-
-
def create_testcase_class(broker_name, types, broker_addr, jms_message_type, shim_product):
"""
Class factory function which creates new subclasses to JmsMessageTypeTestCase. Each call creates a single new
@@ -375,31 +354,31 @@ def create_testcase_class(broker_name, types, broker_addr, jms_message_type, shi
# One message with all the headers together using type[0] and val[0]
all_hdrs = {}
for msg_header in types.HEADERS_MAP.iterkeys():
- header_type_dict = types.HEADERS_MAP[msg_header];
+ header_type_dict = types.HEADERS_MAP[msg_header]
header_type, header_val_list = header_type_dict.iteritems().next()
header_val = header_val_list[0]
all_hdrs[msg_header] = {header_type: header_val}
add_test_method(new_class, ('_hdrs', all_hdrs), ('', {}), send_shim, receive_shim)
-# Properties tests disabled until PROTON-1284 fixed
-# # Iterate through properties
-# # Structure: {prop_type_1: [val_1_1, val_1_2, ...],
-# # prop_type_2: [val_2_1, val_2_2, ...],
-# # ...
-# # }
-# all_props = {}
-# for prop_type, prop_val_list in types.PROPERTIES_MAP.iteritems():
-# prop_val_cnt = 0
-# for prop_val in prop_val_list:
-# prop_val_cnt += 1
-# all_props['%s_%02d' % (prop_type, prop_val_cnt)] = {prop_type: prop_val}
-#
-# # One message with all properties together
-# add_test_method(new_class, ('', {}), ('_props', all_props), send_shim, receive_shim)
-#
-# # One message with all headers and all properties together
-# add_test_method(new_class, ('_hdrs', all_hdrs), ('_props', all_props), send_shim, receive_shim)
-
+ # Properties tests disabled until PROTON-1284 fixed
+ ## Iterate through properties
+ ## Structure: {prop_type_1: [val_1_1, val_1_2, ...],
+ ## prop_type_2: [val_2_1, val_2_2, ...],
+ ## ...
+ ## }
+ #all_props = {}
+ #for prop_type, prop_val_list in types.PROPERTIES_MAP.iteritems():
+ # prop_val_cnt = 0
+ # for prop_val in prop_val_list:
+ # prop_val_cnt += 1
+ # all_props['%s_%02d' % (prop_type, prop_val_cnt)] = {prop_type: prop_val}
+
+ ## One message with all properties together
+ #add_test_method(new_class, ('', {}), ('_props', all_props), send_shim, receive_shim)
+
+ ## One message with all headers and all properties together
+ #add_test_method(new_class, ('_hdrs', all_hdrs), ('_props', all_props), send_shim, receive_shim)
+
return new_class
@@ -411,9 +390,9 @@ class Shim(object):
USE_SHELL = False
def __init__(self, args):
- self.ARGS = args
- self.SEND = None
- self.RECEIVE = None
+ self.args = args
+ self.sender = None
+ self.receiver = None
def send(self, broker_addr, queue_name, jms_message_type, json_send_params_str):
@@ -422,14 +401,14 @@ class Shim(object):
Return output (if any) from stdout.
"""
arg_list = []
- arg_list.extend(self.SEND)
+ arg_list.extend(self.sender)
arg_list.extend([broker_addr, queue_name, jms_message_type])
arg_list.append(json_send_params_str)
try:
# Debug print statements: - these are helpful to see what is being sent to the send shims
- #print '\n### msg_hdr_list (%d): %s' % (msg_hdr_list_size, json_msg_hdr_list_str)
- #print '\n### msg_props_list (%d): %s' % (msg_props_list_size, json_msg_props_list_str)
+ #print '\n*** msg_hdr_list (%d): %s' % (msg_hdr_list_size, json_msg_hdr_list_str)
+ #print '\n*** msg_props_list (%d): %s' % (msg_props_list_size, json_msg_props_list_str)
#print '\n>>>', arg_list # DEBUG - useful to see command-line sent to shim
return check_output(arg_list, shell=self.USE_SHELL)
except CalledProcessError as exc:
@@ -447,7 +426,7 @@ class Shim(object):
output = ''
try:
arg_list = []
- arg_list.extend(self.RECEIVE)
+ arg_list.extend(self.receiver)
arg_list.extend([broker_addr, queue_name, jms_message_type])
arg_list.append(json_receive_params_str)
# Debug print statement: this is useful to see what is being sent to the receive shims
@@ -478,8 +457,8 @@ class ProtonPythonShim(Shim):
def __init__(self, args):
super(ProtonPythonShim, self).__init__(args)
- self.SEND = [path.join(self.SHIM_LOC, 'JmsSenderShim.py')]
- self.RECEIVE = [path.join(self.SHIM_LOC, 'JmsReceiverShim.py')]
+ self.sender = [path.join(self.SHIM_LOC, 'JmsSenderShim.py')]
+ self.receiver = [path.join(self.SHIM_LOC, 'JmsReceiverShim.py')]
class ProtonCppShim(Shim):
@@ -491,8 +470,8 @@ class ProtonCppShim(Shim):
def __init__(self, args):
super(ProtonCppShim, self).__init__(args)
- self.SEND = [path.join(self.SHIM_LOC, 'JmsSender')]
- self.RECEIVE = [path.join(self.SHIM_LOC, 'JmsReceiver')]
+ self.sender = [path.join(self.SHIM_LOC, 'JmsSender')]
+ self.receiver = [path.join(self.SHIM_LOC, 'JmsReceiver')]
class QpidJmsShim(Shim):
@@ -505,29 +484,31 @@ class QpidJmsShim(Shim):
MAVEN_REPO_PATH = getenv('MAVEN_REPO_PATH', path.join(getenv('HOME'), '.m2', 'repository'))
QPID_INTEROP_TEST_SHIM_JAR = path.join(MAVEN_REPO_PATH, 'org', 'apache', 'qpid', 'qpid-interop-test-jms-shim',
'0.1.0-SNAPSHOT', 'qpid-interop-test-jms-shim-0.1.0-SNAPSHOT.jar')
-
+
JAVA_HOME = getenv('JAVA_HOME', '/usr/lib/jvm/java') # Default only works in Linux
JAVA_EXEC = path.join(JAVA_HOME, 'bin/java')
def __init__(self, args):
super(QpidJmsShim, self).__init__(args)
- DEP_CLASSPATH_FILE = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-jms', 'cp.txt')
- with open(DEP_CLASSPATH_FILE, 'r') as dcpfile:
- self.CLASSPATH = dcpfile.read().replace('\n', '')
- if self.jarExists(self.QPID_INTEROP_TEST_SHIM_JAR):
- self.CLASSPATH += ':' + self.QPID_INTEROP_TEST_SHIM_JAR
+ dep_classpath_file = path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-jms', 'cp.txt')
+ with open(dep_classpath_file, 'r') as dcpfile:
+ self.classpath = dcpfile.read().replace('\n', '')
+ if QpidJmsShim.jar_exists(self.QPID_INTEROP_TEST_SHIM_JAR):
+ self.classpath += ':' + self.QPID_INTEROP_TEST_SHIM_JAR
else:
print '*** ERROR: Cannot find jar file "%s"' % self.QPID_INTEROP_TEST_SHIM_JAR
- self.SEND = [self.JAVA_EXEC, '-cp', self.CLASSPATH, 'org.apache.qpid.interop_test.shim.JmsSenderShim']
- self.RECEIVE = [self.JAVA_EXEC, '-cp', self.CLASSPATH, 'org.apache.qpid.interop_test.shim.JmsReceiverShim']
+ self.sender = [self.JAVA_EXEC, '-cp', self.classpath, 'org.apache.qpid.interop_test.shim.JmsSenderShim']
+ self.receiver = [self.JAVA_EXEC, '-cp', self.classpath, 'org.apache.qpid.interop_test.shim.JmsReceiverShim']
- def jarExists(self, jarPath):
+ @staticmethod
+ def jar_exists(jar_path):
+ """ Check if jar in attribute jar_path exists """
try:
- f = open(jarPath, 'rb')
- f.close()
+ jar_file = open(jar_path, 'rb')
+ jar_file.close()
return True
- except IOError as e:
+ except IOError:
pass
return False
@@ -579,7 +560,7 @@ if __name__ == '__main__':
SHIM_MAP = {ProtonCppShim.NAME: ProtonCppShim(ARGS),
QpidJmsShim.NAME: QpidJmsShim(ARGS),
ProtonPythonShim.NAME: ProtonPythonShim(ARGS)
- }
+ }
# Connect to broker to find broker type
CONNECTION_PROPS = broker_properties.getBrokerProperties(ARGS.broker)
@@ -587,9 +568,12 @@ if __name__ == '__main__':
print 'WARNING: Unable to get connection properties - unknown broker'
BROKER = 'unknown'
else:
- BROKER = CONNECTION_PROPS[symbol(u'product')] if symbol(u'product') in CONNECTION_PROPS else '<product not found>'
- BROKER_VERSION = CONNECTION_PROPS[symbol(u'version')] if symbol(u'version') in CONNECTION_PROPS else '<version not found>'
- BROKER_PLATFORM = CONNECTION_PROPS[symbol(u'platform')] if symbol(u'platform') in CONNECTION_PROPS else '<platform not found>'
+ BROKER = CONNECTION_PROPS[symbol(u'product')] if symbol(u'product') in CONNECTION_PROPS \
+ else '<product not found>'
+ BROKER_VERSION = CONNECTION_PROPS[symbol(u'version')] if symbol(u'version') in CONNECTION_PROPS \
+ else '<version not found>'
+ BROKER_PLATFORM = CONNECTION_PROPS[symbol(u'platform')] if symbol(u'platform') in CONNECTION_PROPS \
+ else '<platform not found>'
print 'Test Broker: %s v.%s on %s' % (BROKER, BROKER_VERSION, BROKER_PLATFORM)
print
@@ -619,7 +603,7 @@ if __name__ == '__main__':
TEST_SUITE.addTest(unittest.makeSuite(test_case_class))
# Finally, run all the dynamically created tests
- res = unittest.TextTestRunner(verbosity=2).run(TEST_SUITE)
- if not res.wasSuccessful():
- exit(1)
+ RES = unittest.TextTestRunner(verbosity=2).run(TEST_SUITE)
+ if not RES.wasSuccessful():
+ sys.exit(1)
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/ec0e4bbc/src/python/qpid-interop-test/types/simple_type_tests.py
----------------------------------------------------------------------
diff --git a/src/python/qpid-interop-test/types/simple_type_tests.py b/src/python/qpid-interop-test/types/simple_type_tests.py
index 1a09bb9..0aa410f 100755
--- a/src/python/qpid-interop-test/types/simple_type_tests.py
+++ b/src/python/qpid-interop-test/types/simple_type_tests.py
@@ -24,26 +24,26 @@ Module to test AMQP primitive types across different APIs
#
import argparse
+import sys
import unittest
from itertools import product
from json import dumps, loads
from os import getenv, path
from subprocess import check_output, CalledProcessError
-from sys import exit
from time import mktime, time
from uuid import UUID, uuid4
-from proton import int32, symbol, timestamp, ulong
+from proton import symbol
from test_type_map import TestTypeMap
import broker_properties
-# TODO - propose a sensible default when installation details are worked out
+# TODO: propose a sensible default when installation details are worked out
QPID_INTEROP_TEST_HOME = getenv('QPID_INTEROP_TEST_HOME')
if QPID_INTEROP_TEST_HOME is None:
print 'ERROR: Environment variable QPID_INTEROP_TEST_HOME is not set'
- exit(1)
+ sys.exit(1)
class AmqpPrimitiveTypes(TestTypeMap):
@@ -174,10 +174,32 @@ class AmqpPrimitiveTypes(TestTypeMap):
'list': [[],
['ubyte:1', 'int:-2', 'float:3.14'],
['string:a', 'string:b', 'string:c'],
- ['ulong:12345', 'timestamp:%d' % (time()*1000), 'short:-2500', 'uuid:%s' % uuid4(), 'symbol:a.b.c', 'none:', 'decimal64:0x400921fb54442eea'],
- [[], 'none', ['ubyte:1', 'ubyte:2', 'ubyte:3'], 'boolean:True', 'boolean:False', {'string:hello': 'long:1234', 'string:goodbye': 'boolean:True'}],
+ ['ulong:12345',
+ 'timestamp:%d' % (time()*1000),
+ 'short:-2500',
+ 'uuid:%s' % uuid4(),
+ 'symbol:a.b.c',
+ 'none:',
+ 'decimal64:0x400921fb54442eea'
+ ],
+ [[],
+ 'none',
+ ['ubyte:1', 'ubyte:2', 'ubyte:3'],
+ 'boolean:True',
+ 'boolean:False',
+ {'string:hello': 'long:1234', 'string:goodbye': 'boolean:True'}
+ ],
[[], [[], [[], [], []], []], []],
- ['short:0', 'short:1', 'short:2', 'short:3', 'short:4', 'short:5', 'short:6', 'short:7', 'short:8', 'short:9'] * 100
+ ['short:0',
+ 'short:1',
+ 'short:2',
+ 'short:3',
+ 'short:4',
+ 'short:5',
+ 'short:6',
+ 'short:7',
+ 'short:8',
+ 'short:9'] * 10
],
'map': [{},
{'string:one': 'ubyte:1',
@@ -196,14 +218,14 @@ class AmqpPrimitiveTypes(TestTypeMap):
'char:B': 'int:2'}},
],
# TODO: Support all AMQP types in array (including keys)
-# 'array': [[],
-# [1, 2, 3],
-# ['Hello', 'world'],
-# [[1, 2, 3],
-# ['a', 'b', 'c'],
-# [2.3, 3.4, 4,5],
-# [True, False, True, True]]
-# ]
+ #'array': [[],
+ # [1, 2, 3],
+ # ['Hello', 'world'],
+ # [[1, 2, 3],
+ # ['a', 'b', 'c'],
+ # [2.3, 3.4, 4,5],
+ # [True, False, True, True]]
+ # ]
}
# TODO: Type 'unknown' corresponds to the Artemis broker at present because it does not return connection
@@ -237,9 +259,11 @@ class AmqpTypeTestCase(unittest.TestCase):
"""
if len(test_value_list) > 0:
# TODO: When Artemis can support it (in the next release), revert the queue name back to 'qpid-interop...'
- # Currently, Artemis only supports auto-create queues for JMS, and the queue name must be prefixed by 'jms.queue.'
+ # Currently, Artemis only supports auto-create queues for JMS, and the queue name must be prefixed by
+ # 'jms.queue.'
#queue_name = 'qpid-interop.simple_type_tests.%s.%s.%s' % (amqp_type, send_shim.NAME, receive_shim.NAME)
- queue_name = 'jms.queue.qpid-interop.simple_type_tests.%s.%s.%s' % (amqp_type, send_shim.NAME, receive_shim.NAME)
+ queue_name = 'jms.queue.qpid-interop.simple_type_tests.%s.%s.%s' % \
+ (amqp_type, send_shim.NAME, receive_shim.NAME)
send_error_text = send_shim.send(broker_addr, queue_name, amqp_type, dumps(test_value_list))
if len(send_error_text) > 0:
self.fail('Send shim \'%s\':\n%s' % (send_shim.NAME, send_error_text))
@@ -449,9 +473,12 @@ if __name__ == '__main__':
print 'WARNING: Unable to get connection properties - unknown broker'
BROKER = 'unknown'
else:
- BROKER = CONNECTION_PROPS[symbol(u'product')] if symbol(u'product') in CONNECTION_PROPS else '<product not found>'
- BROKER_VERSION = CONNECTION_PROPS[symbol(u'version')] if symbol(u'version') in CONNECTION_PROPS else '<version not found>'
- BROKER_PLATFORM = CONNECTION_PROPS[symbol(u'platform')] if symbol(u'platform') in CONNECTION_PROPS else '<platform not found>'
+ BROKER = CONNECTION_PROPS[symbol(u'product')] if symbol(u'product') in CONNECTION_PROPS \
+ else '<product not found>'
+ BROKER_VERSION = CONNECTION_PROPS[symbol(u'version')] if symbol(u'version') in CONNECTION_PROPS \
+ else '<version not found>'
+ BROKER_PLATFORM = CONNECTION_PROPS[symbol(u'platform')] if symbol(u'platform') in CONNECTION_PROPS \
+ else '<platform not found>'
print 'Test Broker: %s v.%s on %s' % (BROKER, BROKER_VERSION, BROKER_PLATFORM)
print
@@ -481,7 +508,7 @@ if __name__ == '__main__':
TEST_SUITE.addTest(unittest.makeSuite(test_case_class))
# Finally, run all the dynamically created tests
- res = unittest.TextTestRunner(verbosity=2).run(TEST_SUITE)
- if not res.wasSuccessful():
- exit(1) # Errors or failures present
+ RES = unittest.TextTestRunner(verbosity=2).run(TEST_SUITE)
+ if not RES.wasSuccessful():
+ sys.exit(1) # Errors or failures present
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org