Repository: qpid-interop-test
Updated Branches:
  refs/heads/master f27896de1 -> f17dac39f


QPIDIT-43: WIP messaging features: added connection properties test into main 
test harness and into the python shim. The C++ shim is incomplete woing to the 
inability to access these properties through the C++ bindings ATM.


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/f17dac39
Tree: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/tree/f17dac39
Diff: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/diff/f17dac39

Branch: refs/heads/master
Commit: f17dac39f2c635ef917ed7554664495b0dd8650e
Parents: f27896d
Author: Kim van der Riet <kp...@apache.org>
Authored: Tue Oct 18 14:33:20 2016 -0400
Committer: Kim van der Riet <kp...@apache.org>
Committed: Tue Oct 18 14:33:20 2016 -0400

----------------------------------------------------------------------
 .../src/qpidit/amqp_features_test/Sender.cpp    | 92 +++++++++++++++++++-
 .../src/qpidit/amqp_features_test/Sender.hpp    | 27 ++++++
 .../src/qpidit/amqp_types_test/Sender.cpp       | 13 +--
 .../src/qpidit/amqp_types_test/Sender.hpp       |  3 +-
 .../src/amqp_features_test/Receiver.py          | 28 +++++-
 .../src/amqp_features_test/Sender.py            | 24 ++++-
 .../qpid_interop_test/amqp_features_test.py     | 74 +++++++++++++---
 src/python/qpid_interop_test/amqp_types_test.py |  7 +-
 .../qpid_interop_test/broker_properties.py      |  8 +-
 src/python/qpid_interop_test/shims.py           | 34 +++++---
 10 files changed, 263 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/f17dac39/shims/qpid-proton-cpp/src/qpidit/amqp_features_test/Sender.cpp
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-cpp/src/qpidit/amqp_features_test/Sender.cpp 
b/shims/qpid-proton-cpp/src/qpidit/amqp_features_test/Sender.cpp
index 9a81ef8..00e7200 100644
--- a/shims/qpid-proton-cpp/src/qpidit/amqp_features_test/Sender.cpp
+++ b/shims/qpid-proton-cpp/src/qpidit/amqp_features_test/Sender.cpp
@@ -21,6 +21,11 @@
 
 #include "qpidit/amqp_features_test/Sender.hpp"
 
+#include <iostream>
+#include <json/json.h>
+#include "proton/default_container.hpp"
+#include "proton/transport.hpp"
+#include "qpidit/QpidItErrors.hpp"
 #include <stdlib.h> // exit()
 
 
@@ -28,6 +33,72 @@ namespace qpidit
 {
     namespace amqp_features_test
     {
+        Sender::Sender(const std::string& brokerUrl,
+                       const std::string& queueName,
+                       const std::string& testType,
+                       const Json::Value& testValues) :
+                       _brokerUrl(brokerUrl),
+                       _queueName(queueName),
+                       _testType(testType),
+                       _testValues(testValues)
+        {}
+
+        Sender::~Sender() {}
+
+        void Sender::on_container_start(proton::container &c) {
+            std::ostringstream oss;
+            oss << _brokerUrl << "/" << _queueName;
+            c.open_sender(oss.str());
+        }
+
+        void Sender::on_connection_open(proton::connection& c) {
+            if (_testType.compare("connection_property") == 0) {
+                // Python: self.remote_properties = 
event.connection.remote_properties
+            }
+        }
+
+        void Sender::on_sendable(proton::sender &s) {
+            if (_totalMsgs == 0) {
+                s.connection().close();
+            } else  {
+                if (_testType.compare("connection_property") == 0) {
+                    // Do nothing
+                } else {
+                    // Unknown test
+                }
+            }
+        }
+
+        void Sender::on_tracker_accept(proton::tracker &t) {
+            _msgsConfirmed++;
+            if (_msgsConfirmed == _totalMsgs) {
+                t.connection().close();
+            }
+        }
+
+        void Sender::on_transport_close(proton::transport &t) {
+            _msgsSent = _msgsConfirmed;
+        }
+
+        void Sender::on_connection_error(proton::connection &c) {
+            std::cerr << "AmqpSender::on_connection_error(): " << c.error() << 
std::endl;
+        }
+
+        void Sender::on_sender_error(proton::sender &s) {
+            std::cerr << "AmqpSender::on_sender_error(): " << s.error() << 
std::endl;
+        }
+
+        void Sender::on_session_error(proton::session &s) {
+            std::cerr << "AmqpSender::on_session_error(): " << s.error() << 
std::endl;
+        }
+
+        void Sender::on_transport_error(proton::transport &t) {
+            std::cerr << "AmqpSender::on_transport_error(): " << t.error() << 
std::endl;
+        }
+
+        void Sender::on_error(const proton::error_condition &ec) {
+            std::cerr << "AmqpSender::on_error(): " << ec << std::endl;
+        }
     } /* namespace amqp_features_test */
 } /* namespace qpidit */
 
@@ -36,9 +107,28 @@ namespace qpidit
  * --- main ---
  * Args: 1: Broker address (ip-addr:port)
  *       2: Queue name
- *       ...
+ *       3: Test type
+ *       4: JSON test values
  */
 
 int main(int argc, char** argv) {
+    // TODO: improve arg management a little...
+    if (argc != 5) {
+        throw qpidit::ArgumentError("Incorrect number of arguments");
+    }
+
+    try {
+        Json::Value testValues;
+        Json::Reader jsonReader;
+        if (not jsonReader.parse(argv[4], testValues, false)) {
+            throw qpidit::JsonParserError(jsonReader);
+        }
+
+        qpidit::amqp_features_test::Sender sender(argv[1], argv[2], argv[3], 
testValues);
+        proton::default_container(sender).run();
+    } catch (const std::exception& e) {
+        std::cerr << "amqp_features_test Sender error: " << e.what() << 
std::endl;
+        exit(1);
+    }
     exit(0);
 }

http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/f17dac39/shims/qpid-proton-cpp/src/qpidit/amqp_features_test/Sender.hpp
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-cpp/src/qpidit/amqp_features_test/Sender.hpp 
b/shims/qpid-proton-cpp/src/qpidit/amqp_features_test/Sender.hpp
index 05c9bf1..58a1fb2 100644
--- a/shims/qpid-proton-cpp/src/qpidit/amqp_features_test/Sender.hpp
+++ b/shims/qpid-proton-cpp/src/qpidit/amqp_features_test/Sender.hpp
@@ -22,7 +22,9 @@
 #ifndef SRC_QPIDIT_AMQP_DTX_TEST_SENDER_HPP_
 #define SRC_QPIDIT_AMQP_DTX_TEST_SENDER_HPP_
 
+#include <json/value.h>
 #include "proton/messaging_handler.hpp"
+#include <string>
 
 namespace qpidit
 {
@@ -31,6 +33,31 @@ namespace qpidit
 
         class Sender : public proton::messaging_handler
         {
+            const std::string _brokerUrl;
+            const std::string _queueName;
+            const std::string _testType;
+            const Json::Value _testValues;
+            uint32_t _msgsSent;
+            uint32_t _msgsConfirmed;
+            uint32_t _totalMsgs;
+        public:
+            Sender(const std::string& brokerUrl,
+                   const std::string& queueName,
+                   const std::string& testType,
+                   const Json::Value& testValues);
+            virtual ~Sender();
+
+            void on_container_start(proton::container& c);
+            void on_connection_open(proton::connection &c);
+            void on_sendable(proton::sender& s);
+            void on_tracker_accept(proton::tracker& t);
+            void on_transport_close(proton::transport& t);
+
+            void on_connection_error(proton::connection& c);
+            void on_session_error(proton::session& s);
+            void on_sender_error(proton::sender& s);
+            void on_transport_error(proton::transport& t);
+            void on_error(const proton::error_condition& c);
         };
 
     } /* namespace amqp_features_test */

http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/f17dac39/shims/qpid-proton-cpp/src/qpidit/amqp_types_test/Sender.cpp
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-cpp/src/qpidit/amqp_types_test/Sender.cpp 
b/shims/qpid-proton-cpp/src/qpidit/amqp_types_test/Sender.cpp
index 353bf46..113f23f 100644
--- a/shims/qpid-proton-cpp/src/qpidit/amqp_types_test/Sender.cpp
+++ b/shims/qpid-proton-cpp/src/qpidit/amqp_types_test/Sender.cpp
@@ -35,9 +35,11 @@ namespace qpidit
     {
 
         Sender::Sender(const std::string& brokerUrl,
+                       const std::string& queueName,
                        const std::string& amqpType,
                        const Json::Value& testValues) :
                         _brokerUrl(brokerUrl),
+                        _queueName(queueName),
                         _amqpType(amqpType),
                         _testValues(testValues),
                         _msgsSent(0),
@@ -48,7 +50,9 @@ namespace qpidit
         Sender::~Sender() {}
 
         void Sender::on_container_start(proton::container &c) {
-            c.open_sender(_brokerUrl);
+            std::ostringstream oss;
+            oss << _brokerUrl << "/" << _queueName;
+            c.open_sender(oss.str());
         }
 
         void Sender::on_sendable(proton::sender &s) {
@@ -348,9 +352,6 @@ int main(int argc, char** argv) {
         throw qpidit::ArgumentError("Incorrect number of arguments");
     }
 
-    std::ostringstream oss;
-    oss << argv[1] << "/" << argv[2];
-
     try {
         Json::Value testValues;
         Json::Reader jsonReader;
@@ -358,10 +359,10 @@ int main(int argc, char** argv) {
             throw qpidit::JsonParserError(jsonReader);
         }
 
-        qpidit::amqp_types_test::Sender sender(oss.str(), argv[3], testValues);
+        qpidit::amqp_types_test::Sender sender(argv[1], argv[2], argv[3], 
testValues);
         proton::default_container(sender).run();
     } catch (const std::exception& e) {
-        std::cerr << "AmqpSender error: " << e.what() << std::endl;
+        std::cerr << "amqp_types_test Sender error: " << e.what() << std::endl;
         exit(1);
     }
     exit(0);

http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/f17dac39/shims/qpid-proton-cpp/src/qpidit/amqp_types_test/Sender.hpp
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-cpp/src/qpidit/amqp_types_test/Sender.hpp 
b/shims/qpid-proton-cpp/src/qpidit/amqp_types_test/Sender.hpp
index da53a2e..2ccabaf 100644
--- a/shims/qpid-proton-cpp/src/qpidit/amqp_types_test/Sender.hpp
+++ b/shims/qpid-proton-cpp/src/qpidit/amqp_types_test/Sender.hpp
@@ -37,13 +37,14 @@ namespace qpidit
         {
         protected:
             const std::string _brokerUrl;
+            const std::string _queueName;
             const std::string _amqpType;
             const Json::Value _testValues;
             uint32_t _msgsSent;
             uint32_t _msgsConfirmed;
             uint32_t _totalMsgs;
         public:
-            Sender(const std::string& brokerUrl, const std::string& amqpType, 
const Json::Value& testValues);
+            Sender(const std::string& brokerUrl, const std::string& queueName, 
const std::string& amqpType, const Json::Value& testValues);
             virtual ~Sender();
             void on_container_start(proton::container &c);
             void on_sendable(proton::sender &s);

http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/f17dac39/shims/qpid-proton-python/src/amqp_features_test/Receiver.py
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-python/src/amqp_features_test/Receiver.py 
b/shims/qpid-proton-python/src/amqp_features_test/Receiver.py
index c37739c..0b3edf8 100755
--- a/shims/qpid-proton-python/src/amqp_features_test/Receiver.py
+++ b/shims/qpid-proton-python/src/amqp_features_test/Receiver.py
@@ -23,6 +23,7 @@ AMQP features test receiver shim for qpid-interop-test
 # under the License.
 #
 
+from json import dumps
 import os.path
 import sys
 from traceback import format_exc
@@ -35,22 +36,34 @@ class AmqpFeaturesTestReceiver(MessagingHandler):
     Reciver shim for AMQP dtx test
     ...
     """
-    def __init__(self, broker_url, queue_name):
+    def __init__(self, broker_url, queue_name, test_type, 
num_expected_messages_str):
         super(AmqpFeaturesTestReceiver, self).__init__()
         self.broker_url = broker_url
         self.queue_name = queue_name
+        self.test_type = test_type
         self.received_value_list = []
-        self.expected = int('0')
+        self.expected = int(num_expected_messages_str)
         self.received = 0
+        self.remote_properties = None
 
     def get_received_value_list(self):
         """Return the received list of AMQP values"""
         return self.received_value_list
 
+    def get_remote_properties(self):
+        """Return the remote (broker) properties"""
+        return self.remote_properties
+
     def on_start(self, event):
         """Event callback for when the client starts"""
         event.container.create_receiver('%s/%s' % (self.broker_url, 
self.queue_name))
 
+    def on_connection_remote_open(self, event):
+        """Callback for remote connection open"""
+        self.remote_properties = event.connection.remote_properties
+        if self.test_type == 'connection_property':
+            event.connection.close()
+
     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:
@@ -64,10 +77,17 @@ class AmqpFeaturesTestReceiver(MessagingHandler):
 # --- main ---
 # Args: 1: Broker address (ip-addr:port)
 #       2: Queue name
-#       ...
+#       3: Test type
+#       4: Number of expected messages
 try:
-    RECEIVER = AmqpFeaturesTestReceiver(sys.argv[1], sys.argv[2])
+    RECEIVER = AmqpFeaturesTestReceiver(sys.argv[1], sys.argv[2], sys.argv[3], 
sys.argv[4])
     Container(RECEIVER).run()
+    print sys.argv[3]
+    if (sys.argv[3] == 'connection_property'):
+        print dumps(RECEIVER.get_remote_properties())
+    else:
+        print dumps(RECEIVER.get_received_value_list())
+ 
 except KeyboardInterrupt:
     pass
 except Exception as exc:

http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/f17dac39/shims/qpid-proton-python/src/amqp_features_test/Sender.py
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-python/src/amqp_features_test/Sender.py 
b/shims/qpid-proton-python/src/amqp_features_test/Sender.py
index 3bf19e0..17a84f9 100755
--- a/shims/qpid-proton-python/src/amqp_features_test/Sender.py
+++ b/shims/qpid-proton-python/src/amqp_features_test/Sender.py
@@ -23,6 +23,7 @@ AMQP features test sender shim for qpid-interop-test
 # under the License.
 #
 
+from json import dumps, loads
 import os.path
 import sys
 from traceback import format_exc
@@ -35,19 +36,28 @@ class AmqpFeaturesTestSender(MessagingHandler):
     Sender shim for AMQP dtx test
     ...
     """
-    def __init__(self, broker_url, queue_name):
+    def __init__(self, broker_url, queue_name, test_type, test_args):
         super(AmqpFeaturesTestSender, self).__init__()
         self.broker_url = broker_url
         self.queue_name = queue_name
+        self.test_type = test_type
+        self.test_args = test_args
         self.test_value_list = []
         self.sent = 0
         self.confirmed = 0
         self.total = len(self.test_value_list)
+        self.remote_properties = None
 
     def on_start(self, event):
         """Event callback for when the client starts"""
         event.container.create_sender('%s/%s' % (self.broker_url, 
self.queue_name))
 
+    def on_connection_remote_open(self, event):
+        """Callback for remote connection open"""
+        self.remote_properties = event.connection.remote_properties
+        if self.test_type == 'connection_property':
+            event.connection.close()
+
     def on_sendable(self, event):
         """Event callback for when send credit is received, allowing the 
sending of messages"""
         if self.sent == 0:
@@ -78,14 +88,22 @@ class AmqpFeaturesTestSender(MessagingHandler):
         """Event callback for when the broker disconnects with the client"""
         self.sent = self.confirmed
 
+    def get_remote_properties(self):
+        """Return the remote (broker) properties"""
+        return self.remote_properties
+
 
 # --- main ---
 # Args: 1: Broker address (ip-addr:port)
 #       2: Queue name
-#       ...
+#       3: Test type
+#       4: Test args
 try:
-    SENDER = AmqpFeaturesTestSender(sys.argv[1], sys.argv[2])
+    SENDER = AmqpFeaturesTestSender(sys.argv[1], sys.argv[2], sys.argv[3], 
loads(sys.argv[4]))
     Container(SENDER).run()
+    print sys.argv[3]
+    if sys.argv[3] == 'connection_property':
+        print dumps(SENDER.get_remote_properties())
 except KeyboardInterrupt:
     pass
 except Exception as exc:

http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/f17dac39/src/python/qpid_interop_test/amqp_features_test.py
----------------------------------------------------------------------
diff --git a/src/python/qpid_interop_test/amqp_features_test.py 
b/src/python/qpid_interop_test/amqp_features_test.py
old mode 100644
new mode 100755
index c80e051..fc4cd94
--- a/src/python/qpid_interop_test/amqp_features_test.py
+++ b/src/python/qpid_interop_test/amqp_features_test.py
@@ -27,16 +27,11 @@ import argparse
 import sys
 import unittest
 
-#from itertools import product
-#from json import dumps
+from json import dumps
 from os import getenv, path
-#from time import mktime, time
-#from uuid import UUID, uuid4
 
 from proton import symbol
-#import qpid_interop_test.broker_properties
 import qpid_interop_test.shims
-#from qpid_interop_test.test_type_map import TestTypeMap
 
 # TODO: propose a sensible default when installation details are worked out
 QPID_INTEROP_TEST_HOME = getenv('QPID_INTEROP_TEST_HOME')
@@ -50,13 +45,69 @@ class AmqpFeaturesTestCase(unittest.TestCase):
     Abstract base class for AMQP message features test cases
     """
 
-    def run_test(self):
+    def run_test(self, broker_addr, test_type, send_shim, receive_shim):
         """
         Run this test by invoking the shim send method to send the test 
values, followed by the shim receive method
         to receive the values. Finally, compare the sent values with the 
received values.
         """
-        pass
+        send_queue_name = 'jms.queue.qpid-interop.amqp_features_test.%s' % 
send_shim.NAME
+        receive_queue_name = 'jms.queue.qpid-interop.amqp_features_test.%s' % 
receive_shim.NAME
+
+        # Start the receive shim first (for queueless brokers/dispatch)
+        receiver = receive_shim.create_receiver(broker_addr, 
receive_queue_name, test_type, '0')
+        receiver.start()
+
+        # Start the send shim
+        sender = send_shim.create_sender(broker_addr, send_queue_name, 
test_type, dumps([None]))
+        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)
+
+        if test_type == 'connection_property':
+            
self.check_connection_property_test_results(sender.get_return_object(), 
receiver.get_return_object())
+
+    def check_connection_property_test_results(self, sender_return_obj, 
receiver_return_obj):
+        self.check_connection_properties(sender_return_obj[1], 'sender')
+        self.check_connection_properties(receiver_return_obj[1], 'receiver')
+    
+    def check_connection_properties(self, connection_properties, source):
+        keys = connection_properties.keys()
+        if 'product' not in keys:
+            self.fail('Broker connection properties (from %s) missing 
"product" key' % source)
+        if 'version' not in keys:
+            self.fail('Broker connection properties (from %s) missing 
"version" key' % source)
+        for key in keys:
+            assert(len(connection_properties[key]) > 0, 'Property "%s" (from 
%s) is empty' % (key, source))
+
+
+def create_connection_property_test_class(broker_addr, send_shim, 
receive_shim):
+    """
+    Class factory function which creates new subclasses to 
AmqpFeaturesTestCase.
+    """
+
+    def __repr__(self):
+        """Print the class name"""
+        return self.__class__.__name__
+
+    def add_test_method(cls, send_shim, receive_shim):
+        """Function which creates a new test method in class cls"""
+
+        def inner_test_method(self):
+            self.run_test(self.broker_addr, 'connection_property', send_shim, 
receive_shim)
+
+        inner_test_method.__name__ = 'test_connection_properties_%s->%s' % 
(send_shim.NAME, receive_shim.NAME)
+        setattr(cls, inner_test_method.__name__, inner_test_method)
 
+    class_name = 'ConnectionPropertyTestCase'
+    class_dict = {'__name__': class_name,
+                  '__repr__': __repr__,
+                  '__doc__': 'Test case for AMQP connection properties',
+                  'broker_addr': broker_addr}
+    new_class = type(class_name, (AmqpFeaturesTestCase,), class_dict)
+    add_test_method(new_class, send_shim, receive_shim)
+    return new_class
 
 # SHIM_MAP contains an instance of each client language shim that is to be 
tested as a part of this test. For
 # every shim in this list, a test is dynamically constructed which tests it 
against itself as well as every
@@ -72,8 +123,8 @@ PROTON_PYTHON_RECEIVER_SHIM = 
path.join(QPID_INTEROP_TEST_HOME, 'shims', 'qpid-p
 PROTON_PYTHON_SENDER_SHIM = path.join(QPID_INTEROP_TEST_HOME, 'shims', 
'qpid-proton-python', 'src',
                                       'amqp_features_test', 'Sender.py')
 
-SHIM_MAP = {qpid_interop_test.shims.ProtonCppShim.NAME: \
-                qpid_interop_test.shims.ProtonCppShim(PROTON_CPP_SENDER_SHIM, 
PROTON_CPP_RECEIVER_SHIM),
+SHIM_MAP = {#qpid_interop_test.shims.ProtonCppShim.NAME: \
+            #    qpid_interop_test.shims.ProtonCppShim(PROTON_CPP_SENDER_SHIM, 
PROTON_CPP_RECEIVER_SHIM),
             qpid_interop_test.shims.ProtonPythonShim.NAME: \
                 
qpid_interop_test.shims.ProtonPythonShim(PROTON_PYTHON_SENDER_SHIM, 
PROTON_PYTHON_RECEIVER_SHIM),
            }
@@ -129,6 +180,9 @@ if __name__ == '__main__':
         for shim in ARGS.exclude_shim:
             SHIM_MAP.pop(shim)
     # Create test classes dynamically
+    for shim_name in SHIM_MAP.keys():
+        test_case_class = create_connection_property_test_class(ARGS.broker, 
SHIM_MAP[shim_name], SHIM_MAP[shim_name])
+        TEST_SUITE.addTest(unittest.makeSuite(test_case_class))
 
     # Finally, run all the dynamically created tests
     RES = unittest.TextTestRunner(verbosity=2).run(TEST_SUITE)

http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/f17dac39/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 a61dfc6..b3095e7 100755
--- a/src/python/qpid_interop_test/amqp_types_test.py
+++ b/src/python/qpid_interop_test/amqp_types_test.py
@@ -266,7 +266,7 @@ class AmqpTypeTestCase(unittest.TestCase):
             # 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' % 
\
+            queue_name = 'jms.queue.qpid-interop.amqp_types_test.%s.%s.%s' % \
                          (amqp_type, send_shim.NAME, receive_shim.NAME)
 
             # Start the receive shim first (for queueless brokers/dispatch)
@@ -414,10 +414,6 @@ if __name__ == '__main__':
 
     TYPES = AmqpPrimitiveTypes()
 
-    # TEST_CASE_CLASSES is a list that collects all the test classes that are 
constructed. One class is constructed
-    # per AMQP type used as the key in map AmqpPrimitiveTypes.TYPE_MAP.
-    TEST_CASE_CLASSES = []
-
     # TEST_SUITE is the final suite of tests that will be run and which 
contains all the dynamically created
     # type classes, each of which contains a test for the combinations of 
client shims
     TEST_SUITE = unittest.TestSuite()
@@ -434,7 +430,6 @@ if __name__ == '__main__':
                                                     ARGS.broker,
                                                     at,
                                                     product(SHIM_MAP.values(), 
repeat=2))
-            TEST_CASE_CLASSES.append(test_case_class)
             TEST_SUITE.addTest(unittest.makeSuite(test_case_class))
 
     # Finally, run all the dynamically created tests

http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/f17dac39/src/python/qpid_interop_test/broker_properties.py
----------------------------------------------------------------------
diff --git a/src/python/qpid_interop_test/broker_properties.py 
b/src/python/qpid_interop_test/broker_properties.py
index 01a090f..35a6746 100644
--- a/src/python/qpid_interop_test/broker_properties.py
+++ b/src/python/qpid_interop_test/broker_properties.py
@@ -34,15 +34,15 @@ class Client(MessagingHandler):
         self.url = url
         self.remote_properties = None
 
+    def on_start(self, event):
+        """Event loop start"""
+        event.container.connect(url=self.url)
+
     def on_connection_remote_open(self, event):
         """Callback for remote connection open"""
         self.remote_properties = event.connection.remote_properties
         event.connection.close()
 
-    def on_start(self, event):
-        """Event loop start"""
-        event.container.connect(url=self.url)
-
     def get_connection_properties(self):
         """Return the connection properties"""
         return self.remote_properties

http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/f17dac39/src/python/qpid_interop_test/shims.py
----------------------------------------------------------------------
diff --git a/src/python/qpid_interop_test/shims.py 
b/src/python/qpid_interop_test/shims.py
index 56d6d93..7835fa8 100644
--- a/src/python/qpid_interop_test/shims.py
+++ b/src/python/qpid_interop_test/shims.py
@@ -89,45 +89,55 @@ class ShimWorkerThread(Thread):
 
 class Sender(ShimWorkerThread):
     """Sender class for multi-threaded send"""
-    def __init__(self, use_shell_flag, send_shim_args, broker_addr, 
queue_name, msg_type, json_test_str):
+    def __init__(self, use_shell_flag, send_shim_args, broker_addr, 
queue_name, test_key, json_test_str):
         super(Sender, self).__init__('sender_thread_%s' % queue_name)
         if send_shim_args is None:
             print 'ERROR: Sender: send_shim_args == None'
         self.use_shell_flag = use_shell_flag
         self.arg_list.extend(send_shim_args)
-        self.arg_list.extend([broker_addr, queue_name, msg_type, 
json_test_str])
+        self.arg_list.extend([broker_addr, queue_name, test_key, 
json_test_str])
 
     def run(self):
         """Thread starts here"""
         try:
-            #print '\n>>>', self.arg_list # DEBUG - useful to see command-line 
sent to shim
+            #print '\n>>>Sender>>>', self.arg_list # DEBUG - useful to see 
command-line sent to shim
             self.proc = Popen(self.arg_list, stdout=PIPE, stderr=PIPE, 
shell=self.use_shell_flag, preexec_fn=setsid)
             (stdoutdata, stderrdata) = self.proc.communicate()
-            if len(stdoutdata) > 0 or len(stderrdata) > 0:
+            if len(stderrdata) > 0:
                 self.return_obj = (stdoutdata, stderrdata)
+            else:
+                #print '<<<Sender<<<', stdoutdata # DEBUG - useful to see text 
received from shim
+                str_tvl = stdoutdata.split('\n')[0:-1] # remove trailing \n
+                if len(str_tvl) == 2:
+                    try:
+                        self.return_obj = (str_tvl[0], loads(str_tvl[1]))
+                    except ValueError:
+                        self.return_obj = stdoutdata
+                else: # Make a single line of all the bits and return that
+                    self.return_obj = stdoutdata
         except CalledProcessError as exc:
             self.return_obj = str(exc) + '\n\nOutput:\n' + exc.output
 
 
 class Receiver(ShimWorkerThread):
     """Receiver class for multi-threaded receive"""
-    def __init__(self, receive_shim_args, broker_addr, queue_name, msg_type, 
json_test_str):
+    def __init__(self, receive_shim_args, broker_addr, queue_name, test_key, 
json_test_str):
         super(Receiver, self).__init__('receiver_thread_%s' % queue_name)
         if receive_shim_args is None:
             print 'ERROR: Receiver: receive_shim_args == None'
         self.arg_list.extend(receive_shim_args)
-        self.arg_list.extend([broker_addr, queue_name, msg_type, 
json_test_str])
+        self.arg_list.extend([broker_addr, queue_name, test_key, 
json_test_str])
 
     def run(self):
         """Thread starts here"""
         try:
-            #print '\n>>>', self.arg_list # DEBUG - useful to see command-line 
sent to shim
+            #print '\n>>>Receiver>>>', self.arg_list # DEBUG - useful to see 
command-line sent to shim
             self.proc = Popen(self.arg_list, stdout=PIPE, stderr=PIPE, 
preexec_fn=setsid)
             (stdoutdata, stderrdata) = self.proc.communicate()
             if len(stderrdata) > 0:
                 self.return_obj = (stdoutdata, stderrdata)
             else:
-                #print '<<<', stdoutdata # DEBUG - useful to see text received 
from shim
+                #print '<<<Receiver<<<', stdoutdata # DEBUG - useful to see 
text received from shim
                 str_tvl = stdoutdata.split('\n')[0:-1] # remove trailing \n
                 if len(str_tvl) == 2:
                     try:
@@ -150,13 +160,13 @@ class Shim(object):
         self.receive_params = None
         self.use_shell_flag = False
 
-    def create_sender(self, broker_addr, queue_name, msg_type, json_test_str):
+    def create_sender(self, broker_addr, queue_name, test_key, json_test_str):
         """Create a new sender instance"""
-        return Sender(self.use_shell_flag, self.send_params, broker_addr, 
queue_name, msg_type, json_test_str)
+        return Sender(self.use_shell_flag, self.send_params, broker_addr, 
queue_name, test_key, json_test_str)
 
-    def create_receiver(self, broker_addr, queue_name, msg_type, 
json_test_str):
+    def create_receiver(self, broker_addr, queue_name, test_key, 
json_test_str):
         """Create a new receiver instance"""
-        return Receiver(self.receive_params, broker_addr, queue_name, 
msg_type, json_test_str)
+        return Receiver(self.receive_params, broker_addr, queue_name, 
test_key, json_test_str)
 
 class ProtonPythonShim(Shim):
     """Shim for qpid-proton Python client"""


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

Reply via email to