Hello community,

here is the log from the commit of package python-stomp.py for openSUSE:Factory 
checked in at 2019-04-30 12:59:56
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-stomp.py (Old)
 and      /work/SRC/openSUSE:Factory/.python-stomp.py.new.5536 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-stomp.py"

Tue Apr 30 12:59:56 2019 rev:4 rq:697387 version:4.1.22

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-stomp.py/python-stomp.py.changes  
2018-12-24 11:44:54.633264986 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-stomp.py.new.5536/python-stomp.py.changes    
    2019-04-30 12:59:59.506177884 +0200
@@ -1,0 +2,14 @@
+Thu Apr 18 16:12:05 UTC 2019 - Marketa Calabkova <[email protected]>
+
+- update to version 4.1.22
+ * Infinite retry attempts
+ * Terminate heartbeat thread on shutdown
+ * Remove unused wait_on_receipt parameter
+ * Reduce verbosity in logging to not include headers unless debug 
+   level is turned on (potential security issue)
+ * Fix for disconnect receipt usage in transport
+ * Add __enter__/__exit__ to Connection so it can be used as a 
+   context
+ * Additional ssl options
+
+-------------------------------------------------------------------

Old:
----
  stomp.py-4.1.21.tar.gz

New:
----
  stomp.py-4.1.22.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-stomp.py.spec ++++++
--- /var/tmp/diff_new_pack.NbGD70/_old  2019-04-30 13:00:00.530177656 +0200
+++ /var/tmp/diff_new_pack.NbGD70/_new  2019-04-30 13:00:00.530177656 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package python-stomp.py
 #
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-stomp.py
-Version:        4.1.21
+Version:        4.1.22
 Release:        0
 Summary:        Python STOMP client
 License:        Apache-2.0

++++++ stomp.py-4.1.21.tar.gz -> stomp.py-4.1.22.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stomp.py-4.1.21/CHANGELOG 
new/stomp.py-4.1.22/CHANGELOG
--- old/stomp.py-4.1.21/CHANGELOG       2018-07-07 10:12:06.000000000 +0200
+++ new/stomp.py-4.1.22/CHANGELOG       2019-04-13 15:01:40.000000000 +0200
@@ -1,4 +1,15 @@
-Version 4.1.21 -
+Version 4.1.22 - Apr 2019
+
+ * Infinite retry attempts (https://github.com/jasonrbriggs/stomp.py/pull/235)
+ * Terminate heartbeat thread on shutdown 
(https://github.com/jasonrbriggs/stomp.py/pull/234)
+ * Remove unused wait_on_receipt parameter 
(https://github.com/jasonrbriggs/stomp.py/pull/237)
+ * Reduce verbosity in logging to not include headers unless debug level is 
turned on (potential security issue as per: 
https://github.com/jasonrbriggs/stomp.py/issues/226)
+ * Fix for disconnect receipt usage in transport 
(https://github.com/jasonrbriggs/stomp.py/issues/212)
+ * Add __enter__/__exit__ to Connection so it can be used as a context 
(https://github.com/jasonrbriggs/stomp.py/issues/215)
+ * Additional ssl options (https://github.com/jasonrbriggs/stomp.py/pull/221/)
+
+
+Version 4.1.21 - July 2018
 
  * Fix for deadlock issue (https://github.com/jasonrbriggs/stomp.py/issues/197)
  * Fix for encoding issue (https://github.com/jasonrbriggs/stomp.py/issues/195)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stomp.py-4.1.21/PKG-INFO new/stomp.py-4.1.22/PKG-INFO
--- old/stomp.py-4.1.21/PKG-INFO        2018-07-07 10:14:14.000000000 +0200
+++ new/stomp.py-4.1.22/PKG-INFO        2019-04-13 15:02:15.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: stomp.py
-Version: 4.1.21
+Version: 4.1.22
 Summary: Python STOMP client, supporting versions 1.0, 1.1 and 1.2 of the 
protocol
 Home-page: https://github.com/jasonrbriggs/stomp.py
 Author: Jason R Briggs
@@ -88,7 +88,7 @@
         
         .. _JBossMessaging: http://www.jboss.org/jbossmessaging
         
-        For more info on setting up a test server (using virtualbox), contact 
the developer.
+        For more info on setting up a local test server (using docker), 
contact the developer.
         
         
 Platform: any
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stomp.py-4.1.21/README.rst 
new/stomp.py-4.1.22/README.rst
--- old/stomp.py-4.1.21/README.rst      2018-06-29 13:37:36.000000000 +0200
+++ new/stomp.py-4.1.22/README.rst      2019-04-13 15:01:40.000000000 +0200
@@ -80,5 +80,5 @@
 
 .. _JBossMessaging: http://www.jboss.org/jbossmessaging
 
-For more info on setting up a test server (using virtualbox), contact the 
developer.
+For more info on setting up a local test server (using docker), contact the 
developer.
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stomp.py-4.1.21/stomp/__init__.py 
new/stomp.py-4.1.22/stomp/__init__.py
--- old/stomp.py-4.1.21/stomp/__init__.py       2018-06-29 13:37:36.000000000 
+0200
+++ new/stomp.py-4.1.22/stomp/__init__.py       2018-12-18 19:41:10.000000000 
+0100
@@ -11,8 +11,9 @@
 
 import stomp.connect as connect
 import stomp.listener as listener
+import stomp.adapter as adapter
 
-__version__ = (4, 1, 21)
+__version__ = (4, 1, 22)
 
 ##
 # Alias for STOMP 1.0 connections.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stomp.py-4.1.21/stomp/__main__.py 
new/stomp.py-4.1.22/stomp/__main__.py
--- old/stomp.py-4.1.21/stomp/__main__.py       2018-06-29 13:37:36.000000000 
+0200
+++ new/stomp.py-4.1.22/stomp/__main__.py       2018-12-20 00:12:36.000000000 
+0100
@@ -4,25 +4,28 @@
 Usage: stomp [options]
 
 Options:
-  --version                 Show the version number and exit
-  -h, --help                Show this help message and exit
-  -H <host>, --host=<port>  Hostname or IP address to connect to. [default: 
localhost]
-  -P <port>, --port=<port>  Port providing stomp protocol connections. 
[default: 61613]
-  -U <user>, --user=<user>  Username for the connection
+  --version                    Show the version number and exit
+  -h, --help                   Show this help message and exit
+  -H <host>, --host=<port>     Hostname or IP address to connect to. [default: 
localhost]
+  -P <port>, --port=<port>     Port providing stomp protocol connections. 
[default: 61613]
+  -U <user>, --user=<user>     Username for the connection
   -W <password>, --password=<password>
-                            Password for the connection
+                               Password for the connection
   -F <filename>, --file=<filename>
-                            File containing commands to be executed, instead of
-                            prompting from the command prompt.
+                               File containing commands to be executed, 
instead of
+                               prompting from the command prompt.
   -S <protocol version>, --protocol=<protocol version>
-                            Set the STOMP protocol version (1.0, 1.1, 1.2) 
[default: 1.1]
-  -L <queue>, --listen=<queue>
-                            Listen for messages on a queue/destination
-  -V, --verbose             Verbose logging "on" or "off" (if on, full headers
-                            from stomp server responses are printed)
-  --ssl                     Enable SSL connection
-  --heartbeats=<heartbeats> Heartbeats to request when connecting with 
protocol >=
-                            1.1 (two comma separated integers required) 
[default: 0,0]
+                               Set the STOMP protocol version (1.0, 1.1, 1.2) 
[default: 1.1]
+  -L <queue>, --listen=<queue> Listen for messages on a queue/destination
+  -V, --verbose                Verbose logging "on" or "off" (if on, full 
headers
+                               from stomp server responses are printed)
+  --heartbeats=<heartbeats>    Heartbeats to request when connecting with 
protocol >=
+                               1.1 (two comma separated integers required) 
[default: 0,0]
+  --ssl                        Enable SSL connection
+  --ssl-key-file=<key-file>    ssl key file
+  --ssl-cert-file=<cert-file>  ssl cert file
+  --ssl-ca-file=<ca-file>      ssl ca certs file
+
 """
 
 import base64
@@ -36,8 +39,10 @@
 
 from docopt import docopt
 
+sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
 from stomp.adapter.multicast import MulticastConnection
 import stomp.colors
+import stomp.utils
 from stomp.connect import StompConnection10, StompConnection11, 
StompConnection12
 from stomp.listener import ConnectionListener, StatsListener
 
@@ -48,11 +53,6 @@
 
 heartbeat_pattern = re.compile(r'[0-9]+,[0-9]+')
 
-try:
-    import uuid
-except ImportError:
-    from backward import uuid
-
 
 class SubscriptionInfo(object):
     """
@@ -69,7 +69,7 @@
     for more information on establishing a connection to a stomp server.
     """
     def __init__(self, host='localhost', port=61613, user='', passcode='', 
ver='1.1', prompt='> ', verbose=True,
-                 use_ssl=False, heartbeats=(0, 0), stdin=sys.stdin, 
stdout=sys.stdout):
+                 heartbeats=(0, 0), use_ssl=False, ssl_key_file=None, 
ssl_cert_file=None, ssl_ca_file=None, stdin=sys.stdin, stdout=sys.stdout):
         Cmd.__init__(self, 'Tab', stdin, stdout)
         ConnectionListener.__init__(self)
         self.__start = True
@@ -89,7 +89,7 @@
         else:
             raise RuntimeError('Unknown version')
         if use_ssl:
-            self.conn.set_ssl([(host, port)])
+            self.conn.set_ssl([(host, port)], key_file=ssl_key_file, 
cert_file=ssl_cert_file, ca_certs=ssl_ca_file)
         self.conn.set_listener('', self)
         self.conn.start()
         self.conn.connect(self.user, self.passcode, wait=True)
@@ -311,7 +311,7 @@
 
     def do_sendrec(self, args):
         args = args.split()
-        receipt_id = str(uuid.uuid4())
+        receipt_id = stomp.utils.get_uuid()
         if len(args) < 2:
             self.__error('Expecting: sendrec <destination> <message>')
         elif not self.transaction_id:
@@ -530,7 +530,11 @@
     heartbeats = tuple(map(int, arguments['--heartbeats'].split(",")))
 
     st = StompCLI(arguments['--host'], arguments['--port'], 
arguments['--user'], arguments['--password'], arguments['--protocol'],
-        prompt, arguments['--verbose'], arguments['--ssl'], heartbeats)
+        prompt, arguments['--verbose'], heartbeats=heartbeats,
+        use_ssl=arguments['--ssl'],
+        ssl_key_file=arguments['--ssl-key-file'],
+        ssl_cert_file=arguments['--ssl-cert-file'],
+        ssl_ca_file=arguments['--ssl-ca-file'])
 
     if arguments['--listen'] is not None:
         st.do_subscribe(arguments['--listen'])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stomp.py-4.1.21/stomp/connect.py 
new/stomp.py-4.1.22/stomp/connect.py
--- old/stomp.py-4.1.21/stomp/connect.py        2018-06-30 11:50:26.000000000 
+0200
+++ new/stomp.py-4.1.22/stomp/connect.py        2019-04-13 15:01:40.000000000 
+0200
@@ -8,6 +8,7 @@
 from stomp.listener import *
 from stomp.protocol import *
 from stomp.transport import *
+from stomp.utils import get_uuid
 
 
 class BaseConnection(Publisher):
@@ -21,6 +22,17 @@
         """
         self.transport = transport
 
+    def __enter__(self):
+        self.disconnect_receipt_id = get_uuid()
+        self.disconnect_listener = WaitingListener(self.disconnect_receipt_id)
+        self.set_listener('ZZZZZ-disconnect-listener', 
self.disconnect_listener)
+        return self
+
+    def __exit__(self, exc_type, exc_val, exc_tb):
+        self.disconnect(self.disconnect_receipt_id)
+        self.disconnect_listener.wait_on_receipt()
+        self.disconnect_listener.wait_on_disconnected()
+
     def set_listener(self, name, lstnr):
         """
         :param str name:
@@ -89,7 +101,6 @@
                  ssl_cert_file=None,
                  ssl_ca_certs=None,
                  ssl_cert_validator=None,
-                 wait_on_receipt=False,
                  ssl_version=DEFAULT_SSL_VERSION,
                  timeout=None,
                  keepalive=None,
@@ -100,7 +111,7 @@
         transport = Transport(host_and_ports, prefer_localhost, 
try_loopback_connect,
                               reconnect_sleep_initial, 
reconnect_sleep_increase, reconnect_sleep_jitter,
                               reconnect_sleep_max, reconnect_attempts_max, 
use_ssl, ssl_key_file, ssl_cert_file,
-                              ssl_ca_certs, ssl_cert_validator, 
wait_on_receipt, ssl_version, timeout,
+                              ssl_ca_certs, ssl_cert_validator, ssl_version, 
timeout,
                               keepalive, None, auto_decode, encoding)
         BaseConnection.__init__(self, transport)
         Protocol10.__init__(self, transport, auto_content_length)
@@ -140,7 +151,6 @@
                  ssl_cert_file=None,
                  ssl_ca_certs=None,
                  ssl_cert_validator=None,
-                 wait_on_receipt=False,
                  ssl_version=DEFAULT_SSL_VERSION,
                  timeout=None,
                  heartbeats=(0, 0),
@@ -154,7 +164,7 @@
         transport = Transport(host_and_ports, prefer_localhost, 
try_loopback_connect,
                               reconnect_sleep_initial, 
reconnect_sleep_increase, reconnect_sleep_jitter,
                               reconnect_sleep_max, reconnect_attempts_max, 
use_ssl, ssl_key_file, ssl_cert_file,
-                              ssl_ca_certs, ssl_cert_validator, 
wait_on_receipt, ssl_version, timeout,
+                              ssl_ca_certs, ssl_cert_validator, ssl_version, 
timeout,
                               keepalive, vhost, auto_decode, encoding)
         BaseConnection.__init__(self, transport)
         Protocol11.__init__(self, transport, heartbeats, auto_content_length, 
heart_beat_receive_scale=heart_beat_receive_scale)
@@ -194,7 +204,6 @@
                  ssl_cert_file=None,
                  ssl_ca_certs=None,
                  ssl_cert_validator=None,
-                 wait_on_receipt=False,
                  ssl_version=DEFAULT_SSL_VERSION,
                  timeout=None,
                  heartbeats=(0, 0),
@@ -208,7 +217,7 @@
         transport = Transport(host_and_ports, prefer_localhost, 
try_loopback_connect,
                               reconnect_sleep_initial, 
reconnect_sleep_increase, reconnect_sleep_jitter,
                               reconnect_sleep_max, reconnect_attempts_max, 
use_ssl, ssl_key_file, ssl_cert_file,
-                              ssl_ca_certs, ssl_cert_validator, 
wait_on_receipt, ssl_version, timeout,
+                              ssl_ca_certs, ssl_cert_validator, ssl_version, 
timeout,
                               keepalive, vhost, auto_decode, encoding)
         BaseConnection.__init__(self, transport)
         Protocol12.__init__(self, transport, heartbeats, auto_content_length, 
heart_beat_receive_scale=heart_beat_receive_scale)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stomp.py-4.1.21/stomp/listener.py 
new/stomp.py-4.1.22/stomp/listener.py
--- old/stomp.py-4.1.21/stomp/listener.py       2018-06-30 11:50:26.000000000 
+0200
+++ new/stomp.py-4.1.22/stomp/listener.py       2019-04-13 11:06:09.000000000 
+0200
@@ -162,6 +162,7 @@
         self.received_heartbeat = None
         self.heartbeat_thread = None
         self.next_outbound_heartbeat = None
+        self.heartbeat_terminate_event = threading.Event()
 
     def on_connected(self, headers, body):
         """
@@ -195,6 +196,7 @@
 
     def on_disconnected(self):
         self.running = False
+        self.heartbeat_terminate_event.set()
 
     def on_message(self, headers, body):
         """
@@ -249,6 +251,7 @@
         """
         Main loop for sending (and monitoring received) heartbeats.
         """
+        log.info('Starting heartbeat loop')
         now = monotonic()
 
         # Setup the initial due time for the outbound heartbeat
@@ -267,7 +270,9 @@
                     next_events.append(t)
             sleep_time = min(next_events)
             if sleep_time > 0:
-                time.sleep(sleep_time)
+                terminate = self.heartbeat_terminate_event.wait(sleep_time)
+                if terminate:
+                    break
 
             now = monotonic()
 
@@ -298,6 +303,7 @@
                     for listener in self.transport.listeners.values():
                         listener.on_heartbeat_timeout()
         self.heartbeat_thread = None
+        log.info('Heartbeat loop ended')
 
 
 class WaitingListener(ConnectionListener):
@@ -308,9 +314,11 @@
         """
         :param str receipt:
         """
-        self.condition = threading.Condition()
+        self.receipt_condition = threading.Condition()
+        self.disconnect_condition = threading.Condition()
         self.receipt = receipt
         self.received = False
+        self.disconnected = False
 
     def on_receipt(self, headers, body):
         """
@@ -320,19 +328,31 @@
         :param body: the message content
         """
         if 'receipt-id' in headers and headers['receipt-id'] == self.receipt:
-            with self.condition:
+            with self.receipt_condition:
                 self.received = True
-                self.condition.notify()
+                self.receipt_condition.notify()
+
+    def on_disconnected(self):
+        with self.disconnect_condition:
+            self.disconnected = True
+            self.disconnect_condition.notify()
 
     def wait_on_receipt(self):
         """
         Wait until we receive a message receipt.
         """
-        with self.condition:
+        with self.receipt_condition:
             while not self.received:
-                self.condition.wait()
+                self.receipt_condition.wait()
         self.received = False
 
+    def wait_on_disconnected(self):
+        """
+        Wait until disconnected.
+        """
+        with self.disconnect_condition:
+            while not self.disconnected:
+                self.disconnect_condition.wait()
 
 class StatsListener(ConnectionListener):
     """
@@ -368,7 +388,10 @@
         :param dict headers: headers in the message
         :param body: the message content
         """
-        log.info("received an error %s [%s]", body, headers)
+        if log.isEnabledFor(logging.DEBUG):
+            log.debug("received an error %s [%s]", body, headers)
+        else:
+            log.info("received an error %s", body)
         self.errors += 1
 
     def on_connecting(self, host_and_port):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stomp.py-4.1.21/stomp/protocol.py 
new/stomp.py-4.1.22/stomp/protocol.py
--- old/stomp.py-4.1.21/stomp/protocol.py       2018-06-30 11:50:26.000000000 
+0200
+++ new/stomp.py-4.1.22/stomp/protocol.py       2018-12-19 20:39:06.000000000 
+0100
@@ -1,8 +1,6 @@
 """Provides the 1.0, 1.1 and 1.2 protocol classes.
 """
 
-import uuid
-
 from stomp.constants import *
 from stomp.exception import ConnectFailedException
 from stomp.listener import *
@@ -81,7 +79,7 @@
         """
         headers = utils.merge_headers([headers, keyword_headers])
         if not transaction:
-            transaction = str(uuid.uuid4())
+            transaction = utils.get_uuid()
         headers[HDR_TRANSACTION] = transaction
         self.send_frame(CMD_BEGIN, headers)
         return transaction
@@ -140,7 +138,7 @@
             log.debug('Not sending disconnect, already disconnected')
             return
         headers = utils.merge_headers([headers, keyword_headers])
-        rec = receipt or str(uuid.uuid4())
+        rec = receipt or utils.get_uuid()
         headers[HDR_RECEIPT] = rec
         self.set_receipt(rec, CMD_DISCONNECT)
         self.send_frame(CMD_DISCONNECT, headers)
@@ -293,7 +291,7 @@
         """
         headers = utils.merge_headers([headers, keyword_headers])
         if not transaction:
-            transaction = str(uuid.uuid4())
+            transaction = utils.get_uuid()
         headers[HDR_TRANSACTION] = transaction
         self.send_frame(CMD_BEGIN, headers)
         return transaction
@@ -355,7 +353,7 @@
             log.debug('Not sending disconnect, already disconnected')
             return
         headers = utils.merge_headers([headers, keyword_headers])
-        rec = receipt or str(uuid.uuid4())
+        rec = receipt or utils.get_uuid()
         headers[HDR_RECEIPT] = rec
         self.set_receipt(rec, CMD_DISCONNECT)
         self.send_frame(CMD_DISCONNECT, headers)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stomp.py-4.1.21/stomp/test/__init__.py 
new/stomp.py-4.1.22/stomp/test/__init__.py
--- old/stomp.py-4.1.21/stomp/test/__init__.py  2018-06-30 11:50:26.000000000 
+0200
+++ new/stomp.py-4.1.22/stomp/test/__init__.py  2018-12-18 19:41:10.000000000 
+0100
@@ -1,7 +1,7 @@
 import sys
 
 __all__ = ['basic_test', 'nonascii_test', 'ss_test', 'cli_test', 
'cli_ssl_test', 's10_test',
-           's11_test', 's12_test', 'rabbitmq_test', 'stompserver_test',
+           's11_test', 's12_test', 'activemq_test', 'rabbitmq_test', 
'stompserver_test',
            'misc_test', 'multicast_test', 'ssl_test', 'utils_test',
            'transport_test', 'local_test']
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stomp.py-4.1.21/stomp/test/activemq_test.py 
new/stomp.py-4.1.22/stomp/test/activemq_test.py
--- old/stomp.py-4.1.21/stomp/test/activemq_test.py     1970-01-01 
01:00:00.000000000 +0100
+++ new/stomp.py-4.1.22/stomp/test/activemq_test.py     2018-12-23 
01:04:25.000000000 +0100
@@ -0,0 +1,29 @@
+import unittest
+
+import stomp
+from stomp.listener import TestListener
+from stomp.test.testutils import *
+
+
+class TestRabbitMQSend(unittest.TestCase):
+
+    def setUp(self):
+        pass
+
+    def testbasic(self):
+        conn = stomp.Connection11(get_default_host())
+        listener = TestListener('123')
+        conn.set_listener('', listener)
+        conn.connect(get_default_user(), get_default_password(), wait=True)
+        conn.subscribe(destination='/queue/test', id=1, ack='auto')
+
+        conn.send(body='this is a test', destination='/queue/test', 
receipt='123')
+
+        listener.wait_on_receipt()
+        listener.wait_for_message()
+
+        conn.disconnect(receipt=None)
+
+        self.assertTrue(listener.connections == 1, 'should have received 1 
connection acknowledgement')
+        self.assertTrue(listener.messages == 1, 'should have received 1 
message')
+        self.assertTrue(listener.errors == 0, 'should not have received any 
errors')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stomp.py-4.1.21/stomp/test/apollo_test.py 
new/stomp.py-4.1.22/stomp/test/apollo_test.py
--- old/stomp.py-4.1.21/stomp/test/apollo_test.py       1970-01-01 
01:00:00.000000000 +0100
+++ new/stomp.py-4.1.22/stomp/test/apollo_test.py       2019-04-13 
15:01:40.000000000 +0200
@@ -0,0 +1,24 @@
+import unittest
+
+import stomp
+from stomp.listener import WaitingListener
+from stomp.test.testutils import *
+
+
+class TestApolloSend(unittest.TestCase):
+
+    def setUp(self):
+        pass
+
+    def testbasic(self):
+        conn = stomp.Connection11(get_apollo_host())
+        listener = WaitingListener('123')
+        conn.set_listener('', listener)
+        conn.connect(get_default_user(), get_default_password(), wait=True)
+        conn.subscribe(destination='/queue/test', id=1, ack='auto')
+
+        conn.send(body='this is a test', destination='/queue/test', 
receipt='123')
+
+        listener.wait_on_receipt()
+
+        conn.disconnect(receipt=None)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stomp.py-4.1.21/stomp/test/basic_test.py 
new/stomp.py-4.1.22/stomp/test/basic_test.py
--- old/stomp.py-4.1.21/stomp/test/basic_test.py        2018-06-29 
13:37:36.000000000 +0200
+++ new/stomp.py-4.1.22/stomp/test/basic_test.py        2018-12-19 
20:52:44.000000000 +0100
@@ -190,3 +190,21 @@
             self.assertFalse(conn.is_connected(), 'Should not be connected')
         except:
             self.fail("Shouldn't happen")
+
+class TestContext(unittest.TestCase):
+    def setUp(self):
+        self.timestamp = time.strftime('%Y%m%d%H%M%S')
+
+    def test_with_context(self):
+        with stomp.Connection(get_default_host()) as conn:
+            self.listener = TestListener('123')
+            conn.set_listener('', self.listener)
+            conn.connect(get_default_user(), get_default_password(), wait=True)
+
+            queuename = '/queue/test1-%s' % self.timestamp
+            conn.subscribe(destination=queuename, id=1, ack='auto')
+            conn.send(body='this is a test', destination=queuename, 
receipt='123')
+            self.listener.wait_for_message()
+
+        self.assertTrue(self.listener.connections == 1, 'should have received 
1 connection acknowledgement')
+        self.assertTrue(self.listener.disconnects >= 1, 'should have received 
1 disconnect')
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stomp.py-4.1.21/stomp/test/local_test.py 
new/stomp.py-4.1.22/stomp/test/local_test.py
--- old/stomp.py-4.1.21/stomp/test/local_test.py        2018-06-29 
13:37:36.000000000 +0200
+++ new/stomp.py-4.1.22/stomp/test/local_test.py        2018-12-18 
19:41:10.000000000 +0100
@@ -27,6 +27,7 @@
         self.conn.send(body='this is a test', destination=queuename, 
receipt='123')
 
         self.listener.wait_on_receipt()
+        self.listener.wait_for_message()
 
         self.assertTrue(self.listener.connections == 1, 'should have received 
1 connection acknowledgement')
         self.assertTrue(self.listener.messages == 1, 'should have received 1 
message')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stomp.py-4.1.21/stomp/test/misc_test.py 
new/stomp.py-4.1.22/stomp/test/misc_test.py
--- old/stomp.py-4.1.21/stomp/test/misc_test.py 2018-06-29 13:37:36.000000000 
+0200
+++ new/stomp.py-4.1.22/stomp/test/misc_test.py 2018-12-18 19:41:10.000000000 
+0100
@@ -51,10 +51,10 @@
 class TestMessageTransform(unittest.TestCase):
 
     def setUp(self):
-        conn = stomp.Connection(get_default_host())
+        conn = stomp.Connection(get_rabbitmq_host())
         listener = TransformationListener('123')
         conn.set_listener('', listener)
-        conn.connect(get_default_user(), get_default_password(), wait=True)
+        conn.connect(get_rabbitmq_user(), get_rabbitmq_password(), wait=True)
         self.conn = conn
         self.listener = listener
         self.timestamp = time.strftime('%Y%m%d%H%M%S')
@@ -78,11 +78,12 @@
     </entry>
 </map>''', destination=queuename, headers={'transformation': 'jms-map-xml'}, 
receipt='123')
 
+        self.listener.wait_on_receipt()
         self.listener.wait_for_message()
 
         self.assertTrue(self.listener.message is not None, 'Did not receive a 
message')
         self.assertTrue(self.listener.message.__class__ == dict,
-                        'Message type should be dict after transformation, was 
%s' % self.listener.message.__class__)
+            'Message type should be dict after transformation, was %s' % 
self.listener.message.__class__)
         self.assertTrue(self.listener.message['name'] == 'Dejan', 'Missing an 
expected dict element')
         self.assertTrue(self.listener.message['city'] == 'Belgrade', 'Missing 
an expected dict element')
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stomp.py-4.1.21/stomp/test/multicast_test.py 
new/stomp.py-4.1.22/stomp/test/multicast_test.py
--- old/stomp.py-4.1.21/stomp/test/multicast_test.py    2018-06-30 
11:50:26.000000000 +0200
+++ new/stomp.py-4.1.22/stomp/test/multicast_test.py    2019-04-13 
15:01:40.000000000 +0200
@@ -1,10 +1,10 @@
 import time
 import unittest
-import uuid
 
 from stomp.adapter.multicast import MulticastConnection
 from stomp.listener import TestListener
 from stomp.test.testutils import *
+from stomp.utils import get_uuid
 
 
 class TestMulticast(unittest.TestCase):
@@ -58,7 +58,7 @@
         queuename = '/queue/test1-%s' % self.timestamp
         self.conn.subscribe(destination=queuename, id=1, ack='auto')
 
-        trans_id = str(uuid.uuid4())
+        trans_id = get_uuid()
         self.conn.begin(trans_id)
 
         self.conn.send(body='this is a test', transaction=trans_id, 
destination=queuename, receipt='123')
@@ -113,7 +113,4 @@
 
         (_, msg) = self.listener.get_latest_message()
 
-        if sys.hexversion >= 0x03000000:
-            self.assertEqual(txt, msg)
-        else:
-            self.assertEqual(txt.encode('utf-8'), msg)
+        self.assertEqual(txt.encode('utf-8'), msg)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stomp.py-4.1.21/stomp/test/s11_test.py 
new/stomp.py-4.1.22/stomp/test/s11_test.py
--- old/stomp.py-4.1.21/stomp/test/s11_test.py  2018-06-29 13:37:36.000000000 
+0200
+++ new/stomp.py-4.1.22/stomp/test/s11_test.py  2019-04-13 11:06:09.000000000 
+0200
@@ -80,3 +80,37 @@
             server.stop()
 
         self.assertTrue(listener.heartbeat_timeouts >= 1, 'should have 
received a heartbeat timeout')
+
+        def testheartbeat_shutdown(self):
+            server = TestStompServer('127.0.0.1', 60000)
+            server.start()
+            conn = None
+            try:
+                server.add_frame('''CONNECTED
+    version:1.1
+    session:1
+    server:test
+    heart-beat:1000,1000
+
+    \x00''')
+
+                conn = stomp.Connection([('127.0.0.1', 60000)], 
heartbeats=(10000, 10000))
+                listener = TestListener()
+                conn.set_listener('', listener)
+                conn.connect()
+
+                start_time = time.time()
+                time.sleep(0.5)
+                # shutdown connection
+                server.stop()
+                while conn.heartbeat_thread is not None:
+                    time.sleep(0.5)
+                end_time = time.time()
+
+                server.running = False
+            except Exception:
+                _, e, _ = sys.exc_info()
+                log.error("Error: %s", e)
+
+            self.assertLessEqual(end_time - start_time, 2, 'should stop 
immediately and not after heartbeat timeout')
+            self.assertIsNone(conn.heartbeat_thread, 'heartbeat thread should 
have finished')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stomp.py-4.1.21/stomp/test/s12_test.py 
new/stomp.py-4.1.22/stomp/test/s12_test.py
--- old/stomp.py-4.1.21/stomp/test/s12_test.py  2018-06-29 13:37:36.000000000 
+0200
+++ new/stomp.py-4.1.22/stomp/test/s12_test.py  2018-12-18 19:41:10.000000000 
+0100
@@ -111,7 +111,8 @@
         self.assertTrue('special-3' in headers)
         self.assertEqual('test with newlines \n \n', headers['special-3'])
         self.assertTrue('special-4' in headers)
-        self.assertEqual('test with carriage return \r', headers['special-4'])
+        cr_header = headers['special-4'].replace('\\r', '\r')
+        self.assertEqual('test with carriage return \r', cr_header)
 
     def test_suppress_content_length(self):
         queuename = '/queue/testspecialchars12-%s' % self.timestamp
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stomp.py-4.1.21/stomp/test/setup.ini 
new/stomp.py-4.1.22/stomp/test/setup.ini
--- old/stomp.py-4.1.21/stomp/test/setup.ini    2018-06-30 11:50:26.000000000 
+0200
+++ new/stomp.py-4.1.22/stomp/test/setup.ini    2018-12-23 00:35:35.000000000 
+0100
@@ -1,24 +1,28 @@
 [default]
-host = 10.0.0.20
-port = 61613
+host = 172.17.0.2
+port = 62613
 ssl_port = 62614
 user = admin
 password = password
 
 [ipv6]
-host = fe80::a00:27ff:fe90:3f1a%wlp58s0
+host = 2001:db8:1234:5678:9abc:242:ac11:2
 port = 62613
 
 [rabbitmq]
-host = 10.0.0.113
+host = 172.17.0.2
 port = 61613
 user = guest
 password = guest
 
 [stompserver]
-host = 10.0.0.113
+host = 172.17.0.2
 port = 63613
 
 [sni]
 host = my.example.com
 ssl_port = 65001
+
+[apollo]
+host = 172.17.0.2
+port = 64613
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stomp.py-4.1.21/stomp/test/ssl_test.py 
new/stomp.py-4.1.22/stomp/test/ssl_test.py
--- old/stomp.py-4.1.21/stomp/test/ssl_test.py  2018-06-29 13:37:36.000000000 
+0200
+++ new/stomp.py-4.1.22/stomp/test/ssl_test.py  2018-12-18 19:41:10.000000000 
+0100
@@ -20,12 +20,14 @@
             conn = stomp.Connection(get_default_ssl_host())
             conn.set_ssl(get_default_ssl_host())
             conn.set_listener('', self.listener)
-            conn.connect('admin', 'password', wait=True)
+            conn.connect(get_default_user(), get_default_password(), wait=True)
             conn.subscribe(destination=queuename, id=1, ack='auto')
 
             conn.send(body='this is a test', destination=queuename, 
receipt='123')
 
             self.listener.wait_on_receipt()
+            self.listener.wait_for_message()
+
             conn.disconnect(receipt=None)
 
             self.assertTrue(self.listener.connections == 1, 'should have 
received 1 connection acknowledgement')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stomp.py-4.1.21/stomp/test/stompserver_test.py 
new/stomp.py-4.1.22/stomp/test/stompserver_test.py
--- old/stomp.py-4.1.21/stomp/test/stompserver_test.py  2018-06-29 
13:37:36.000000000 +0200
+++ new/stomp.py-4.1.22/stomp/test/stompserver_test.py  2018-12-18 
19:41:10.000000000 +0100
@@ -20,6 +20,7 @@
         conn.send(body='this is a test', destination='/queue/test', 
receipt='123')
 
         listener.wait_on_receipt()
+        listener.wait_for_message()
 
         conn.unsubscribe('/queue/test')
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stomp.py-4.1.21/stomp/test/testutils.py 
new/stomp.py-4.1.22/stomp/test/testutils.py
--- old/stomp.py-4.1.21/stomp/test/testutils.py 2018-06-30 11:50:26.000000000 
+0200
+++ new/stomp.py-4.1.22/stomp/test/testutils.py 2018-12-23 00:36:33.000000000 
+0100
@@ -95,6 +95,10 @@
     port = config.get('stompserver', 'port')
     return [(get_environ('STOMPSERVER_HOST') or host, 
int(get_environ('STOMPSERVER_PORT') or port))]
 
+def get_apollo_host():
+    host = config.get('apollo', 'host')
+    port = config.get('apollo', 'port')
+    return [(get_environ('APOLLO_HOST') or host, 
int(get_environ('APOLLO_PORT') or port))]
 
 class TestStompServer(object):
     def __init__(self, host, port):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stomp.py-4.1.21/stomp/transport.py 
new/stomp.py-4.1.22/stomp/transport.py
--- old/stomp.py-4.1.21/stomp/transport.py      2018-06-30 12:51:09.000000000 
+0200
+++ new/stomp.py-4.1.22/stomp/transport.py      2019-04-13 15:01:40.000000000 
+0200
@@ -51,7 +51,6 @@
     and anything else outside of actually establishing a network connection, 
sending and
     receiving of messages (so generally socket-agnostic functions).
 
-    :param bool wait_on_receipt: deprecated, ignored
     :param bool auto_decode: automatically decode message responses as 
strings, rather than
         leaving them as bytes. This preserves the behaviour as of version 
4.0.16.
         (To be defaulted to False as of the next release)
@@ -63,7 +62,7 @@
     #
     __content_length_re = 
re.compile(b'^content-length[:]\\s*(?P<value>[0-9]+)', re.MULTILINE)
 
-    def __init__(self, wait_on_receipt=False, auto_decode=True, 
encoding='utf-8'):
+    def __init__(self, auto_decode=True, encoding='utf-8'):
         self.__recvbuf = b''
         self.listeners = {}
         self.running = False
@@ -189,7 +188,7 @@
             if log.isEnabledFor(logging.DEBUG):
                 log.debug("Received frame: %r, headers=%r, body=%r", f.cmd, 
f.headers, f.body)
             else:
-                log.info("Received frame: %r, headers=%r, len(body)=%r", 
f.cmd, f.headers, utils.length(f.body))
+                log.info("Received frame: %r, len(body)=%r", f.cmd, 
utils.length(f.body))
             self.notify(frame_type, f.headers, f.body)
         else:
             log.warning("Unknown response frame type: '%s' (frame length was 
%d)", frame_type, utils.length(frame_str))
@@ -210,12 +209,12 @@
                 self.set_receipt(receipt, None)
                 self.__send_wait_condition.notify()
 
-            # received a stomp 1.1+ disconnect receipt
-            if receipt == self.__disconnect_receipt:
-                self.disconnect_socket()
-
             if receipt_value == CMD_DISCONNECT:
                 self.set_connected(False)
+                # received a stomp 1.1+ disconnect receipt
+                if receipt == self.__disconnect_receipt:
+                    self.disconnect_socket()
+                self.__disconnect_receipt = None
 
         elif frame_type == 'connected':
             self.set_connected(True)
@@ -224,9 +223,9 @@
             self.set_connected(False)
 
         with self.__listeners_change_condition:
-            listeners = list(self.listeners.values())
+            listeners = sorted(self.listeners.items())
 
-        for listener in listeners:
+        for (_, listener) in listeners:
             if not listener:
                 continue
 
@@ -258,9 +257,9 @@
         :param Frame frame: the Frame object to transmit
         """
         with self.__listeners_change_condition:
-            listeners = list(self.listeners.values())
+            listeners = sorted(self.listeners.items())
 
-        for listener in listeners:
+        for (_, listener) in listeners:
             if not listener:
                 continue
             try:
@@ -268,13 +267,16 @@
             except AttributeError:
                 continue
 
+        if frame.cmd == CMD_DISCONNECT and HDR_RECEIPT in frame.headers:
+            self.__disconnect_receipt = frame.headers[HDR_RECEIPT]
+
         lines = utils.convert_frame(frame)
         packed_frame = pack(lines)
 
         if log.isEnabledFor(logging.DEBUG):
             log.debug("Sending frame: %s", lines)
         else:
-            log.info("Sending frame: %r, headers=%r", frame.cmd or 
"heartbeat", utils.clean_headers(frame.headers))
+            log.info("Sending frame: %r", frame.cmd or "heartbeat")
         self.send(packed_frame)
 
     def send(self, encoded_frame):
@@ -472,7 +474,7 @@
         stampeding. For example, a value of 0.1 means to wait
         an extra 0%-10% (randomly determined) of the delay
         calculated using the previous three parameters.
-    :param int reconnect_attempts_max: maximum attempts to reconnect
+    :param int reconnect_attempts_max: maximum attempts to reconnect (Can also 
be used for infinite attempts : `-1`)
     :param bool use_ssl: deprecated, see :py:meth:`set_ssl`
     :param ssl_cert_file: deprecated, see :py:meth:`set_ssl`
     :param ssl_key_file: deprecated, see :py:meth:`set_ssl`
@@ -480,7 +482,6 @@
     :param ssl_cert_validator: deprecated, see :py:meth:`set_ssl`
     :param ssl_version: deprecated, see :py:meth:`set_ssl`
     :param timeout: the timeout value to use when connecting the stomp socket
-    :param bool wait_on_receipt: deprecated, ignored
     :param keepalive: some operating systems support sending the occasional 
heart
         beat packets to detect when a connection fails.  This
         parameter can either be set set to a boolean to turn on the
@@ -505,7 +506,6 @@
                  ssl_cert_file=None,
                  ssl_ca_certs=None,
                  ssl_cert_validator=None,
-                 wait_on_receipt=False,
                  ssl_version=None,
                  timeout=None,
                  keepalive=None,
@@ -514,7 +514,7 @@
                  encoding='utf-8',
                  recv_bytes=1024
                  ):
-        BaseTransport.__init__(self, wait_on_receipt, auto_decode, encoding)
+        BaseTransport.__init__(self, auto_decode, encoding)
 
         if host_and_ports is None:
             host_and_ports = [('localhost', 61613)]
@@ -725,7 +725,9 @@
         sleep_exp = 1
         connect_count = 0
 
-        while self.running and self.socket is None and connect_count < 
self.__reconnect_attempts_max:
+        while self.running and self.socket is None and (
+            connect_count < self.__reconnect_attempts_max or 
+            self.__reconnect_attempts_max == -1 ):
             for host_and_port in self.__host_and_ports:
                 try:
                     log.info("Attempting connection to host %s, port %s", 
host_and_port[0], host_and_port[1])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stomp.py-4.1.21/stomp/utils.py 
new/stomp.py-4.1.22/stomp/utils.py
--- old/stomp.py-4.1.21/stomp/utils.py  2018-06-30 11:50:26.000000000 +0200
+++ new/stomp.py-4.1.22/stomp/utils.py  2018-12-19 20:39:06.000000000 +0100
@@ -9,6 +9,10 @@
 from stomp.backward import encode, decode, NULL
 from stomp.constants import *
 
+try:
+    import uuid
+except ImportError:
+    from backward import uuid
 
 # List of all host names (unqualified, fully-qualified, and IP
 # addresses) that refer to the local host (both loopback interface
@@ -271,3 +275,7 @@
 
     def __str__(self):
         return '{cmd=%s,headers=[%s],body=%s}' % (self.cmd, self.headers, 
self.body)
+
+
+def get_uuid():
+    return str(uuid.uuid4())
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stomp.py-4.1.21/stomp.py.egg-info/PKG-INFO 
new/stomp.py-4.1.22/stomp.py.egg-info/PKG-INFO
--- old/stomp.py-4.1.21/stomp.py.egg-info/PKG-INFO      2018-07-07 
10:14:14.000000000 +0200
+++ new/stomp.py-4.1.22/stomp.py.egg-info/PKG-INFO      2019-04-13 
15:02:15.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: stomp.py
-Version: 4.1.21
+Version: 4.1.22
 Summary: Python STOMP client, supporting versions 1.0, 1.1 and 1.2 of the 
protocol
 Home-page: https://github.com/jasonrbriggs/stomp.py
 Author: Jason R Briggs
@@ -88,7 +88,7 @@
         
         .. _JBossMessaging: http://www.jboss.org/jbossmessaging
         
-        For more info on setting up a test server (using virtualbox), contact 
the developer.
+        For more info on setting up a local test server (using docker), 
contact the developer.
         
         
 Platform: any
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stomp.py-4.1.21/stomp.py.egg-info/SOURCES.txt 
new/stomp.py-4.1.22/stomp.py.egg-info/SOURCES.txt
--- old/stomp.py-4.1.21/stomp.py.egg-info/SOURCES.txt   2018-07-07 
10:14:14.000000000 +0200
+++ new/stomp.py-4.1.22/stomp.py.egg-info/SOURCES.txt   2019-04-13 
15:02:15.000000000 +0200
@@ -31,6 +31,8 @@
 stomp/adapter/__init__.py
 stomp/adapter/multicast.py
 stomp/test/__init__.py
+stomp/test/activemq_test.py
+stomp/test/apollo_test.py
 stomp/test/basic_test.py
 stomp/test/cli_ssl_test.py
 stomp/test/cli_test.py


Reply via email to