Merge branch 'master' into kgiusti-python3

Conflicts:
        proton-c/bindings/python/proton/__init__.py
        tests/python/proton_tests/sasl.py


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/2721c639
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/2721c639
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/2721c639

Branch: refs/heads/master
Commit: 2721c639fc5e750291d4badd081d6f6d1207434f
Parents: 43a61bb c2c178c
Author: Ken Giusti <[email protected]>
Authored: Mon Jun 15 13:19:55 2015 -0400
Committer: Ken Giusti <[email protected]>
Committed: Mon Jun 15 13:19:55 2015 -0400

----------------------------------------------------------------------
 .gitattributes                                  |   2 +
 .gitignore                                      |   6 +
 .travis.yml                                     |   2 +-
 LICENSE                                         |   6 +
 README.md                                       |   4 +
 appveyor.yml                                    |  16 +
 bin/export.sh                                   |  29 +-
 examples/engine/java/drain                      |   2 +-
 examples/engine/java/pom.xml                    |   2 +-
 examples/engine/java/server                     |   2 +-
 examples/engine/java/spout                      |   2 +-
 examples/go/README.md                           |  69 ++
 examples/go/event/broker.go                     | 186 ++--
 examples/go/example.go                          |  54 --
 examples/go/receive.go                          |  99 +-
 examples/go/send.go                             | 117 ++-
 examples/python/README                          |  22 +
 examples/python/reactor/send.py                 |   3 +
 examples/ruby/engine_recv.rb                    | 158 ++++
 examples/ruby/engine_send.rb                    | 143 +++
 examples/ruby/lib/driver.rb                     |  69 ++
 examples/ruby/lib/qpid_examples.rb              |  28 +
 examples/ruby/lib/selectable.rb                 | 120 +++
 examples/ruby/messenger/README.md               | 163 ++++
 examples/ruby/messenger/client.rb               |   2 +-
 examples/ruby/messenger/mailserver.rb           |   3 +-
 examples/ruby/messenger/nonblocking_recv.rb     | 145 +++
 examples/ruby/messenger/passive_recv.rb         | 140 ---
 examples/ruby/messenger/recv.rb                 |   2 +-
 examples/ruby/messenger/send.rb                 |   2 +-
 examples/ruby/wrapper_test.rb                   |  82 ++
 proton-c/CMakeLists.txt                         |  52 +-
 proton-c/bindings/CMakeLists.txt                |   2 +-
 proton-c/bindings/go/README.md                  | 196 +---
 proton-c/bindings/go/WARNING_EXPERIMENTAL       |   1 -
 proton-c/bindings/go/src/Makefile               |  25 -
 proton-c/bindings/go/src/genwrap.go             | 398 --------
 .../go/src/qpid.apache.org/proton/doc.go        |  36 -
 .../go/src/qpid.apache.org/proton/dummy.go      |  82 --
 .../go/src/qpid.apache.org/proton/error.go      | 111 ---
 .../go/src/qpid.apache.org/proton/event/doc.go  |  28 -
 .../src/qpid.apache.org/proton/event/error.go   |  77 --
 .../qpid.apache.org/proton/event/handlers.go    | 328 -------
 .../go/src/qpid.apache.org/proton/event/pump.go | 262 ------
 .../qpid.apache.org/proton/event/wrappers.go    | 137 ---
 .../proton/event/wrappers_gen.go                | 505 ----------
 .../src/qpid.apache.org/proton/interop_test.go  | 308 -------
 .../go/src/qpid.apache.org/proton/marshal.go    | 229 -----
 .../go/src/qpid.apache.org/proton/message.go    | 388 --------
 .../src/qpid.apache.org/proton/message_test.go  |  90 --
 .../go/src/qpid.apache.org/proton/types.go      | 193 ----
 .../go/src/qpid.apache.org/proton/unmarshal.go  | 530 -----------
 .../go/src/qpid.apache.org/proton/url.go        |  95 --
 .../go/src/qpid.apache.org/proton/url_test.go   |  51 --
 proton-c/bindings/javascript/CMakeLists.txt     |   9 +-
 proton-c/bindings/javascript/binding.c          |   2 +
 proton-c/bindings/php/php.i                     |  15 -
 proton-c/bindings/python/CMakeLists.txt         |  13 +
 proton-c/bindings/python/MANIFEST.in            |   2 +
 proton-c/bindings/python/cproton.i              |  36 +
 proton-c/bindings/python/docs/Makefile          | 153 ----
 proton-c/bindings/python/docs/README            |   5 -
 proton-c/bindings/python/docs/conf.py           | 242 +++++
 proton-c/bindings/python/docs/index.rst         |  11 +
 proton-c/bindings/python/docs/make.bat          | 190 ----
 proton-c/bindings/python/docs/overview.rst      | 160 ++++
 proton-c/bindings/python/docs/source/conf.py    | 242 -----
 proton-c/bindings/python/docs/source/index.rst  |  24 -
 .../bindings/python/docs/source/overview.rst    | 161 ----
 .../bindings/python/docs/source/reference.rst   |  44 -
 .../bindings/python/docs/source/tutorial.rst    | 301 ------
 proton-c/bindings/python/docs/tutorial.rst      | 301 ++++++
 proton-c/bindings/python/proton/__init__.py     |  70 +-
 proton-c/bindings/python/proton/handlers.py     |   2 +-
 proton-c/bindings/python/proton/reactor.py      |  27 +-
 proton-c/bindings/python/setup.py               | 305 ++++++-
 .../python/setuputils/PYZMQ_LICENSE.BSD         |  32 +
 proton-c/bindings/python/setuputils/__init__.py |   0
 proton-c/bindings/python/setuputils/bundle.py   |  84 ++
 proton-c/bindings/python/setuputils/log.py      |  46 +
 proton-c/bindings/python/setuputils/misc.py     |  55 ++
 proton-c/bindings/python/tox.ini                |  32 +
 proton-c/bindings/ruby/.yardopts                |   1 +
 proton-c/bindings/ruby/lib/codec/data.rb        | 912 +++++++++++++++++++
 proton-c/bindings/ruby/lib/codec/mapping.rb     | 169 ++++
 proton-c/bindings/ruby/lib/core/connection.rb   | 328 +++++++
 proton-c/bindings/ruby/lib/core/delivery.rb     | 271 ++++++
 proton-c/bindings/ruby/lib/core/disposition.rb  | 158 ++++
 proton-c/bindings/ruby/lib/core/endpoint.rb     | 115 +++
 proton-c/bindings/ruby/lib/core/exceptions.rb   | 116 +++
 proton-c/bindings/ruby/lib/core/link.rb         | 387 ++++++++
 proton-c/bindings/ruby/lib/core/message.rb      | 633 +++++++++++++
 proton-c/bindings/ruby/lib/core/receiver.rb     |  95 ++
 proton-c/bindings/ruby/lib/core/sasl.rb         |  94 ++
 proton-c/bindings/ruby/lib/core/sender.rb       |  76 ++
 proton-c/bindings/ruby/lib/core/session.rb      | 163 ++++
 proton-c/bindings/ruby/lib/core/ssl.rb          | 160 ++++
 proton-c/bindings/ruby/lib/core/ssl_details.rb  |  33 +
 proton-c/bindings/ruby/lib/core/ssl_domain.rb   | 156 ++++
 proton-c/bindings/ruby/lib/core/terminus.rb     | 218 +++++
 proton-c/bindings/ruby/lib/core/transport.rb    | 412 +++++++++
 proton-c/bindings/ruby/lib/event/collector.rb   | 148 +++
 proton-c/bindings/ruby/lib/event/event.rb       | 296 ++++++
 proton-c/bindings/ruby/lib/event/event_base.rb  |  91 ++
 proton-c/bindings/ruby/lib/event/event_type.rb  |  71 ++
 proton-c/bindings/ruby/lib/messenger/filters.rb |  64 ++
 .../bindings/ruby/lib/messenger/messenger.rb    | 702 ++++++++++++++
 .../bindings/ruby/lib/messenger/selectable.rb   | 124 +++
 .../bindings/ruby/lib/messenger/subscription.rb |  37 +
 proton-c/bindings/ruby/lib/messenger/tracker.rb |  38 +
 .../ruby/lib/messenger/tracker_status.rb        |  69 ++
 proton-c/bindings/ruby/lib/qpid_proton.rb       |  95 +-
 proton-c/bindings/ruby/lib/qpid_proton/array.rb | 173 ----
 proton-c/bindings/ruby/lib/qpid_proton/data.rb  | 788 ----------------
 .../bindings/ruby/lib/qpid_proton/described.rb  |  66 --
 .../ruby/lib/qpid_proton/exception_handling.rb  | 127 ---
 .../bindings/ruby/lib/qpid_proton/exceptions.rb |  85 --
 .../bindings/ruby/lib/qpid_proton/filters.rb    |  67 --
 proton-c/bindings/ruby/lib/qpid_proton/hash.rb  |  86 --
 .../bindings/ruby/lib/qpid_proton/mapping.rb    | 170 ----
 .../bindings/ruby/lib/qpid_proton/message.rb    | 621 -------------
 .../bindings/ruby/lib/qpid_proton/messenger.rb  | 702 --------------
 .../bindings/ruby/lib/qpid_proton/selectable.rb | 126 ---
 .../bindings/ruby/lib/qpid_proton/strings.rb    |  65 --
 .../ruby/lib/qpid_proton/subscription.rb        |  41 -
 .../bindings/ruby/lib/qpid_proton/tracker.rb    |  42 -
 .../ruby/lib/qpid_proton/tracker_status.rb      |  73 --
 .../bindings/ruby/lib/qpid_proton/version.rb    |  32 -
 proton-c/bindings/ruby/lib/types/array.rb       | 172 ++++
 proton-c/bindings/ruby/lib/types/described.rb   |  63 ++
 proton-c/bindings/ruby/lib/types/hash.rb        |  87 ++
 proton-c/bindings/ruby/lib/types/strings.rb     |  62 ++
 .../bindings/ruby/lib/util/class_wrapper.rb     |  52 ++
 proton-c/bindings/ruby/lib/util/condition.rb    |  45 +
 proton-c/bindings/ruby/lib/util/constants.rb    |  85 ++
 proton-c/bindings/ruby/lib/util/engine.rb       |  82 ++
 .../bindings/ruby/lib/util/error_handler.rb     | 127 +++
 proton-c/bindings/ruby/lib/util/swig_helper.rb  | 114 +++
 proton-c/bindings/ruby/lib/util/uuid.rb         |  32 +
 proton-c/bindings/ruby/lib/util/version.rb      |  30 +
 proton-c/bindings/ruby/lib/util/wrapper.rb      | 124 +++
 proton-c/bindings/ruby/ruby.i                   | 119 +++
 proton-c/include/proton/object.h                |   9 +-
 proton-c/include/proton/reactor.h               |   2 +
 proton-c/include/proton/sasl.h                  |  13 +
 proton-c/include/proton/ssl.h                   |  15 +
 proton-c/include/proton/transport.h             |   2 +-
 proton-c/src/buffer.c                           |  90 +-
 proton-c/src/codec/codec.c                      | 195 ++--
 proton-c/src/codec/decoder.c                    |  28 +-
 proton-c/src/config.h                           |  26 +
 proton-c/src/engine/engine-internal.h           |  10 -
 proton-c/src/engine/engine.c                    | 124 +--
 proton-c/src/error.c                            |   8 +-
 proton-c/src/messenger/messenger.c              |  42 +-
 proton-c/src/messenger/store.c                  |  22 +-
 proton-c/src/object/list.c                      |  11 +-
 proton-c/src/object/map.c                       |  16 +-
 proton-c/src/object/object.c                    |   9 +-
 proton-c/src/parser.c                           | 129 ++-
 proton-c/src/platform.c                         |  48 +-
 proton-c/src/platform.h                         |  22 +-
 proton-c/src/posix/io.c                         |   2 +-
 proton-c/src/reactor/acceptor.c                 |  15 +
 proton-c/src/sasl/cyrus_sasl.c                  | 888 +++++-------------
 proton-c/src/sasl/none_sasl.c                   | 490 +++-------
 proton-c/src/sasl/sasl-internal.h               |  60 +-
 proton-c/src/sasl/sasl.c                        | 505 +++++++++-
 proton-c/src/scanner.c                          |  92 +-
 proton-c/src/ssl/openssl.c                      |  49 +-
 proton-c/src/ssl/ssl-internal.h                 |   4 +-
 proton-c/src/ssl/ssl_stub.c                     |  10 +
 proton-c/src/transport/transport.c              | 209 ++---
 proton-c/src/util.c                             |  31 +-
 proton-c/src/util.h                             |  10 +-
 proton-c/src/windows/schannel.c                 |  37 +-
 .../org/apache/qpid/proton/engine/Sasl.java     |  13 +
 .../qpid/proton/engine/impl/SaslImpl.java       |  22 +
 proton-j/src/main/resources/cengine.py          |   3 +
 proton-j/src/main/resources/csasl.py            |  19 +
 .../qpid/proton/systemtests/SaslTest.java       | 100 ++
 tests/python/proton_tests/common.py             |  12 +-
 tests/python/proton_tests/engine.py             |  47 +
 tests/python/proton_tests/sasl.py               | 248 ++++-
 tests/python/proton_tests/ssl.py                |  62 +-
 tests/python/proton_tests/transport.py          |  15 +
 tests/tools/apps/c/reactor-recv.c               |   8 +-
 187 files changed, 12313 insertions(+), 10517 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/2721c639/proton-c/bindings/python/cproton.i
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/2721c639/proton-c/bindings/python/proton/__init__.py
----------------------------------------------------------------------
diff --cc proton-c/bindings/python/proton/__init__.py
index 2098ef9,9432bd8..747bfad
--- a/proton-c/bindings/python/proton/__init__.py
+++ b/proton-c/bindings/python/proton/__init__.py
@@@ -79,16 -76,16 +79,16 @@@ except ImportError
    rand = random.Random()
    rand.seed((os.getpid(), time.time(), socket.gethostname()))
    def random_uuid():
 -    bytes = [rand.randint(0, 255) for i in xrange(16)]
 +    data = [rand.randint(0, 255) for i in xrange(16)]
  
      # From RFC4122, the version bits are set to 0100
-     data[7] &= 0x0F
-     data[7] |= 0x40
 -    bytes[6] &= 0x0F
 -    bytes[6] |= 0x40
++    data[6] &= 0x0F
++    data[6] |= 0x40
  
      # From RFC4122, the top two bits of byte 8 get set to 01
 -    bytes[8] &= 0x3F
 -    bytes[8] |= 0x80
 -    return "".join(map(chr, bytes))
 +    data[8] &= 0x3F
 +    data[8] |= 0x80
 +    return "".join(map(chr, data))
  
    def uuid4():
      return uuid.UUID(bytes=random_uuid())

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/2721c639/proton-c/bindings/python/proton/handlers.py
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/2721c639/proton-c/bindings/python/proton/reactor.py
----------------------------------------------------------------------
diff --cc proton-c/bindings/python/proton/reactor.py
index b475333,a7b0717..c66334b
--- a/proton-c/bindings/python/proton/reactor.py
+++ b/proton-c/bindings/python/proton/reactor.py
@@@ -488,9 -489,13 +496,13 @@@ class Connector(Handler)
      def _connect(self, connection):
          url = self.address.next()
          # IoHandler uses the hostname to determine where to try to connect to
 -        connection.hostname = "%s:%i" % (url.host, url.port)
 +        connection.hostname = "%s:%s" % (url.host, url.port)
          logging.info("connecting to %s..." % connection.hostname)
  
+         if url.username:
+             connection.user = url.username
+         if url.password:
+             connection.password = url.password
          transport = Transport()
          transport.bind(connection)
          if self.heartbeat:

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/2721c639/tests/python/proton_tests/common.py
----------------------------------------------------------------------
diff --cc tests/python/proton_tests/common.py
index 4f23c13,83a39f8..8bb3609
--- a/tests/python/proton_tests/common.py
+++ b/tests/python/proton_tests/common.py
@@@ -244,12 -225,16 +246,18 @@@ class MessengerApp(object)
                      del cmd[0:1]
                      cmd.insert(0, foundfile)
                      cmd.insert(0, sys.executable)
 -            self._process = Popen(cmd, stdout=PIPE, stderr=STDOUT, 
bufsize=4096)
 -        except OSError, e:
 +            self._process = Popen(cmd, stdout=PIPE, stderr=STDOUT,
 +                                  bufsize=4096, universal_newlines=True)
 +        except OSError:
 +            e = sys.exc_info()[1]
              print("ERROR: '%s'" % e)
-             assert False, "Unable to execute command '%s', is it in your 
PATH?" % cmd[0]
+             msg = "Unable to execute command '%s', is it in your PATH?" % 
cmd[0]
+ 
+             # NOTE(flaper87): Skip the test if the command is not found.
+             if e.errno == 2:
+               raise Skipped("Skipping test - %s" % msg)
+             assert False, msg
+ 
          self._ready()  # wait for it to initialize
  
      def stop(self):

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/2721c639/tests/python/proton_tests/engine.py
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/2721c639/tests/python/proton_tests/sasl.py
----------------------------------------------------------------------
diff --cc tests/python/proton_tests/sasl.py
index ce10882,91b3e69..b214b62
--- a/tests/python/proton_tests/sasl.py
+++ b/tests/python/proton_tests/sasl.py
@@@ -16,14 -16,71 +16,74 @@@
  # specific language governing permissions and limitations
  # under the License.
  #
 +from __future__ import absolute_import
  
 -import sys, os, common
 +import sys, os
 +from . import common
+ from string import Template
+ import subprocess
+ 
  from proton import *
 -from common import pump, Skipped
 +from .common import pump, Skipped
 +from proton._compat import str2bin
  
+ from cproton import *
+ 
+ def _sslCertpath(file):
+     """ Return the full path to the certificate,keyfile, etc.
+     """
+     return os.path.join(os.path.dirname(__file__),
+                         "ssl_db/%s" % file)
+ 
+ def _cyrusSetup(conf_dir):
+   """Write out simple SASL config
+   """
+   t = Template("""sasldb_path: ${db}
+ mech_list: EXTERNAL DIGEST-MD5 SCRAM-SHA-1 CRAM-MD5 PLAIN ANONYMOUS
+ """)
+   subprocess.call(args=['rm','-rf',conf_dir])
+   os.mkdir(conf_dir)
+   db = os.path.abspath(os.path.join(conf_dir,'proton.sasldb'))
+   conf = os.path.abspath(os.path.join(conf_dir,'proton.conf'))
+   f = open(conf, 'w')
+   f.write(t.substitute(db=db))
+   f.close()
+ 
+   cmd = Template("echo password | saslpasswd2 -c -p -f ${db} -u proton 
user").substitute(db=db)
+   subprocess.call(args=cmd, shell=True)
+ 
+ def _testSaslMech(self, mech, clientUser='user@proton', 
authUser='user@proton', encrypted=False, authenticated=True):
+   self.s1.allowed_mechs(mech)
+   self.c1.open()
+ 
+   pump(self.t1, self.t2, 1024)
+ 
+   if encrypted:
+     assert self.t2.encrypted == encrypted
+     assert self.t1.encrypted == encrypted
+   assert self.t2.authenticated == authenticated
+   assert self.t1.authenticated == authenticated
+   if authenticated:
+     # Server
+     assert self.t2.user == authUser
+     assert self.s2.user == authUser
+     assert self.s2.mech == mech.strip()
+     assert self.s2.outcome == SASL.OK
+     # Client
+     assert self.t1.user == clientUser
+     assert self.s1.user == clientUser
+     assert self.s1.mech == mech.strip()
+     assert self.s1.outcome == SASL.OK
+   else:
+     # Server
+     assert self.t2.user == None
+     assert self.s2.user == None
+     assert self.s2.outcome != SASL.OK
+     # Client
+     assert self.t1.user == clientUser
+     assert self.s1.user == clientUser
+     assert self.s1.outcome != SASL.OK
+ 
  class Test(common.Test):
    pass
  

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/2721c639/tests/python/proton_tests/ssl.py
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/2721c639/tests/python/proton_tests/transport.py
----------------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to