You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2014/09/29 23:02:37 UTC

svn commit: r1628315 - in /qpid/proton/trunk: proton-c/bindings/python/proton.py tests/python/proton_tests/url.py

Author: astitcher
Date: Mon Sep 29 21:02:37 2014
New Revision: 1628315

URL: http://svn.apache.org/r1628315
Log:
PROTON-693: If the system doesn't have port definitions for amqp/amqps
use the default values of 5672/5671.
- Not all systems have /etc/service (or similar) files that define
  these ports, but our tests use them and the defaults are these
  strings.

Modified:
    qpid/proton/trunk/proton-c/bindings/python/proton.py
    qpid/proton/trunk/tests/python/proton_tests/url.py

Modified: qpid/proton/trunk/proton-c/bindings/python/proton.py
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/bindings/python/proton.py?rev=1628315&r1=1628314&r2=1628315&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/bindings/python/proton.py (original)
+++ qpid/proton/trunk/proton-c/bindings/python/proton.py Mon Sep 29 21:02:37 2014
@@ -3716,7 +3716,11 @@ class Url(object):
         try:
           return socket.getservbyname(value)
         except socket.error:
-          raise ValueError("Not a valid port number or service name: '%s'" % value)
+          # Not every system has amqp/amqps defined as a service
+          if value == Url.AMQPS:  return 5671
+          elif value == Url.AMQP: return 5672
+          else:
+            raise ValueError("Not a valid port number or service name: '%s'" % value)
 
   def __init__(self, url=None, **kwargs):
     """

Modified: qpid/proton/trunk/tests/python/proton_tests/url.py
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/tests/python/proton_tests/url.py?rev=1628315&r1=1628314&r2=1628315&view=diff
==============================================================================
--- qpid/proton/trunk/tests/python/proton_tests/url.py (original)
+++ qpid/proton/trunk/tests/python/proton_tests/url.py Mon Sep 29 21:02:37 2014
@@ -106,13 +106,6 @@ class UrlTest(common.Test):
             self.assertEqual(str(Url(s).defaults()), full)
 
     def testAmqps(self):
-        """Some old platforms don't recognize the amqps service name, this test is a no-op
-        if that is the case otherwise verify we treat amqps correctly."""
-        try:
-            Url.Port('amqps')
-        except ValueError:
-            print "skipping: service 'amqps' not recognized on this platform"
-            return
         # Scheme defaults
         self.assertEqual(str(Url("me:secret@myhost/foobar").defaults()),
                          "amqp://me:secret@myhost:amqp/foobar")



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