You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2018/11/02 20:46:21 UTC

[01/50] qpid-proton git commit: PROTON-1873: bump so versions based on review by Justin, Andrew, and Alan.

Repository: qpid-proton
Updated Branches:
  refs/heads/go1 3826a8e5b -> e3c49ae25


PROTON-1873: bump so versions based on review by Justin, Andrew, and Alan.


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

Branch: refs/heads/go1
Commit: 4c9395ef2e1d6150247845772b24017b8319d29e
Parents: 546f885
Author: Robbie Gemmell <ro...@apache.org>
Authored: Mon Sep 3 11:46:14 2018 +0100
Committer: Robbie Gemmell <ro...@apache.org>
Committed: Mon Sep 3 11:46:14 2018 +0100

----------------------------------------------------------------------
 c/versions.cmake   | 6 +++---
 cpp/versions.cmake | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/4c9395ef/c/versions.cmake
----------------------------------------------------------------------
diff --git a/c/versions.cmake b/c/versions.cmake
index 7161422..00178c6 100644
--- a/c/versions.cmake
+++ b/c/versions.cmake
@@ -1,14 +1,14 @@
 set(PN_LIB_CORE_MAJOR_VERSION 10)
 set(PN_LIB_CORE_MINOR_VERSION 5)
-set(PN_LIB_CORE_PATCH_VERSION 0)
+set(PN_LIB_CORE_PATCH_VERSION 1)
 set(PN_LIB_CORE_VERSION "${PN_LIB_CORE_MAJOR_VERSION}.${PN_LIB_CORE_MINOR_VERSION}.${PN_LIB_CORE_PATCH_VERSION}")
 
 set(PN_LIB_PROACTOR_MAJOR_VERSION 1)
 set(PN_LIB_PROACTOR_MINOR_VERSION 3)
-set(PN_LIB_PROACTOR_PATCH_VERSION 2)
+set(PN_LIB_PROACTOR_PATCH_VERSION 3)
 set(PN_LIB_PROACTOR_VERSION "${PN_LIB_PROACTOR_MAJOR_VERSION}.${PN_LIB_PROACTOR_MINOR_VERSION}.${PN_LIB_PROACTOR_PATCH_VERSION}")
 
 set(PN_LIB_LEGACY_MAJOR_VERSION 11)
 set(PN_LIB_LEGACY_MINOR_VERSION 6)
-set(PN_LIB_LEGACY_PATCH_VERSION 0)
+set(PN_LIB_LEGACY_PATCH_VERSION 1)
 set(PN_LIB_LEGACY_VERSION "${PN_LIB_LEGACY_MAJOR_VERSION}.${PN_LIB_LEGACY_MINOR_VERSION}.${PN_LIB_LEGACY_PATCH_VERSION}")

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/4c9395ef/cpp/versions.cmake
----------------------------------------------------------------------
diff --git a/cpp/versions.cmake b/cpp/versions.cmake
index f83a8d2..4f1e180 100644
--- a/cpp/versions.cmake
+++ b/cpp/versions.cmake
@@ -1,4 +1,4 @@
 set(PN_LIB_CPP_MAJOR_VERSION 12)
-set(PN_LIB_CPP_MINOR_VERSION 1)
+set(PN_LIB_CPP_MINOR_VERSION 2)
 set(PN_LIB_CPP_PATCH_VERSION 0)
 set(PN_LIB_CPP_VERSION "${PN_LIB_CPP_MAJOR_VERSION}.${PN_LIB_CPP_MINOR_VERSION}.${PN_LIB_CPP_PATCH_VERSION}")


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


[35/50] qpid-proton git commit: PROTON-1940: [c] normalize encoding of multiple="true" fields

Posted by ac...@apache.org.
PROTON-1940: [c] normalize encoding of multiple="true" fields

Append src to data after normalizing for "multiple" field encoding.

AMQP composite field definitions can be declared "multiple", see:

- http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-types-v1.0-os.html#doc-idp115568
- http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-types-v1.0-os.html#section-composite-type-representation

Multiple fields allow redundant encoding of two cases:

1. empty: null or an empty array.
2. single-value: direct encoding of value, or array with one element

For encoding compactness and inter-operability, normalize multiple
field values to always use null for empty, and direct encoding for
single value.


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

Branch: refs/heads/go1
Commit: 5960f15df324daf04387066af55dbb2f79c68f71
Parents: b114344
Author: Alan Conway <ac...@redhat.com>
Authored: Mon Sep 24 11:41:03 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Fri Sep 28 09:15:53 2018 -0400

----------------------------------------------------------------------
 c/src/core/codec.c                  | 106 +++++++++++++++++++++++++++----
 c/src/core/transport.c              |   9 ++-
 c/tests/data.c                      |  57 ++++++++++++++++-
 c/tests/test_tools.h                |   7 ++
 python/tests/proton_tests/engine.py |   2 +-
 5 files changed, 165 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5960f15d/c/src/core/codec.c
----------------------------------------------------------------------
diff --git a/c/src/core/codec.c b/c/src/core/codec.c
index 595a4e6..37165f5 100644
--- a/c/src/core/codec.c
+++ b/c/src/core/codec.c
@@ -481,6 +481,84 @@ static int pni_data_intern_node(pn_data_t *data, pni_node_t *node)
   return 0;
 }
 
+
+/*
+   Append src to data after normalizing for "multiple" field encoding.
+
+   AMQP composite field definitions can be declared "multiple", see:
+
+   - http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-types-v1.0-os.html#doc-idp115568
+   - http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-types-v1.0-os.html#section-composite-type-representation
+
+   Multiple fields allow redundant encoding of two cases:
+
+   1. empty: null or an empty array.
+   2. single-value: direct encoding of value, or array with one element
+
+   For encoding compactness and inter-operability, normalize multiple
+   field values to always use null for empty, and direct encoding for
+   single value.
+*/
+static int pni_normalize_multiple(pn_data_t *data, pn_data_t *src) {
+  int err = 0;
+  pn_handle_t point = pn_data_point(src);
+  pn_data_rewind(src);
+  pn_data_next(src);
+  if (pn_data_type(src) == PN_ARRAY) {
+    switch (pn_data_get_array(src)) {
+     case 0:                    /* Empty array => null */
+      err = pn_data_put_null(data);
+      break;
+     case 1:          /* Single-element array => encode the element */
+      pn_data_enter(src);
+      pn_data_narrow(src);
+      err = pn_data_appendn(data, src, 1);
+      pn_data_widen(src);
+      break;
+     default:              /* Multi-element array, encode unchanged */
+      err = pn_data_appendn(data, src, 1);
+      break;
+    }
+  } else {
+    err = pn_data_appendn(data, src, 1); /* Non-array, append the value */
+  }
+  pn_data_restore(src, point);
+  return err;
+}
+
+
+/* Format codes:
+   code: AMQP-type (arguments)
+   n: null ()
+   o: bool (int)
+   B: ubyte (unsigned int)
+   b: byte (int)
+   H: ushort  (unsigned int)
+   h: short (int)
+   I: uint (uint32_t)
+   i: int (int32_t)
+   L: ulong (ulong32_t)
+   l: long (long32_t)
+   t: timestamp (pn_timestamp_t)
+   f: float (float)
+   d: double (double)
+   Z: binary (size_t, char*) - must not be NULL
+   z: binary (size_t, char*) - encode as AMQP null if NULL
+   S: symbol (char*)
+   s: string (char*)
+   D: described - next two codes are [descriptor, body]
+   @: enter array. If followed by D, a described array. Following codes to matching ']' are elements.
+   T: type (pn_type_t) - set array type while in array
+   [: enter list. Following codes up to matching ']' are elements
+   {: enter map. Following codes up to matching '}' are key, value  pairs
+   ]: exit list or array
+   }: exit map
+   ?: TODO document
+   *: TODO document
+   C: single value (pn_data_t*) - append the pn_data_t unmodified
+   M: multiple value (pn_data_t*) - normalize and append multiple field value,
+      see pni_normalize_multiple()
+ */
 int pn_data_vfill(pn_data_t *data, const char *fmt, va_list ap)
 {
   int err = 0;
@@ -529,7 +607,7 @@ int pn_data_vfill(pn_data_t *data, const char *fmt, va_list ap)
     case 'd':
       err = pn_data_put_double(data, va_arg(ap, double));
       break;
-    case 'Z':
+    case 'Z':                   /* encode binary, must not be NULL */
       {
 	// For maximum portability, caller must pass these as two separate args, not a single struct
         size_t size = va_arg(ap, size_t);
@@ -537,7 +615,7 @@ int pn_data_vfill(pn_data_t *data, const char *fmt, va_list ap)
         err = pn_data_put_binary(data, pn_bytes(size, start));
       }
       break;
-    case 'z':
+    case 'z':                   /* encode binary or null if pointer is NULL */
       {
 	// For maximum portability, caller must pass these as two separate args, not a single struct
         size_t size = va_arg(ap, size_t);
@@ -549,8 +627,8 @@ int pn_data_vfill(pn_data_t *data, const char *fmt, va_list ap)
         }
       }
       break;
-    case 'S':
-    case 's':
+    case 'S':                   /* encode symbol or null if NULL */
+    case 's':                   /* encode string or null if NULL */
       {
         char *start = va_arg(ap, char *);
         size_t size;
@@ -571,7 +649,7 @@ int pn_data_vfill(pn_data_t *data, const char *fmt, va_list ap)
       err = pn_data_put_described(data);
       pn_data_enter(data);
       break;
-    case 'T':
+    case 'T':                   /* Set type of open array */
       {
         pni_node_t *parent = pn_data_node(data, data->parent);
         if (parent->atom.type == PN_ARRAY) {
@@ -581,7 +659,7 @@ int pn_data_vfill(pn_data_t *data, const char *fmt, va_list ap)
         }
       }
       break;
-    case '@':
+    case '@':                   /* begin array */
       {
         bool described;
         if (*(fmt + 1) == 'D') {
@@ -594,14 +672,14 @@ int pn_data_vfill(pn_data_t *data, const char *fmt, va_list ap)
         pn_data_enter(data);
       }
       break;
-    case '[':
+    case '[':                   /* begin list */
       if (fmt < (begin + 2) || *(fmt - 2) != 'T') {
         err = pn_data_put_list(data);
         if (err) return err;
         pn_data_enter(data);
       }
       break;
-    case '{':
+    case '{':                   /* begin map */
       err = pn_data_put_map(data);
       if (err) return err;
       pn_data_enter(data);
@@ -612,7 +690,6 @@ int pn_data_vfill(pn_data_t *data, const char *fmt, va_list ap)
         return pn_error_format(data->error, PN_ERR, "exit failed");
       break;
     case '?':
-     /* Consumes 2 args: bool, value. Insert null if bool is false else value */
       if (!va_arg(ap, int)) {
         err = pn_data_put_null(data);
         if (err) return err;
@@ -645,7 +722,7 @@ int pn_data_vfill(pn_data_t *data, const char *fmt, va_list ap)
         }
       }
       break;
-    case 'C':
+    case 'C':                   /* Append an existing pn_data_t *  */
       {
         pn_data_t *src = va_arg(ap, pn_data_t *);
         if (src && pn_data_size(src) > 0) {
@@ -657,7 +734,14 @@ int pn_data_vfill(pn_data_t *data, const char *fmt, va_list ap)
         }
       }
       break;
-    default:
+     case 'M':
+      {
+        pn_data_t *src = va_arg(ap, pn_data_t *);
+        err = (src && pn_data_size(src) > 0) ?
+          pni_normalize_multiple(data, src) : pn_data_put_null(data);
+        break;
+      }
+     default:
       pn_logf("unrecognized fill code: 0x%.2X '%c'", code, code);
       return PN_ARG_ERR;
     }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5960f15d/c/src/core/transport.c
----------------------------------------------------------------------
diff --git a/c/src/core/transport.c b/c/src/core/transport.c
index 7dee571..5dce530 100644
--- a/c/src/core/transport.c
+++ b/c/src/core/transport.c
@@ -1858,13 +1858,13 @@ static int pni_process_conn_setup(pn_transport_t *transport, pn_endpoint_t *endp
       pn_connection_t *connection = (pn_connection_t *) endpoint;
       const char *cid = pn_string_get(connection->container);
       pni_calculate_channel_max(transport);
-      int err = pn_post_frame(transport, AMQP_FRAME_TYPE, 0, "DL[SS?I?H?InnCCC]", OPEN,
+      int err = pn_post_frame(transport, AMQP_FRAME_TYPE, 0, "DL[SS?I?H?InnMMC]", OPEN,
                               cid ? cid : "",
                               pn_string_get(connection->hostname),
                               // TODO: This is messy, because we also have to allow local_max_frame_ to be 0 to mean unlimited
                               // otherwise flow control goes wrong
                               transport->local_max_frame!=0 && transport->local_max_frame!=OPEN_MAX_FRAME_SIZE_DEFAULT,
-                                transport->local_max_frame,
+                              transport->local_max_frame,
                               transport->channel_max!=OPEN_CHANNEL_MAX_DEFAULT, transport->channel_max,
                               (bool)idle_timeout, idle_timeout,
                               connection->offered_capabilities,
@@ -2024,12 +2024,13 @@ static int pni_process_link_setup(pn_transport_t *transport, pn_endpoint_t *endp
         if (err) return err;
       } else {
         int err = pn_post_frame(transport, AMQP_FRAME_TYPE, ssn_state->local_channel,
-                                "DL[SIoBB?DL[SIsIoC?sCnCC]?DL[SIsIoCC]nnIL]", ATTACH,
+                                "DL[SIoBB?DL[SIsIoC?sCnMM]?DL[SIsIoCM]nnIL]", ATTACH,
                                 pn_string_get(link->name),
                                 state->local_handle,
                                 endpoint->type == RECEIVER,
                                 link->snd_settle_mode,
                                 link->rcv_settle_mode,
+
                                 (bool) link->source.type, SOURCE,
                                 pn_string_get(link->source.address),
                                 link->source.durability,
@@ -2041,6 +2042,7 @@ static int pni_process_link_setup(pn_transport_t *transport, pn_endpoint_t *endp
                                 link->source.filter,
                                 link->source.outcomes,
                                 link->source.capabilities,
+
                                 (bool) link->target.type, TARGET,
                                 pn_string_get(link->target.address),
                                 link->target.durability,
@@ -2049,6 +2051,7 @@ static int pni_process_link_setup(pn_transport_t *transport, pn_endpoint_t *endp
                                 link->target.dynamic,
                                 link->target.properties,
                                 link->target.capabilities,
+
                                 0, link->max_message_size);
         if (err) return err;
       }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5960f15d/c/tests/data.c
----------------------------------------------------------------------
diff --git a/c/tests/data.c b/c/tests/data.c
index 10e7039..8f8030f 100644
--- a/c/tests/data.c
+++ b/c/tests/data.c
@@ -21,8 +21,10 @@
 
 #undef NDEBUG                   /* Make sure that assert() is enabled even in a release build. */
 
-#include <proton/codec.h>
+#include "test_tools.h"
 #include "core/data.h"
+
+#include <proton/codec.h>
 #include <assert.h>
 #include <stdio.h>
 
@@ -44,6 +46,59 @@ static void test_grow(void)
   pn_data_free(data);
 }
 
+static void test_multiple(test_t *t) {
+  pn_data_t *data = pn_data(1);
+  pn_data_t *src = pn_data(1);
+
+  /* NULL data pointer */
+  pn_data_fill(data, "M", NULL);
+  TEST_INSPECT(t, "null", data);
+
+  /* Empty data object */
+  pn_data_clear(data);
+  pn_data_fill(data, "M", src);
+  TEST_INSPECT(t, "null", data);
+
+  /* Empty array */
+  pn_data_clear(data);
+  pn_data_clear(src);
+  pn_data_put_array(src, false, PN_SYMBOL);
+  pn_data_fill(data, "M", src);
+  TEST_INSPECT(t, "null", data);
+
+  /* Single-element array */
+  pn_data_clear(data);
+  pn_data_clear(src);
+  pn_data_put_array(src, false, PN_SYMBOL);
+  pn_data_enter(src);
+  pn_data_put_symbol(src, PN_BYTES_LITERAL(foo));
+  pn_data_fill(data, "M", src);
+  TEST_INSPECT(t, ":foo", data);
+
+  /* Multi-element array */
+  pn_data_clear(data);
+  pn_data_clear(src);
+  pn_data_put_array(src, false, PN_SYMBOL);
+  pn_data_enter(src);
+  pn_data_put_symbol(src, PN_BYTES_LITERAL(foo));
+  pn_data_put_symbol(src, PN_BYTES_LITERAL(bar));
+  pn_data_fill(data, "M", src);
+  TEST_INSPECT(t, "@PN_SYMBOL[:foo, :bar]", data);
+
+  /* Non-array */
+  pn_data_clear(data);
+  pn_data_clear(src);
+  pn_data_put_symbol(src, PN_BYTES_LITERAL(baz));
+  pn_data_fill(data, "M", src);
+  TEST_INSPECT(t, ":baz", data);
+
+  pn_data_free(data);
+  pn_data_free(src);
+}
+
 int main(int argc, char **argv) {
+  int failed = 0;
   test_grow();
+  RUN_ARGV_TEST(failed, t, test_multiple(&t));
+  return failed;
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5960f15d/c/tests/test_tools.h
----------------------------------------------------------------------
diff --git a/c/tests/test_tools.h b/c/tests/test_tools.h
index 6910450..164968e 100644
--- a/c/tests/test_tools.h
+++ b/c/tests/test_tools.h
@@ -160,6 +160,13 @@ bool test_str_equal_(test_t *t, const char* want, const char* got, const char *f
 }
 #define TEST_STR_EQUAL(TEST, WANT, GOT) test_str_equal_((TEST), (WANT), (GOT), __FILE__, __LINE__)
 
+#define TEST_INSPECT(TEST, WANT, GOT) do {              \
+    pn_string_t *s = pn_string(NULL);                   \
+    TEST_ASSERT(0 == pn_inspect(GOT, s));               \
+    TEST_STR_EQUAL((TEST), (WANT), pn_string_get(s));   \
+    pn_free(s);                                         \
+  } while (0)
+
 #define TEST_STR_IN(TEST, WANT, GOT)                                    \
   test_check_((TEST), strstr((GOT), (WANT)), NULL, __FILE__, __LINE__, "'%s' not in '%s'", (WANT), (GOT))
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5960f15d/python/tests/proton_tests/engine.py
----------------------------------------------------------------------
diff --git a/python/tests/proton_tests/engine.py b/python/tests/proton_tests/engine.py
index df9e6a1..41857c2 100644
--- a/python/tests/proton_tests/engine.py
+++ b/python/tests/proton_tests/engine.py
@@ -690,7 +690,7 @@ class LinkTest(Test):
                                             capabilities=["one", "two", "three"]),
                              TerminusConfig(address="source",
                                             timeout=7,
-                                            capabilities=[]))
+                                            capabilities=None))
   def test_distribution_mode(self):
     self._test_source_target(TerminusConfig(address="source",
                                             dist_mode=Terminus.DIST_MODE_COPY),


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


[38/50] qpid-proton git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/qpid-proton

Posted by ac...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/qpid-proton


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

Branch: refs/heads/go1
Commit: ae96bced86c7e6c62655ee9b607ff57eabb056f1
Parents: adb9cb9 1c44c43
Author: Kim van der Riet <kv...@localhost.localdomain>
Authored: Fri Sep 28 14:28:15 2018 -0400
Committer: Kim van der Riet <kv...@localhost.localdomain>
Committed: Fri Sep 28 14:28:15 2018 -0400

----------------------------------------------------------------------
 .../multithreaded_client_flow_control.cpp       | 48 ++++++++++++++------
 1 file changed, 33 insertions(+), 15 deletions(-)
----------------------------------------------------------------------



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


[04/50] qpid-proton git commit: PROTON-1798: [c] Fix leaks in tools/*.c, found by asan.

Posted by ac...@apache.org.
PROTON-1798: [c] Fix leaks in tools/*.c, found by asan.


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

Branch: refs/heads/go1
Commit: 0da413e6f5e8e0c3dbdf0db615336482460a6d5e
Parents: 6275c98
Author: Alan Conway <ac...@redhat.com>
Authored: Thu Sep 6 17:46:32 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Fri Sep 7 09:45:50 2018 -0400

----------------------------------------------------------------------
 c/tools/msgr-recv.c    | 1 +
 c/tools/msgr-send.c    | 1 +
 c/tools/reactor-send.c | 1 +
 3 files changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0da413e6/c/tools/msgr-recv.c
----------------------------------------------------------------------
diff --git a/c/tools/msgr-recv.c b/c/tools/msgr-recv.c
index 729a8f8..3b2a24e 100644
--- a/c/tools/msgr-recv.c
+++ b/c/tools/msgr-recv.c
@@ -181,6 +181,7 @@ int main(int argc, char** argv)
 
     if (opts.password) {
         rc = pn_messenger_set_password(messenger, opts.password);
+        free(opts.password);
         check_messenger(messenger);
         check( rc == 0, "Failed to set password" );
     }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0da413e6/c/tools/msgr-send.c
----------------------------------------------------------------------
diff --git a/c/tools/msgr-send.c b/c/tools/msgr-send.c
index 75b5931..d4299cf 100644
--- a/c/tools/msgr-send.c
+++ b/c/tools/msgr-send.c
@@ -212,6 +212,7 @@ int main(int argc, char** argv)
 
     if (opts.password) {
         rc = pn_messenger_set_password(messenger, opts.password);
+        free(opts.password);
         check( rc == 0, "Failed to set password" );
     }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0da413e6/c/tools/reactor-send.c
----------------------------------------------------------------------
diff --git a/c/tools/reactor-send.c b/c/tools/reactor-send.c
index f182193..1b7870f 100644
--- a/c/tools/reactor-send.c
+++ b/c/tools/reactor-send.c
@@ -414,6 +414,7 @@ int main(int argc, char** argv)
 
   pn_handler_free(sh);
   addresses_free(&opts.targets);
+  free(opts.password);
   return 0;
 }
 


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


[33/50] qpid-proton git commit: PROTON-1942: [c] separate pn_message_encode2 from pn_message_send

Posted by ac...@apache.org.
PROTON-1942: [c] separate pn_message_encode2 from pn_message_send


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

Branch: refs/heads/go1
Commit: b429db0f70f5b37c907224d6c7ee0f2a698fd6e9
Parents: 77c6354
Author: Alan Conway <ac...@redhat.com>
Authored: Thu Sep 27 13:17:32 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Thu Sep 27 14:07:55 2018 -0400

----------------------------------------------------------------------
 c/include/proton/message.h | 34 ++++++++++++++++++++--------------
 c/src/core/message.c       | 25 ++++++++++++++++---------
 2 files changed, 36 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b429db0f/c/include/proton/message.h
----------------------------------------------------------------------
diff --git a/c/include/proton/message.h b/c/include/proton/message.h
index 9340d03..41c37af 100644
--- a/c/include/proton/message.h
+++ b/c/include/proton/message.h
@@ -737,6 +737,20 @@ PN_EXTERN int pn_message_decode(pn_message_t *msg, const char *bytes, size_t siz
  */
 PN_EXTERN int pn_message_encode(pn_message_t *msg, char *bytes, size_t *size);
 
+/**
+ * **Unsettled API**: Encode a message, allocating space if necessary
+ *
+ * @param[in] msg A message object.
+ * @param[inout] buf Used to encode msg.
+ *   If buf->start == NULL memory is allocated with malloc().
+ *   If buf->size is not large enough, buffer is expanded with realloc().
+ *   On return buf holds the address and size of the final buffer.
+ *   buf->size may be larger than the length of the encoded message.
+ * @return The length of the encoded message or an error code (<0).
+ * On error pn_message_error(msg) will provide more information.
+ */
+PN_EXTERN ssize_t pn_message_encode2(pn_message_t *msg, pn_rwbytes_t *buf);
+
 struct pn_link_t;
 
 /**
@@ -745,8 +759,7 @@ struct pn_link_t;
  * Encode and send a message on a sender link.
  *
  * Performs the following steps:
- * - create or expand the buffer @p buf as required
- * - call pn_message_encode() to encode the message to a buffer
+ * - call pn_message_encode2() to encode the message to a buffer
  * - call pn_link_send() to send the encoded message bytes
  * - call pn_link_advance() to indicate the message is complete
  *
@@ -755,18 +768,11 @@ struct pn_link_t;
  *
  * @param[in] msg A message object.
  * @param[in] sender A sending link.
- * The message will be encoded and sent with pn_link_send()
- * @param[inout] buf Used to encode the message.
- * - if buf == NULL, temporary space will be allocated and freed with malloc()/free()
- * - if buf->start != NULL and buf->size is large enough, the message is encoded to
- *   buf->start
- * - if buf->start == NULL or buf->size is not enough, the buffer will be extended like this:
- *
- *       buf->size = new_size; buf->start = realloc(buf->start, new_size)
- *
- *   it is possible for the buffer to be extended more than once.
- * @return The number of bytes encoded and sent on success.
- * Returns an error code (< 0) on failure and sets pn_message_error() on msg
+ * @param[inout] buf See pn_message_encode2. If buf == NULL then
+ * any memory needed for encoding will be allocated and freed by pn_message_send().
+ *
+ * @return The length of the encoded message or an error code (<0).
+ * On error pn_message_error(msg) will provide more information.
  */
 PN_EXTERN ssize_t pn_message_send(pn_message_t *msg, pn_link_t *sender, pn_rwbytes_t *buf);
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b429db0f/c/src/core/message.c
----------------------------------------------------------------------
diff --git a/c/src/core/message.c b/c/src/core/message.c
index dbbdacf..41ccd08 100644
--- a/c/src/core/message.c
+++ b/c/src/core/message.c
@@ -897,13 +897,11 @@ pn_data_t *pn_message_body(pn_message_t *msg)
   return msg ? msg->body : NULL;
 }
 
-PN_EXTERN ssize_t pn_message_send(pn_message_t *msg, pn_link_t *sender, pn_rwbytes_t *buffer) {
+ssize_t pn_message_encode2(pn_message_t *msg, pn_rwbytes_t *buffer) {
   static const size_t initial_size = 256;
-  pn_rwbytes_t local_buf = { 0 };
-  ssize_t err = 0;
+  int err = 0;
   size_t size = 0;
 
-  if (buffer == NULL) buffer = &local_buf;
   if (buffer->start == NULL) {
     buffer->start = (char*)malloc(initial_size);
     buffer->size = initial_size;
@@ -916,9 +914,18 @@ PN_EXTERN ssize_t pn_message_send(pn_message_t *msg, pn_link_t *sender, pn_rwbyt
     if (buffer->start == NULL) return PN_OUT_OF_MEMORY;
     size = buffer->size;
   }
-  if (err >= 0) err = pn_link_send(sender, buffer->start, size);
-  if (err >= 0) err = pn_link_advance(sender);
-  if (err < 0) pn_error_copy(pn_message_error(msg), pn_link_error(sender));
-  free(local_buf.start);
-  return err;
+  return err == 0 ? (ssize_t)size : err;
+}
+
+ssize_t pn_message_send(pn_message_t *msg, pn_link_t *sender, pn_rwbytes_t *buffer) {
+  pn_rwbytes_t local_buf = { 0 };
+  if (!buffer) buffer = &local_buf;
+  ssize_t ret = pn_message_encode2(msg, buffer);
+  if (ret >= 0) {
+    ret = pn_link_send(sender, buffer->start, ret);
+    if (ret >= 0) ret = pn_link_advance(sender);
+    if (ret < 0) pn_error_copy(pn_message_error(msg), pn_link_error(sender));
+  }
+  if (local_buf.start) free(local_buf.start);
+  return ret;
 }


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


[15/50] qpid-proton git commit: PROTON-1798: [cmake] string(APPEND) is not available in CMake 2.8.12

Posted by ac...@apache.org.
PROTON-1798: [cmake] string(APPEND) is not available in CMake 2.8.12


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

Branch: refs/heads/go1
Commit: 7e3d648e40e1baa76540f0a975bec929c5839350
Parents: f963e4f
Author: Alan Conway <ac...@redhat.com>
Authored: Wed Sep 12 10:30:19 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Wed Sep 12 10:30:19 2018 -0400

----------------------------------------------------------------------
 ruby/CMakeLists.txt       | 4 ++--
 tests/runtime_check.cmake | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/7e3d648e/ruby/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/ruby/CMakeLists.txt b/ruby/CMakeLists.txt
index ca342dc..9accbe2 100644
--- a/ruby/CMakeLists.txt
+++ b/ruby/CMakeLists.txt
@@ -41,9 +41,9 @@ swig_link_libraries(cproton-ruby ${BINDING_DEPS} ${RUBY_LIBRARY})
 if (RUBY_VERSION VERSION_LESS 1.9.0)
    # Don't have blocking control API
 elseif(RUBY_VERSION VERSION_LESS 2.0.0)
-  string(APPEND CMAKE_C_FLAGS " -DRUBY_USE_rb_thread_blocking_region")
+  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DRUBY_USE_rb_thread_blocking_region")
 else()
-  string(APPEND CMAKE_C_FLAGS " -DRUBY_USE_rb_thread_call_without_gvl")
+  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DRUBY_USE_rb_thread_call_without_gvl")
 endif()
 
 # Remove -fvisibility=hidden, it causes an obscure failure in release builds.

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/7e3d648e/tests/runtime_check.cmake
----------------------------------------------------------------------
diff --git a/tests/runtime_check.cmake b/tests/runtime_check.cmake
index e1d76c3..c0b7191 100644
--- a/tests/runtime_check.cmake
+++ b/tests/runtime_check.cmake
@@ -110,8 +110,8 @@ endif()
 
 if(SANITIZE_FLAGS)
   set(ENABLE_UNDEFINED_ERROR OFF CACHE BOOL "Disabled for sanitizers" FORCE)
-  string(APPEND CMAKE_C_FLAGS " ${SANITIZE_FLAGS}")
-  string(APPEND CMAKE_CXX_FLAGS "${SANITIZE_FLAGS}")
+  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SANITIZE_FLAGS}")
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SANITIZE_FLAGS}")
 endif()
 
 if(TEST_EXE_PREFIX)


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


[23/50] qpid-proton git commit: PROTON-1935: [cpp] fix minor c++03 compatibility issues.

Posted by ac...@apache.org.
PROTON-1935: [cpp] fix minor c++03 compatibility issues.


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

Branch: refs/heads/go1
Commit: 32b9708c6a1a59e5fce2c64930fdc16f02aa9cd4
Parents: 23a4b4f
Author: Alan Conway <ac...@redhat.com>
Authored: Tue Sep 18 15:48:48 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Tue Sep 18 15:59:18 2018 -0400

----------------------------------------------------------------------
 cpp/src/connect_config.cpp | 2 +-
 cpp/src/value_test.cpp     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/32b9708c/cpp/src/connect_config.cpp
----------------------------------------------------------------------
diff --git a/cpp/src/connect_config.cpp b/cpp/src/connect_config.cpp
index 0dc577a..3ec16fb 100644
--- a/cpp/src/connect_config.cpp
+++ b/cpp/src/connect_config.cpp
@@ -202,7 +202,7 @@ string parse_default(connection_options& opts) {
     std::ifstream f;
     try {
         f.exceptions(~std::ifstream::goodbit);
-        f.open(name);
+        f.open(name.c_str());
     } catch (const std::exception& e) {
         raise(msg() << "error opening '" << name << "': " << e.what());
     }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/32b9708c/cpp/src/value_test.cpp
----------------------------------------------------------------------
diff --git a/cpp/src/value_test.cpp b/cpp/src/value_test.cpp
index 64a1d72..2d991c4 100644
--- a/cpp/src/value_test.cpp
+++ b/cpp/src/value_test.cpp
@@ -161,12 +161,12 @@ int main(int, char**) {
         many<pair<annotation_key, message_id> > restricted_pairs(si_pairs);
         RUN_TEST(failed, (map_test<map<annotation_key, message_id> >(
                               restricted_pairs, "{:a=0, :b=1, :c=2}")));
+        RUN_TEST(failed, null_test());
 
 #if PN_CPP_HAS_CPP11
         RUN_TEST(failed, sequence_test<forward_list<binary> >(
                      ARRAY, many<binary>() + binary("xx") + binary("yy"), "@PN_BINARY[b\"xx\", b\"yy\"]"));
         RUN_TEST(failed, (map_test<unordered_map<string, uint64_t> >(si_pairs, "")));
-        RUN_TEST(failed, null_test());
 #endif
         return failed;
     } catch (const std::exception& e) {


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


[36/50] qpid-proton git commit: NO-JIRA: [cpp] fix example race condition, causing occasional hang

Posted by ac...@apache.org.
NO-JIRA: [cpp] fix example race condition, causing occasional hang


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

Branch: refs/heads/go1
Commit: 1c44c431ef2acc1b37e88a0891c8e8c03bd30eb5
Parents: 5960f15
Author: Alan Conway <ac...@redhat.com>
Authored: Fri Sep 28 11:11:41 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Fri Sep 28 11:12:42 2018 -0400

----------------------------------------------------------------------
 .../multithreaded_client_flow_control.cpp       | 48 ++++++++++++++------
 1 file changed, 33 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1c44c431/cpp/examples/multithreaded_client_flow_control.cpp
----------------------------------------------------------------------
diff --git a/cpp/examples/multithreaded_client_flow_control.cpp b/cpp/examples/multithreaded_client_flow_control.cpp
index 93c6b3d..73ea6f6 100644
--- a/cpp/examples/multithreaded_client_flow_control.cpp
+++ b/cpp/examples/multithreaded_client_flow_control.cpp
@@ -61,6 +61,12 @@
 std::mutex out_lock;
 #define OUT(x) do { std::lock_guard<std::mutex> l(out_lock); x; } while (false)
 
+// Exception raised if a sender or receiver is closed when trying to send/receive
+class closed : public std::runtime_error {
+  public:
+    closed(const std::string& msg) : std::runtime_error(msg) {}
+};
+
 // A thread-safe sending connection that blocks sending threads when there
 // is no AMQP credit to send messages.
 class sender : private proton::messaging_handler {
@@ -151,12 +157,13 @@ class receiver : private proton::messaging_handler {
     proton::work_queue* work_queue_;
     std::queue<proton::message> buffer_; // Messages not yet returned by receive()
     std::condition_variable can_receive_; // Notify receivers of messages
+    bool closed_;
 
   public:
 
     // Connect to url
     receiver(proton::container& cont, const std::string& url, const std::string& address)
-        : work_queue_()
+        : work_queue_(0), closed_(false)
     {
         // NOTE:credit_window(0) disables automatic flow control.
         // We will use flow control to match AMQP credit to buffer capacity.
@@ -168,8 +175,10 @@ class receiver : private proton::messaging_handler {
     proton::message receive() {
         std::unique_lock<std::mutex> l(lock_);
         // Wait for buffered messages
-        while (!work_queue_ || buffer_.empty())
+        while (!closed_ && (!work_queue_ || buffer_.empty())) {
             can_receive_.wait(l);
+        }
+        if (closed_) throw closed("receiver closed");
         proton::message m = std::move(buffer_.front());
         buffer_.pop();
         // Add a lambda to the work queue to call receive_done().
@@ -178,9 +187,16 @@ class receiver : private proton::messaging_handler {
         return m;
     }
 
+    // Thread safe
     void close() {
         std::lock_guard<std::mutex> l(lock_);
-        if (work_queue_) work_queue_->add([this]() { this->receiver_.connection().close(); });
+        if (!closed_) {
+            closed_ = true;
+            can_receive_.notify_all();
+            if (work_queue_) {
+                work_queue_->add([this]() { this->receiver_.connection().close(); });
+            }
+        }
     }
 
   private:
@@ -229,24 +245,26 @@ void send_thread(sender& s, int n) {
 // Receive messages till atomic remaining count is 0.
 // remaining is shared among all receiving threads
 void receive_thread(receiver& r, std::atomic_int& remaining) {
-    auto id = std::this_thread::get_id();
-    int n = 0;
-    // atomically check and decrement remaining *before* receiving.
-    // If it is 0 or less then return, as there are no more
-    // messages to receive so calling r.receive() would block forever.
-    while (remaining-- > 0) {
-        auto m = r.receive();
-        ++n;
-        OUT(std::cout << id << " received \"" << m.body() << '"' << std::endl);
-    }
-    OUT(std::cout << id << " received " << n << " messages" << std::endl);
+    try {
+        auto id = std::this_thread::get_id();
+        int n = 0;
+        // atomically check and decrement remaining *before* receiving.
+        // If it is 0 or less then return, as there are no more
+        // messages to receive so calling r.receive() would block forever.
+        while (remaining-- > 0) {
+            auto m = r.receive();
+            ++n;
+            OUT(std::cout << id << " received \"" << m.body() << '"' << std::endl);
+        }
+        OUT(std::cout << id << " received " << n << " messages" << std::endl);
+    } catch (const closed&) {}
 }
 
 int main(int argc, const char **argv) {
     try {
         if (argc != 5) {
             std::cerr <<
-                "Usage: " << argv[0] << " MESSAGE-COUNT THREAD-COUNT URL\n"
+                "Usage: " << argv[0] << " CONNECTION-URL AMQP-ADDRESS MESSAGE-COUNT THREAD-COUNT\n"
                 "CONNECTION-URL: connection address, e.g.'amqp://127.0.0.1'\n"
                 "AMQP-ADDRESS: AMQP node address, e.g. 'examples'\n"
                 "MESSAGE-COUNT: number of messages to send\n"


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


[44/50] qpid-proton git commit: PROTON-1947: [cpp] not locating jsoncpp library on some platforms

Posted by ac...@apache.org.
PROTON-1947: [cpp] not locating jsoncpp library on some platforms

CMake was not adding the INCLUDE_DIR locations found by FindJsonCpp
so a non-standard installation would be found but cause a compile failure.


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

Branch: refs/heads/go1
Commit: ab82a8b8e92f2dff3fa8d03d9c11403439420bba
Parents: b342151
Author: Alan Conway <ac...@redhat.com>
Authored: Tue Oct 2 10:54:50 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Tue Oct 2 10:55:49 2018 -0400

----------------------------------------------------------------------
 cpp/CMakeLists.txt | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ab82a8b8/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index 7d399d8..f3c93fb 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -31,6 +31,7 @@ set (BUILD_CPP_03 OFF CACHE BOOL "Compile the C++ binding as C++03 even when C++
 find_package(JsonCpp)
 option(ENABLE_JSONCPP "Use jsoncpp parser for connection configuration" ${JsonCpp_FOUND})
 if (ENABLE_JSONCPP)
+  include_directories(${JsonCpp_INCLUDE_DIRS})
   set(CONNECT_CONFIG_SRC src/connect_config.cpp)
   set(CONNECT_CONFIG_LIBS ${JsonCpp_LIBRARY})
 else()


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


[29/50] qpid-proton git commit: NO-JIRA: Fixing numpy brew link error via removal of unused postgis

Posted by ac...@apache.org.
NO-JIRA: Fixing numpy brew link error via removal of unused postgis


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

Branch: refs/heads/go1
Commit: d1179720f31334372f2f541d1576283cd59bcfa1
Parents: 436275a
Author: Roddie Kieley <rk...@unifiedsoftworx.com>
Authored: Fri Sep 21 14:34:15 2018 -0230
Committer: Alan Conway <ac...@redhat.com>
Committed: Tue Sep 25 08:35:50 2018 -0400

----------------------------------------------------------------------
 .travis.yml | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d1179720/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index af12f21..d3fd7c9 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -51,6 +51,7 @@ matrix:
     - QPID_PROTON_CMAKE_ARGS='-DCMAKE_OSX_DEPLOYMENT_TARGET=10.13 -DBUILD_RUBY=NO'
     before_install:
     - brew update
+    - brew uninstall postgis
     - brew upgrade cmake python openssl
     - brew install libuv swig
 


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


[21/50] qpid-proton git commit: PROTON-1935: [cpp] connection configuration and default connect()

Posted by ac...@apache.org.
PROTON-1935: [cpp] connection configuration and default connect()

docs/connect-config.md: describes connection configuration JSON format.

container::connect() connects using the default configuration file

Additional API in proton::connect_config allows the user to parse configuration
and apply to a connection_options object for more flexible use.


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

Branch: refs/heads/go1
Commit: b164d99c80129a2a24ae7203846579569c9cf3b5
Parents: 348e9da
Author: Alan Conway <ac...@redhat.com>
Authored: Tue Sep 18 09:31:47 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Tue Sep 18 11:03:25 2018 -0400

----------------------------------------------------------------------
 INSTALL.md                            |   2 +
 c/include/proton/cproton.i            |   1 +
 c/include/proton/version.h.in         |   2 +
 cpp/CMakeLists.txt                    |  20 ++-
 cpp/docs/CMakeLists.txt               |   2 +-
 cpp/docs/user.doxygen.in              |   3 +-
 cpp/include/proton/connect_config.hpp |  49 +++++++
 cpp/include/proton/container.hpp      |   6 +
 cpp/src/connect_config.cpp            | 219 +++++++++++++++++++++++++++++
 cpp/src/connect_config_dummy.cpp      |  31 ++++
 cpp/src/connect_config_test.cpp       | 142 +++++++++++++++++++
 cpp/src/connection_options.cpp        |   1 +
 cpp/src/container.cpp                 |   4 +
 cpp/src/proactor_container_impl.cpp   |   7 +
 cpp/src/proactor_container_impl.hpp   |   1 +
 cpp/src/test_bits.hpp                 |   8 ++
 docs/connect_config.md                |  42 ++++++
 tools/cmake/Modules/FindJsonCpp.cmake |  70 +++++++++
 18 files changed, 607 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b164d99c/INSTALL.md
----------------------------------------------------------------------
diff --git a/INSTALL.md b/INSTALL.md
index 430d648..76e6af2 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -20,6 +20,7 @@ Linux dependencies
   - GCC 4.4+
   - Cyrus SASL 2.1+ (for SASL support)
   - OpenSSL 1.0+ (for SSL support)
+  - JsonCpp 1.8+ for C++ connection configuration file support
 
 Windows dependencies
 
@@ -46,6 +47,7 @@ language.
     $ yum install swig                                       # Required for all bindings
     $ yum install python-devel                               # Python
     $ yum install ruby-devel rubygem-minitest                # Ruby
+    $ yum install jsoncpp-devel                              # C++ optional config file
 
     # Dependencies needed to generate documentation
     $ yum install epydoc                                     # Python

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b164d99c/c/include/proton/cproton.i
----------------------------------------------------------------------
diff --git a/c/include/proton/cproton.i b/c/include/proton/cproton.i
index 430deca..c642438 100644
--- a/c/include/proton/cproton.i
+++ b/c/include/proton/cproton.i
@@ -37,6 +37,7 @@ typedef unsigned long int uintptr_t;
 %include "proton/import_export.h"
 
 %ignore _PROTON_VERSION_H;
+%ignore PN_INSTALL_PREFIX;
 %include "proton/version.h"
 
 /* We cannot safely just wrap pn_bytes_t but each language binding must have a typemap for it - presumably to a string type */

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b164d99c/c/include/proton/version.h.in
----------------------------------------------------------------------
diff --git a/c/include/proton/version.h.in b/c/include/proton/version.h.in
index 133b0bb..13ee411 100644
--- a/c/include/proton/version.h.in
+++ b/c/include/proton/version.h.in
@@ -26,4 +26,6 @@
 #define PN_VERSION_MINOR @PN_VERSION_MINOR@
 #define PN_VERSION_POINT @PN_VERSION_POINT@
 
+#define PN_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@"
+
 #endif /* version.h */

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b164d99c/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index d0b3cfb..35f5478 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -27,6 +27,16 @@ include(versions.cmake)
 
 set (BUILD_CPP_03 OFF CACHE BOOL "Compile the C++ binding as C++03 even when C++11 is available")
 
+# Check for JSON-CPP support for connection configuration
+find_package(JsonCpp)
+option(ENABLE_JSONCPP "Use jsoncpp parser for connection configuration" ${JsonCpp_FOUND})
+if (ENABLE_JSONCPP)
+  set(CONNECT_CONFIG_SRC src/connect_config.cpp)
+  set(CONNECT_CONFIG_LIBS ${JsonCpp_LIBRARY})
+else()
+  set(CONNECT_CONFIG_SRC src/connect_config_dummy.cpp)
+endif()
+
 # This effectively checks for cmake version 3.1 or later
 if (DEFINED CMAKE_CXX_COMPILE_FEATURES)
   if (BUILD_CPP_03)
@@ -150,6 +160,7 @@ set(qpid-proton-cpp-source
   src/uuid.cpp
   src/value.cpp
   src/work_queue.cpp
+  ${CONNECT_CONFIG_SRC}
   )
 
 set_source_files_properties (
@@ -167,7 +178,7 @@ if(BUILD_STATIC_LIBS)
   add_library(qpid-proton-cpp-static STATIC ${qpid-proton-cpp-source})
 endif(BUILD_STATIC_LIBS)
 
-target_link_libraries (qpid-proton-cpp LINK_PRIVATE ${PLATFORM_LIBS} qpid-proton-core qpid-proton-proactor)
+target_link_libraries (qpid-proton-cpp LINK_PRIVATE ${PLATFORM_LIBS} qpid-proton-core qpid-proton-proactor ${CONNECT_CONFIG_LIBS})
 
 set_target_properties (
   qpid-proton-cpp
@@ -258,3 +269,10 @@ add_cpp_test(container_test)
 add_cpp_test(url_test)
 add_cpp_test(reconnect_test)
 add_cpp_test(link_test)
+if (ENABLE_JSONCPP)
+  # Directories needed by connect_config tests
+  file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/testdata/.config/messaging")
+  add_cpp_test(connect_config_test)
+  set_tests_properties(cpp-connect_config_test PROPERTIES
+    WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
+endif()

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b164d99c/cpp/docs/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/cpp/docs/CMakeLists.txt b/cpp/docs/CMakeLists.txt
index d512d15..690230d 100644
--- a/cpp/docs/CMakeLists.txt
+++ b/cpp/docs/CMakeLists.txt
@@ -24,7 +24,7 @@ if (DOXYGEN_FOUND)
     ${CMAKE_CURRENT_SOURCE_DIR}/user.doxygen.in
     ${CMAKE_CURRENT_BINARY_DIR}/user.doxygen)
 
-  file(GLOB_RECURSE headers ../include/proton/*.hpp)
+  file(GLOB_RECURSE sources ../include/proton/*.hpp ../../connect_config.md)
   add_custom_target (docs-cpp
     COMMAND ${CMAKE_COMMAND} -E remove_directory html # get rid of old files
     COMMAND ${DOXYGEN_EXECUTABLE} user.doxygen

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b164d99c/cpp/docs/user.doxygen.in
----------------------------------------------------------------------
diff --git a/cpp/docs/user.doxygen.in b/cpp/docs/user.doxygen.in
index 6bcd1bd..84375d8 100644
--- a/cpp/docs/user.doxygen.in
+++ b/cpp/docs/user.doxygen.in
@@ -55,7 +55,8 @@ WARNINGS                = YES
 
 INPUT                   = @CMAKE_SOURCE_DIR@/cpp/include \
                           @CMAKE_SOURCE_DIR@/cpp/docs \
-                          @CMAKE_SOURCE_DIR@/cpp/examples
+                          @CMAKE_SOURCE_DIR@/cpp/examples \
+                          @CMAKE_SOURCE_DIR@/docs/connect_config.md
 FILE_PATTERNS           = *.hpp *.md *.dox
 EXCLUDE_PATTERNS        = @CMAKE_SOURCE_DIR@/cpp/examples/*.?pp \
                           @CMAKE_SOURCE_DIR@/cpp/include/proton/internal/*.hpp

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b164d99c/cpp/include/proton/connect_config.hpp
----------------------------------------------------------------------
diff --git a/cpp/include/proton/connect_config.hpp b/cpp/include/proton/connect_config.hpp
new file mode 100644
index 0000000..be5c7ac
--- /dev/null
+++ b/cpp/include/proton/connect_config.hpp
@@ -0,0 +1,49 @@
+#ifndef CONNECT_CONFIG_HPP
+#define CONNECT_CONFIG_HPP
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <proton/connection_options.hpp>
+
+namespace proton {
+
+class connection_options;
+
+/// *Unsettled API*
+namespace connect_config {
+
+/// @return name of the default connection configuration file
+/// @throw proton::error if no default file is found
+PN_CPP_EXTERN std::string default_file();
+
+/// Parse configuration from @p is and update @p opts
+/// @param is input stream for configuration file/string
+/// @param opts [out] connection options to update
+/// @return address suitable for container::connect() from configuration
+PN_CPP_EXTERN std::string parse(std::istream& is, connection_options& opts);
+
+/// Parse configuration from default_file() and update @p opts
+/// @param opts [out] connection options to update
+/// @return address suitable for container::connect() from configuration
+PN_CPP_EXTERN std::string parse_default(connection_options& opts);
+
+}} // namespace proton::connect_config
+
+#endif // CONNECT_CONFIG_HPP

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b164d99c/cpp/include/proton/container.hpp
----------------------------------------------------------------------
diff --git a/cpp/include/proton/container.hpp b/cpp/include/proton/container.hpp
index 27ac498..362dba0 100644
--- a/cpp/include/proton/container.hpp
+++ b/cpp/include/proton/container.hpp
@@ -113,6 +113,12 @@ class PN_CPP_CLASS_EXTERN container {
     /// @copydetails returned
     PN_CPP_EXTERN returned<connection> connect(const std::string& conn_url);
 
+    /// Connect using the default @ref connect_config
+    /// FIXME aconway 2018-08-07: cmake - copy connect_config.md into C++ doc
+    ///
+    /// @copydetails returned
+    PN_CPP_EXTERN returned<connection> connect();
+
     /// Listen for new connections on `listen_url`.
     ///
     /// If the listener opens successfully, listen_handler::on_open() is called.

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b164d99c/cpp/src/connect_config.cpp
----------------------------------------------------------------------
diff --git a/cpp/src/connect_config.cpp b/cpp/src/connect_config.cpp
new file mode 100644
index 0000000..0dc577a
--- /dev/null
+++ b/cpp/src/connect_config.cpp
@@ -0,0 +1,219 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "msg.hpp"
+
+#include <proton/connect_config.hpp>
+#include <proton/error.hpp>
+#include <proton/ssl.hpp>
+
+#include <proton/version.h>
+
+#include <json/value.h>
+#include <json/reader.h>
+
+#include <cstdlib>
+#include <fstream>
+
+using namespace Json;
+using std::string;
+
+namespace {
+const char *type_name(ValueType t) {
+    switch (t) {
+      case nullValue: return "null";
+      case intValue: return "int";
+      case uintValue: return "uint";
+      case realValue: return "real";
+      case stringValue: return "string";
+      case booleanValue: return "boolean";
+      case arrayValue: return "array";
+      case objectValue: return "object";
+      default: return "unknown";
+    }
+}
+} // namespace
+
+namespace std {
+ostream& operator<<(ostream& o, ValueType t) { return o << type_name(t); }
+}
+
+namespace proton {
+namespace connect_config {
+
+namespace {
+
+void raise(const string& message) {
+    throw proton::error("connection configuration: " + message);
+}
+
+Value validate(ValueType t, const Value& v, const string& name) {
+    if (v.type() != t)
+        raise(msg() << " '" << name << "' expected " << t << ", found " << v.type());
+    return v;
+}
+
+Value get(ValueType t, const Value& obj, const char *key, const Value& dflt=Value()) {
+    Value v = obj ? obj.get(key, dflt) : dflt;
+    return validate(t, v, key);
+}
+
+bool get_bool(const Value& obj, const char *key, bool dflt) {
+    return get(booleanValue, obj, key, dflt).asBool();
+}
+
+string get_string(const Value& obj, const char *key, const string& dflt) {
+    return get(stringValue, obj, key, dflt).asString();
+}
+
+static const string HOME("HOME");
+static const string ENV_VAR("MESSAGING_CONNECT_FILE");
+static const string FILE_NAME("connect.json");
+static const string HOME_FILE_NAME("/.config/messaging/" + FILE_NAME);
+static const string ETC_FILE_NAME("/etc/messaging/" + FILE_NAME);
+
+bool exists(const string& name) { return std::ifstream(name.c_str()).good(); }
+
+void parse_sasl(Value root, connection_options& opts) {
+    Value sasl = root.get("sasl", Value());
+    opts.sasl_enabled(get_bool(sasl, "enable", true));
+    if (sasl) {
+        validate(objectValue, sasl, "sasl");
+        opts.sasl_allow_insecure_mechs(get_bool(sasl, "allow_insecure", false));
+        Value mechs = sasl.get("mechanisms", Value());
+        switch (mechs.type()) {
+          case nullValue:
+            break;
+          case stringValue:
+            opts.sasl_allowed_mechs(mechs.asString());
+            break;
+          case arrayValue: {
+              std::ostringstream s;
+              for (ArrayIndex i= 0; i < mechs.size(); ++i) {
+                  Value v = mechs.get(i, Value());
+                  if (v.type() != stringValue) {
+                      raise(msg() << "'sasl/mechanisms' expect string elements, found " << v.type());
+                  }
+                  if (i > 0) s << " ";
+                  s << v.asString();
+              }
+              opts.sasl_allowed_mechs(s.str().c_str());
+              break;
+          }
+          default:
+            raise(msg() << "'mechanisms' expected string or array, found " << mechs.type());
+        }
+    }
+}
+
+void parse_tls(const string& scheme, Value root, connection_options& opts) {
+    Value tls = root.get("tls", Value());
+    if (tls) {
+        validate(objectValue, tls, "tls");
+        if (scheme != "amqps") {
+            raise(msg() << "'tls' object is not allowed unless scheme is \"amqps\"");
+        }
+        string ca = get_string(tls, "ca", "");
+        bool verify = get_bool(tls, "verify", true);
+        Value cert = get(stringValue, tls, "cert");
+        ssl::verify_mode mode = verify ? ssl::VERIFY_PEER_NAME : ssl::ANONYMOUS_PEER;
+        if (cert) {
+            Value key = get(stringValue, tls, "key");
+            ssl_certificate cert2 = key ?
+                ssl_certificate(cert.asString(), key.asString()) :
+                ssl_certificate(cert.asString());
+            opts.ssl_client_options(ssl_client_options(cert2, ca, mode));
+        } else {
+            ssl_client_options(ssl_client_options(ca, mode));
+        }
+    }
+}
+
+} // namespace
+
+std::string parse(std::istream& is, connection_options& opts) {
+    Value root;
+    is >> root;
+
+    string scheme = get_string(root, "scheme", "amqps");
+    if (scheme != "amqp" && scheme != "amqps") {
+        raise(msg() << "'scheme' must be \"amqp\" or \"amqps\"");
+    }
+
+    string host = get_string(root, "host", "");
+    opts.virtual_host(host.c_str());
+
+    Value port = root.get("port", scheme);
+    if (!port.isIntegral() && !port.isString()) {
+        raise(msg() << "'port' expected string or integer, found " << port.type());
+    }
+
+    Value user = root.get("user", Value());
+    if (user) opts.user(validate(stringValue, user, "user").asString());
+    Value password = root.get("password", Value());
+    if (password) opts.password(validate(stringValue, password, "password").asString());
+
+    parse_sasl(root, opts);
+    parse_tls(scheme, root, opts);
+    return host + ":" + port.asString();
+}
+
+string default_file() {
+    /* Use environment variable if set */
+    const char *env_path = getenv(ENV_VAR.c_str());
+    if (env_path) return env_path;
+    /* current directory */
+    if (exists(FILE_NAME)) return FILE_NAME;
+    /* $HOME/.config/messaging/FILE_NAME */
+    const char *home = getenv(HOME.c_str());
+    if (home) {
+        string path = home + HOME_FILE_NAME;
+        if (exists(path)) return path;
+    }
+    /* INSTALL_PREFIX/etc/messaging/FILE_NAME */
+    if (PN_INSTALL_PREFIX && *PN_INSTALL_PREFIX) {
+        string path = PN_INSTALL_PREFIX + ETC_FILE_NAME;
+        if (exists(path)) return path;
+    }
+    /* /etc/messaging/FILE_NAME */
+    if (exists(ETC_FILE_NAME)) return ETC_FILE_NAME;
+    raise("no default configuration");
+    return "";                  // Never get here, keep compiler happy
+}
+
+string parse_default(connection_options& opts) {
+    string name = default_file();
+    std::ifstream f;
+    try {
+        f.exceptions(~std::ifstream::goodbit);
+        f.open(name);
+    } catch (const std::exception& e) {
+        raise(msg() << "error opening '" << name << "': " << e.what());
+    }
+    try {
+        return parse(f, opts);
+    } catch (const std::exception& e) {
+        raise(msg() << "error parsing '" << name << "': " << e.what());
+    } catch (...) {
+        raise(msg() << "error parsing '" << name);
+    }
+    return "";                  // Never get here, keep compiler happy
+}
+
+}} // namespace proton::connect_config

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b164d99c/cpp/src/connect_config_dummy.cpp
----------------------------------------------------------------------
diff --git a/cpp/src/connect_config_dummy.cpp b/cpp/src/connect_config_dummy.cpp
new file mode 100644
index 0000000..4d46726
--- /dev/null
+++ b/cpp/src/connect_config_dummy.cpp
@@ -0,0 +1,31 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <proton/connect_config.hpp>
+#include <proton/error.hpp>
+
+namespace proton {
+namespace connect_config {
+namespace { const error nope("connection configuration is not supported"); }
+
+std::string default_file() { throw nope; }
+std::string parse(std::istream& is, connection_options& opts)  { throw nope; }
+std::string parse_default(proton::connection_options&)  { throw nope; }
+
+}} // namespace proton::connect_config

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b164d99c/cpp/src/connect_config_test.cpp
----------------------------------------------------------------------
diff --git a/cpp/src/connect_config_test.cpp b/cpp/src/connect_config_test.cpp
new file mode 100644
index 0000000..17f0c4b
--- /dev/null
+++ b/cpp/src/connect_config_test.cpp
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "test_bits.hpp"
+
+#include "proton/connect_config.hpp"
+#include "proton/connection.hpp"
+#include "proton/connection_options.hpp"
+#include "proton/container.hpp"
+#include "proton/error_condition.hpp"
+#include "proton/listener.hpp"
+#include "proton/messaging_handler.hpp"
+#include "proton/transport.hpp"
+
+#include <sstream>
+#include <fstream>
+#include <cstdio>
+
+#include <stdlib.h>
+
+namespace {
+
+using namespace std;
+using namespace proton;
+using proton::error_condition;
+
+string configure(connection_options& opts, const string& config) {
+    istringstream is(config);
+    return connect_config::parse(is, opts);
+}
+
+void test_default_file() {
+    // Default file locations in order of preference.
+    ::setenv("MESSAGING_CONNECT_FILE", "environment", 1);
+    ofstream("connect.json") << "{ \"host\": \"current\" }" << endl;
+    ::setenv("HOME", "testdata", 1);
+    ofstream("testdata/.config/messaging/connect.json") << "{ \"host\": \".config\" }" << endl;
+    ASSERT_EQUAL("environment", connect_config::default_file());
+    ::unsetenv("MESSAGING_CONNECT_FILE");
+    ASSERT_EQUAL("connect.json", connect_config::default_file());
+    remove("connect.json");
+    ASSERT_EQUAL("testdata/.config/messaging/connect.json", connect_config::default_file());
+    remove("testdata/.config/messaging/connect.json");
+
+    // We can't fully test prefix and /etc locations, we have no control.
+    try {
+        ASSERT_SUBSTRING("/etc/messaging", connect_config::default_file());
+    } catch (...) {}            // OK if not there
+}
+
+void test_addr() {
+    connection_options opts;
+    ASSERT_EQUAL("foo:bar", configure(opts, "{ \"host\":\"foo\", \"port\":\"bar\" }"));
+    ASSERT_EQUAL("foo:1234", configure(opts, "{ \"host\":\"foo\", \"port\":\"1234\" }"));
+    ASSERT_EQUAL(":amqps", configure(opts, "{}"));
+    ASSERT_EQUAL(":amqp", configure(opts, "{\"scheme\":\"amqp\"}"));
+    ASSERT_EQUAL("foo:bar", configure(opts, "{ \"host\":\"foo\", /* inline comment */\"port\":\"bar\" // end of line comment\n}"));
+
+    ASSERT_THROWS_MSG(error, "'scheme' must be", configure(opts, "{\"scheme\":\"bad\"}"));
+    ASSERT_THROWS_MSG(error, "'scheme' expected string, found boolean", configure(opts, "{\"scheme\":true}"));
+    ASSERT_THROWS_MSG(error, "'port' expected string or integer, found boolean", configure(opts, "{\"port\":true}"));
+    ASSERT_THROWS_MSG(error, "'host' expected string, found boolean", configure(opts, "{\"host\":true}"));
+}
+
+class test_handler : public messaging_handler {
+  protected:
+    string config_;
+    listener listener_;
+    bool opened_;
+    proton::error_condition error_;
+
+  public:
+
+    void on_container_start(container& c) PN_CPP_OVERRIDE {
+        listener_ = c.listen("//:0");
+    }
+
+    virtual void check_connection(connection& c) {}
+
+    void on_connection_open(connection& c) PN_CPP_OVERRIDE {
+        if (!c.active()) {      // Server side
+            opened_ = true;
+            check_connection(c);
+            listener_.stop();
+            c.close();
+        }
+    }
+
+    void on_error(const error_condition& e) PN_CPP_OVERRIDE {
+        FAIL("unexpected error " << e);
+    }
+
+    void run(const string& config) {
+        config_ = config;
+        container(*this).run();
+    }
+};
+
+class test_default_connect : public test_handler {
+  public:
+
+    void on_container_start(container& c) PN_CPP_OVERRIDE {
+        test_handler::on_container_start(c);
+        ofstream os("connect.json");
+        ASSERT(os << "{ \"port\": " << listener_.port() << "}" << endl);
+        os.close();
+        c.connect();
+    }
+
+    void run() {
+        container(*this).run();
+        ASSERT(opened_);
+        ASSERT(!error_);
+    }
+};
+
+} // namespace
+
+
+int main(int argc, char** argv) {
+    int failed = 0;
+    RUN_ARGV_TEST(failed, test_default_file());
+    RUN_ARGV_TEST(failed, test_addr());
+    RUN_ARGV_TEST(failed, test_default_connect().run());
+    return failed;
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b164d99c/cpp/src/connection_options.cpp
----------------------------------------------------------------------
diff --git a/cpp/src/connection_options.cpp b/cpp/src/connection_options.cpp
index 1903536..fdc770e 100644
--- a/cpp/src/connection_options.cpp
+++ b/cpp/src/connection_options.cpp
@@ -217,4 +217,5 @@ void connection_options::apply_unbound_client(pn_transport_t *t) const { impl_->
 void connection_options::apply_unbound_server(pn_transport_t *t) const { impl_->apply_sasl(t); impl_->apply_ssl(t, false); impl_->apply_transport(t); }
 
 messaging_handler* connection_options::handler() const { return impl_->handler.value; }
+
 } // namespace proton

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b164d99c/cpp/src/container.cpp
----------------------------------------------------------------------
diff --git a/cpp/src/container.cpp b/cpp/src/container.cpp
index cfc0196..013fb4b 100644
--- a/cpp/src/container.cpp
+++ b/cpp/src/container.cpp
@@ -83,6 +83,10 @@ returned<connection> container::connect(const std::string& url, const connection
     return impl_->connect(url, opts);
 }
 
+returned<connection> container::connect() {
+    return impl_->connect();
+}
+
 listener container::listen(const std::string& url, listen_handler& l) { return impl_->listen(url, l); }
 
 void container::run() { impl_->run(1); }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b164d99c/cpp/src/proactor_container_impl.cpp
----------------------------------------------------------------------
diff --git a/cpp/src/proactor_container_impl.cpp b/cpp/src/proactor_container_impl.cpp
index 01aea77..e0057cd 100644
--- a/cpp/src/proactor_container_impl.cpp
+++ b/cpp/src/proactor_container_impl.cpp
@@ -20,6 +20,7 @@
 #include "proactor_container_impl.hpp"
 #include "proactor_work_queue_impl.hpp"
 
+#include "proton/connect_config.hpp"
 #include "proton/error_condition.hpp"
 #include "proton/listener.hpp"
 #include "proton/listen_handler.hpp"
@@ -350,6 +351,12 @@ returned<connection> container::impl::connect(
     return make_returned<proton::connection>(pnc);
 }
 
+returned<connection> container::impl::connect() {
+    connection_options opts;
+    std::string addr = connect_config::parse_default(opts);
+    return connect(addr, opts);
+}
+
 returned<sender> container::impl::open_sender(const std::string &urlstr, const proton::sender_options &o1, const connection_options &o2)
 {
     proton::url url(urlstr);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b164d99c/cpp/src/proactor_container_impl.hpp
----------------------------------------------------------------------
diff --git a/cpp/src/proactor_container_impl.hpp b/cpp/src/proactor_container_impl.hpp
index dcc9381..912a036 100644
--- a/cpp/src/proactor_container_impl.hpp
+++ b/cpp/src/proactor_container_impl.hpp
@@ -71,6 +71,7 @@ class container::impl {
     impl(container& c, const std::string& id, messaging_handler* = 0);
     ~impl();
     std::string id() const { return id_; }
+    returned<connection> connect();
     returned<connection> connect(const std::string&, const connection_options&);
     returned<sender> open_sender(
         const std::string&, const proton::sender_options &, const connection_options &);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b164d99c/cpp/src/test_bits.hpp
----------------------------------------------------------------------
diff --git a/cpp/src/test_bits.hpp b/cpp/src/test_bits.hpp
index 28271f0..50ea2ee 100644
--- a/cpp/src/test_bits.hpp
+++ b/cpp/src/test_bits.hpp
@@ -52,6 +52,11 @@ inline void assert_equalish(T want, T got, T delta, const std::string& what)
         throw fail(MSG(what << " " << want << " !=~ " << got));
 }
 
+void assert_substring(const std::string& want, const std::string& got, const std::string& what) {
+    if (got.find(want) == std::string::npos)
+        throw fail(MSG(what << " '" << want << "' not found in '" << got << "'"));
+}
+
 #define FAIL_MSG(WHAT) (MSG(__FILE__ << ":" << __LINE__ << ": " << WHAT).str())
 #define FAIL(WHAT) throw test::fail(FAIL_MSG(WHAT))
 #define ASSERT(TEST) do { if (!(TEST)) FAIL("failed ASSERT(" #TEST ")"); } while(false)
@@ -59,7 +64,10 @@ inline void assert_equalish(T want, T got, T delta, const std::string& what)
     test::assert_equal((WANT), (GOT), FAIL_MSG("failed ASSERT_EQUAL(" #WANT ", " #GOT ")"))
 #define ASSERT_EQUALISH(WANT, GOT, DELTA) \
     test::assert_equalish((WANT), (GOT), (DELTA), FAIL_MSG("failed ASSERT_EQUALISH(" #WANT ", " #GOT ")"))
+#define ASSERT_SUBSTRING(WANT, GOT) \
+    test::assert_substring((WANT), (GOT), FAIL_MSG("failed ASSERT_SUBSTRING(" #WANT ", " #GOT ")"))
 #define ASSERT_THROWS(WANT, EXPR) do { try { EXPR; FAIL("Expected " #WANT); } catch(const WANT&) {} } while(0)
+#define ASSERT_THROWS_MSG(CLASS, MSG, EXPR) do { try { EXPR; FAIL("Expected " #CLASS); } catch(const CLASS& e) { ASSERT_SUBSTRING((MSG), e.what()); } } while(0)
 
 #define RUN_TEST(BAD_COUNT, TEST)                                       \
     do {                                                                \

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b164d99c/docs/connect_config.md
----------------------------------------------------------------------
diff --git a/docs/connect_config.md b/docs/connect_config.md
new file mode 100644
index 0000000..f0419cc
--- /dev/null
+++ b/docs/connect_config.md
@@ -0,0 +1,42 @@
+# Connection Configuration
+
+Proton clients can read default connection information from a
+configuration file.
+
+If the environment variable `MESSAGING_CONNECT_FILE` is set, it is the
+path to the file. Otherwise the client looks for a file named
+`connect.json` in the following locations, using the first one found:
+
+* Current working directory of client process.
+* `$HOME/.config/messaging/` - $HOME is user's home directory.
+* `$PREFIX/etc/messaging/` - $PREFIX is the prefix where the proton library is installed
+* `/etc/messaging/`
+
+The configuration file is in JSON object format. Comments are allowed,
+as defined by the [JavaScript Minifier](https://www.crockford.com/javascript/jsmin.html)
+
+The file format is as follows. Properties are shown with their default
+values, all properties are optional.
+
+    {
+      "scheme": "amqps",   // [string] "amqp" (no TLS) or "amqps"
+      "host": "",          // [string] DNS or IP address for connection. Defaults to local host.
+      "port": "amqps",     // [string] "amqp", "amqps" or port number. Defaults to value of 'scheme'.
+      "user": null,        // [string] Authentication user name
+      "password": null,    // [string] Authentication password
+
+      "sasl": {
+        "enable": true,         // [bool] Enable or disable SASL
+        "mechanisms": null,     // [list] List of allowed SASL mechanism names.
+                                // If null the library determines the default list.
+        "allow_insecure": false // [boolean] Allow mechanisms that send clear-text passwords
+      },
+
+      // Note: it is an error to have a "tls" object unless scheme="amqps"
+      "tls": {
+        "cert": null,   // [string] name of client certificate or database
+        "key": null     // [string] private key or identity for client certificate
+        "ca": null,     // [string] name of CA certificate or database
+        "verify": true, // [bool] if true, require a valid cert with matching host name
+      }
+    }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b164d99c/tools/cmake/Modules/FindJsonCpp.cmake
----------------------------------------------------------------------
diff --git a/tools/cmake/Modules/FindJsonCpp.cmake b/tools/cmake/Modules/FindJsonCpp.cmake
new file mode 100644
index 0000000..083d3fc
--- /dev/null
+++ b/tools/cmake/Modules/FindJsonCpp.cmake
@@ -0,0 +1,70 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+#.rst
+# FindJsonCpp
+#----------
+#
+# Find jsoncpp include directories and libraries.
+#
+# Sets the following variables:
+#
+#   JsonCpp_FOUND            - True if headers and requested libraries were found
+#   JsonCpp_INCLUDE_DIRS     - JsonCpp include directories
+#   JsonCpp_LIBRARIES        - Link these to use jsoncpp.
+#
+# This module reads hints about search locations from variables::
+#   JSONCPP_ROOT             - Preferred installation prefix
+#   JSONCPP_INCLUDEDIR       - Preferred include directory e.g. <prefix>/include
+#   JSONCPP_LIBRARYDIR       - Preferred library directory e.g. <prefix>/lib
+
+find_package (PkgConfig)
+pkg_check_modules (PC_JsonCpp QUIET jsoncpp)
+
+find_library(JsonCpp_LIBRARY NAMES jsoncpp libjsoncpp
+  HINTS ${JSONCPP_LIBRARYDIR} ${JSONCPP_ROOT}/lib ${CMAKE_INSTALL_PREFIX}/lib
+  PATHS ${PC_JsonCpp_LIBRARY_DIRS})
+
+find_path(JsonCpp_INCLUDE_DIR NAMES json/json.h json/value.h
+  HINTS ${JSONCPP_INCLUDEDIR} ${JSONCPP_ROOT}/include ${CMAKE_INSTALL_PREFIX}/include
+  PATHS /usr/include ${PC_JsonCpp_INCLUDE_DIRS})
+
+set(JsonCpp_VERSION ${PC_JsonCpp_VERSION})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(JsonCpp
+  REQUIRED_VARS JsonCpp_LIBRARY JsonCpp_INCLUDE_DIR
+  VERSION_VAR JsonCpp_VERSION)
+
+if (JsonCpp_FOUND)
+  set(JsonCpp_INCLUDE_DIRS ${JsonCpp_INCLUDE_DIR})
+  set(JsonCpp_LIBRARIES ${JsonCpp_LIBRARY})
+
+  if (NOT TARGET JsonCpp::JsonCpp)
+    add_library(JsonCpp::JsonCpp UNKNOWN IMPORTED)
+    set_target_properties(JsonCpp::JsonCpp
+      PROPERTIES
+        IMPORTED_LOCATION "${JsonCpp_LIBRARY}"
+        INTERFACE_INCLUDE_DIRECTORIES "${JsonCpp_INCLUDE_DIR}"
+    )
+  endif ()
+
+endif ()
+
+mark_as_advanced (JsonCpp_LIBRARY JsonCpp_INCLUDE_DIR)


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


[06/50] qpid-proton git commit: PROTON-1928: install static libraries

Posted by ac...@apache.org.
PROTON-1928: install static libraries


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

Branch: refs/heads/go1
Commit: 407711aacf377a9b576adcd3f12d5f5242c4bf2a
Parents: 0da413e
Author: Alan Conway <ac...@redhat.com>
Authored: Fri Sep 7 09:56:26 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Fri Sep 7 09:56:26 2018 -0400

----------------------------------------------------------------------
 c/CMakeLists.txt | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/407711aa/c/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/c/CMakeLists.txt b/c/CMakeLists.txt
index da68c4f..a16f46b 100644
--- a/c/CMakeLists.txt
+++ b/c/CMakeLists.txt
@@ -515,7 +515,10 @@ if (qpid-proton-proactor)
 endif()
 
 # Install executables and libraries
-install(TARGETS qpid-proton qpid-proton-core
+if (BUILD_STATIC_LIBS)
+  set(STATIC_LIBS qpid-proton-static qpid-proton-core-static)
+endif()
+install(TARGETS qpid-proton qpid-proton-core ${STATIC_LIBS}
   EXPORT  proton
   RUNTIME DESTINATION bin
   ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
@@ -532,7 +535,10 @@ if (MSVC)
 endif (MSVC)
 
 if (HAS_PROACTOR)
-  install(TARGETS qpid-proton-proactor
+  if (BUILD_STATIC_LIBS)
+    set(STATIC_LIBS qpid-proton-proactor-static)
+  endif()
+  install(TARGETS qpid-proton-proactor ${STATIC_LIBS}
     EXPORT  proton
     RUNTIME DESTINATION bin
     ARCHIVE DESTINATION ${LIB_INSTALL_DIR}


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


[47/50] qpid-proton git commit: NO-JIRA: Removed python upgrade for xcode7.3 build to fix pip issue

Posted by ac...@apache.org.
NO-JIRA: Removed python upgrade for xcode7.3 build to fix pip issue


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

Branch: refs/heads/go1
Commit: 386a88ccd33ccdd3008f2f4de84f13599cc77a68
Parents: 555878d
Author: Roddie Kieley <rk...@unifiedsoftworx.com>
Authored: Wed Oct 3 16:13:29 2018 -0230
Committer: Roddie Kieley <rk...@unifiedsoftworx.com>
Committed: Wed Oct 3 16:27:20 2018 -0230

----------------------------------------------------------------------
 .travis.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/386a88cc/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 6a8aa2e..d3cfabb 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -40,7 +40,7 @@ matrix:
     - QPID_PROTON_CMAKE_ARGS='-DCMAKE_OSX_DEPLOYMENT_TARGET=10.11 -DBUILD_RUBY=NO'
     before_install:
     - brew update
-    - brew upgrade cmake python openssl
+    - brew upgrade cmake openssl
     - brew install libuv swig
 
   - os: osx


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


[17/50] qpid-proton git commit: PROTON-1934: [Python] Export Backoff from reactor.py - Also some minor fixes to internal imports

Posted by ac...@apache.org.
PROTON-1934: [Python] Export Backoff from reactor.py
- Also some minor fixes to internal imports


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

Branch: refs/heads/go1
Commit: 4acc81ea2e47688427160bee9d59d2428da49497
Parents: c2e3992
Author: Andrew Stitcher <as...@apache.org>
Authored: Wed Sep 12 16:51:43 2018 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Wed Sep 12 17:01:47 2018 -0400

----------------------------------------------------------------------
 python/proton/_compat.py   | 4 ++--
 python/proton/_handlers.py | 2 +-
 python/proton/_reactor.py  | 3 ++-
 python/proton/reactor.py   | 6 ++++--
 4 files changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/4acc81ea/python/proton/_compat.py
----------------------------------------------------------------------
diff --git a/python/proton/_compat.py b/python/proton/_compat.py
index 79bd2c1..4d9d070 100644
--- a/python/proton/_compat.py
+++ b/python/proton/_compat.py
@@ -27,11 +27,11 @@ import sys
 try:
     import Queue as queue
 except ImportError:
-    import queue
+    import queue # type: ignore
 
 try:
     from urlparse import urlparse, urlunparse
-    from urllib import quote, unquote
+    from urllib import quote, unquote # type: ignore
 except ImportError:
     from urllib.parse import urlparse, urlunparse, quote, unquote
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/4acc81ea/python/proton/_handlers.py
----------------------------------------------------------------------
diff --git a/python/proton/_handlers.py b/python/proton/_handlers.py
index 8b798f8..f8d5413 100644
--- a/python/proton/_handlers.py
+++ b/python/proton/_handlers.py
@@ -672,7 +672,7 @@ CFlowController = FlowController
 CHandshaker = Handshaker
 
 
-from ._events import WrappedHandler
+from ._reactor_impl import WrappedHandler
 from cproton import pn_iohandler
 
 class IOHandler(WrappedHandler):

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/4acc81ea/python/proton/_reactor.py
----------------------------------------------------------------------
diff --git a/python/proton/_reactor.py b/python/proton/_reactor.py
index 5a826bf..1d09b18 100644
--- a/python/proton/_reactor.py
+++ b/python/proton/_reactor.py
@@ -36,9 +36,10 @@ from cproton import PN_MILLIS_MAX, PN_PYREF, PN_ACCEPTED, \
 
 from ._delivery import  Delivery
 from ._endpoints import Connection, Endpoint, Link, Session, Terminus
+from ._exceptions import SSLUnavailable
 from ._data import Described, symbol, ulong
 from ._message import  Message
-from ._transport import Transport, SSL, SSLDomain, SSLUnavailable
+from ._transport import Transport, SSL, SSLDomain
 from ._url import Url
 from ._common import isstring, secs2millis, millis2secs, unicode2utf8, utf82unicode
 from ._events import EventType, EventBase, Handler

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/4acc81ea/python/proton/reactor.py
----------------------------------------------------------------------
diff --git a/python/proton/reactor.py b/python/proton/reactor.py
index 639cc5b..db1f826 100644
--- a/python/proton/reactor.py
+++ b/python/proton/reactor.py
@@ -21,7 +21,8 @@ from __future__ import absolute_import
 
 from ._reactor import Container, ApplicationEvent, EventInjector, Handler,\
     LinkOption, ReceiverOption, SenderOption,\
-    AtLeastOnce, AtMostOnce, DynamicNodeProperties, Filter, Selector, DurableSubscription, Copy, Move
+    AtLeastOnce, AtMostOnce, DynamicNodeProperties, Filter, Selector, \
+    DurableSubscription, Copy, Move, Backoff
 
 __all__ = [
     'Container',
@@ -38,5 +39,6 @@ __all__ = [
     'Selector',
     'DurableSubscription',
     'Copy',
-    'Move'
+    'Move',
+    'Backoff'
 ]


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


[50/50] qpid-proton git commit: Merge tag '0.26.0' into go1

Posted by ac...@apache.org.
Merge tag '0.26.0' into go1

Release 0.26.0


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

Branch: refs/heads/go1
Commit: e3c49ae25318799604fe382392c54408e82b7bb9
Parents: 3826a8e 5b5927d
Author: Alan Conway <ac...@redhat.com>
Authored: Fri Nov 2 16:43:35 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Fri Nov 2 16:43:35 2018 -0400

----------------------------------------------------------------------
 amqp/types_test.go     | 17 -----------------
 electron/connection.go |  9 +++++++++
 2 files changed, 9 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e3c49ae2/amqp/types_test.go
----------------------------------------------------------------------
diff --cc amqp/types_test.go
index efa6e59,0000000..8f7cd6a
mode 100644,000000..100644
--- a/amqp/types_test.go
+++ b/amqp/types_test.go
@@@ -1,219 -1,0 +1,202 @@@
 +/*
 +Licensed to the Apache Software Foundation (ASF) under one
 +or more contributor license agreements.  See the NOTICE file
 +distributed with this work for additional information
 +regarding copyright ownership.  The ASF licenses this file
 +to you under the Apache License, Version 2.0 (the
 +"License"); you may not use this file except in compliance
 +with the License.  You may obtain a copy of the License at
 +
 +  http://www.apache.org/licenses/LICENSE-2.0
 +
 +Unless required by applicable law or agreed to in writing,
 +software distributed under the License is distributed on an
 +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 +KIND, either express or implied.  See the License for the
 +specific language governing permissions and limitations
 +under the License.
 +*/
 +
 +package amqp
 +
 +import (
 +	"fmt"
 +	"reflect"
 +	"testing"
 +	"time"
 +)
 +
 +func checkEqual(want interface{}, got interface{}) error {
 +	if !reflect.DeepEqual(want, got) {
 +		return fmt.Errorf("%#v != %#v", want, got)
 +	}
 +	return nil
 +}
 +
 +func checkUnmarshal(marshaled []byte, v interface{}) error {
 +	got, err := Unmarshal(marshaled, v)
 +	if err != nil {
 +		return err
 +	}
 +	if got != len(marshaled) {
 +		return fmt.Errorf("Wanted to Unmarshal %v bytes, got %v", len(marshaled), got)
 +	}
 +	return nil
 +}
 +
 +func ExampleKey() {
 +	var k AnnotationKey = AnnotationKeySymbol(Symbol("foo"))
 +	fmt.Println(k.Get().(Symbol))
 +	k = AnnotationKeyUint64(42)
 +	fmt.Println(k.Get().(uint64))
 +	// Output:
 +	// foo
 +	// 42
 +}
 +
 +var timeValue = time.Now().Round(time.Millisecond)
 +
 +// Values that are unchanged by a marshal/unmarshal round-trip from interface{}
 +// to interface{}
 +var rtValues = []interface{}{
 +	true,
 +	int8(-8), int16(-16), int32(-32), int64(-64),
 +	uint8(8), uint16(16), uint32(32), uint64(64),
 +	float32(0.32), float64(0.64),
 +	"string", Binary("Binary"), Symbol("symbol"),
 +	nil,
 +	Described{"D", "V"},
 +	timeValue,
 +	UUID{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16},
 +	Char('a'),
 +	Map{"V": "X"},
 +	Map{},
 +	List{"V", int32(1)},
 +	List{},
 +	[]string{"a", "b", "c"},
 +	[]int8{},
 +	AnyMap{{[]int8{1, 2, 3}, "bad-key"}, {int16(1), "duplicate-1"}, {int16(1), "duplicate-2"}},
 +}
 +
 +// Go values that round-trip if unmarshalled back to the same type they were
 +// marshalled from, but unmarshal to interface{} as a different default type.
 +var oddValues = []interface{}{
 +	int(-99),                  // int32|64 depending on platform
 +	uint(99),                  // int32|64 depending on platform
 +	[]byte("byte"),            // amqp.Binary
 +	map[string]int{"str": 99}, // amqp.Map
 +	[]Map{Map{}},              // amqp.Array - the generic array
 +	AnyMap(nil),               // Map
 +}
 +
 +var allValues = append(rtValues, oddValues...)
 +
 +// %v formatted representation of allValues
 +var vstrings = []string{
 +	// for rtValues
 +	"true",
 +	"-8", "-16", "-32", "-64",
 +	"8", "16", "32", "64",
 +	"0.32", "0.64",
 +	"string", "Binary", "symbol",
 +	"<nil>",
 +	"{D V}",
 +	fmt.Sprintf("%v", timeValue),
 +	"UUID(01020304-0506-0708-090a-0b0c0d0e0f10)",
 +	fmt.Sprintf("%v", 'a'),
 +	"map[V:X]",
 +	"map[]",
 +	"[V 1]",
 +	"[]",
 +	"[a b c]",
 +	"[]",
 +	"[{[1 2 3] bad-key} {1 duplicate-1} {1 duplicate-2}]",
 +	// for oddValues
 +	"-99", "99",
 +	"[98 121 116 101]", /*"byte"*/
 +	"map[str:99]",
 +	"[map[]]",
 +	"[]",
 +}
 +
 +// Round-trip encoding test
 +func TestTypesRoundTrip(t *testing.T) {
 +	for _, x := range rtValues {
 +		marshalled, err := Marshal(x, nil)
 +		if err != nil {
 +			t.Error(err)
 +		}
 +		var v interface{}
 +		if err := checkUnmarshal(marshalled, &v); err != nil {
 +			t.Error(err)
 +		}
 +		if err := checkEqual(x, v); err != nil {
 +			t.Error(err)
 +		}
 +	}
 +}
 +
 +// Round trip from T to T where T is the type of the value.
 +func TestTypesRoundTripAll(t *testing.T) {
 +	for _, x := range allValues {
 +		marshaled, err := Marshal(x, nil)
 +		if err != nil {
 +			t.Error(err)
 +		}
 +		if x == nil { // We can't create an instance of nil to unmarshal to.
 +			continue
 +		}
 +		vp := reflect.New(reflect.TypeOf(x)) // v points to a Zero of the same type as x
 +		if err := checkUnmarshal(marshaled, vp.Interface()); err != nil {
 +			t.Error(err)
 +		}
 +		v := vp.Elem().Interface()
 +		if err := checkEqual(x, v); err != nil {
 +			t.Error(err)
 +		}
 +	}
 +}
 +
 +func TestTypesPrint(t *testing.T) {
 +	// Default %v representations of rtValues and oddValues
 +	for i, x := range allValues {
 +		if s := fmt.Sprintf("%v", x); vstrings[i] != s {
 +			t.Errorf("printing %T: want %v, got %v", x, vstrings[i], s)
 +		}
 +	}
 +}
 +
 +func TestDescribed(t *testing.T) {
 +	want := Described{"D", "V"}
 +	marshaled, _ := Marshal(want, nil)
 +
 +	// Unmarshal to Described type
 +	var d Described
 +	if err := checkUnmarshal(marshaled, &d); err != nil {
 +		t.Error(err)
 +	}
 +	if err := checkEqual(want, d); err != nil {
 +		t.Error(err)
 +	}
 +
 +	// Unmarshal to interface{}
 +	var i interface{}
 +	if err := checkUnmarshal(marshaled, &i); err != nil {
 +		t.Error(err)
 +	}
 +	if _, ok := i.(Described); !ok {
 +		t.Errorf("Expected Described, got %T(%v)", i, i)
 +	}
 +	if err := checkEqual(want, i); err != nil {
 +		t.Error(err)
 +	}
 +
 +	// Unmarshal value only (drop descriptor) to the value type
 +	var s string
 +	if err := checkUnmarshal(marshaled, &s); err != nil {
 +		t.Error(err)
 +	}
 +	if err := checkEqual(want.Value, s); err != nil {
 +		t.Error(err)
 +	}
- 
- 	// Nested described types
- 	want = Described{Described{int64(123), true}, "foo"}
- 	marshaled, _ = Marshal(want, nil)
- 	if err := checkUnmarshal(marshaled, &d); err != nil {
- 		t.Error(err)
- 	}
- 	if err := checkEqual(want, d); err != nil {
- 		t.Error(err)
- 	}
- 	// Nested to interface
- 	if err := checkUnmarshal(marshaled, &i); err != nil {
- 		t.Error(err)
- 	}
- 	if err := checkEqual(want, i); err != nil {
- 		t.Error(err)
- 	}
 +}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e3c49ae2/electron/connection.go
----------------------------------------------------------------------
diff --cc electron/connection.go
index 9c0ef31,0000000..295dd50
mode 100644,000000..100644
--- a/electron/connection.go
+++ b/electron/connection.go
@@@ -1,442 -1,0 +1,451 @@@
 +/*
 +Licensed to the Apache Software Foundation (ASF) under one
 +or more contributor license agreements.  See the NOTICE file
 +distributed with this work for additional information
 +regarding copyright ownership.  The ASF licenses this file
 +to you under the Apache License, Version 2.0 (the
 +"License"); you may not use this file except in compliance
 +with the License.  You may obtain a copy of the License at
 +
 +  http://www.apache.org/licenses/LICENSE-2.0
 +
 +Unless required by applicable law or agreed to in writing,
 +software distributed under the License is distributed on an
 +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 +KIND, either express or implied.  See the License for the
 +specific language governing permissions and limitations
 +under the License.
 +*/
 +
 +package electron
 +
 +// #include <proton/disposition.h>
 +import "C"
 +
 +import (
 +	"net"
 +	"qpid.apache.org/proton"
 +	"sync"
 +	"time"
 +)
 +
 +// Settings associated with a Connection.
 +type ConnectionSettings interface {
 +	// Authenticated user name associated with the connection.
 +	User() string
 +
 +	// The AMQP virtual host name for the connection.
 +	//
 +	// Optional, useful when the server has multiple names and provides different
 +	// service based on the name the client uses to connect.
 +	//
 +	// By default it is set to the DNS host name that the client uses to connect,
 +	// but it can be set to something different at the client side with the
 +	// VirtualHost() option.
 +	//
 +	// Returns error if the connection fails to authenticate.
 +	VirtualHost() string
 +
 +	// Heartbeat is the maximum delay between sending frames that the remote peer
 +	// has requested of us. If the interval expires an empty "heartbeat" frame
 +	// will be sent automatically to keep the connection open.
 +	Heartbeat() time.Duration
 +}
 +
 +// Connection is an AMQP connection, created by a Container.
 +type Connection interface {
 +	Endpoint
 +	ConnectionSettings
 +
 +	// Sender opens a new sender on the DefaultSession.
 +	Sender(...LinkOption) (Sender, error)
 +
 +	// Receiver opens a new Receiver on the DefaultSession().
 +	Receiver(...LinkOption) (Receiver, error)
 +
 +	// DefaultSession() returns a default session for the connection. It is opened
 +	// on the first call to DefaultSession and returned on subsequent calls.
 +	DefaultSession() (Session, error)
 +
 +	// Session opens a new session.
 +	Session(...SessionOption) (Session, error)
 +
 +	// Container for the connection.
 +	Container() Container
 +
 +	// Disconnect the connection abruptly with an error.
 +	Disconnect(error)
 +
 +	// Wait waits for the connection to be disconnected.
 +	Wait() error
 +
 +	// WaitTimeout is like Wait but returns Timeout if the timeout expires.
 +	WaitTimeout(time.Duration) error
 +
 +	// Incoming returns a channel for incoming endpoints opened by the remote peer.
 +	// See the Incoming interface for more detail.
 +	//
 +	// Note: this channel will first return an *IncomingConnection for the
 +	// connection itself which allows you to look at security information and
 +	// decide whether to Accept() or Reject() the connection. Then it will return
 +	// *IncomingSession, *IncomingSender and *IncomingReceiver as they are opened
 +	// by the remote end.
 +	//
 +	// Note 2: you must receiving from Incoming() and call Accept/Reject to avoid
 +	// blocking electron event loop. Normally you would run a loop in a goroutine
 +	// to handle incoming types that interest and Accept() those that don't.
 +	Incoming() <-chan Incoming
 +}
 +
 +type connectionSettings struct {
 +	user, virtualHost string
 +	heartbeat         time.Duration
 +}
 +
 +func (c connectionSettings) User() string             { return c.user }
 +func (c connectionSettings) VirtualHost() string      { return c.virtualHost }
 +func (c connectionSettings) Heartbeat() time.Duration { return c.heartbeat }
 +
 +// ConnectionOption can be passed when creating a connection to configure various options
 +type ConnectionOption func(*connection)
 +
 +// User returns a ConnectionOption sets the user name for a connection
 +func User(user string) ConnectionOption {
 +	return func(c *connection) {
 +		c.user = user
 +		c.pConnection.SetUser(user)
 +	}
 +}
 +
 +// VirtualHost returns a ConnectionOption to set the AMQP virtual host for the connection.
 +// Only applies to outbound client connection.
 +func VirtualHost(virtualHost string) ConnectionOption {
 +	return func(c *connection) {
 +		c.virtualHost = virtualHost
 +		c.pConnection.SetHostname(virtualHost)
 +	}
 +}
 +
 +// Password returns a ConnectionOption to set the password used to establish a
 +// connection.  Only applies to outbound client connection.
 +//
 +// The connection will erase its copy of the password from memory as soon as it
 +// has been used to authenticate. If you are concerned about passwords staying in
 +// memory you should never store them as strings, and should overwrite your
 +// copy as soon as you are done with it.
 +//
 +func Password(password []byte) ConnectionOption {
 +	return func(c *connection) { c.pConnection.SetPassword(password) }
 +}
 +
 +// Server returns a ConnectionOption to put the connection in server mode for incoming connections.
 +//
 +// A server connection will do protocol negotiation to accept a incoming AMQP
 +// connection. Normally you would call this for a connection created by
 +// net.Listener.Accept()
 +//
 +func Server() ConnectionOption {
 +	return func(c *connection) { c.engine.Server(); c.server = true; AllowIncoming()(c) }
 +}
 +
 +// AllowIncoming returns a ConnectionOption to enable incoming endpoints, see
 +// Connection.Incoming() This is automatically set for Server() connections.
 +func AllowIncoming() ConnectionOption {
 +	return func(c *connection) { c.incoming = make(chan Incoming) }
 +}
 +
 +// Parent returns a ConnectionOption that associates the Connection with it's Container
 +// If not set a connection will create its own default container.
 +func Parent(cont Container) ConnectionOption {
 +	return func(c *connection) { c.container = cont.(*container) }
 +}
 +
 +type connection struct {
 +	endpoint
 +	connectionSettings
 +
 +	defaultSessionOnce, closeOnce sync.Once
 +
 +	container   *container
 +	conn        net.Conn
 +	server      bool
 +	incoming    chan Incoming
 +	handler     *handler
 +	engine      *proton.Engine
 +	pConnection proton.Connection
 +
 +	defaultSession Session
 +}
 +
 +// NewConnection creates a connection with the given options.
 +func NewConnection(conn net.Conn, opts ...ConnectionOption) (*connection, error) {
 +	c := &connection{
 +		conn: conn,
 +	}
 +	c.handler = newHandler(c)
 +	var err error
 +	c.engine, err = proton.NewEngine(c.conn, c.handler.delegator)
 +	if err != nil {
 +		return nil, err
 +	}
 +	c.pConnection = c.engine.Connection()
 +	for _, set := range opts {
 +		set(c)
 +	}
 +	if c.container == nil {
 +		c.container = NewContainer("").(*container)
 +	}
 +	c.pConnection.SetContainer(c.container.Id())
 +	saslConfig.setup(c.engine)
 +	c.endpoint.init(c.engine.String())
 +	go c.run()
 +	return c, nil
 +}
 +
 +func (c *connection) run() {
 +	if !c.server {
 +		c.pConnection.Open()
 +	}
 +	_ = c.engine.Run()
 +	if c.incoming != nil {
 +		close(c.incoming)
 +	}
 +	_ = c.closed(Closed)
 +}
 +
 +func (c *connection) Close(err error) {
 +	c.err.Set(err)
 +	c.engine.Close(err)
 +}
 +
 +func (c *connection) Disconnect(err error) {
 +	c.err.Set(err)
 +	c.engine.Disconnect(err)
 +}
 +
 +func (c *connection) Session(opts ...SessionOption) (Session, error) {
 +	var s Session
 +	err := c.engine.InjectWait(func() error {
 +		if c.Error() != nil {
 +			return c.Error()
 +		}
 +		pSession, err := c.engine.Connection().Session()
 +		if err == nil {
 +			pSession.Open()
 +			if err == nil {
 +				s = newSession(c, pSession, opts...)
 +			}
 +		}
 +		return err
 +	})
 +	return s, err
 +}
 +
 +func (c *connection) Container() Container { return c.container }
 +
 +func (c *connection) DefaultSession() (s Session, err error) {
 +	c.defaultSessionOnce.Do(func() {
 +		c.defaultSession, err = c.Session()
 +	})
 +	if err == nil {
 +		err = c.Error()
 +	}
 +	return c.defaultSession, err
 +}
 +
 +func (c *connection) Sender(opts ...LinkOption) (Sender, error) {
 +	if s, err := c.DefaultSession(); err == nil {
 +		return s.Sender(opts...)
 +	} else {
 +		return nil, err
 +	}
 +}
 +
 +func (c *connection) Receiver(opts ...LinkOption) (Receiver, error) {
 +	if s, err := c.DefaultSession(); err == nil {
 +		return s.Receiver(opts...)
 +	} else {
 +		return nil, err
 +	}
 +}
 +
 +func (c *connection) Connection() Connection { return c }
 +
 +func (c *connection) Wait() error { return c.WaitTimeout(Forever) }
 +func (c *connection) WaitTimeout(timeout time.Duration) error {
 +	_, err := timedReceive(c.done, timeout)
 +	if err == Timeout {
 +		return Timeout
 +	}
 +	return c.Error()
 +}
 +
 +func (c *connection) Incoming() <-chan Incoming {
 +	assert(c.incoming != nil, "Incoming() is only allowed for a Connection created with the Server() option: %s", c)
 +	return c.incoming
 +}
 +
 +type IncomingConnection struct {
 +	incoming
 +	connectionSettings
 +	c *connection
 +}
 +
 +func newIncomingConnection(c *connection) *IncomingConnection {
 +	c.user = c.pConnection.Transport().User()
 +	c.virtualHost = c.pConnection.RemoteHostname()
 +	return &IncomingConnection{
 +		incoming:           makeIncoming(c.pConnection),
 +		connectionSettings: c.connectionSettings,
 +		c:                  c}
 +}
 +
 +// AcceptConnection is like Accept() but takes ConnectionOption s
 +// For example you can set the Heartbeat() for the accepted connection.
 +func (in *IncomingConnection) AcceptConnection(opts ...ConnectionOption) Connection {
 +	return in.accept(func() Endpoint {
 +		for _, opt := range opts {
 +			opt(in.c)
 +		}
 +		in.c.pConnection.Open()
 +		return in.c
 +	}).(Connection)
 +}
 +
 +func (in *IncomingConnection) Accept() Endpoint {
 +	return in.AcceptConnection()
 +}
 +
 +func sasl(c *connection) proton.SASL { return c.engine.Transport().SASL() }
 +
 +// SASLEnable returns a ConnectionOption that enables SASL authentication.
 +// Only required if you don't set any other SASL options.
 +func SASLEnable() ConnectionOption { return func(c *connection) { sasl(c) } }
 +
 +// SASLAllowedMechs returns a ConnectionOption to set the list of allowed SASL
 +// mechanisms.
 +//
 +// Can be used on the client or the server to restrict the SASL for a connection.
 +// mechs is a space-separated list of mechanism names.
 +//
++// The mechanisms allowed by default are determined by your SASL
++// library and system configuration, with two exceptions: GSSAPI
++// and GSS-SPNEGO are disabled by default.  To enable them, you
++// must explicitly add them using this option.
++//
++// Clients must set the allowed mechanisms before the the
++// outgoing connection is attempted.  Servers must set them
++// before the listening connection is setup.
++//
 +func SASLAllowedMechs(mechs string) ConnectionOption {
 +	return func(c *connection) { sasl(c).AllowedMechs(mechs) }
 +}
 +
 +// SASLAllowInsecure returns a ConnectionOption that allows or disallows clear
 +// text SASL authentication mechanisms
 +//
 +// By default the SASL layer is configured not to allow mechanisms that disclose
 +// the clear text of the password over an unencrypted AMQP connection. This specifically
 +// will disallow the use of the PLAIN mechanism without using SSL encryption.
 +//
 +// This default is to avoid disclosing password information accidentally over an
 +// insecure network.
 +//
 +func SASLAllowInsecure(b bool) ConnectionOption {
 +	return func(c *connection) { sasl(c).SetAllowInsecureMechs(b) }
 +}
 +
 +// Heartbeat returns a ConnectionOption that requests the maximum delay
 +// between sending frames for the remote peer. If we don't receive any frames
 +// within 2*delay we will close the connection.
 +//
 +func Heartbeat(delay time.Duration) ConnectionOption {
 +	// Proton-C divides the idle-timeout by 2 before sending, so compensate.
 +	return func(c *connection) { c.engine.Transport().SetIdleTimeout(2 * delay) }
 +}
 +
 +type saslConfigState struct {
 +	lock        sync.Mutex
 +	name        string
 +	dir         string
 +	initialized bool
 +}
 +
 +func (s *saslConfigState) set(target *string, value string) {
 +	s.lock.Lock()
 +	defer s.lock.Unlock()
 +	if s.initialized {
 +		panic("SASL configuration cannot be changed after a Connection has been created")
 +	}
 +	*target = value
 +}
 +
 +// Apply the global SASL configuration the first time a proton.Engine needs it
 +//
 +// TODO aconway 2016-09-15: Current pn_sasl C impl config is broken, so all we
 +// can realistically offer is global configuration. Later if/when the pn_sasl C
 +// impl is fixed we can offer per connection over-rides.
 +func (s *saslConfigState) setup(eng *proton.Engine) {
 +	s.lock.Lock()
 +	defer s.lock.Unlock()
 +	if !s.initialized {
 +		s.initialized = true
 +		sasl := eng.Transport().SASL()
 +		if s.name != "" {
 +			sasl.ConfigName(saslConfig.name)
 +		}
 +		if s.dir != "" {
 +			sasl.ConfigPath(saslConfig.dir)
 +		}
 +	}
 +}
 +
 +var saslConfig saslConfigState
 +
 +// GlobalSASLConfigDir sets the SASL configuration directory for every
 +// Connection created in this process. If not called, the default is determined
 +// by your SASL installation.
 +//
 +// You can set SASLAllowInsecure and SASLAllowedMechs on individual connections.
 +//
 +// Must be called at most once, before any connections are created.
 +func GlobalSASLConfigDir(dir string) { saslConfig.set(&saslConfig.dir, dir) }
 +
 +// GlobalSASLConfigName sets the SASL configuration name for every Connection
 +// created in this process. If not called the default is "proton-server".
 +//
 +// The complete configuration file name is
 +//     <sasl-config-dir>/<sasl-config-name>.conf
 +//
 +// You can set SASLAllowInsecure and SASLAllowedMechs on individual connections.
 +//
 +// Must be called at most once, before any connections are created.
 +func GlobalSASLConfigName(name string) { saslConfig.set(&saslConfig.name, name) }
 +
 +// Do we support extended SASL negotiation?
 +// All implementations of Proton support ANONYMOUS and EXTERNAL on both
 +// client and server sides and PLAIN on the client side.
 +//
 +// Extended SASL implememtations use an external library (Cyrus SASL)
 +// to support other mechanisms beyond these basic ones.
 +func SASLExtended() bool { return proton.SASLExtended() }
 +
 +// Dial is shorthand for using net.Dial() then NewConnection()
 +// See net.Dial() for the meaning of the network, address arguments.
 +func Dial(network, address string, opts ...ConnectionOption) (c Connection, err error) {
 +	conn, err := net.Dial(network, address)
 +	if err == nil {
 +		c, err = NewConnection(conn, opts...)
 +	}
 +	return
 +}
 +
 +// DialWithDialer is shorthand for using dialer.Dial() then NewConnection()
 +// See net.Dial() for the meaning of the network, address arguments.
 +func DialWithDialer(dialer *net.Dialer, network, address string, opts ...ConnectionOption) (c Connection, err error) {
 +	conn, err := dialer.Dial(network, address)
 +	if err == nil {
 +		c, err = NewConnection(conn, opts...)
 +	}
 +	return
 +}


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


[37/50] qpid-proton git commit: NO_JIRA: Minor typo fix for C++ codec tests which change type long for long long.

Posted by ac...@apache.org.
NO_JIRA: Minor typo fix for C++ codec tests which change type long for long long.


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

Branch: refs/heads/go1
Commit: adb9cb94c9b21f9d9ef77e1d71e8ddb8b5f1acec
Parents: 5960f15
Author: Kim van der Riet <kv...@localhost.localdomain>
Authored: Fri Sep 28 14:26:58 2018 -0400
Committer: Kim van der Riet <kv...@localhost.localdomain>
Committed: Fri Sep 28 14:26:58 2018 -0400

----------------------------------------------------------------------
 cpp/src/codec_test.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/adb9cb94/cpp/src/codec_test.cpp
----------------------------------------------------------------------
diff --git a/cpp/src/codec_test.cpp b/cpp/src/codec_test.cpp
index 015a64a..53d7628 100644
--- a/cpp/src/codec_test.cpp
+++ b/cpp/src/codec_test.cpp
@@ -92,9 +92,9 @@ int main(int, char**) {
     RUN_TEST(failed, simple_type_test(static_cast<unsigned long>(42)));
 
 #if PN_CPP_HAS_LONG_LONG_TYPE
-    RUN_TEST(failed, simple_type_test(static_cast<long>(42)));
-    RUN_TEST(failed, simple_type_test(static_cast<signed long>(42)));
-    RUN_TEST(failed, simple_type_test(static_cast<unsigned long>(42)));
+    RUN_TEST(failed, simple_type_test(static_cast<long long>(42)));
+    RUN_TEST(failed, simple_type_test(static_cast<signed long long>(42)));
+    RUN_TEST(failed, simple_type_test(static_cast<unsigned long long>(42)));
 #endif
 
     // value and scalar types, more tests in value_test and scalar_test.


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


[16/50] qpid-proton git commit: PROTON-1929: [c] move pn_log_data from util.c to log.c

Posted by ac...@apache.org.
PROTON-1929: [c] move pn_log_data from util.c to log.c

util.c should not depend on anything but standard C libraries.


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

Branch: refs/heads/go1
Commit: c2e39920a7fc762ea7943c62a07a4e2af08bfd60
Parents: 7e3d648
Author: Alan Conway <ac...@redhat.com>
Authored: Wed Sep 12 13:35:17 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Wed Sep 12 13:35:55 2018 -0400

----------------------------------------------------------------------
 c/src/core/log.c            | 18 +++++++++++++++---
 c/src/core/log_private.h    |  2 ++
 c/src/core/util.c           | 14 --------------
 c/src/core/util.h           |  1 -
 c/tests/fuzz/CMakeLists.txt | 17 ++++++-----------
 5 files changed, 23 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c2e39920/c/src/core/log.c
----------------------------------------------------------------------
diff --git a/c/src/core/log.c b/c/src/core/log.c
index ed04573..9a71d1e 100644
--- a/c/src/core/log.c
+++ b/c/src/core/log.c
@@ -17,12 +17,12 @@
  * under the License.
  */
 
-#include <proton/log.h>
-#include <proton/object.h>
-#include <stdio.h>
 #include "log_private.h"
 #include "util.h"
 
+#include <proton/error.h>
+#include <proton/log.h>
+#include <proton/object.h>
 
 static void stderr_logger(const char *message) {
     fprintf(stderr, "%s\n", message);
@@ -69,3 +69,15 @@ void pni_logf_impl(const char *fmt, ...) {
   va_end(ap);
 }
 
+void pn_log_data(const char *msg, const char *bytes, size_t size)
+{
+  char buf[256];
+  ssize_t n = pn_quote_data(buf, 256, bytes, size);
+  if (n >= 0) {
+    pn_logf("%s: %s", msg, buf);
+  } else if (n == PN_OVERFLOW) {
+    pn_logf("%s: %s (truncated)", msg, buf);
+  } else {
+    pn_logf("%s: cannot log data: %s", msg, pn_code(n));
+  }
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c2e39920/c/src/core/log_private.h
----------------------------------------------------------------------
diff --git a/c/src/core/log_private.h b/c/src/core/log_private.h
index 75044ed..80f3002 100644
--- a/c/src/core/log_private.h
+++ b/c/src/core/log_private.h
@@ -49,6 +49,8 @@ PN_EXTERN void pni_logf_impl(const char* fmt, ...);
 /**@internal*/
 PN_EXTERN void pni_vlogf_impl(const char *fmt, va_list ap);
 
+/**@internal*/
+void pn_log_data(const char *msg, const char *bytes, size_t size);
 
 
 #endif

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c2e39920/c/src/core/util.c
----------------------------------------------------------------------
diff --git a/c/src/core/util.c b/c/src/core/util.c
index 2597d60..39bea4d 100644
--- a/c/src/core/util.c
+++ b/c/src/core/util.c
@@ -20,7 +20,6 @@
  */
 
 #include "buffer.h"
-#include "log_private.h"
 #include "util.h"
 
 #include <proton/error.h>
@@ -82,19 +81,6 @@ int pn_quote(pn_string_t *dst, const char *src, size_t size)
   }
 }
 
-void pn_log_data(const char *msg, const char *bytes, size_t size)
-{
-  char buf[256];
-  ssize_t n = pn_quote_data(buf, 256, bytes, size);
-  if (n >= 0) {
-    pn_logf("%s: %s", msg, buf);
-  } else if (n == PN_OVERFLOW) {
-    pn_logf("%s: %s (truncated)", msg, buf);
-  } else {
-    pn_logf("%s: cannot log data: %s", msg, pn_code(n));
-  }
-}
-
 int pn_strcasecmp(const char *a, const char *b)
 {
   int diff;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c2e39920/c/src/core/util.h
----------------------------------------------------------------------
diff --git a/c/src/core/util.h b/c/src/core/util.h
index 559fbaa..baddff0 100644
--- a/c/src/core/util.h
+++ b/c/src/core/util.h
@@ -36,7 +36,6 @@
 
 ssize_t pn_quote_data(char *dst, size_t capacity, const char *src, size_t size);
 int pn_quote(pn_string_t *dst, const char *src, size_t size);
-void pn_log_data(const char *msg, const char *bytes, size_t size);
 bool pn_env_bool(const char *name);
 pn_timestamp_t pn_timestamp_min(pn_timestamp_t a, pn_timestamp_t b);
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c2e39920/c/tests/fuzz/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/c/tests/fuzz/CMakeLists.txt b/c/tests/fuzz/CMakeLists.txt
index 1af7e50..9880bdc 100644
--- a/c/tests/fuzz/CMakeLists.txt
+++ b/c/tests/fuzz/CMakeLists.txt
@@ -30,9 +30,10 @@ endif ()
 
 add_library (StandaloneFuzzTargetMain STATIC StandaloneFuzzTargetMain.c StandaloneFuzzTargetInit.c)
 
-macro (pn_add_fuzz_test_no_proton test)
+macro (pn_add_fuzz_test test)
   add_executable (${test} ${ARGN})
-  target_link_libraries (${test} ${FUZZING_LIBRARY})
+  target_link_libraries (${test} qpid-proton-core ${FUZZING_LIBRARY})
+
   if (FUZZ_REGRESSION_TESTS)
     # StandaloneFuzzTargetMain cannot walk directory trees
     file(GLOB_RECURSE files ${CMAKE_CURRENT_SOURCE_DIR}/${test}/*)
@@ -40,20 +41,14 @@ macro (pn_add_fuzz_test_no_proton test)
   else ()
     add_test (NAME ${test} COMMAND $<TARGET_FILE:${test}> -runs=1 ${CMAKE_CURRENT_SOURCE_DIR}/${test}>)
   endif ()
-endmacro(pn_add_fuzz_test_no_proton)
-
-macro (pn_add_fuzz_test test)
-  pn_add_fuzz_test_no_proton (${test} ${ARGN})
-  target_link_libraries (${test} qpid-proton-core ${FUZZING_LIBRARY})
-endmacro (pn_add_fuzz_test)
+endmacro(pn_add_fuzz_test)
 
 # Fuzz tests at the User API level
 pn_add_fuzz_test (fuzz-connection-driver fuzz-connection-driver.c)
 pn_add_fuzz_test (fuzz-message-decode fuzz-message-decode.c)
 
-# pn_url_parse is not in qpid-proton-core so link with qpid-proton instead
-pn_add_fuzz_test_no_proton (fuzz-url fuzz-url.c)
-target_link_libraries (fuzz-url qpid-proton ${FUZZING_LIBRARY})
+# pn_url_parse is not in proton core and is only used by messenger so compile specially
+pn_add_fuzz_test (fuzz-url fuzz-url.c ${PN_C_SOURCE_DIR}/extra/url.c  ${PN_C_SOURCE_DIR}/core/util.c)
 
 # This regression test can take a very long time so don't run by default
 if(HAS_PROACTOR AND FUZZ_LONG_TESTS)


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


[41/50] qpid-proton git commit: PROTON-1926: update versions for 0.26.0-rc1

Posted by ac...@apache.org.
PROTON-1926: update versions for 0.26.0-rc1


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

Branch: refs/heads/go1
Commit: fd518f29b532c4e692ca7684b0917234e4bfff1d
Parents: 2149ad6
Author: Robbie Gemmell <ro...@apache.org>
Authored: Mon Oct 1 12:31:26 2018 +0100
Committer: Robbie Gemmell <ro...@apache.org>
Committed: Mon Oct 1 12:31:26 2018 +0100

----------------------------------------------------------------------
 VERSION.txt         | 2 +-
 python/docs/conf.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd518f29/VERSION.txt
----------------------------------------------------------------------
diff --git a/VERSION.txt b/VERSION.txt
index a756457..4e8f395 100644
--- a/VERSION.txt
+++ b/VERSION.txt
@@ -1 +1 @@
-0.26.0-SNAPSHOT
+0.26.0

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fd518f29/python/docs/conf.py
----------------------------------------------------------------------
diff --git a/python/docs/conf.py b/python/docs/conf.py
index 30b16ce..59317d4 100644
--- a/python/docs/conf.py
+++ b/python/docs/conf.py
@@ -50,7 +50,7 @@ copyright = u'2015, Apache Qpid'
 # The short X.Y version.
 version = '0.26.0'
 # The full version, including alpha/beta/rc tags.
-release = '0.26.0-SNAPSHOT'
+release = '0.26.0'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.


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


[30/50] qpid-proton git commit: NO-JIRA: Rename runtime_check.cmake to RuntimeCheck.cmake

Posted by ac...@apache.org.
NO-JIRA: Rename runtime_check.cmake to RuntimeCheck.cmake

Follow CMake file naming conventions


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

Branch: refs/heads/go1
Commit: 3e227e16d93b555cedd7ad3ca3e1a60d7682e2b0
Parents: d117972
Author: Alan Conway <ac...@redhat.com>
Authored: Tue Sep 25 17:59:34 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Tue Sep 25 18:00:06 2018 -0400

----------------------------------------------------------------------
 CMakeLists.txt             |   2 +-
 tests/RuntimeCheck.cmake   | 123 ++++++++++++++++++++++++++++++++++++++++
 tests/runtime_check.cmake  | 123 ----------------------------------------
 tests/share/CMakeLists.txt |   2 +-
 4 files changed, 125 insertions(+), 125 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3e227e16/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b9e1656..04b0ed2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -39,7 +39,7 @@ find_package (CyrusSASL)
 enable_testing ()
 
 # Set up runtime checks (valgrind, sanitizers etc.)
-include(tests/runtime_check.cmake)  
+include(tests/RuntimeCheck.cmake)  
 
 ## Variables used across components
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3e227e16/tests/RuntimeCheck.cmake
----------------------------------------------------------------------
diff --git a/tests/RuntimeCheck.cmake b/tests/RuntimeCheck.cmake
new file mode 100644
index 0000000..57ae2f5
--- /dev/null
+++ b/tests/RuntimeCheck.cmake
@@ -0,0 +1,123 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# Configuration for code analysis tools: runtime checking and coverage.
+
+# Any test that needs runtime checks should use TEST_EXE_PREFIX and TEST_ENV.
+# Normally they are set as a result of the RUNTIME_CHECK value,
+# but can be set directly for unsupported tools or unusual flags
+# e.g. -DTEST_EXE_PREFIX=rr or -DTEST_EXE_PREFIX="valgrind --tool=massif"
+
+set(TEST_EXE_PREFIX "" CACHE STRING "Prefix for test executable command line")
+set(TEST_WRAP_PREFIX "" CACHE STRING "Prefix for interpreter tests (e.g. python, ruby) that load proton as an extension")
+set(TEST_ENV "" CACHE STRING "Extra environment for tests: name1=value1;name2=value2")
+mark_as_advanced(TEST_EXE_PREFIX TEST_WRAP_PREFIX TEST_ENV)
+
+# Check for valgrind
+find_program(VALGRIND_EXECUTABLE valgrind DOC "location of valgrind program")
+set(VALGRIND_SUPPRESSIONS "${CMAKE_SOURCE_DIR}/tests/valgrind.supp" CACHE STRING "Suppressions file for valgrind")
+set(VALGRIND_COMMON_ARGS "--error-exitcode=42 --quiet --suppressions=${VALGRIND_SUPPRESSIONS}")
+mark_as_advanced(VALGRIND_EXECUTABLE VALGRIND_SUPPRESSIONS VALGRIND_COMMON_ARGS)
+
+# Check for compiler sanitizers
+if((CMAKE_C_COMPILER_ID MATCHES "GNU"
+      AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.8)
+    OR (CMAKE_C_COMPILER_ID MATCHES "Clang"
+      AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.1))
+  set(HAS_SANITIZERS TRUE)
+endif()
+
+# Valid values for RUNTIME_CHECK
+set(runtime_checks OFF asan tsan memcheck helgrind)
+
+# Set the default
+if(NOT CMAKE_BUILD_TYPE MATCHES "Coverage" AND VALGRIND_EXECUTABLE)
+  set(RUNTIME_CHECK_DEFAULT "memcheck")
+endif()
+
+# Deprecated options to enable runtime checks
+macro(deprecated_enable_check old new doc)
+  option(${old} ${doc} OFF)
+  if (${old})
+    message("WARNING: option ${old} is deprecated, use RUNTIME_CHECK=${new} instead")
+    set(RUNTIME_CHECK_DEFAULT ${new})
+  endif()
+endmacro()
+deprecated_enable_check(ENABLE_VALGRIND memcheck "Use valgrind to detect run-time problems")
+deprecated_enable_check(ENABLE_SANITIZERS asan "Compile with memory sanitizers (asan, ubsan)")
+deprecated_enable_check(ENABLE_TSAN tsan "Compile with thread sanitizer (tsan)")
+
+set(RUNTIME_CHECK ${RUNTIME_CHECK_DEFAULT} CACHE string "Enable runtime checks. Valid values: ${runtime_checks}")
+
+if(CMAKE_BUILD_TYPE MATCHES "Coverage" AND RUNTIME_CHECK)
+  message(FATAL_ERROR "Cannot set RUNTIME_CHECK with CMAKE_BUILD_TYPE=Coverage")
+endif()
+
+macro(assert_has_sanitizers)
+  if(NOT HAS_SANITIZERS)
+    message(FATAL_ERROR "compiler sanitizers are not available")
+  endif()
+endmacro()
+
+macro(assert_has_valgrind)
+  if(NOT VALGRIND_EXECUTABLE)
+    message(FATAL_ERROR "valgrind is not available")
+  endif()
+endmacro()
+
+if(RUNTIME_CHECK STREQUAL "memcheck")
+  assert_has_valgrind()
+  message(STATUS "Runtime memory checker: valgrind memcheck")
+  set(TEST_EXE_PREFIX "${VALGRIND_EXECUTABLE} --tool=memcheck --leak-check=full ${VALGRIND_COMMON_ARGS}")
+  # TODO aconway 2018-09-06: NO TEST_WRAP_PREFIX, need --trace-children + many suppressions
+
+elseif(RUNTIME_CHECK STREQUAL "helgrind")
+  assert_has_valgrind()
+  message(STATUS "Runtime race checker: valgrind helgrind")
+  set(TEST_EXE_PREFIX "${VALGRIND_EXECUTABLE} --tool=helgrind ${VALGRIND_COMMON_ARGS}")
+  # TODO aconway 2018-09-06: NO TEST_WRAP_PREFIX, need --trace-children + many suppressions
+
+elseif(RUNTIME_CHECK STREQUAL "asan")
+  assert_has_sanitizers()
+  message(STATUS "Runtime memory checker: gcc/clang memory sanitizers")
+  set(SANITIZE_FLAGS "-g -fno-omit-frame-pointer -fsanitize=address,undefined")
+  set(TEST_WRAP_PREFIX "${CMAKE_SOURCE_DIR}/tests/preload_asan.sh $<TARGET_FILE:qpid-proton-core>")
+
+elseif(RUNTIME_CHECK STREQUAL "tsan")
+  assert_has_sanitizers()
+  message(STATUS "Runtime race checker: gcc/clang thread sanitizer")
+  set(SANITIZE_FLAGS "-g -fno-omit-frame-pointer -fsanitize=thread")
+
+elseif(RUNTIME_CHECK)
+  message(FATAL_ERROR "'RUNTIME_CHECK=${RUNTIME_CHECK}' is invalid, valid values: ${runtime_checks}")
+endif()
+
+if(SANITIZE_FLAGS)
+  set(ENABLE_UNDEFINED_ERROR OFF CACHE BOOL "Disabled for sanitizers" FORCE)
+  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SANITIZE_FLAGS}")
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SANITIZE_FLAGS}")
+endif()
+
+if(TEST_EXE_PREFIX)
+  # Add TEST_EXE_PREFIX to TEST_ENV so test runner scripts can use it.
+  list(APPEND TEST_ENV "TEST_EXE_PREFIX=${TEST_EXE_PREFIX}")
+  # Make a CMake-list form of TEST_EXE_PREFIX for add_test() commands
+  separate_arguments(TEST_EXE_PREFIX_CMD UNIX_COMMAND "${TEST_EXE_PREFIX}")
+endif()
+separate_arguments(TEST_WRAP_PREFIX_CMD UNIX_COMMAND "${TEST_WRAP_PREFIX}")

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3e227e16/tests/runtime_check.cmake
----------------------------------------------------------------------
diff --git a/tests/runtime_check.cmake b/tests/runtime_check.cmake
deleted file mode 100644
index 57ae2f5..0000000
--- a/tests/runtime_check.cmake
+++ /dev/null
@@ -1,123 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-# Configuration for code analysis tools: runtime checking and coverage.
-
-# Any test that needs runtime checks should use TEST_EXE_PREFIX and TEST_ENV.
-# Normally they are set as a result of the RUNTIME_CHECK value,
-# but can be set directly for unsupported tools or unusual flags
-# e.g. -DTEST_EXE_PREFIX=rr or -DTEST_EXE_PREFIX="valgrind --tool=massif"
-
-set(TEST_EXE_PREFIX "" CACHE STRING "Prefix for test executable command line")
-set(TEST_WRAP_PREFIX "" CACHE STRING "Prefix for interpreter tests (e.g. python, ruby) that load proton as an extension")
-set(TEST_ENV "" CACHE STRING "Extra environment for tests: name1=value1;name2=value2")
-mark_as_advanced(TEST_EXE_PREFIX TEST_WRAP_PREFIX TEST_ENV)
-
-# Check for valgrind
-find_program(VALGRIND_EXECUTABLE valgrind DOC "location of valgrind program")
-set(VALGRIND_SUPPRESSIONS "${CMAKE_SOURCE_DIR}/tests/valgrind.supp" CACHE STRING "Suppressions file for valgrind")
-set(VALGRIND_COMMON_ARGS "--error-exitcode=42 --quiet --suppressions=${VALGRIND_SUPPRESSIONS}")
-mark_as_advanced(VALGRIND_EXECUTABLE VALGRIND_SUPPRESSIONS VALGRIND_COMMON_ARGS)
-
-# Check for compiler sanitizers
-if((CMAKE_C_COMPILER_ID MATCHES "GNU"
-      AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.8)
-    OR (CMAKE_C_COMPILER_ID MATCHES "Clang"
-      AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.1))
-  set(HAS_SANITIZERS TRUE)
-endif()
-
-# Valid values for RUNTIME_CHECK
-set(runtime_checks OFF asan tsan memcheck helgrind)
-
-# Set the default
-if(NOT CMAKE_BUILD_TYPE MATCHES "Coverage" AND VALGRIND_EXECUTABLE)
-  set(RUNTIME_CHECK_DEFAULT "memcheck")
-endif()
-
-# Deprecated options to enable runtime checks
-macro(deprecated_enable_check old new doc)
-  option(${old} ${doc} OFF)
-  if (${old})
-    message("WARNING: option ${old} is deprecated, use RUNTIME_CHECK=${new} instead")
-    set(RUNTIME_CHECK_DEFAULT ${new})
-  endif()
-endmacro()
-deprecated_enable_check(ENABLE_VALGRIND memcheck "Use valgrind to detect run-time problems")
-deprecated_enable_check(ENABLE_SANITIZERS asan "Compile with memory sanitizers (asan, ubsan)")
-deprecated_enable_check(ENABLE_TSAN tsan "Compile with thread sanitizer (tsan)")
-
-set(RUNTIME_CHECK ${RUNTIME_CHECK_DEFAULT} CACHE string "Enable runtime checks. Valid values: ${runtime_checks}")
-
-if(CMAKE_BUILD_TYPE MATCHES "Coverage" AND RUNTIME_CHECK)
-  message(FATAL_ERROR "Cannot set RUNTIME_CHECK with CMAKE_BUILD_TYPE=Coverage")
-endif()
-
-macro(assert_has_sanitizers)
-  if(NOT HAS_SANITIZERS)
-    message(FATAL_ERROR "compiler sanitizers are not available")
-  endif()
-endmacro()
-
-macro(assert_has_valgrind)
-  if(NOT VALGRIND_EXECUTABLE)
-    message(FATAL_ERROR "valgrind is not available")
-  endif()
-endmacro()
-
-if(RUNTIME_CHECK STREQUAL "memcheck")
-  assert_has_valgrind()
-  message(STATUS "Runtime memory checker: valgrind memcheck")
-  set(TEST_EXE_PREFIX "${VALGRIND_EXECUTABLE} --tool=memcheck --leak-check=full ${VALGRIND_COMMON_ARGS}")
-  # TODO aconway 2018-09-06: NO TEST_WRAP_PREFIX, need --trace-children + many suppressions
-
-elseif(RUNTIME_CHECK STREQUAL "helgrind")
-  assert_has_valgrind()
-  message(STATUS "Runtime race checker: valgrind helgrind")
-  set(TEST_EXE_PREFIX "${VALGRIND_EXECUTABLE} --tool=helgrind ${VALGRIND_COMMON_ARGS}")
-  # TODO aconway 2018-09-06: NO TEST_WRAP_PREFIX, need --trace-children + many suppressions
-
-elseif(RUNTIME_CHECK STREQUAL "asan")
-  assert_has_sanitizers()
-  message(STATUS "Runtime memory checker: gcc/clang memory sanitizers")
-  set(SANITIZE_FLAGS "-g -fno-omit-frame-pointer -fsanitize=address,undefined")
-  set(TEST_WRAP_PREFIX "${CMAKE_SOURCE_DIR}/tests/preload_asan.sh $<TARGET_FILE:qpid-proton-core>")
-
-elseif(RUNTIME_CHECK STREQUAL "tsan")
-  assert_has_sanitizers()
-  message(STATUS "Runtime race checker: gcc/clang thread sanitizer")
-  set(SANITIZE_FLAGS "-g -fno-omit-frame-pointer -fsanitize=thread")
-
-elseif(RUNTIME_CHECK)
-  message(FATAL_ERROR "'RUNTIME_CHECK=${RUNTIME_CHECK}' is invalid, valid values: ${runtime_checks}")
-endif()
-
-if(SANITIZE_FLAGS)
-  set(ENABLE_UNDEFINED_ERROR OFF CACHE BOOL "Disabled for sanitizers" FORCE)
-  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SANITIZE_FLAGS}")
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SANITIZE_FLAGS}")
-endif()
-
-if(TEST_EXE_PREFIX)
-  # Add TEST_EXE_PREFIX to TEST_ENV so test runner scripts can use it.
-  list(APPEND TEST_ENV "TEST_EXE_PREFIX=${TEST_EXE_PREFIX}")
-  # Make a CMake-list form of TEST_EXE_PREFIX for add_test() commands
-  separate_arguments(TEST_EXE_PREFIX_CMD UNIX_COMMAND "${TEST_EXE_PREFIX}")
-endif()
-separate_arguments(TEST_WRAP_PREFIX_CMD UNIX_COMMAND "${TEST_WRAP_PREFIX}")

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3e227e16/tests/share/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/tests/share/CMakeLists.txt b/tests/share/CMakeLists.txt
index a50c0e9..924ce37 100644
--- a/tests/share/CMakeLists.txt
+++ b/tests/share/CMakeLists.txt
@@ -22,7 +22,7 @@ cmake_minimum_required(VERSION 2.8.12)
 project(ProtonExamples)
 include(CTest)
 enable_testing()
-include("tests/runtime_check.cmake")
+include("tests/RuntimeCheck.cmake")
 
 # ind example sub-directories that contain "CMakeLists.txt" or "testme"
 set(ex_dir "${CMAKE_SOURCE_DIR}/examples")


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


[11/50] qpid-proton git commit: PROTON-1930: [cpp] Fix race condition in container_test.cpp

Posted by ac...@apache.org.
PROTON-1930: [cpp] Fix race condition in container_test.cpp

Test was starting container, opening connection and then checking for
["start", "open"] sequence to be set by handlers.

Sometimes the sequence was instead ["open", "start"], which is legal since the
events are generated in different handler contexts.

Fixed by starting container, waiting for "start", opening connection, then
waiting for "open"


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

Branch: refs/heads/go1
Commit: d3c113548146b56cdd8b2a31c2d4dd7ba5dddbfd
Parents: 27edd9a
Author: Alan Conway <ac...@redhat.com>
Authored: Mon Sep 10 12:35:52 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Mon Sep 10 15:50:37 2018 -0400

----------------------------------------------------------------------
 cpp/src/container_test.cpp | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d3c11354/cpp/src/container_test.cpp
----------------------------------------------------------------------
diff --git a/cpp/src/container_test.cpp b/cpp/src/container_test.cpp
index 6f7caa4..0e74aaa 100644
--- a/cpp/src/container_test.cpp
+++ b/cpp/src/container_test.cpp
@@ -366,17 +366,18 @@ void test_container_mt_stop_empty() {
     c.auto_stop( false );
     container_runner runner(c);
     auto t = std::thread(runner);
-    // Must ensure that thread is joined or detached
+    // Must ensure that thread is joined
     try {
         ASSERT_EQUAL("start", th.wait());
         c.stop();
         t.join();
         ASSERT_EQUAL("", th.error().name());
-    } catch (...) {
-        // We don't join as we don't know if we'll be stuck waiting
-        if (t.joinable()) {
-            t.detach();
-        }
+    } catch (const std::exception &e) {
+        std::cerr << FAIL_MSG(e.what()) << std::endl;
+        // If join hangs, let the test die by timeout.  We cannot
+        // detach and continue: deleting the container while t is
+        // still alive will put the process in an undefined state.
+        t.join();
         throw;
     }
 }
@@ -387,19 +388,20 @@ void test_container_mt_stop() {
     c.auto_stop(false);
     container_runner runner(c);
     auto t = std::thread(runner);
-    // Must ensure that thread is joined or detached
+    // Must ensure that thread is joined
     try {
         test_listen_handler lh;
-        c.listen("//:0", lh);       //  Also opens a connection
         ASSERT_EQUAL("start", th.wait());
+        c.listen("//:0", lh);       //  Also opens a connection
         ASSERT_EQUAL("open", th.wait());
         c.stop();
         t.join();
-    } catch (...) {
-        // We don't join as we don't know if we'll be stuck waiting
-        if (t.joinable()) {
-            t.detach();
-        }
+    } catch (const std::exception& e) {
+        std::cerr << FAIL_MSG(e.what()) << std::endl;
+        // If join hangs, let the test die by timeout.  We cannot
+        // detach and continue: deleting the container while t is
+        // still alive will put the process in an undefined state.
+        t.join();
         throw;
     }
 }


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


[40/50] qpid-proton git commit: PROTON-1926: bump so versions based on review by Justin, Andrew, Alan, and Cliff.

Posted by ac...@apache.org.
PROTON-1926: bump so versions based on review by Justin, Andrew, Alan, and Cliff.


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

Branch: refs/heads/go1
Commit: 2149ad68ae1ba3db09ba70b96a4bb4d9991f5ddc
Parents: dc96ae5
Author: Robbie Gemmell <ro...@apache.org>
Authored: Mon Oct 1 12:08:14 2018 +0100
Committer: Robbie Gemmell <ro...@apache.org>
Committed: Mon Oct 1 12:08:14 2018 +0100

----------------------------------------------------------------------
 c/versions.cmake   | 10 +++++-----
 cpp/versions.cmake |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/2149ad68/c/versions.cmake
----------------------------------------------------------------------
diff --git a/c/versions.cmake b/c/versions.cmake
index 00178c6..46a8619 100644
--- a/c/versions.cmake
+++ b/c/versions.cmake
@@ -1,14 +1,14 @@
 set(PN_LIB_CORE_MAJOR_VERSION 10)
-set(PN_LIB_CORE_MINOR_VERSION 5)
-set(PN_LIB_CORE_PATCH_VERSION 1)
+set(PN_LIB_CORE_MINOR_VERSION 6)
+set(PN_LIB_CORE_PATCH_VERSION 0)
 set(PN_LIB_CORE_VERSION "${PN_LIB_CORE_MAJOR_VERSION}.${PN_LIB_CORE_MINOR_VERSION}.${PN_LIB_CORE_PATCH_VERSION}")
 
 set(PN_LIB_PROACTOR_MAJOR_VERSION 1)
 set(PN_LIB_PROACTOR_MINOR_VERSION 3)
-set(PN_LIB_PROACTOR_PATCH_VERSION 3)
+set(PN_LIB_PROACTOR_PATCH_VERSION 4)
 set(PN_LIB_PROACTOR_VERSION "${PN_LIB_PROACTOR_MAJOR_VERSION}.${PN_LIB_PROACTOR_MINOR_VERSION}.${PN_LIB_PROACTOR_PATCH_VERSION}")
 
 set(PN_LIB_LEGACY_MAJOR_VERSION 11)
-set(PN_LIB_LEGACY_MINOR_VERSION 6)
-set(PN_LIB_LEGACY_PATCH_VERSION 1)
+set(PN_LIB_LEGACY_MINOR_VERSION 7)
+set(PN_LIB_LEGACY_PATCH_VERSION 0)
 set(PN_LIB_LEGACY_VERSION "${PN_LIB_LEGACY_MAJOR_VERSION}.${PN_LIB_LEGACY_MINOR_VERSION}.${PN_LIB_LEGACY_PATCH_VERSION}")

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/2149ad68/cpp/versions.cmake
----------------------------------------------------------------------
diff --git a/cpp/versions.cmake b/cpp/versions.cmake
index 4f1e180..d05ecce 100644
--- a/cpp/versions.cmake
+++ b/cpp/versions.cmake
@@ -1,4 +1,4 @@
 set(PN_LIB_CPP_MAJOR_VERSION 12)
-set(PN_LIB_CPP_MINOR_VERSION 2)
+set(PN_LIB_CPP_MINOR_VERSION 3)
 set(PN_LIB_CPP_PATCH_VERSION 0)
 set(PN_LIB_CPP_VERSION "${PN_LIB_CPP_MAJOR_VERSION}.${PN_LIB_CPP_MINOR_VERSION}.${PN_LIB_CPP_PATCH_VERSION}")


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


[43/50] qpid-proton git commit: PROTON-1946: [cpp] connection config parser incorrect defaults

Posted by ac...@apache.org.
PROTON-1946: [cpp] connection config parser incorrect defaults

- Change default "host" to "localhost" (was "")
- Only throw proton::error, don't leak jsoncpp exceptions
- Add tests for SASL/TLS behavior
- Treat explicit "null" valued field as equivalent to a missing field


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

Branch: refs/heads/go1
Commit: b34215170680ebb2f6b60604374c58f598b45803
Parents: 1b554aa
Author: Alan Conway <ac...@redhat.com>
Authored: Mon Oct 1 14:54:35 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Tue Oct 2 10:18:46 2018 -0400

----------------------------------------------------------------------
 cpp/CMakeLists.txt                              |  30 ++--
 cpp/src/connect_config.cpp                      | 103 +++++------
 cpp/src/connect_config_test.cpp                 | 171 +++++++++++++++++--
 cpp/testdata/.config/messaging/TEST             |   1 +
 cpp/testdata/certs/bad-server-certificate.p12   | Bin 0 -> 2186 bytes
 cpp/testdata/certs/bad-server-certificate.pem   |  31 ++++
 cpp/testdata/certs/bad-server-private-key.pem   |  21 +++
 cpp/testdata/certs/bad-server.pkcs12            | Bin 0 -> 2223 bytes
 cpp/testdata/certs/ca-certificate.p12           | Bin 0 -> 1408 bytes
 cpp/testdata/certs/ca-certificate.pem           |  32 ++++
 cpp/testdata/certs/ca.pkcs12                    | Bin 0 -> 2263 bytes
 cpp/testdata/certs/client-certificate.p12       | Bin 0 -> 2242 bytes
 cpp/testdata/certs/client-certificate.pem       |  26 +++
 cpp/testdata/certs/client-certificate1.p12      | Bin 0 -> 2300 bytes
 cpp/testdata/certs/client-certificate1.pem      |  27 +++
 .../certs/client-private-key-no-password.pem    |  19 +++
 cpp/testdata/certs/client-private-key.pem       |  21 +++
 cpp/testdata/certs/client-private-key1.pem      |  21 +++
 cpp/testdata/certs/client-request.pem           |  24 +++
 cpp/testdata/certs/client-request1.pem          |  25 +++
 cpp/testdata/certs/client.pkcs12                | Bin 0 -> 2231 bytes
 cpp/testdata/certs/client1.pkcs12               | Bin 0 -> 2345 bytes
 cpp/testdata/certs/make_certs.sh                |  57 +++++++
 cpp/testdata/certs/server-certificate-lh.pem    |  26 +++
 cpp/testdata/certs/server-certificate.p12       | Bin 0 -> 2258 bytes
 cpp/testdata/certs/server-certificate.pem       |  27 +++
 cpp/testdata/certs/server-lh.pkcs12             | Bin 0 -> 2199 bytes
 cpp/testdata/certs/server-private-key-lh.pem    |  21 +++
 cpp/testdata/certs/server-private-key.pem       |  21 +++
 cpp/testdata/certs/server-request-lh.pem        |  23 +++
 cpp/testdata/certs/server-request.pem           |  24 +++
 cpp/testdata/certs/server-wc-certificate.p12    | Bin 0 -> 2320 bytes
 cpp/testdata/certs/server-wc-certificate.pem    |  28 +++
 cpp/testdata/certs/server-wc-private-key.pem    |  21 +++
 cpp/testdata/certs/server-wc-request.pem        |  25 +++
 cpp/testdata/certs/server-wc.pkcs12             | Bin 0 -> 2317 bytes
 cpp/testdata/certs/server.pkcs12                | Bin 0 -> 2263 bytes
 cpp/testdata/sasl-conf/proton-server.conf.in    |   2 +
 38 files changed, 751 insertions(+), 76 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b3421517/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index 35f5478..7d399d8 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -245,17 +245,17 @@ install (FILES
   ${CMAKE_CURRENT_BINARY_DIR}/ProtonCppConfigVersion.cmake
   DESTINATION ${LIB_INSTALL_DIR}/cmake/ProtonCpp)
 
+set(testdata "${CMAKE_CURRENT_BINARY_DIR}/testdata")
+set(test_env "PN_SASL_CONFIG_PATH=${testdata}/sasl-conf")
+if (CMAKE_SYSTEM_NAME STREQUAL Windows)
+  set(test_env ${test_env} "PATH=$<TARGET_FILE_DIR:qpid-proton>")
+endif()
+
 macro(add_cpp_test test)
   add_executable (${test} src/${test}.cpp)
   target_link_libraries (${test} qpid-proton-cpp ${PLATFORM_LIBS})
-  if (CMAKE_SYSTEM_NAME STREQUAL Windows)
-    add_test (NAME cpp-${test}
-      COMMAND ${PN_ENV_SCRIPT}
-      "PATH=$<TARGET_FILE_DIR:qpid-proton>"
-      $<TARGET_FILE:${test}> ${ARGN})
-  else ()
-    add_test (NAME cpp-${test} COMMAND ${TEST_EXE_PREFIX_CMD} $<TARGET_FILE:${test}> ${ARGN})
-  endif ()
+  add_test (NAME cpp-${test}
+    COMMAND ${PN_ENV_SCRIPT} -- ${test_env}  ${TEST_EXE_PREFIX_CMD} $<TARGET_FILE:${test}> ${ARGN})
 endmacro(add_cpp_test)
 
 add_cpp_test(codec_test)
@@ -270,9 +270,15 @@ add_cpp_test(url_test)
 add_cpp_test(reconnect_test)
 add_cpp_test(link_test)
 if (ENABLE_JSONCPP)
-  # Directories needed by connect_config tests
-  file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/testdata/.config/messaging")
   add_cpp_test(connect_config_test)
-  set_tests_properties(cpp-connect_config_test PROPERTIES
-    WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
+  target_link_libraries(connect_config_test qpid-proton-core) # For pn_sasl_enabled
+  set_tests_properties(cpp-connect_config_test PROPERTIES WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
+  # Test data and output directories for connect_config_test
+  file(COPY  "${CMAKE_CURRENT_SOURCE_DIR}/testdata" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
+  if(CyrusSASL_Saslpasswd_EXECUTABLE)
+    configure_file("${CMAKE_CURRENT_SOURCE_DIR}/testdata/sasl-conf/proton-server.conf.in"
+      "${testdata}/sasl-conf/proton-server.conf")
+    execute_process(COMMAND echo password
+      COMMAND ${CyrusSASL_Saslpasswd_EXECUTABLE} -c -p -f "${testdata}/sasl-conf/proton.sasldb" -u proton user)
+  endif()
 endif()

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b3421517/cpp/src/connect_config.cpp
----------------------------------------------------------------------
diff --git a/cpp/src/connect_config.cpp b/cpp/src/connect_config.cpp
index d85eb04..2bcbfc2 100644
--- a/cpp/src/connect_config.cpp
+++ b/cpp/src/connect_config.cpp
@@ -59,19 +59,19 @@ namespace connect_config {
 
 namespace {
 
-void raise(const string& message) {
-    throw proton::error("connection configuration: " + message);
+proton::error err(const string& message) {
+    return proton::error("connection configuration: " + message);
 }
 
 Value validate(ValueType t, const Value& v, const string& name) {
     if (v.type() != t)
-        raise(msg() << " '" << name << "' expected " << t << ", found " << v.type());
+        throw err(msg() << " '" << name << "' expected " << t << ", found " << v.type());
     return v;
 }
 
 Value get(ValueType t, const Value& obj, const char *key, const Value& dflt=Value()) {
-    Value v = (obj.type() != nullValue) ? obj.get(key, dflt) : dflt;
-    return validate(t, v, key);
+    Value v = obj.get(key, dflt);
+    return v.type() == nullValue ? dflt : validate(t, v, key);
 }
 
 bool get_bool(const Value& obj, const char *key, bool dflt) {
@@ -91,11 +91,10 @@ static const string ETC_FILE_NAME("/etc/messaging/" + FILE_NAME);
 bool exists(const string& name) { return std::ifstream(name.c_str()).good(); }
 
 void parse_sasl(Value root, connection_options& opts) {
-    Value sasl = root.get("sasl", Value());
+    Value sasl = get(objectValue, root, "sasl");
     opts.sasl_enabled(get_bool(sasl, "enable", true));
+    opts.sasl_allow_insecure_mechs(get_bool(sasl, "allow_insecure", false));
     if (sasl.type() != nullValue) {
-        validate(objectValue, sasl, "sasl");
-        opts.sasl_allow_insecure_mechs(get_bool(sasl, "allow_insecure", false));
         Value mechs = sasl.get("mechanisms", Value());
         switch (mechs.type()) {
           case nullValue:
@@ -108,7 +107,7 @@ void parse_sasl(Value root, connection_options& opts) {
               for (ArrayIndex i= 0; i < mechs.size(); ++i) {
                   Value v = mechs.get(i, Value());
                   if (v.type() != stringValue) {
-                      raise(msg() << "'sasl/mechanisms' expect string elements, found " << v.type());
+                      throw err(msg() << "'sasl/mechanisms' expect string elements, found " << v.type());
                   }
                   if (i > 0) s << " ";
                   s << v.asString();
@@ -117,61 +116,65 @@ void parse_sasl(Value root, connection_options& opts) {
               break;
           }
           default:
-            raise(msg() << "'mechanisms' expected string or array, found " << mechs.type());
+            throw err(msg() << "'mechanisms' expected string or array, found " << mechs.type());
         }
     }
 }
 
 void parse_tls(const string& scheme, Value root, connection_options& opts) {
-    Value tls = root.get("tls", Value());
-    if (tls.type() != nullValue) {
-        validate(objectValue, tls, "tls");
-        if (scheme != "amqps") {
-            raise(msg() << "'tls' object is not allowed unless scheme is \"amqps\"");
-        }
-        string ca = get_string(tls, "ca", "");
+    Value tls = get(objectValue, root, "tls");
+    if (scheme == "amqps") { // TLS is enabled
         bool verify = get_bool(tls, "verify", true);
-        Value cert = get(stringValue, tls, "cert");
         ssl::verify_mode mode = verify ? ssl::VERIFY_PEER_NAME : ssl::ANONYMOUS_PEER;
-        if (cert.type() != nullValue) {
-            Value key = get(stringValue, tls, "key");
-            ssl_certificate cert2 = (key.type() != nullValue) ?
-                ssl_certificate(cert.asString(), key.asString()) :
-                ssl_certificate(cert.asString());
-            opts.ssl_client_options(ssl_client_options(cert2, ca, mode));
-        } else {
-            ssl_client_options(ssl_client_options(ca, mode));
+        string ca = get_string(tls, "ca", "");
+        string cert = get_string(tls, "cert", "");
+        string key = get_string(tls, "key", "");
+        ssl_client_options ssl_opts;
+        if (!cert.empty()) {
+            ssl_certificate sc = key.empty() ? ssl_certificate(cert) : ssl_certificate(cert, key);
+            ssl_opts = ssl_client_options(sc, ca, mode);
+        } else if (!ca.empty()) {
+            ssl_opts = ssl_client_options(ca, mode);
         }
+        opts.ssl_client_options(ssl_opts);
+    } else if (tls.type() != nullValue) {
+        throw err(msg() << "'tls' object not allowed unless scheme is \"amqps\"");
     }
 }
 
 } // namespace
 
 std::string parse(std::istream& is, connection_options& opts) {
-    Value root;
-    is >> root;
+    try {
+        Value root;
+        is >> root;
 
-    string scheme = get_string(root, "scheme", "amqps");
-    if (scheme != "amqp" && scheme != "amqps") {
-        raise(msg() << "'scheme' must be \"amqp\" or \"amqps\"");
-    }
+        string scheme = get_string(root, "scheme", "amqps");
+        if (scheme != "amqp" && scheme != "amqps") {
+            throw err(msg() << "'scheme' must be \"amqp\" or \"amqps\"");
+        }
 
-    string host = get_string(root, "host", "");
-    opts.virtual_host(host.c_str());
+        string host = get_string(root, "host", "localhost");
+        opts.virtual_host(host.c_str());
 
-    Value port = root.get("port", scheme);
-    if (!port.isIntegral() && !port.isString()) {
-        raise(msg() << "'port' expected string or integer, found " << port.type());
-    }
+        Value port = root.get("port", scheme);
+        if (!port.isIntegral() && !port.isString()) {
+            throw err(msg() << "'port' expected string or integer, found " << port.type());
+        }
 
-    Value user = root.get("user", Value());
-    if (user.type() != nullValue) opts.user(validate(stringValue, user, "user").asString());
-    Value password = root.get("password", Value());
-    if (password.type() != nullValue) opts.password(validate(stringValue, password, "password").asString());
+        Value user = get(stringValue, root, "user");
+        if (user.type() != nullValue) opts.user(user.asString());
+        Value password = get(stringValue, root, "password");
+        if (password.type() != nullValue) opts.password(password.asString());
 
-    parse_sasl(root, opts);
-    parse_tls(scheme, root, opts);
-    return host + ":" + port.asString();
+        parse_sasl(root, opts);
+        parse_tls(scheme, root, opts);
+        return host + ":" + port.asString();
+    } catch (const std::exception& e) {
+        throw err(e.what());
+    } catch (...) {
+        throw err("unknown error");
+    }
 }
 
 string default_file() {
@@ -193,8 +196,7 @@ string default_file() {
     }
     /* /etc/messaging/FILE_NAME */
     if (exists(ETC_FILE_NAME)) return ETC_FILE_NAME;
-    raise("no default configuration");
-    return "";                  // Never get here, keep compiler happy
+    throw err("no default configuration");
 }
 
 string parse_default(connection_options& opts) {
@@ -204,16 +206,15 @@ string parse_default(connection_options& opts) {
         f.exceptions(~std::ifstream::goodbit);
         f.open(name.c_str());
     } catch (const std::exception& e) {
-        raise(msg() << "error opening '" << name << "': " << e.what());
+        throw err(msg() << "error opening '" << name << "': " << e.what());
     }
     try {
         return parse(f, opts);
     } catch (const std::exception& e) {
-        raise(msg() << "error parsing '" << name << "': " << e.what());
+        throw err(msg() << "error parsing '" << name << "': " << e.what());
     } catch (...) {
-        raise(msg() << "error parsing '" << name);
+        throw err(msg() << "error parsing '" << name);
     }
-    return "";                  // Never get here, keep compiler happy
 }
 
 }} // namespace proton::connect_config

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b3421517/cpp/src/connect_config_test.cpp
----------------------------------------------------------------------
diff --git a/cpp/src/connect_config_test.cpp b/cpp/src/connect_config_test.cpp
index 17f0c4b..0573f8f 100644
--- a/cpp/src/connect_config_test.cpp
+++ b/cpp/src/connect_config_test.cpp
@@ -27,6 +27,12 @@
 #include "proton/listener.hpp"
 #include "proton/messaging_handler.hpp"
 #include "proton/transport.hpp"
+#include "proton/ssl.hpp"
+#include "proton/sasl.hpp"
+
+// The C++ API lacks a way to test for presence of extended SASL or SSL support.
+#include "proton/sasl.h"
+#include "proton/ssl.h"
 
 #include <sstream>
 #include <fstream>
@@ -68,8 +74,8 @@ void test_addr() {
     connection_options opts;
     ASSERT_EQUAL("foo:bar", configure(opts, "{ \"host\":\"foo\", \"port\":\"bar\" }"));
     ASSERT_EQUAL("foo:1234", configure(opts, "{ \"host\":\"foo\", \"port\":\"1234\" }"));
-    ASSERT_EQUAL(":amqps", configure(opts, "{}"));
-    ASSERT_EQUAL(":amqp", configure(opts, "{\"scheme\":\"amqp\"}"));
+    ASSERT_EQUAL("localhost:amqps", configure(opts, "{}"));
+    ASSERT_EQUAL("localhost:amqp", configure(opts, "{\"scheme\":\"amqp\"}"));
     ASSERT_EQUAL("foo:bar", configure(opts, "{ \"host\":\"foo\", /* inline comment */\"port\":\"bar\" // end of line comment\n}"));
 
     ASSERT_THROWS_MSG(error, "'scheme' must be", configure(opts, "{\"scheme\":\"bad\"}"));
@@ -78,17 +84,44 @@ void test_addr() {
     ASSERT_THROWS_MSG(error, "'host' expected string, found boolean", configure(opts, "{\"host\":true}"));
 }
 
+// Hack to write strings with embedded '"' and newlines
+#define RAW_STRING(...) #__VA_ARGS__
+
+void test_invalid() {
+    connection_options opts;
+    ASSERT_THROWS_MSG(proton::error, "Missing '}'", configure(opts, "{"));
+    ASSERT_THROWS_MSG(proton::error, "Syntax error", configure(opts, ""));
+    ASSERT_THROWS_MSG(proton::error, "Missing ','", configure(opts, RAW_STRING({ "user":"x" "host":"y"})));
+    ASSERT_THROWS_MSG(proton::error, "expected string", configure(opts, RAW_STRING({ "scheme":true})));
+    ASSERT_THROWS_MSG(proton::error, "expected object", configure(opts, RAW_STRING({ "tls":""})));
+    ASSERT_THROWS_MSG(proton::error, "expected object", configure(opts, RAW_STRING({ "sasl":true})));
+    ASSERT_THROWS_MSG(proton::error, "expected boolean", configure(opts, RAW_STRING({ "sasl": { "enable":""}})));
+    ASSERT_THROWS_MSG(proton::error, "expected boolean", configure(opts, RAW_STRING({ "tls": { "verify":""}})));
+}
+
 class test_handler : public messaging_handler {
   protected:
-    string config_;
-    listener listener_;
     bool opened_;
-    proton::error_condition error_;
+    connection_options listen_opts_;
+    listener listener_;
 
   public:
+    test_handler(const connection_options& listen_opts = connection_options()) :
+        opened_(false), listen_opts_(listen_opts) {}
+
+    string config_with_port(const string& bare_config) {
+        ostringstream ss;
+        ss << "{" << "\"port\":" << listener_.port() << ", " << bare_config << "}";
+        return ss.str();
+    }
+
+    void connect(container& c, const string& bare_config) {
+        connection_options opts;
+        c.connect(configure(opts, config_with_port(bare_config)), opts);
+    }
 
     void on_container_start(container& c) PN_CPP_OVERRIDE {
-        listener_ = c.listen("//:0");
+        listener_ = c.listen("//:0", listen_opts_);
     }
 
     virtual void check_connection(connection& c) {}
@@ -106,9 +139,9 @@ class test_handler : public messaging_handler {
         FAIL("unexpected error " << e);
     }
 
-    void run(const string& config) {
-        config_ = config;
+    void run() {
         container(*this).run();
+        ASSERT(opened_);
     }
 };
 
@@ -118,15 +151,113 @@ class test_default_connect : public test_handler {
     void on_container_start(container& c) PN_CPP_OVERRIDE {
         test_handler::on_container_start(c);
         ofstream os("connect.json");
-        ASSERT(os << "{ \"port\": " << listener_.port() << "}" << endl);
+        ASSERT(os << config_with_port(RAW_STRING("scheme":"amqp")));
         os.close();
         c.connect();
     }
 
-    void run() {
-        container(*this).run();
-        ASSERT(opened_);
-        ASSERT(!error_);
+    void check_connection(connection& c) PN_CPP_OVERRIDE {
+        ASSERT_EQUAL("localhost", c.virtual_host());
+    }
+};
+
+class test_host_user_pass : public test_handler {
+  public:
+
+    void on_container_start(container& c) PN_CPP_OVERRIDE {
+        test_handler::on_container_start(c);
+        connect(c, RAW_STRING("scheme":"amqp", "host":"127.0.0.1", "user":"user@proton", "password":"password"));
+    }
+
+    void check_connection(connection& c) PN_CPP_OVERRIDE {
+        ASSERT_EQUAL("127.0.0.1", c.virtual_host());
+        if (pn_sasl_extended()) {
+            ASSERT_EQUAL("user@proton", c.user());
+        } else {
+            ASSERT_EQUAL("anonymous", c.user());
+        }
+    }
+};
+
+class test_tls : public test_handler {
+    static connection_options make_opts() {
+        ssl_certificate cert("testdata/certs/server-certificate.pem",
+                             "testdata/certs/server-private-key.pem",
+                             "server-password");
+        connection_options opts;
+        opts.ssl_server_options(ssl_server_options(cert));
+        return opts;
+    }
+
+  public:
+
+    test_tls() : test_handler(make_opts()) {}
+
+    void on_container_start(container& c) PN_CPP_OVERRIDE {
+        test_handler::on_container_start(c);
+        connect(c, RAW_STRING("scheme":"amqps", "tls": { "verify":false }));
+    }
+};
+
+class test_tls_external : public test_handler {
+
+    static connection_options make_opts() {
+        ssl_certificate cert("testdata/certs/server-certificate-lh.pem",
+                             "testdata/certs/server-private-key-lh.pem",
+                             "server-password");
+        connection_options opts;
+        opts.ssl_server_options(ssl_server_options(cert,
+                                                   "testdata/certs/ca-certificate.pem",
+                                                   "testdata/certs/ca-certificate.pem",
+                                                   ssl::VERIFY_PEER));
+        return opts;
+    }
+
+  public:
+
+    test_tls_external() : test_handler(make_opts()) {}
+
+    void on_container_start(container& c) PN_CPP_OVERRIDE {
+        test_handler::on_container_start(c);
+        connect(c, RAW_STRING(
+                    "scheme":"amqps",
+                    "sasl":{ "mechanisms": "EXTERNAL" },
+                    "tls": {
+                            "cert":"testdata/certs/client-certificate.pem",
+                            "key":"testdata/certs/client-private-key-no-password.pem",
+                            "ca":"testdata/certs/ca-certificate.pem",
+                            "verify":true }));
+    }
+};
+
+class test_tls_plain : public test_handler {
+
+    static connection_options make_opts() {
+        ssl_certificate cert("testdata/certs/server-certificate-lh.pem",
+                             "testdata/certs/server-private-key-lh.pem",
+                             "server-password");
+        connection_options opts;
+        opts.ssl_server_options(ssl_server_options(cert,
+                                                   "testdata/certs/ca-certificate.pem",
+                                                   "testdata/certs/ca-certificate.pem",
+                                                   ssl::VERIFY_PEER));
+        return opts;
+    }
+
+  public:
+
+    test_tls_plain() : test_handler(make_opts()) {}
+
+    void on_container_start(container& c) PN_CPP_OVERRIDE {
+        test_handler::on_container_start(c);
+        connect(c, RAW_STRING(
+                    "scheme":"amqps", "user":"user@proton", "password": "password",
+                    "sasl":{ "mechanisms": "PLAIN" },
+                    "tls": {
+                            "cert":"testdata/certs/client-certificate.pem",
+                            "key":"testdata/certs/client-private-key-no-password.pem",
+                            "ca":"testdata/certs/ca-certificate.pem",
+                            "verify":true }));
     }
 };
 
@@ -137,6 +268,20 @@ int main(int argc, char** argv) {
     int failed = 0;
     RUN_ARGV_TEST(failed, test_default_file());
     RUN_ARGV_TEST(failed, test_addr());
+    RUN_ARGV_TEST(failed, test_invalid());
     RUN_ARGV_TEST(failed, test_default_connect().run());
+    RUN_ARGV_TEST(failed, test_host_user_pass().run());
+
+    pn_ssl_domain_t *have_ssl = pn_ssl_domain(PN_SSL_MODE_SERVER);
+    if (have_ssl) {
+        pn_ssl_domain_free(have_ssl);
+        RUN_ARGV_TEST(failed, test_tls().run());
+        RUN_ARGV_TEST(failed, test_tls_external().run());
+        if (pn_sasl_extended()) {
+            RUN_ARGV_TEST(failed, test_tls_plain().run());
+        }
+    } else {
+        std::cout << "SKIP: TLS tests, not available" << std::endl;
+    }
     return failed;
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b3421517/cpp/testdata/.config/messaging/TEST
----------------------------------------------------------------------
diff --git a/cpp/testdata/.config/messaging/TEST b/cpp/testdata/.config/messaging/TEST
new file mode 100644
index 0000000..9537efb
--- /dev/null
+++ b/cpp/testdata/.config/messaging/TEST
@@ -0,0 +1 @@
+Location for test config file
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b3421517/cpp/testdata/certs/bad-server-certificate.p12
----------------------------------------------------------------------
diff --git a/cpp/testdata/certs/bad-server-certificate.p12 b/cpp/testdata/certs/bad-server-certificate.p12
new file mode 100644
index 0000000..b986651
Binary files /dev/null and b/cpp/testdata/certs/bad-server-certificate.p12 differ

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b3421517/cpp/testdata/certs/bad-server-certificate.pem
----------------------------------------------------------------------
diff --git a/cpp/testdata/certs/bad-server-certificate.pem b/cpp/testdata/certs/bad-server-certificate.pem
new file mode 100644
index 0000000..a18b890
--- /dev/null
+++ b/cpp/testdata/certs/bad-server-certificate.pem
@@ -0,0 +1,31 @@
+Bag Attributes
+    friendlyName: bad-server
+    localKeyID: 54 69 6D 65 20 31 35 33 38 34 34 39 30 36 34 33 33 37 
+subject=/CN=127.0.0.1/O=Not Trusted Inc
+issuer=/CN=127.0.0.1/O=Not Trusted Inc
+-----BEGIN CERTIFICATE-----
+MIIEWjCCBAWgAwIBAgIEZQJ1MDANBglghkgBZQMEAwIFADAuMRIwEAYDVQQDEwkx
+MjcuMC4wLjExGDAWBgNVBAoTD05vdCBUcnVzdGVkIEluYzAgFw0xODEwMDIwMjU3
+NDRaGA8yMjkyMDcxNjAyNTc0NFowLjESMBAGA1UEAxMJMTI3LjAuMC4xMRgwFgYD
+VQQKEw9Ob3QgVHJ1c3RlZCBJbmMwggNCMIICNQYHKoZIzjgEATCCAigCggEBAI95
+Ndm5qum/q+2Ies9JUbbzLsWeO683GOjqxJYfPv02BudDUanEGDM5uAnnwq4cU5un
+R1uF0BGtuLR5h3VJhGlcrA6PFLM2CCiiL/onEQo9YqmTRTQJoP5pbEZY+EvdIIGc
+NwmgEFexla3NACM9ulSEtikfnWSO+INEhneXnOwEtDSmrC516Zhd4j2wKS/BEYyf
++p2BgeczjbeStzDXueNJWS9oCZhyFTkV6j1ri0ZTxjNFj4A7MqTC4PJykCVuTj+K
+Owg4ocRQ5OGMGimjfd9eoUPeS2b/BJA+1c8WI+FY1IfGCOl/IRzYHcojy244B2X4
+IuNCvkhMBXY5OWAc1mcCHQC69pamhXj3397n+mfJd8eF7zKyM7rlgMC81WldAoIB
+ABamXFggSFBwTnUCo5dXBA002jo0eMFU1OSlwC0kLuBPluYeS9CQSr2sjzfuseCf
+MYLSPJBDy2QviABBYO35ygmzIHannDKmJ/JHPpGHm6LE50S9IIFUTLVbgCw2jR+o
+PtSJ6U4PoGiOMkKKXHjEeMaNBSe3HJo6uwsL4SxEaJY559POdNsQGmWqK4f2TGgm
+2z7HL0tVmYNLtO2wL3yQ6aSW06VdU1vr/EXU9hn2Pz3tu4c5JcLyJOB3MSltqIfs
+HkdI+H77X963VIQxayIy3uVT3a8CESsNHwLaMJcyJP4nrtqLnUspItm6i+Oe2eED
+pjxSgQvGiLfi7UMW4e8X294DggEFAAKCAQAKvekP2/H9NsTDIq8HlIUiyYxxLGzv
+GDCBruQ7QF8Qqijzkp/cMMQJ6dmPfsga9UCcNjrwixcNq3tI17Cmzj3kEWPOLUeo
+f0ub9j0mBMUqT0V2WzE9jus5nAWvasdNICCFBPYJzSLeu+qsU0qeMKVeq38dXA/o
+WDcGFIWxU1QhZ4Cc9l6QAAguE54KSIzwMNwzE1jJUmCflmSgl2PYuw7cDGhZrw2j
+NUfVmZzQ83iUAd/HrGafXKqtFOD55burf+wZqyUjJpTBo5TCCWXuyHHcn79obRpy
+4hzeZRc/DyM2r2VsHEEeCbOJVD91GOJmfDRE94sGEHyp+q3LLjxcKwjioyEwHzAd
+BgNVHQ4EFgQUJ0NBCiT1XKnqZ/EFlYiODE+npAMwDQYJYIZIAWUDBAMCBQADQAAw
+PQIdAK563jEEkDEhYl11yURvpkLmdUCi03QGI28b9TECHGGaXLOjJ4qDYXj+pAG4
+vWiU3+LoVvFRKAdQjXU=
+-----END CERTIFICATE-----

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b3421517/cpp/testdata/certs/bad-server-private-key.pem
----------------------------------------------------------------------
diff --git a/cpp/testdata/certs/bad-server-private-key.pem b/cpp/testdata/certs/bad-server-private-key.pem
new file mode 100644
index 0000000..d6c5290
--- /dev/null
+++ b/cpp/testdata/certs/bad-server-private-key.pem
@@ -0,0 +1,21 @@
+Bag Attributes
+    friendlyName: bad-server
+    localKeyID: 54 69 6D 65 20 31 35 33 38 34 34 39 30 36 34 33 33 37 
+Key Attributes: <No Attributes>
+-----BEGIN ENCRYPTED PRIVATE KEY-----
+MIICvDBOBgkqhkiG9w0BBQ0wQTApBgkqhkiG9w0BBQwwHAQIN4MFpSDG6hgCAggA
+MAwGCCqGSIb3DQIJBQAwFAYIKoZIhvcNAwcECINvxSQeBIj4BIICaIr+2ZZG1iGE
+czibL6bT7/fLSJve9AKBFjZFhrDNy6YD5Kr+SeCKHZhB/dY4xJlwtYngLrb+7Q4P
+R9wI0yDpXKawSIY9xJ6ZMv0t9nzfPXc7zC2RPzKPe4GTLLrl2Ji6Jt1etVS0gS2R
+ow4fkwuO+f1lIEs7gpZqSYP3UG6Z0Y3kRgCgKrEB8cv8SJKPx5/g8y2pQthCcfdD
+0vZvSG1U44wwrjZHXUWIeZogMnyV9yXgY6XDpWdUbyOr7Gf7qSrqSVlGrVdhAes/
+/li0hkp6tzoKV+/IE6M9lHqdvuu8T9GKCAoba80UQ3XPc3WVKx2ZrQOqsmrOUH7a
+kZQMygcyaSgI0VUSUudZdJ0k88Tbh9h8IDzdhUjE3i9WLF1hyqHESCHipWImvuTg
+TzuWawJnf8mvtKiSVc9dzothBOyk9xR0EQ95rHFpXReQOfZEvLQqCw8Y3TOWKpbU
+Uwc2gd9y2B/Pd3uiYYz5Urvu+usd80qVD18kwSp1U+FFCcP9kgj8ak6JgkmEYTeQ
+FzNNkTFP5mc11r4Reh1brl5yvoKHRs6CRDCxuNTTwJ+i1cBqUAcZVq5nwzujOT06
+JWM6bCoBaygmyJMNDmaBGToalS3GqOvI356hGz2kPvu4M4uEBhrfzt/6Xx0/AFkI
+h4wgq+ddmOqM5ZsdGdALbKH/rSiTM03DLEAIdkAAhjnvjeBHdOMa3sytfNG6mtQE
+rhND+SE+cKHE003e3/WYuSZbB6ZQSkcyI4EkLIfWYcZnPBhahORvD1L+xbuGPwCq
+ET/hD6LDGdVns4QeXGtseR7gzedzObNRXTPtW+QKB9Y=
+-----END ENCRYPTED PRIVATE KEY-----

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b3421517/cpp/testdata/certs/bad-server.pkcs12
----------------------------------------------------------------------
diff --git a/cpp/testdata/certs/bad-server.pkcs12 b/cpp/testdata/certs/bad-server.pkcs12
new file mode 100644
index 0000000..8bbf3c6
Binary files /dev/null and b/cpp/testdata/certs/bad-server.pkcs12 differ

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b3421517/cpp/testdata/certs/ca-certificate.p12
----------------------------------------------------------------------
diff --git a/cpp/testdata/certs/ca-certificate.p12 b/cpp/testdata/certs/ca-certificate.p12
new file mode 100644
index 0000000..d165ec2
Binary files /dev/null and b/cpp/testdata/certs/ca-certificate.p12 differ

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b3421517/cpp/testdata/certs/ca-certificate.pem
----------------------------------------------------------------------
diff --git a/cpp/testdata/certs/ca-certificate.pem b/cpp/testdata/certs/ca-certificate.pem
new file mode 100644
index 0000000..e7a7ff8
--- /dev/null
+++ b/cpp/testdata/certs/ca-certificate.pem
@@ -0,0 +1,32 @@
+Bag Attributes
+    friendlyName: ca
+    localKeyID: 54 69 6D 65 20 31 35 33 38 34 34 39 30 35 39 32 34 31 
+subject=/CN=Trusted.CA.com/O=Trust Me Inc.
+issuer=/CN=Trusted.CA.com/O=Trust Me Inc.
+-----BEGIN CERTIFICATE-----
+MIIEozCCBE6gAwIBAgIEAW3CPDANBglghkgBZQMEAwIFADAxMRcwFQYDVQQDEw5U
+cnVzdGVkLkNBLmNvbTEWMBQGA1UEChMNVHJ1c3QgTWUgSW5jLjAgFw0xODEwMDIw
+MjU3MzlaGA8yMjkyMDcxNjAyNTczOVowMTEXMBUGA1UEAxMOVHJ1c3RlZC5DQS5j
+b20xFjAUBgNVBAoTDVRydXN0IE1lIEluYy4wggNCMIICNQYHKoZIzjgEATCCAigC
+ggEBAI95Ndm5qum/q+2Ies9JUbbzLsWeO683GOjqxJYfPv02BudDUanEGDM5uAnn
+wq4cU5unR1uF0BGtuLR5h3VJhGlcrA6PFLM2CCiiL/onEQo9YqmTRTQJoP5pbEZY
++EvdIIGcNwmgEFexla3NACM9ulSEtikfnWSO+INEhneXnOwEtDSmrC516Zhd4j2w
+KS/BEYyf+p2BgeczjbeStzDXueNJWS9oCZhyFTkV6j1ri0ZTxjNFj4A7MqTC4PJy
+kCVuTj+KOwg4ocRQ5OGMGimjfd9eoUPeS2b/BJA+1c8WI+FY1IfGCOl/IRzYHcoj
+y244B2X4IuNCvkhMBXY5OWAc1mcCHQC69pamhXj3397n+mfJd8eF7zKyM7rlgMC8
+1WldAoIBABamXFggSFBwTnUCo5dXBA002jo0eMFU1OSlwC0kLuBPluYeS9CQSr2s
+jzfuseCfMYLSPJBDy2QviABBYO35ygmzIHannDKmJ/JHPpGHm6LE50S9IIFUTLVb
+gCw2jR+oPtSJ6U4PoGiOMkKKXHjEeMaNBSe3HJo6uwsL4SxEaJY559POdNsQGmWq
+K4f2TGgm2z7HL0tVmYNLtO2wL3yQ6aSW06VdU1vr/EXU9hn2Pz3tu4c5JcLyJOB3
+MSltqIfsHkdI+H77X963VIQxayIy3uVT3a8CESsNHwLaMJcyJP4nrtqLnUspItm6
+i+Oe2eEDpjxSgQvGiLfi7UMW4e8X294DggEFAAKCAQBi9HHyyKJh9nAYIfrOqR43
+CTVVlQ6ymAQ0owndzkNB2oHd/ZGyCbvHfT2pSKGe2Rp/SOa8fKzjZOqbN54YLZO9
+NxGd3qWPhTDvPs8kVWUDnnCjm1tuC4Xs4peYatcjlMnICRhM6RuKWk/iTSx7x9Ct
+o74xb9QVMHfVnnchYY7aEFppaq1gaE0cdB5XQv9ARqm2Uk1HFSxArSLNCNCMOvQu
+KpF0gebgw5IGvmfAbojdHR1jW+ha5cvdaF1xphxQYEty0OvePZA+rUl5EMW//ROl
+mwUXQlPIvqVgayvyVAfXLVEAbc1J59ib7SlOo6aWTZ54vHOBZJf+QQeZFEnD17jG
+o2QwYjASBgNVHRMBAf8ECDAGAQH/AgEAMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggr
+BgEFBQcDAjAOBgNVHQ8BAf8EBAMCAoQwHQYDVR0OBBYEFD2jgfVgC41G8Lhr/k3n
+dPlJLcF8MA0GCWCGSAFlAwQDAgUAA0AAMD0CHQCT65TIzFwXa7Tam4ePyL/qO7oM
+puqdHKEYsGL8Ahwcx3KGKTH7otV2J1Ha3UuiGqYU7HoL5ljVu5iN
+-----END CERTIFICATE-----

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b3421517/cpp/testdata/certs/ca.pkcs12
----------------------------------------------------------------------
diff --git a/cpp/testdata/certs/ca.pkcs12 b/cpp/testdata/certs/ca.pkcs12
new file mode 100644
index 0000000..6ef6338
Binary files /dev/null and b/cpp/testdata/certs/ca.pkcs12 differ

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b3421517/cpp/testdata/certs/client-certificate.p12
----------------------------------------------------------------------
diff --git a/cpp/testdata/certs/client-certificate.p12 b/cpp/testdata/certs/client-certificate.p12
new file mode 100644
index 0000000..c83a4ed
Binary files /dev/null and b/cpp/testdata/certs/client-certificate.p12 differ

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b3421517/cpp/testdata/certs/client-certificate.pem
----------------------------------------------------------------------
diff --git a/cpp/testdata/certs/client-certificate.pem b/cpp/testdata/certs/client-certificate.pem
new file mode 100644
index 0000000..da7c186
--- /dev/null
+++ b/cpp/testdata/certs/client-certificate.pem
@@ -0,0 +1,26 @@
+-----BEGIN CERTIFICATE-----
+MIIEdjCCBCCgAwIBAgIEdGE04zANBglghkgBZQMEAwIFADAxMRcwFQYDVQQDEw5U
+cnVzdGVkLkNBLmNvbTEWMBQGA1UEChMNVHJ1c3QgTWUgSW5jLjAgFw0xODEwMDIw
+MjU3NDJaGA8yMjkyMDcxNjAyNTc0MlowJTESMBAGA1UEAxMJMTI3LjAuMC4xMQ8w
+DQYDVQQKEwZDbGllbnQwggNCMIICNQYHKoZIzjgEATCCAigCggEBAI95Ndm5qum/
+q+2Ies9JUbbzLsWeO683GOjqxJYfPv02BudDUanEGDM5uAnnwq4cU5unR1uF0BGt
+uLR5h3VJhGlcrA6PFLM2CCiiL/onEQo9YqmTRTQJoP5pbEZY+EvdIIGcNwmgEFex
+la3NACM9ulSEtikfnWSO+INEhneXnOwEtDSmrC516Zhd4j2wKS/BEYyf+p2Bgecz
+jbeStzDXueNJWS9oCZhyFTkV6j1ri0ZTxjNFj4A7MqTC4PJykCVuTj+KOwg4ocRQ
+5OGMGimjfd9eoUPeS2b/BJA+1c8WI+FY1IfGCOl/IRzYHcojy244B2X4IuNCvkhM
+BXY5OWAc1mcCHQC69pamhXj3397n+mfJd8eF7zKyM7rlgMC81WldAoIBABamXFgg
+SFBwTnUCo5dXBA002jo0eMFU1OSlwC0kLuBPluYeS9CQSr2sjzfuseCfMYLSPJBD
+y2QviABBYO35ygmzIHannDKmJ/JHPpGHm6LE50S9IIFUTLVbgCw2jR+oPtSJ6U4P
+oGiOMkKKXHjEeMaNBSe3HJo6uwsL4SxEaJY559POdNsQGmWqK4f2TGgm2z7HL0tV
+mYNLtO2wL3yQ6aSW06VdU1vr/EXU9hn2Pz3tu4c5JcLyJOB3MSltqIfsHkdI+H77
+X963VIQxayIy3uVT3a8CESsNHwLaMJcyJP4nrtqLnUspItm6i+Oe2eEDpjxSgQvG
+iLfi7UMW4e8X294DggEFAAKCAQBAeiJsw6hYkJKR7Sgd5Ay8IhnlKfpMxcEUTKkm
+UfFt/HafsQF7XXVqik3+QEtUeDiXsYxIX0xrPI/PrDM2octK3CZlcNe2MAUfmbuB
+NaeQmAek96Jyui2sPO2wCqXn6uj64LF4VAA2a4Qu843kx3kdrzh5ruGaVXrkDoDU
+xbfbpjeNJHkW/EacNO12pnMWRqkTU+Daj0nb6daNrzu1Soon+0+TuADvepe6AClV
+LgHZ+/gR3e+45UK9bs8RZpFlKy/S0PHVF32AtZAeFrtJpNrq7itpWZvJux16yoWW
+tvSFMti3LvATMV/0z/3S21fLLK5rnZNIFO5KS5hn9ajBwtOgo0IwQDAfBgNVHSME
+GDAWgBQ9o4H1YAuNRvC4a/5N53T5SS3BfDAdBgNVHQ4EFgQUzKZ8bzmfn/iJAEmd
+YdtqKdVAfGkwDQYJYIZIAWUDBAMCBQADQQAwPgIdAJa+UfWOdTeBjYjbL4gAtMKf
+0Anf5279cwXzxncCHQCC1NI/wj63MrhbSIcs+5wEsJ8DQsQy/cdQWjQO
+-----END CERTIFICATE-----

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b3421517/cpp/testdata/certs/client-certificate1.p12
----------------------------------------------------------------------
diff --git a/cpp/testdata/certs/client-certificate1.p12 b/cpp/testdata/certs/client-certificate1.p12
new file mode 100644
index 0000000..b96511b
Binary files /dev/null and b/cpp/testdata/certs/client-certificate1.p12 differ

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b3421517/cpp/testdata/certs/client-certificate1.pem
----------------------------------------------------------------------
diff --git a/cpp/testdata/certs/client-certificate1.pem b/cpp/testdata/certs/client-certificate1.pem
new file mode 100644
index 0000000..16fbcb5
--- /dev/null
+++ b/cpp/testdata/certs/client-certificate1.pem
@@ -0,0 +1,27 @@
+-----BEGIN CERTIFICATE-----
+MIIEqzCCBFegAwIBAgIEC1BF+zANBglghkgBZQMEAwIFADAxMRcwFQYDVQQDEw5U
+cnVzdGVkLkNBLmNvbTEWMBQGA1UEChMNVHJ1c3QgTWUgSW5jLjAgFw0xODEwMDIw
+MjU3NDNaGA8yMjkyMDcxNjAyNTc0M1owXDEMMAoGA1UECxMDRGV2MQ0wCwYDVQQH
+EwRDaXR5MQswCQYDVQQIEwJTVDELMAkGA1UEBhMCVVMxEjAQBgNVBAMTCTEyNy4w
+LjAuMTEPMA0GA1UEChMGQ2xpZW50MIIDQjCCAjUGByqGSM44BAEwggIoAoIBAQCP
+eTXZuarpv6vtiHrPSVG28y7FnjuvNxjo6sSWHz79NgbnQ1GpxBgzObgJ58KuHFOb
+p0dbhdARrbi0eYd1SYRpXKwOjxSzNggooi/6JxEKPWKpk0U0CaD+aWxGWPhL3SCB
+nDcJoBBXsZWtzQAjPbpUhLYpH51kjviDRIZ3l5zsBLQ0pqwudemYXeI9sCkvwRGM
+n/qdgYHnM423krcw17njSVkvaAmYchU5Feo9a4tGU8YzRY+AOzKkwuDycpAlbk4/
+ijsIOKHEUOThjBopo33fXqFD3ktm/wSQPtXPFiPhWNSHxgjpfyEc2B3KI8tuOAdl
++CLjQr5ITAV2OTlgHNZnAh0AuvaWpoV499/e5/pnyXfHhe8ysjO65YDAvNVpXQKC
+AQAWplxYIEhQcE51AqOXVwQNNNo6NHjBVNTkpcAtJC7gT5bmHkvQkEq9rI837rHg
+nzGC0jyQQ8tkL4gAQWDt+coJsyB2p5wypifyRz6Rh5uixOdEvSCBVEy1W4AsNo0f
+qD7UielOD6BojjJCilx4xHjGjQUntxyaOrsLC+EsRGiWOefTznTbEBplqiuH9kxo
+Jts+xy9LVZmDS7TtsC98kOmkltOlXVNb6/xF1PYZ9j897buHOSXC8iTgdzEpbaiH
+7B5HSPh++1/et1SEMWsiMt7lU92vAhErDR8C2jCXMiT+J67ai51LKSLZuovjntnh
+A6Y8UoELxoi34u1DFuHvF9veA4IBBQACggEAP6WuNvc2HWNn9yhtvaXjdmdF99VE
+XnJJzDYTQH0gOZgWJbB+Wu/ybSYz2/lvhFWw22rp/8hYfcnW1W8X2RBidzhhevKV
+bhj3JrjSR2u2H53K3tve2nhteo84Hu8On8dywCcVcmIIeMzRnYWb14DK0QV1YX1K
+Ks8Or+2h14i93cpzhqGd5CuvbeoHQilLxWcjpmTK4fhSfXeE+KrSund79naFXMha
+bvJlcrNkXxLPTkVxPFmFVWuS7nI6h5KoPfyLWGZUjeehTTTP6aFDyxbBULnMcNq5
+AZBWi6t6iNWdbzNkcfki2uYv3mIEXVr2C2nvS2LE/n0I4T9tjkr0jD2kOqNCMEAw
+HwYDVR0jBBgwFoAUPaOB9WALjUbwuGv+Ted0+UktwXwwHQYDVR0OBBYEFMXbw8rs
+5agCIXAWjyMYZaHrMPrMMA0GCWCGSAFlAwQDAgUAAz8AMDwCHBkFCKc1WPj6bZbf
+Z+MoJi5pNHKT0DlNIBmX8/8CHBGEd72cWKZBmkhlSgI5kMACamJyuYRBIaVD3/Y=
+-----END CERTIFICATE-----

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b3421517/cpp/testdata/certs/client-private-key-no-password.pem
----------------------------------------------------------------------
diff --git a/cpp/testdata/certs/client-private-key-no-password.pem b/cpp/testdata/certs/client-private-key-no-password.pem
new file mode 100644
index 0000000..cb02fd9
--- /dev/null
+++ b/cpp/testdata/certs/client-private-key-no-password.pem
@@ -0,0 +1,19 @@
+Bag Attributes
+    friendlyName: client-certificate
+    localKeyID: 54 69 6D 65 20 31 35 33 38 34 34 39 30 36 31 39 34 35 
+Key Attributes: <No Attributes>
+-----BEGIN PRIVATE KEY-----
+MIICXAIBADCCAjUGByqGSM44BAEwggIoAoIBAQCPeTXZuarpv6vtiHrPSVG28y7F
+njuvNxjo6sSWHz79NgbnQ1GpxBgzObgJ58KuHFObp0dbhdARrbi0eYd1SYRpXKwO
+jxSzNggooi/6JxEKPWKpk0U0CaD+aWxGWPhL3SCBnDcJoBBXsZWtzQAjPbpUhLYp
+H51kjviDRIZ3l5zsBLQ0pqwudemYXeI9sCkvwRGMn/qdgYHnM423krcw17njSVkv
+aAmYchU5Feo9a4tGU8YzRY+AOzKkwuDycpAlbk4/ijsIOKHEUOThjBopo33fXqFD
+3ktm/wSQPtXPFiPhWNSHxgjpfyEc2B3KI8tuOAdl+CLjQr5ITAV2OTlgHNZnAh0A
+uvaWpoV499/e5/pnyXfHhe8ysjO65YDAvNVpXQKCAQAWplxYIEhQcE51AqOXVwQN
+NNo6NHjBVNTkpcAtJC7gT5bmHkvQkEq9rI837rHgnzGC0jyQQ8tkL4gAQWDt+coJ
+syB2p5wypifyRz6Rh5uixOdEvSCBVEy1W4AsNo0fqD7UielOD6BojjJCilx4xHjG
+jQUntxyaOrsLC+EsRGiWOefTznTbEBplqiuH9kxoJts+xy9LVZmDS7TtsC98kOmk
+ltOlXVNb6/xF1PYZ9j897buHOSXC8iTgdzEpbaiH7B5HSPh++1/et1SEMWsiMt7l
+U92vAhErDR8C2jCXMiT+J67ai51LKSLZuovjntnhA6Y8UoELxoi34u1DFuHvF9ve
+BB4CHDooXtQ8wzgxsdAvDqgVW9IHuar1l+//1qxE3kg=
+-----END PRIVATE KEY-----

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b3421517/cpp/testdata/certs/client-private-key.pem
----------------------------------------------------------------------
diff --git a/cpp/testdata/certs/client-private-key.pem b/cpp/testdata/certs/client-private-key.pem
new file mode 100644
index 0000000..92d7d89
--- /dev/null
+++ b/cpp/testdata/certs/client-private-key.pem
@@ -0,0 +1,21 @@
+Bag Attributes
+    friendlyName: client-certificate
+    localKeyID: 54 69 6D 65 20 31 35 33 38 34 34 39 30 36 31 39 34 35 
+Key Attributes: <No Attributes>
+-----BEGIN ENCRYPTED PRIVATE KEY-----
+MIICvDBOBgkqhkiG9w0BBQ0wQTApBgkqhkiG9w0BBQwwHAQIPRdD+ab7CMkCAggA
+MAwGCCqGSIb3DQIJBQAwFAYIKoZIhvcNAwcECCbLUrG5jy6RBIICaP4jF1eYEHeH
+wKuP1gxMn1fuKnzw7oo4YqZgZM9Fdi7wnaBvm4ZKEQsUdxB9zX4qzBo6PmWn4hVz
+6WDBorMGpFDEqDBHkieZwxi2ypNmNCN5lLsHmqa6jSr4Hw6s+IKgNdaL/aINgeKy
+xY8WfAfkGAiiDwRwmbLCRq+rP7BWgB9vEvt6wv5kNfFk041FeSgQvjrn3K8EteF4
+eXT1eO1xMsNmqZd2SCgWUUsVKooeV/jBIzxzHpNSE5vaBnTSoez/MIrFfotbbf09
+zYVRJdkwlCwthTqzfbLorNeKqAVkeI/jLiuI3SvXsKIwW3wAmmhPPd9ukh4+WRnk
+YhT87OC9h8k5Z4O/0WIo73zGyfi7GeBcU69eMaQEkpf8Xnf3k9YjX3KnI5vlXEqY
+3WpD8PFXrnySWx8BzNWVG9/HKgD3+cq2O37Prgd9ULP9azrW0CTzV3uwpnYHXpjj
+jR+GYxf535rIu4PCoYaPq7tJzpSohMXK+cVeVp+UT40KZVXNkDBhI0B+au65QmKE
+2cAaYd4ysr0mU0qQBInFc2g+wUPibDxXb7I5vhXEglDvI4VZVScHSAZN7usDxOcI
+MtUmrpPNmjgHofvtXg+L784JrDkTyTWC1XUVE3EhP4oXuG9kWL84Q0OMhIlJKBuI
+yQcwYuORWRU0b64kZigektRruBjZOzpYfN56VJaFlbGtVE5PIVrClPY65aGdNWUd
+MJeTRm5KsHp5sHG8h2OsDkAiXbG1eaRkRLwyN/nESbLMjGGxueTuOW/xqAlt54dC
+0x1H0MN1BToe7yua8mkSydyfidkGgFHc/S2nD3ot1ps=
+-----END ENCRYPTED PRIVATE KEY-----

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b3421517/cpp/testdata/certs/client-private-key1.pem
----------------------------------------------------------------------
diff --git a/cpp/testdata/certs/client-private-key1.pem b/cpp/testdata/certs/client-private-key1.pem
new file mode 100644
index 0000000..071e5c5
--- /dev/null
+++ b/cpp/testdata/certs/client-private-key1.pem
@@ -0,0 +1,21 @@
+Bag Attributes
+    friendlyName: client-certificate1
+    localKeyID: 54 69 6D 65 20 31 35 33 38 34 34 39 30 36 33 31 37 37 
+Key Attributes: <No Attributes>
+-----BEGIN ENCRYPTED PRIVATE KEY-----
+MIICvDBOBgkqhkiG9w0BBQ0wQTApBgkqhkiG9w0BBQwwHAQIuxW2yTuxF0ICAggA
+MAwGCCqGSIb3DQIJBQAwFAYIKoZIhvcNAwcECMhCoBDSVwIfBIICaEJqhKKhkeNb
+8x8iQ+JmrNaVWMVClv1Sg+ajTACgsLUyb5herY+Ph009/VwJmeTZtFRZofEa6Jtn
+OvXCSkpnyzA02hV1gxXkAp8LUzS1QPVNSMikZs2zrvHz86wbe3N1P7fjz2YgSyKm
+LIH6ozN85H5t6IF/yiZKxRn5869/d6r1J1CK/HJce8TZenaQCD5vtGLaHWFYaWpq
+GCITj1Wbgq1E9KF3RjAvpCp+9vL//xUhQYPnM7SScCES+jfzU6pqXgKRaVKgbM+N
+oMTnOo0PNlDbl+xRCrJuOEIpztDNFXaMAJLh2aswPfOzXctdTkVsqBfQuxY+nD2Q
+jarTldSl8QfkMOKKgYf+xTtUmt5JDBZITr5MmaihrRsZQo5pjfHsYGgcC1r54FU8
+CkoiFsLHuZG0martgLA6N/k2+t152u97PKD2q2U0n6n6jniO7zqTjqn1sb3drxkj
+7AaUSfK54zUJmTdnKGcYfK9tQRjKmAQenIbX5Qf+oq68vC+HWRbHz287ft0ZnXe6
+kiIpAUThvZ+i3wkLZcs69EPvtIk7NrdsA/k7gqipM+QpXMy1cmV0Fm6Qn1zsEDBw
+108eQGP4Jd5tvTFoeXCVDKHm2wxZSieLmStDXohLIlzxtdbZnTLKtlkhE2NpVxz8
+bjjAg7Qji2CWa7HnNYTEjvzG/IELZxMtrr7nGs1Ee8QxeTufwJsqSoMud8LteGvp
+wOy+BHciepBx9aohVX8s56wqVtrUmJfdrL/89ag4tvU8O155Wj0F/wOXpD658cwD
+iMt5cgsyGrOz8+f6QASE85fSN7d9DJLD+iGtD5AcWNE=
+-----END ENCRYPTED PRIVATE KEY-----

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b3421517/cpp/testdata/certs/client-request.pem
----------------------------------------------------------------------
diff --git a/cpp/testdata/certs/client-request.pem b/cpp/testdata/certs/client-request.pem
new file mode 100644
index 0000000..c5b8fb3
--- /dev/null
+++ b/cpp/testdata/certs/client-request.pem
@@ -0,0 +1,24 @@
+-----BEGIN NEW CERTIFICATE REQUEST-----
+MIID9zCCA6ICAQAwJTESMBAGA1UEAxMJMTI3LjAuMC4xMQ8wDQYDVQQKEwZDbGll
+bnQwggNCMIICNQYHKoZIzjgEATCCAigCggEBAI95Ndm5qum/q+2Ies9JUbbzLsWe
+O683GOjqxJYfPv02BudDUanEGDM5uAnnwq4cU5unR1uF0BGtuLR5h3VJhGlcrA6P
+FLM2CCiiL/onEQo9YqmTRTQJoP5pbEZY+EvdIIGcNwmgEFexla3NACM9ulSEtikf
+nWSO+INEhneXnOwEtDSmrC516Zhd4j2wKS/BEYyf+p2BgeczjbeStzDXueNJWS9o
+CZhyFTkV6j1ri0ZTxjNFj4A7MqTC4PJykCVuTj+KOwg4ocRQ5OGMGimjfd9eoUPe
+S2b/BJA+1c8WI+FY1IfGCOl/IRzYHcojy244B2X4IuNCvkhMBXY5OWAc1mcCHQC6
+9pamhXj3397n+mfJd8eF7zKyM7rlgMC81WldAoIBABamXFggSFBwTnUCo5dXBA00
+2jo0eMFU1OSlwC0kLuBPluYeS9CQSr2sjzfuseCfMYLSPJBDy2QviABBYO35ygmz
+IHannDKmJ/JHPpGHm6LE50S9IIFUTLVbgCw2jR+oPtSJ6U4PoGiOMkKKXHjEeMaN
+BSe3HJo6uwsL4SxEaJY559POdNsQGmWqK4f2TGgm2z7HL0tVmYNLtO2wL3yQ6aSW
+06VdU1vr/EXU9hn2Pz3tu4c5JcLyJOB3MSltqIfsHkdI+H77X963VIQxayIy3uVT
+3a8CESsNHwLaMJcyJP4nrtqLnUspItm6i+Oe2eEDpjxSgQvGiLfi7UMW4e8X294D
+ggEFAAKCAQBAeiJsw6hYkJKR7Sgd5Ay8IhnlKfpMxcEUTKkmUfFt/HafsQF7XXVq
+ik3+QEtUeDiXsYxIX0xrPI/PrDM2octK3CZlcNe2MAUfmbuBNaeQmAek96Jyui2s
+PO2wCqXn6uj64LF4VAA2a4Qu843kx3kdrzh5ruGaVXrkDoDUxbfbpjeNJHkW/Eac
+NO12pnMWRqkTU+Daj0nb6daNrzu1Soon+0+TuADvepe6AClVLgHZ+/gR3e+45UK9
+bs8RZpFlKy/S0PHVF32AtZAeFrtJpNrq7itpWZvJux16yoWWtvSFMti3LvATMV/0
+z/3S21fLLK5rnZNIFO5KS5hn9ajBwtOgoDAwLgYJKoZIhvcNAQkOMSEwHzAdBgNV
+HQ4EFgQUzKZ8bzmfn/iJAEmdYdtqKdVAfGkwDQYJYIZIAWUDBAMCBQADQAAwPQId
+ALlARQZwWqzfFb1SvnNhmSdF4Mi7Uxg+J6fSiW8CHBUpOXuQdC1DLanxFZiQGwX0
+6r4ApU5duGCOBTc=
+-----END NEW CERTIFICATE REQUEST-----

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b3421517/cpp/testdata/certs/client-request1.pem
----------------------------------------------------------------------
diff --git a/cpp/testdata/certs/client-request1.pem b/cpp/testdata/certs/client-request1.pem
new file mode 100644
index 0000000..e8819ab
--- /dev/null
+++ b/cpp/testdata/certs/client-request1.pem
@@ -0,0 +1,25 @@
+-----BEGIN NEW CERTIFICATE REQUEST-----
+MIIELTCCA9kCAQAwXDEMMAoGA1UECxMDRGV2MQ0wCwYDVQQHEwRDaXR5MQswCQYD
+VQQIEwJTVDELMAkGA1UEBhMCVVMxEjAQBgNVBAMTCTEyNy4wLjAuMTEPMA0GA1UE
+ChMGQ2xpZW50MIIDQjCCAjUGByqGSM44BAEwggIoAoIBAQCPeTXZuarpv6vtiHrP
+SVG28y7FnjuvNxjo6sSWHz79NgbnQ1GpxBgzObgJ58KuHFObp0dbhdARrbi0eYd1
+SYRpXKwOjxSzNggooi/6JxEKPWKpk0U0CaD+aWxGWPhL3SCBnDcJoBBXsZWtzQAj
+PbpUhLYpH51kjviDRIZ3l5zsBLQ0pqwudemYXeI9sCkvwRGMn/qdgYHnM423krcw
+17njSVkvaAmYchU5Feo9a4tGU8YzRY+AOzKkwuDycpAlbk4/ijsIOKHEUOThjBop
+o33fXqFD3ktm/wSQPtXPFiPhWNSHxgjpfyEc2B3KI8tuOAdl+CLjQr5ITAV2OTlg
+HNZnAh0AuvaWpoV499/e5/pnyXfHhe8ysjO65YDAvNVpXQKCAQAWplxYIEhQcE51
+AqOXVwQNNNo6NHjBVNTkpcAtJC7gT5bmHkvQkEq9rI837rHgnzGC0jyQQ8tkL4gA
+QWDt+coJsyB2p5wypifyRz6Rh5uixOdEvSCBVEy1W4AsNo0fqD7UielOD6BojjJC
+ilx4xHjGjQUntxyaOrsLC+EsRGiWOefTznTbEBplqiuH9kxoJts+xy9LVZmDS7Tt
+sC98kOmkltOlXVNb6/xF1PYZ9j897buHOSXC8iTgdzEpbaiH7B5HSPh++1/et1SE
+MWsiMt7lU92vAhErDR8C2jCXMiT+J67ai51LKSLZuovjntnhA6Y8UoELxoi34u1D
+FuHvF9veA4IBBQACggEAP6WuNvc2HWNn9yhtvaXjdmdF99VEXnJJzDYTQH0gOZgW
+JbB+Wu/ybSYz2/lvhFWw22rp/8hYfcnW1W8X2RBidzhhevKVbhj3JrjSR2u2H53K
+3tve2nhteo84Hu8On8dywCcVcmIIeMzRnYWb14DK0QV1YX1KKs8Or+2h14i93cpz
+hqGd5CuvbeoHQilLxWcjpmTK4fhSfXeE+KrSund79naFXMhabvJlcrNkXxLPTkVx
+PFmFVWuS7nI6h5KoPfyLWGZUjeehTTTP6aFDyxbBULnMcNq5AZBWi6t6iNWdbzNk
+cfki2uYv3mIEXVr2C2nvS2LE/n0I4T9tjkr0jD2kOqAwMC4GCSqGSIb3DQEJDjEh
+MB8wHQYDVR0OBBYEFMXbw8rs5agCIXAWjyMYZaHrMPrMMA0GCWCGSAFlAwQDAgUA
+Az8AMDwCHEnHjXuiO2BX/JRz6Wg3nUCFt+Z0YbiuaQ8vhxQCHGTrDJZI2JRDsM+E
+XmeCfhm9+upOobERNBL17wI=
+-----END NEW CERTIFICATE REQUEST-----

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b3421517/cpp/testdata/certs/client.pkcs12
----------------------------------------------------------------------
diff --git a/cpp/testdata/certs/client.pkcs12 b/cpp/testdata/certs/client.pkcs12
new file mode 100644
index 0000000..1035c5e
Binary files /dev/null and b/cpp/testdata/certs/client.pkcs12 differ

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b3421517/cpp/testdata/certs/client1.pkcs12
----------------------------------------------------------------------
diff --git a/cpp/testdata/certs/client1.pkcs12 b/cpp/testdata/certs/client1.pkcs12
new file mode 100644
index 0000000..b729a53
Binary files /dev/null and b/cpp/testdata/certs/client1.pkcs12 differ

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b3421517/cpp/testdata/certs/make_certs.sh
----------------------------------------------------------------------
diff --git a/cpp/testdata/certs/make_certs.sh b/cpp/testdata/certs/make_certs.sh
new file mode 100755
index 0000000..073b620
--- /dev/null
+++ b/cpp/testdata/certs/make_certs.sh
@@ -0,0 +1,57 @@
+#!/bin/bash
+# Create certificates used by tests
+
+rm -f *.pem *.pkcs12
+
+# Create a self-signed certificate for the CA, and a private key to sign certificate requests:
+keytool -storetype pkcs12 -keystore ca.pkcs12 -storepass ca-password -alias ca -keypass ca-password -genkey -dname "O=Trust Me Inc.,CN=Trusted.CA.com" -validity 99999 -ext bc:c=ca:true,pathlen:0 -ext ku:c=digitalSignature,keyCertSign -ext ExtendedkeyUsage=serverAuth,clientAuth
+openssl pkcs12 -nokeys -passin pass:ca-password -in ca.pkcs12 -passout pass:ca-password -out ca-certificate.pem
+
+# Create a certificate request for the server certificate.  Use the CA's certificate to sign it:
+keytool -storetype pkcs12 -keystore server.pkcs12 -storepass server-password -alias server-certificate -keypass server-password -genkey  -dname "O=Server,CN=A1.Good.Server.domain.com" -validity 99999
+keytool -storetype pkcs12 -keystore server.pkcs12 -storepass server-password -alias server-certificate -keypass server-password -certreq -file server-request.pem
+keytool -storetype pkcs12 -keystore ca.pkcs12 -storepass ca-password -alias ca -keypass ca-password -gencert -rfc -validity 99999 -infile server-request.pem -outfile server-certificate.pem
+openssl pkcs12 -nocerts -passin pass:server-password -in server.pkcs12 -passout pass:server-password -out server-private-key.pem
+
+# Create a certificate request for a server certificate using localhost.  Use the CA's certificate to sign it:
+keytool -storetype pkcs12 -keystore server-lh.pkcs12 -storepass server-password -alias server-certificate -keypass server-password -genkey  -dname "CN=localhost" -validity 99999
+keytool -storetype pkcs12 -keystore server-lh.pkcs12 -storepass server-password -alias server-certificate -keypass server-password -certreq -file server-request-lh.pem
+keytool -storetype pkcs12 -keystore ca.pkcs12 -storepass ca-password -alias ca -keypass ca-password -gencert -rfc -validity 99999 -infile server-request-lh.pem -outfile server-certificate-lh.pem
+openssl pkcs12 -nocerts -passin pass:server-password -in server-lh.pkcs12 -passout pass:server-password -out server-private-key-lh.pem
+
+# Create a certificate request for the client certificate.  Use the CA's certificate to sign it:
+keytool -storetype pkcs12 -keystore client.pkcs12 -storepass client-password -alias client-certificate -keypass client-password -genkey  -dname "O=Client,CN=127.0.0.1" -validity 99999
+keytool -storetype pkcs12 -keystore client.pkcs12 -storepass client-password -alias client-certificate -keypass client-password -certreq -file client-request.pem
+keytool -storetype pkcs12 -keystore ca.pkcs12 -storepass ca-password -alias ca -keypass ca-password -gencert -rfc -validity 99999 -infile client-request.pem -outfile client-certificate.pem
+openssl pkcs12 -nocerts -passin pass:client-password -in client.pkcs12 -passout pass:client-password -out client-private-key.pem
+openssl pkcs12 -nocerts -passin pass:client-password -in client.pkcs12 -nodes -out client-private-key-no-password.pem
+
+# Create another client certificate with a different subject line
+keytool -storetype pkcs12 -keystore client1.pkcs12 -storepass client-password -alias client-certificate1 -keypass client-password -genkey  -dname "O=Client,CN=127.0.0.1,C=US,ST=ST,L=City,OU=Dev" -validity 99999
+keytool -storetype pkcs12 -keystore client1.pkcs12 -storepass client-password -alias client-certificate1 -keypass client-password -certreq -file client-request1.pem
+keytool -storetype pkcs12 -keystore ca.pkcs12 -storepass ca-password -alias ca -keypass ca-password -gencert -rfc -validity 99999 -infile client-request1.pem -outfile client-certificate1.pem
+openssl pkcs12 -nocerts -passin pass:client-password -in client1.pkcs12 -passout pass:client-password -out client-private-key1.pem
+
+# Create a "bad" certificate - not signed by a trusted authority
+keytool -storetype pkcs12 -keystore bad-server.pkcs12 -storepass server-password -alias bad-server -keypass server-password -genkey -dname "O=Not Trusted Inc,CN=127.0.0.1" -validity 99999
+openssl pkcs12 -nocerts -passin pass:server-password -in bad-server.pkcs12 -passout pass:server-password -out bad-server-private-key.pem
+openssl pkcs12 -nokeys  -passin pass:server-password -in bad-server.pkcs12 -passout pass:server-password -out bad-server-certificate.pem
+
+# Create a server certificate with several alternate names, including a wildcarded common name:
+keytool -ext san=dns:alternate.name.one.com,dns:another.name.com -storetype pkcs12 -keystore server-wc.pkcs12 -storepass server-password -alias server-wc-certificate -keypass server-password -genkeypair -dname "O=Server,CN=*.prefix*.domain.com" -validity 99999
+keytool -ext san=dns:alternate.name.one.com,dns:another.name.com -storetype pkcs12 -keystore server-wc.pkcs12 -storepass server-password -alias server-wc-certificate -keypass server-password -certreq -file server-wc-request.pem
+keytool -ext san=dns:alternate.name.one.com,dns:another.name.com  -storetype pkcs12 -keystore ca.pkcs12 -storepass ca-password -alias ca -keypass ca-password -gencert -rfc -validity 99999 -infile server-wc-request.pem -outfile server-wc-certificate.pem
+openssl pkcs12 -nocerts -passin pass:server-password -in server-wc.pkcs12 -passout pass:server-password -out server-wc-private-key.pem
+
+# Create pkcs12 versions of the above certificates (for Windows SChannel)
+# The CA certificate store/DB is created without public keys.
+# Give the "p12" files the same base name so the tests can just change the extension to switch between platforms.
+# These certificates might work for OpenSSL <-> SChannel interop tests, but note that the DH cypher suite
+# overlap is poor between platforms especially for older Windows versions.  RSA certificates are better for
+# interop (or PFS-friendly certificates on newer platforms).
+openssl pkcs12 -export -out ca-certificate.p12 -in ca-certificate.pem -name ca-certificate -nokeys -passout pass:
+openssl pkcs12 -export -out server-certificate.p12 -passin pass:server-password -passout pass:server-password -inkey server-private-key.pem -in server-certificate.pem -name server-certificate
+openssl pkcs12 -export -out client-certificate.p12 -passin pass:client-password -passout pass:client-password -inkey client-private-key.pem -in client-certificate.pem -name client-certificate
+openssl pkcs12 -export -out client-certificate1.p12 -passin pass:client-password -passout pass:client-password -inkey client-private-key1.pem -in client-certificate1.pem -name client-certificate1
+openssl pkcs12 -export -out bad-server-certificate.p12 -passin pass:server-password -passout pass:server-password -inkey bad-server-private-key.pem -in bad-server-certificate.pem -name bad-server
+openssl pkcs12 -export -out server-wc-certificate.p12 -passin pass:server-password -passout pass:server-password -inkey server-wc-private-key.pem -in server-wc-certificate.pem -name server-wc-certificate

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b3421517/cpp/testdata/certs/server-certificate-lh.pem
----------------------------------------------------------------------
diff --git a/cpp/testdata/certs/server-certificate-lh.pem b/cpp/testdata/certs/server-certificate-lh.pem
new file mode 100644
index 0000000..2f8af74
--- /dev/null
+++ b/cpp/testdata/certs/server-certificate-lh.pem
@@ -0,0 +1,26 @@
+-----BEGIN CERTIFICATE-----
+MIIEYzCCBA+gAwIBAgIEJgEJHzANBglghkgBZQMEAwIFADAxMRcwFQYDVQQDEw5U
+cnVzdGVkLkNBLmNvbTEWMBQGA1UEChMNVHJ1c3QgTWUgSW5jLjAgFw0xODEwMDIw
+MjU3NDFaGA8yMjkyMDcxNjAyNTc0MVowFDESMBAGA1UEAxMJbG9jYWxob3N0MIID
+QjCCAjUGByqGSM44BAEwggIoAoIBAQCPeTXZuarpv6vtiHrPSVG28y7FnjuvNxjo
+6sSWHz79NgbnQ1GpxBgzObgJ58KuHFObp0dbhdARrbi0eYd1SYRpXKwOjxSzNggo
+oi/6JxEKPWKpk0U0CaD+aWxGWPhL3SCBnDcJoBBXsZWtzQAjPbpUhLYpH51kjviD
+RIZ3l5zsBLQ0pqwudemYXeI9sCkvwRGMn/qdgYHnM423krcw17njSVkvaAmYchU5
+Feo9a4tGU8YzRY+AOzKkwuDycpAlbk4/ijsIOKHEUOThjBopo33fXqFD3ktm/wSQ
+PtXPFiPhWNSHxgjpfyEc2B3KI8tuOAdl+CLjQr5ITAV2OTlgHNZnAh0AuvaWpoV4
+99/e5/pnyXfHhe8ysjO65YDAvNVpXQKCAQAWplxYIEhQcE51AqOXVwQNNNo6NHjB
+VNTkpcAtJC7gT5bmHkvQkEq9rI837rHgnzGC0jyQQ8tkL4gAQWDt+coJsyB2p5wy
+pifyRz6Rh5uixOdEvSCBVEy1W4AsNo0fqD7UielOD6BojjJCilx4xHjGjQUntxya
+OrsLC+EsRGiWOefTznTbEBplqiuH9kxoJts+xy9LVZmDS7TtsC98kOmkltOlXVNb
+6/xF1PYZ9j897buHOSXC8iTgdzEpbaiH7B5HSPh++1/et1SEMWsiMt7lU92vAhEr
+DR8C2jCXMiT+J67ai51LKSLZuovjntnhA6Y8UoELxoi34u1DFuHvF9veA4IBBQAC
+ggEAaJDFkKEciZBEGohwGeijpVC76m8bJkaUpn/0anSaXg6Q7aVmKyXSfIjdVnEj
+UKx9Sf3EHW0d6bogVZeDDKAAwjXOV0iqgbJCKb+U6iH9TICYFKLqLQcXpaNNhyS8
+16gZHRk5mke3eAuDUYCzJm8XjGyO0t8toR29MWg9Tq5ssLeGEECENXrykJjodM3E
+LHGXR/tjFdIJ/2wJuu5KrXzagI6yuBA/Ux79kuS8HluVB+5QMmnxaRO5XHmOgvz5
+QyChDV/E6joL5DmIW6ZeyL9KAbxbK7ktktpQEc0sNUCKdqJwlC8LX4q9wCBPu2jp
+RC/F/qXyea245qYL9yGv6XPn0KNCMEAwHwYDVR0jBBgwFoAUPaOB9WALjUbwuGv+
+Ted0+UktwXwwHQYDVR0OBBYEFO6Jp9fsRsqm1blc+X6d7GQezlkkMA0GCWCGSAFl
+AwQDAgUAAz8AMDwCHDN3rhYg1G4UNxhBL0h8bJ3j8+nY+QvqJi1TpWsCHDOb5DOG
+oXZrLyAjCqPziT3gBCe78nq/6Hmq+TQ=
+-----END CERTIFICATE-----

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b3421517/cpp/testdata/certs/server-certificate.p12
----------------------------------------------------------------------
diff --git a/cpp/testdata/certs/server-certificate.p12 b/cpp/testdata/certs/server-certificate.p12
new file mode 100644
index 0000000..a3f2822
Binary files /dev/null and b/cpp/testdata/certs/server-certificate.p12 differ

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b3421517/cpp/testdata/certs/server-certificate.pem
----------------------------------------------------------------------
diff --git a/cpp/testdata/certs/server-certificate.pem b/cpp/testdata/certs/server-certificate.pem
new file mode 100644
index 0000000..2bda16a
--- /dev/null
+++ b/cpp/testdata/certs/server-certificate.pem
@@ -0,0 +1,27 @@
+-----BEGIN CERTIFICATE-----
+MIIEhDCCBDCgAwIBAgIEUj3FFjANBglghkgBZQMEAwIFADAxMRcwFQYDVQQDEw5U
+cnVzdGVkLkNBLmNvbTEWMBQGA1UEChMNVHJ1c3QgTWUgSW5jLjAgFw0xODEwMDIw
+MjU3NDBaGA8yMjkyMDcxNjAyNTc0MFowNTEiMCAGA1UEAxMZQTEuR29vZC5TZXJ2
+ZXIuZG9tYWluLmNvbTEPMA0GA1UEChMGU2VydmVyMIIDQjCCAjUGByqGSM44BAEw
+ggIoAoIBAQCPeTXZuarpv6vtiHrPSVG28y7FnjuvNxjo6sSWHz79NgbnQ1GpxBgz
+ObgJ58KuHFObp0dbhdARrbi0eYd1SYRpXKwOjxSzNggooi/6JxEKPWKpk0U0CaD+
+aWxGWPhL3SCBnDcJoBBXsZWtzQAjPbpUhLYpH51kjviDRIZ3l5zsBLQ0pqwudemY
+XeI9sCkvwRGMn/qdgYHnM423krcw17njSVkvaAmYchU5Feo9a4tGU8YzRY+AOzKk
+wuDycpAlbk4/ijsIOKHEUOThjBopo33fXqFD3ktm/wSQPtXPFiPhWNSHxgjpfyEc
+2B3KI8tuOAdl+CLjQr5ITAV2OTlgHNZnAh0AuvaWpoV499/e5/pnyXfHhe8ysjO6
+5YDAvNVpXQKCAQAWplxYIEhQcE51AqOXVwQNNNo6NHjBVNTkpcAtJC7gT5bmHkvQ
+kEq9rI837rHgnzGC0jyQQ8tkL4gAQWDt+coJsyB2p5wypifyRz6Rh5uixOdEvSCB
+VEy1W4AsNo0fqD7UielOD6BojjJCilx4xHjGjQUntxyaOrsLC+EsRGiWOefTznTb
+EBplqiuH9kxoJts+xy9LVZmDS7TtsC98kOmkltOlXVNb6/xF1PYZ9j897buHOSXC
+8iTgdzEpbaiH7B5HSPh++1/et1SEMWsiMt7lU92vAhErDR8C2jCXMiT+J67ai51L
+KSLZuovjntnhA6Y8UoELxoi34u1DFuHvF9veA4IBBQACggEARp1TRM/rm22JyKZo
+ojrNjWObZRCzcjpojjbAEr74RFnCIFZ3c9nyPDYGjM4cPlHR6vUhp0HJQXdV9Gd8
+0tDDgi+CiTBwvr9c5an100ldtUKRAKr043TK75LSm0UvtdSjVFVFA/9Te3I64iH2
+6zwVST+YkG7IIK12s3srvSMlx3ey3j7OwAhg6etwp8Kb6QyjfMtDOO95mbrVk4K1
+9D8j0j4GbqufwV5QG8KUMXH02YU+lcxE7+zENwCHUqYpo8dXIBan2lZoC9l5/BN/
+2kHviaTvwa7VzmVOLHkOjD447nKrYagMvV3otPHJSy1BGJGwIXX8NUdGlo5fncct
+cWrueaNCMEAwHwYDVR0jBBgwFoAUPaOB9WALjUbwuGv+Ted0+UktwXwwHQYDVR0O
+BBYEFJia3zvMshSHDBeQ2U0b6/XPKjYOMA0GCWCGSAFlAwQDAgUAAz8AMDwCHDmr
+wNOSfEiL8Ydy84t/B900bF1T8wumTfSxRCsCHD5qNubQlBEXsanlQ3bVbZrGW7E6
+5hxv6u9Y7Ok=
+-----END CERTIFICATE-----

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b3421517/cpp/testdata/certs/server-lh.pkcs12
----------------------------------------------------------------------
diff --git a/cpp/testdata/certs/server-lh.pkcs12 b/cpp/testdata/certs/server-lh.pkcs12
new file mode 100644
index 0000000..63de556
Binary files /dev/null and b/cpp/testdata/certs/server-lh.pkcs12 differ

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b3421517/cpp/testdata/certs/server-private-key-lh.pem
----------------------------------------------------------------------
diff --git a/cpp/testdata/certs/server-private-key-lh.pem b/cpp/testdata/certs/server-private-key-lh.pem
new file mode 100644
index 0000000..e2fb27a
--- /dev/null
+++ b/cpp/testdata/certs/server-private-key-lh.pem
@@ -0,0 +1,21 @@
+Bag Attributes
+    friendlyName: server-certificate
+    localKeyID: 54 69 6D 65 20 31 35 33 38 34 34 39 30 36 30 38 30 39 
+Key Attributes: <No Attributes>
+-----BEGIN ENCRYPTED PRIVATE KEY-----
+MIICvDBOBgkqhkiG9w0BBQ0wQTApBgkqhkiG9w0BBQwwHAQISxlyGoyD1QYCAggA
+MAwGCCqGSIb3DQIJBQAwFAYIKoZIhvcNAwcECC3Vui8i8+0kBIICaCnTZ7hk0APw
+RyXxRWFOGGbgqPnseiHlq9pI1QOJN/zCa8EVUREIgdwGOO7VDw4JeOqR8SxxNL8H
+QTm/pITLE5qY1cnBJXncNRnPlz6XlblHCJoSOeDz7cJb+wZPL5CEYFsgHBZ8Odf1
+9keZ+ur5rZDW6UcOgu4p+RKsauy7BBVBIJXL4JAXfWxXTOLd7GF0SKKulgLoS0vi
+JQsCfGoIq5FJkp6GUwhnODCHfBEmddmH6AOS+lfxC6wjcXAqVYLsCuyw4Sm9QqdL
+eaTjUYwXiSXdWMOqWdxzWhxkrrK9wh4qxYBMoWBcSr2iir1nhW2uu9182GbyEPNV
+TOmQrxW/veJTEtRdZIAIs51C373FIDHkzsSsFHSZsFKZcOnpH5VfAWz0/g1i1/Rs
+a8wsFYj0csyuIQJjKFc4N/gaFwkSZxYvl5Getk5Prxo27o10ZoF7P7lBszdUxf95
+GKa/4M9AI3ftPCAa53VreRxGayOKFe+bvyWEH9mIfXXbQbMEbE8KxZ/pz8f6xhHk
+qbdJqlaVtzznZKl6Xp3UoDoJUf1pLJRIWiQENiTvlHdTtJGoL6eTqDU+0Kgtwnxg
+wMDkjYW2x2FKvICz3QUB+8BeC1QCV22YVdgi7qt+qNnlsBEegERvSiq9agk9SULc
+lcfVs+iAHgh0JdU85OKJ+QN9JgL3jmdXnSuZbdbZwNXzOHAyRMEMOTIp4d6AbcTK
+giZmvjb/TwO/giQGqA+Aum0KY8JdyEy+SObP91jWu1yFt9jm7qppYHZZa31uGXBf
+fJm1jqMP/zW/Vmzf62FWaLEHsU4DW8pAbAqkk1YMV7s=
+-----END ENCRYPTED PRIVATE KEY-----

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b3421517/cpp/testdata/certs/server-private-key.pem
----------------------------------------------------------------------
diff --git a/cpp/testdata/certs/server-private-key.pem b/cpp/testdata/certs/server-private-key.pem
new file mode 100644
index 0000000..1cdfe72
--- /dev/null
+++ b/cpp/testdata/certs/server-private-key.pem
@@ -0,0 +1,21 @@
+Bag Attributes
+    friendlyName: server-certificate
+    localKeyID: 54 69 6D 65 20 31 35 33 38 34 34 39 30 35 39 36 34 36 
+Key Attributes: <No Attributes>
+-----BEGIN ENCRYPTED PRIVATE KEY-----
+MIICvDBOBgkqhkiG9w0BBQ0wQTApBgkqhkiG9w0BBQwwHAQInP4M1lKTezECAggA
+MAwGCCqGSIb3DQIJBQAwFAYIKoZIhvcNAwcECHnnILCeCb0tBIICaAYdJIuASx3+
+0N/BzvdlyRbkGRuW4c1eA8myfAOHP9aCpjhhWG/i0MRZYyo0XHcq3HuBMPKgsL/7
+/zEZ/sefL94xEp4pTtZZR6i8Ign1PqdEj7df7+NFxs5nottszInZQDxoqd+c6XF3
+YgtdGfSYF3WYtwjmijzCP51uiEFlytNQo3yLbn1QNdZPTI8HOTl8h7i+34oPzi66
+A8XNyCo02W14gZ+egq5op8pbq0+sS46PvGuK8xcJDOl6GrP/8T4C4sFE6mrC/Gg+
+uasqQFXo9O4gQgvJQPnGsk3RRDYG5AdM52uGBDM4kok66U4q4Vbd7rqegfwr+BIB
+GSk2oBeCHjPZ3eOwSuoNFt13c91eaIXIWRh4XYRctaoJzaZg6E0a6s23u7tohajn
+e8l/QX1NOUX4jb3mZVh24EvNsJKlMaWyaXdZvWJfWGYTvl8IeRVvX94t8m11ftWE
+hzA707SCQSzYWU3Oit/+MbrLxwoerSeNz/Wzc5GMTJGm+2Vu+tlQt1KsBvUSnB/P
+px5odaMO+kH2ipVjycmnpaqmskIE+NjasiLLgwub1FNMv4WDGeRs2lM7ZmgPEkX/
+/kSfr/fo9Ex0A+e1n7olXif/IJeFZ9RY0ZWTAvEv0W8DcX4rEOEgjbwtLJiQOBd1
+YfMLEktNGt2tnlKiGBG6CFKpUvBUhqUjwJey0ENIK2NXf2N9vHFGzmtF/xq3cuOn
+dQBwicoBBka2ANhoA24K2Zm8L3n5eNWzVAHcOHAXRY7iy+QGdmgtASPk2a1b+F06
+l5sUGNB0koW9vFinj9Hc6xB/wASZp3NXBBC5jPZXf9M=
+-----END ENCRYPTED PRIVATE KEY-----

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b3421517/cpp/testdata/certs/server-request-lh.pem
----------------------------------------------------------------------
diff --git a/cpp/testdata/certs/server-request-lh.pem b/cpp/testdata/certs/server-request-lh.pem
new file mode 100644
index 0000000..d550135
--- /dev/null
+++ b/cpp/testdata/certs/server-request-lh.pem
@@ -0,0 +1,23 @@
+-----BEGIN NEW CERTIFICATE REQUEST-----
+MIID5TCCA5ECAQAwFDESMBAGA1UEAxMJbG9jYWxob3N0MIIDQjCCAjUGByqGSM44
+BAEwggIoAoIBAQCPeTXZuarpv6vtiHrPSVG28y7FnjuvNxjo6sSWHz79NgbnQ1Gp
+xBgzObgJ58KuHFObp0dbhdARrbi0eYd1SYRpXKwOjxSzNggooi/6JxEKPWKpk0U0
+CaD+aWxGWPhL3SCBnDcJoBBXsZWtzQAjPbpUhLYpH51kjviDRIZ3l5zsBLQ0pqwu
+demYXeI9sCkvwRGMn/qdgYHnM423krcw17njSVkvaAmYchU5Feo9a4tGU8YzRY+A
+OzKkwuDycpAlbk4/ijsIOKHEUOThjBopo33fXqFD3ktm/wSQPtXPFiPhWNSHxgjp
+fyEc2B3KI8tuOAdl+CLjQr5ITAV2OTlgHNZnAh0AuvaWpoV499/e5/pnyXfHhe8y
+sjO65YDAvNVpXQKCAQAWplxYIEhQcE51AqOXVwQNNNo6NHjBVNTkpcAtJC7gT5bm
+HkvQkEq9rI837rHgnzGC0jyQQ8tkL4gAQWDt+coJsyB2p5wypifyRz6Rh5uixOdE
+vSCBVEy1W4AsNo0fqD7UielOD6BojjJCilx4xHjGjQUntxyaOrsLC+EsRGiWOefT
+znTbEBplqiuH9kxoJts+xy9LVZmDS7TtsC98kOmkltOlXVNb6/xF1PYZ9j897buH
+OSXC8iTgdzEpbaiH7B5HSPh++1/et1SEMWsiMt7lU92vAhErDR8C2jCXMiT+J67a
+i51LKSLZuovjntnhA6Y8UoELxoi34u1DFuHvF9veA4IBBQACggEAaJDFkKEciZBE
+GohwGeijpVC76m8bJkaUpn/0anSaXg6Q7aVmKyXSfIjdVnEjUKx9Sf3EHW0d6bog
+VZeDDKAAwjXOV0iqgbJCKb+U6iH9TICYFKLqLQcXpaNNhyS816gZHRk5mke3eAuD
+UYCzJm8XjGyO0t8toR29MWg9Tq5ssLeGEECENXrykJjodM3ELHGXR/tjFdIJ/2wJ
+uu5KrXzagI6yuBA/Ux79kuS8HluVB+5QMmnxaRO5XHmOgvz5QyChDV/E6joL5DmI
+W6ZeyL9KAbxbK7ktktpQEc0sNUCKdqJwlC8LX4q9wCBPu2jpRC/F/qXyea245qYL
+9yGv6XPn0KAwMC4GCSqGSIb3DQEJDjEhMB8wHQYDVR0OBBYEFO6Jp9fsRsqm1blc
++X6d7GQezlkkMA0GCWCGSAFlAwQDAgUAAz8AMDwCHDLL/Bx68UXR2thddk3Bmj8a
+vrQ57RXpgu+18M4CHCpcPKGIxBOzWKIw8KTp2BenpS2Pd9llGO+RYHs=
+-----END NEW CERTIFICATE REQUEST-----

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b3421517/cpp/testdata/certs/server-request.pem
----------------------------------------------------------------------
diff --git a/cpp/testdata/certs/server-request.pem b/cpp/testdata/certs/server-request.pem
new file mode 100644
index 0000000..accad0a
--- /dev/null
+++ b/cpp/testdata/certs/server-request.pem
@@ -0,0 +1,24 @@
+-----BEGIN NEW CERTIFICATE REQUEST-----
+MIIEBjCCA7ICAQAwNTEiMCAGA1UEAxMZQTEuR29vZC5TZXJ2ZXIuZG9tYWluLmNv
+bTEPMA0GA1UEChMGU2VydmVyMIIDQjCCAjUGByqGSM44BAEwggIoAoIBAQCPeTXZ
+uarpv6vtiHrPSVG28y7FnjuvNxjo6sSWHz79NgbnQ1GpxBgzObgJ58KuHFObp0db
+hdARrbi0eYd1SYRpXKwOjxSzNggooi/6JxEKPWKpk0U0CaD+aWxGWPhL3SCBnDcJ
+oBBXsZWtzQAjPbpUhLYpH51kjviDRIZ3l5zsBLQ0pqwudemYXeI9sCkvwRGMn/qd
+gYHnM423krcw17njSVkvaAmYchU5Feo9a4tGU8YzRY+AOzKkwuDycpAlbk4/ijsI
+OKHEUOThjBopo33fXqFD3ktm/wSQPtXPFiPhWNSHxgjpfyEc2B3KI8tuOAdl+CLj
+Qr5ITAV2OTlgHNZnAh0AuvaWpoV499/e5/pnyXfHhe8ysjO65YDAvNVpXQKCAQAW
+plxYIEhQcE51AqOXVwQNNNo6NHjBVNTkpcAtJC7gT5bmHkvQkEq9rI837rHgnzGC
+0jyQQ8tkL4gAQWDt+coJsyB2p5wypifyRz6Rh5uixOdEvSCBVEy1W4AsNo0fqD7U
+ielOD6BojjJCilx4xHjGjQUntxyaOrsLC+EsRGiWOefTznTbEBplqiuH9kxoJts+
+xy9LVZmDS7TtsC98kOmkltOlXVNb6/xF1PYZ9j897buHOSXC8iTgdzEpbaiH7B5H
+SPh++1/et1SEMWsiMt7lU92vAhErDR8C2jCXMiT+J67ai51LKSLZuovjntnhA6Y8
+UoELxoi34u1DFuHvF9veA4IBBQACggEARp1TRM/rm22JyKZoojrNjWObZRCzcjpo
+jjbAEr74RFnCIFZ3c9nyPDYGjM4cPlHR6vUhp0HJQXdV9Gd80tDDgi+CiTBwvr9c
+5an100ldtUKRAKr043TK75LSm0UvtdSjVFVFA/9Te3I64iH26zwVST+YkG7IIK12
+s3srvSMlx3ey3j7OwAhg6etwp8Kb6QyjfMtDOO95mbrVk4K19D8j0j4GbqufwV5Q
+G8KUMXH02YU+lcxE7+zENwCHUqYpo8dXIBan2lZoC9l5/BN/2kHviaTvwa7VzmVO
+LHkOjD447nKrYagMvV3otPHJSy1BGJGwIXX8NUdGlo5fncctcWrueaAwMC4GCSqG
+SIb3DQEJDjEhMB8wHQYDVR0OBBYEFJia3zvMshSHDBeQ2U0b6/XPKjYOMA0GCWCG
+SAFlAwQDAgUAAz8AMDwCHAVe2riCrlPBbpsFxmAJqF7PHDgOiCuIE5gPbI8CHCf5
+y75e09RGsjBmivZoThPFGrFYLdIvqF8dYk0=
+-----END NEW CERTIFICATE REQUEST-----

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b3421517/cpp/testdata/certs/server-wc-certificate.p12
----------------------------------------------------------------------
diff --git a/cpp/testdata/certs/server-wc-certificate.p12 b/cpp/testdata/certs/server-wc-certificate.p12
new file mode 100644
index 0000000..20a9c81
Binary files /dev/null and b/cpp/testdata/certs/server-wc-certificate.p12 differ

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b3421517/cpp/testdata/certs/server-wc-certificate.pem
----------------------------------------------------------------------
diff --git a/cpp/testdata/certs/server-wc-certificate.pem b/cpp/testdata/certs/server-wc-certificate.pem
new file mode 100644
index 0000000..cef7a78
--- /dev/null
+++ b/cpp/testdata/certs/server-wc-certificate.pem
@@ -0,0 +1,28 @@
+-----BEGIN CERTIFICATE-----
+MIIEtjCCBGCgAwIBAgIEUkyrdTANBglghkgBZQMEAwIFADAxMRcwFQYDVQQDEw5U
+cnVzdGVkLkNBLmNvbTEWMBQGA1UEChMNVHJ1c3QgTWUgSW5jLjAgFw0xODEwMDIw
+MjU3NDVaGA8yMjkyMDcxNjAyNTc0NVowMDEdMBsGA1UEAwwUKi5wcmVmaXgqLmRv
+bWFpbi5jb20xDzANBgNVBAoTBlNlcnZlcjCCA0IwggI1BgcqhkjOOAQBMIICKAKC
+AQEAj3k12bmq6b+r7Yh6z0lRtvMuxZ47rzcY6OrElh8+/TYG50NRqcQYMzm4CefC
+rhxTm6dHW4XQEa24tHmHdUmEaVysDo8UszYIKKIv+icRCj1iqZNFNAmg/mlsRlj4
+S90ggZw3CaAQV7GVrc0AIz26VIS2KR+dZI74g0SGd5ec7AS0NKasLnXpmF3iPbAp
+L8ERjJ/6nYGB5zONt5K3MNe540lZL2gJmHIVORXqPWuLRlPGM0WPgDsypMLg8nKQ
+JW5OP4o7CDihxFDk4YwaKaN9316hQ95LZv8EkD7VzxYj4VjUh8YI6X8hHNgdyiPL
+bjgHZfgi40K+SEwFdjk5YBzWZwIdALr2lqaFePff3uf6Z8l3x4XvMrIzuuWAwLzV
+aV0CggEAFqZcWCBIUHBOdQKjl1cEDTTaOjR4wVTU5KXALSQu4E+W5h5L0JBKvayP
+N+6x4J8xgtI8kEPLZC+IAEFg7fnKCbMgdqecMqYn8kc+kYebosTnRL0ggVRMtVuA
+LDaNH6g+1InpTg+gaI4yQopceMR4xo0FJ7ccmjq7CwvhLERoljnn08502xAaZaor
+h/ZMaCbbPscvS1WZg0u07bAvfJDppJbTpV1TW+v8RdT2GfY/Pe27hzklwvIk4Hcx
+KW2oh+weR0j4fvtf3rdUhDFrIjLe5VPdrwIRKw0fAtowlzIk/ieu2oudSyki2bqL
+457Z4QOmPFKBC8aIt+LtQxbh7xfb3gOCAQUAAoIBAAVDMGlarHLWrMs4l+6xegQE
+9H4WqDz7qFRdF0F7p2OEEC6kJ4DhuYaUvGETx+snVRbBiGbOyE1fyftcW+GrxUu1
+8pu1qb+emk4eLg1hxRqt/zmHEojRrqPH/Xii9BKLX1H3uileQwJu7JMjZ46DUkDc
+OMqtLCldXxH1F1/cO94otknkwu7TY6Mu799i0QRSGEzUJ2oAHDD3N0vaCw0zipNC
+H/w9AjL/SzIh0Rw+Et3/9Usa9q/BNy5+mhZqym7s56ori1fd7a5DFP1uk+QWphyT
+3bwsIF/tWrm8+fKlIM+gSzgflgFUxwgabh6BrGf+0I/ikd5idsOAQ9qrXezCUj+j
+dzB1MB8GA1UdIwQYMBaAFD2jgfVgC41G8Lhr/k3ndPlJLcF8MDMGA1UdEQQsMCqC
+FmFsdGVybmF0ZS5uYW1lLm9uZS5jb22CEGFub3RoZXIubmFtZS5jb20wHQYDVR0O
+BBYEFF96eWh/xgffyH0uCGZc6vPUQD2YMA0GCWCGSAFlAwQDAgUAA0EAMD4CHQCj
+/geaVC5aa1KoAjbefleP0hoKhsOssJ97/aqyAh0AsAJPFXvBYAQGJQOph/mJkNQT
+9o/LNyaEB6QnQg==
+-----END CERTIFICATE-----

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b3421517/cpp/testdata/certs/server-wc-private-key.pem
----------------------------------------------------------------------
diff --git a/cpp/testdata/certs/server-wc-private-key.pem b/cpp/testdata/certs/server-wc-private-key.pem
new file mode 100644
index 0000000..d2b5094
--- /dev/null
+++ b/cpp/testdata/certs/server-wc-private-key.pem
@@ -0,0 +1,21 @@
+Bag Attributes
+    friendlyName: server-wc-certificate
+    localKeyID: 54 69 6D 65 20 31 35 33 38 34 34 39 30 36 34 37 38 35 
+Key Attributes: <No Attributes>
+-----BEGIN ENCRYPTED PRIVATE KEY-----
+MIICvDBOBgkqhkiG9w0BBQ0wQTApBgkqhkiG9w0BBQwwHAQIjxM5RLFGE7ICAggA
+MAwGCCqGSIb3DQIJBQAwFAYIKoZIhvcNAwcECOAmYE1vfly1BIICaBle2jIyrouB
+QGgywMpL+5VCGB1O/+TIt1fSO1QW6PNk6AkXMnnI6ivIPymfozXOOXKu3VsEl4ge
+L8pukXuclBMj2nPxP80HgMwE7manDAe/qGQeBYKBZX+udiTOS92N0oKqPBwcenuK
+a+49FLfeUj0HrGACyZJK3UJOGA6s0cb5mYI5GVV2bKZR040cDRM3jKzu6MMZTF4K
+UZ+HqFU2hZcZ6mHQB+hyo4/QaSSk2MABVdI2mZ6aFeZB8Zd+2LT+Ibw2wimOW7+H
+xjFY52uN2Ng8yoV0dAyFHmDkpRuPQibz6JOFLrw4a5bDxIpUOGQLw88z33gbqFqt
+gndUn3SLFjo+LK/r1efgjNMZulRb36Ibrdy7JJFognpv3SLNfuImmMycN2P22dgS
+dPgw3SbNMA1FJObS70B91ceJZj3K+/16ZLf1/A2lbO48UBTqeChW7+31iQfML+D4
+3pI4bt6Bltz+aF01pksty/4299XuVo/HFTF59p2h9ztVOXVK+8ok4XIM1LXmQjyv
+dZsdqaYSVLNNMvFPt+odrl2mB3+7Y55+nRWZw5s/ARA+mJ1lKkaIQi6bpZ4OTFfS
+Fz9X9bxCOcElAZZUwKJFg/ai8ILz8VibNhy8izZzO5682TojNYkLdm1frzaa96Re
+GKQPIXzGgn0njZMzuFwpxEPw2UnTazpe9VO+b2F07K+Z5/tLijf/J9eAUwRo4IZK
+RtDRhnL6PfhgZGNFbk0YNgXI6cQ5+eix8cHAVE0R9SKnV3HM7DOo7cUQubemPCwT
++h5lGAU3oE3SOxYtsPa1Te//gF3DyYrym2atNBnprm0=
+-----END ENCRYPTED PRIVATE KEY-----

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b3421517/cpp/testdata/certs/server-wc-request.pem
----------------------------------------------------------------------
diff --git a/cpp/testdata/certs/server-wc-request.pem b/cpp/testdata/certs/server-wc-request.pem
new file mode 100644
index 0000000..0b9ec10
--- /dev/null
+++ b/cpp/testdata/certs/server-wc-request.pem
@@ -0,0 +1,25 @@
+-----BEGIN NEW CERTIFICATE REQUEST-----
+MIIENjCCA+ICAQAwMDEdMBsGA1UEAwwUKi5wcmVmaXgqLmRvbWFpbi5jb20xDzAN
+BgNVBAoTBlNlcnZlcjCCA0IwggI1BgcqhkjOOAQBMIICKAKCAQEAj3k12bmq6b+r
+7Yh6z0lRtvMuxZ47rzcY6OrElh8+/TYG50NRqcQYMzm4CefCrhxTm6dHW4XQEa24
+tHmHdUmEaVysDo8UszYIKKIv+icRCj1iqZNFNAmg/mlsRlj4S90ggZw3CaAQV7GV
+rc0AIz26VIS2KR+dZI74g0SGd5ec7AS0NKasLnXpmF3iPbApL8ERjJ/6nYGB5zON
+t5K3MNe540lZL2gJmHIVORXqPWuLRlPGM0WPgDsypMLg8nKQJW5OP4o7CDihxFDk
+4YwaKaN9316hQ95LZv8EkD7VzxYj4VjUh8YI6X8hHNgdyiPLbjgHZfgi40K+SEwF
+djk5YBzWZwIdALr2lqaFePff3uf6Z8l3x4XvMrIzuuWAwLzVaV0CggEAFqZcWCBI
+UHBOdQKjl1cEDTTaOjR4wVTU5KXALSQu4E+W5h5L0JBKvayPN+6x4J8xgtI8kEPL
+ZC+IAEFg7fnKCbMgdqecMqYn8kc+kYebosTnRL0ggVRMtVuALDaNH6g+1InpTg+g
+aI4yQopceMR4xo0FJ7ccmjq7CwvhLERoljnn08502xAaZaorh/ZMaCbbPscvS1WZ
+g0u07bAvfJDppJbTpV1TW+v8RdT2GfY/Pe27hzklwvIk4HcxKW2oh+weR0j4fvtf
+3rdUhDFrIjLe5VPdrwIRKw0fAtowlzIk/ieu2oudSyki2bqL457Z4QOmPFKBC8aI
+t+LtQxbh7xfb3gOCAQUAAoIBAAVDMGlarHLWrMs4l+6xegQE9H4WqDz7qFRdF0F7
+p2OEEC6kJ4DhuYaUvGETx+snVRbBiGbOyE1fyftcW+GrxUu18pu1qb+emk4eLg1h
+xRqt/zmHEojRrqPH/Xii9BKLX1H3uileQwJu7JMjZ46DUkDcOMqtLCldXxH1F1/c
+O94otknkwu7TY6Mu799i0QRSGEzUJ2oAHDD3N0vaCw0zipNCH/w9AjL/SzIh0Rw+
+Et3/9Usa9q/BNy5+mhZqym7s56ori1fd7a5DFP1uk+QWphyT3bwsIF/tWrm8+fKl
+IM+gSzgflgFUxwgabh6BrGf+0I/ikd5idsOAQ9qrXezCUj+gZTBjBgkqhkiG9w0B
+CQ4xVjBUMDMGA1UdEQQsMCqCFmFsdGVybmF0ZS5uYW1lLm9uZS5jb22CEGFub3Ro
+ZXIubmFtZS5jb20wHQYDVR0OBBYEFF96eWh/xgffyH0uCGZc6vPUQD2YMA0GCWCG
+SAFlAwQDAgUAAz8AMDwCHAoNyH8KS3UNA/YHb/gHExmyNq6P+FvxVQYRqAsCHHei
+Pqnz39VtyJ0S2ozP60/raQzagEziWIZxozY=
+-----END NEW CERTIFICATE REQUEST-----

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b3421517/cpp/testdata/certs/server-wc.pkcs12
----------------------------------------------------------------------
diff --git a/cpp/testdata/certs/server-wc.pkcs12 b/cpp/testdata/certs/server-wc.pkcs12
new file mode 100644
index 0000000..3cd2f9f
Binary files /dev/null and b/cpp/testdata/certs/server-wc.pkcs12 differ

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b3421517/cpp/testdata/certs/server.pkcs12
----------------------------------------------------------------------
diff --git a/cpp/testdata/certs/server.pkcs12 b/cpp/testdata/certs/server.pkcs12
new file mode 100644
index 0000000..51630d7
Binary files /dev/null and b/cpp/testdata/certs/server.pkcs12 differ

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b3421517/cpp/testdata/sasl-conf/proton-server.conf.in
----------------------------------------------------------------------
diff --git a/cpp/testdata/sasl-conf/proton-server.conf.in b/cpp/testdata/sasl-conf/proton-server.conf.in
new file mode 100644
index 0000000..ff2fb17
--- /dev/null
+++ b/cpp/testdata/sasl-conf/proton-server.conf.in
@@ -0,0 +1,2 @@
+sasldb_path: ${CMAKE_BINARY_DIR}/cpp/testdata/sasl-conf/proton.sasldb
+mech_list: EXTERNAL DIGEST-MD5 SCRAM-SHA-1 CRAM-MD5 PLAIN ANONYMOUS


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


[24/50] qpid-proton git commit: fNO-JIRA: [cpp] testme check program exists instead of using HAS_CPP11

Posted by ac...@apache.org.
fNO-JIRA: [cpp] testme check program exists instead of using HAS_CPP11

Using HAS_CPP11 won't work outside a build tree. Instead check for existence
of test executables to detect tests that are not built under c++03


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

Branch: refs/heads/go1
Commit: 96972871c78ed9aabfca24e73e95b9e5f0f58c59
Parents: 32b9708
Author: Alan Conway <ac...@redhat.com>
Authored: Tue Sep 18 16:01:21 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Tue Sep 18 16:01:21 2018 -0400

----------------------------------------------------------------------
 cpp/examples/testme         | 29 ++++++++++++++++-------------
 tests/py/test_subprocess.py |  7 +++++++
 2 files changed, 23 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/96972871/cpp/examples/testme
----------------------------------------------------------------------
diff --git a/cpp/examples/testme b/cpp/examples/testme
index d4abc0a..5f30f23 100755
--- a/cpp/examples/testme
+++ b/cpp/examples/testme
@@ -21,7 +21,7 @@
 # Run the C++ examples and verify that they behave as expected.
 # Example executables must be in PATH
 
-import unittest, sys, shutil, os
+import unittest, sys, shutil, os, errno
 from test_subprocess import Popen, TestProcessError, check_output
 import test_subprocess
 from os.path import dirname
@@ -143,11 +143,13 @@ map{string(k1):int(42), symbol(k2):boolean(0)}
         self.assertTrue(len(out) > 0);
         self.assertEqual(["send"]*len(out), out)
 
-    @unittest.skipUnless(os.getenv('HAS_CPP11'), "not a  C++11 build")
     def test_scheduled_send(self):
-        out = check_output(["scheduled_send", "-a", Broker.addr+"scheduled_send", "-t", "0.1", "-i", "0.001"]).split()
-        self.assertTrue(len(out) > 0);
-        self.assertEqual(["send"]*len(out), out)
+        try:
+            out = check_output(["scheduled_send", "-a", Broker.addr+"scheduled_send", "-t", "0.1", "-i", "0.001"]).split()
+            self.assertTrue(len(out) > 0);
+            self.assertEqual(["send"]*len(out), out)
+        except OSError as e:
+            if e.errno != errno.ENOENT: raise
 
     def test_message_properties(self):
         expect="""using put/get: short=123 string=foo symbol=sym
@@ -161,15 +163,16 @@ expected conversion_error: "unexpected type, want: uint got: string"
 """
         self.assertMultiLineEqual(expect, check_output(["message_properties"]))
 
-    @unittest.skipUnless(os.getenv('HAS_CPP11'), "not a  C++11 build")
     def test_multithreaded_client(self):
-        got = check_output(["multithreaded_client", Broker.addr, "examples", "10"])
-        self.maxDiff = None
-        self.assertIn("10 messages sent and received", got);
-
-#    @unittest.skipUnless(os.getenv('HAS_CPP11'), "not a  C++11 build")
-    @unittest.skip("Test is unstable, will enable when fixed")
-    def test_multithreaded_client_flow_control(self):
+        try:
+            got = check_output(["multithreaded_client", Broker.addr, "examples", "10"])
+            self.maxDiff = None
+            self.assertIn("10 messages sent and received", got);
+        except OSError as e:
+            if e.errno != errno.ENOENT: raise
+
+    # Test is unstable, enable when fixed
+    def skip_test_multithreaded_client_flow_control(self):
         got = check_output(["multithreaded_client_flow_control", Broker.addr, "examples", "10", "2"])
         self.maxDiff = None
         self.assertIn("20 messages sent and received", got);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/96972871/tests/py/test_subprocess.py
----------------------------------------------------------------------
diff --git a/tests/py/test_subprocess.py b/tests/py/test_subprocess.py
index 512123f..4905107 100644
--- a/tests/py/test_subprocess.py
+++ b/tests/py/test_subprocess.py
@@ -23,6 +23,13 @@ import subprocess, re, os, tempfile
 
 from subprocess import PIPE
 
+def in_path(name):
+    """Look for name in the PATH""" 
+    for path in os.environ["PATH"].split(os.pathsep):
+        f = os.path.join(path, name)
+        if os.path.isfile(f) and os.access(f, os.X_OK):
+            return f
+
 class TestProcessError(Exception):
     def __init__(self, proc, what, output=None):
         self.output = output


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


[27/50] qpid-proton git commit: NO-JIRA: Rename docs/connect_config.md -> connect-config.md

Posted by ac...@apache.org.
NO-JIRA: Rename docs/connect_config.md -> connect-config.md

Keep in line with file naming conventions.


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

Branch: refs/heads/go1
Commit: e7930c0580bd3e975bab2195edb68deced2afe19
Parents: 5595c41
Author: Alan Conway <ac...@redhat.com>
Authored: Fri Sep 21 15:59:31 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Fri Sep 21 17:01:00 2018 -0400

----------------------------------------------------------------------
 cpp/docs/CMakeLists.txt               |  2 +-
 cpp/docs/user.doxygen.in              |  2 +-
 cpp/include/proton/connect_config.hpp |  9 ++++---
 cpp/include/proton/container.hpp      |  3 +--
 docs/connect-config.md                | 42 ++++++++++++++++++++++++++++++
 docs/connect_config.md                | 42 ------------------------------
 6 files changed, 51 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e7930c05/cpp/docs/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/cpp/docs/CMakeLists.txt b/cpp/docs/CMakeLists.txt
index 690230d..ff329aa 100644
--- a/cpp/docs/CMakeLists.txt
+++ b/cpp/docs/CMakeLists.txt
@@ -24,7 +24,7 @@ if (DOXYGEN_FOUND)
     ${CMAKE_CURRENT_SOURCE_DIR}/user.doxygen.in
     ${CMAKE_CURRENT_BINARY_DIR}/user.doxygen)
 
-  file(GLOB_RECURSE sources ../include/proton/*.hpp ../../connect_config.md)
+  file(GLOB_RECURSE sources ../include/proton/*.hpp ../../connect-config.md)
   add_custom_target (docs-cpp
     COMMAND ${CMAKE_COMMAND} -E remove_directory html # get rid of old files
     COMMAND ${DOXYGEN_EXECUTABLE} user.doxygen

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e7930c05/cpp/docs/user.doxygen.in
----------------------------------------------------------------------
diff --git a/cpp/docs/user.doxygen.in b/cpp/docs/user.doxygen.in
index 84375d8..9810991 100644
--- a/cpp/docs/user.doxygen.in
+++ b/cpp/docs/user.doxygen.in
@@ -56,7 +56,7 @@ WARNINGS                = YES
 INPUT                   = @CMAKE_SOURCE_DIR@/cpp/include \
                           @CMAKE_SOURCE_DIR@/cpp/docs \
                           @CMAKE_SOURCE_DIR@/cpp/examples \
-                          @CMAKE_SOURCE_DIR@/docs/connect_config.md
+                          @CMAKE_SOURCE_DIR@/docs/connect-config.md
 FILE_PATTERNS           = *.hpp *.md *.dox
 EXCLUDE_PATTERNS        = @CMAKE_SOURCE_DIR@/cpp/examples/*.?pp \
                           @CMAKE_SOURCE_DIR@/cpp/include/proton/internal/*.hpp

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e7930c05/cpp/include/proton/connect_config.hpp
----------------------------------------------------------------------
diff --git a/cpp/include/proton/connect_config.hpp b/cpp/include/proton/connect_config.hpp
index be5c7ac..d9d2c0f 100644
--- a/cpp/include/proton/connect_config.hpp
+++ b/cpp/include/proton/connect_config.hpp
@@ -27,19 +27,22 @@ namespace proton {
 class connection_options;
 
 /// *Unsettled API*
+///
+/// Functions for locating and using a @ref connect-config file, or a
+/// configuration string to set @ref connection_options
 namespace connect_config {
 
-/// @return name of the default connection configuration file
+/// @return name of the default @ref connect-config file.
 /// @throw proton::error if no default file is found
 PN_CPP_EXTERN std::string default_file();
 
-/// Parse configuration from @p is and update @p opts
+/// Parse @ref connect-config from @p is and update @p opts
 /// @param is input stream for configuration file/string
 /// @param opts [out] connection options to update
 /// @return address suitable for container::connect() from configuration
 PN_CPP_EXTERN std::string parse(std::istream& is, connection_options& opts);
 
-/// Parse configuration from default_file() and update @p opts
+/// Parse @ref connect-config from default_file() and update @p opts
 /// @param opts [out] connection options to update
 /// @return address suitable for container::connect() from configuration
 PN_CPP_EXTERN std::string parse_default(connection_options& opts);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e7930c05/cpp/include/proton/container.hpp
----------------------------------------------------------------------
diff --git a/cpp/include/proton/container.hpp b/cpp/include/proton/container.hpp
index 362dba0..aa735f4 100644
--- a/cpp/include/proton/container.hpp
+++ b/cpp/include/proton/container.hpp
@@ -113,8 +113,7 @@ class PN_CPP_CLASS_EXTERN container {
     /// @copydetails returned
     PN_CPP_EXTERN returned<connection> connect(const std::string& conn_url);
 
-    /// Connect using the default @ref connect_config
-    /// FIXME aconway 2018-08-07: cmake - copy connect_config.md into C++ doc
+    /// Connect using the default @ref connect-config file.
     ///
     /// @copydetails returned
     PN_CPP_EXTERN returned<connection> connect();

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e7930c05/docs/connect-config.md
----------------------------------------------------------------------
diff --git a/docs/connect-config.md b/docs/connect-config.md
new file mode 100644
index 0000000..eeaea4e
--- /dev/null
+++ b/docs/connect-config.md
@@ -0,0 +1,42 @@
+# Connection Configuration {#connect-config}
+
+Proton clients can read default connection configuration from a
+configuration file.
+
+If the environment variable `MESSAGING_CONNECT_FILE` is set, it is the
+path to the file. Otherwise the client looks for a file named
+`connect.json` in the following locations, using the first one found:
+
+* Current working directory of client process.
+* `$HOME/.config/messaging/` - $HOME is user's home directory.
+* `$PREFIX/etc/messaging/` - $PREFIX is the prefix where the proton library is installed
+* `/etc/messaging/`
+
+The configuration file is in JSON object format. Comments are allowed,
+as defined by the [JavaScript Minifier](https://www.crockford.com/javascript/jsmin.html)
+
+The file format is as follows. Properties are shown with their default
+values, all properties are optional.
+
+    {
+      "scheme": "amqps",   // [string] "amqp" (no TLS) or "amqps"
+      "host": "localhost", // [string] DNS or IP address for connection. Defaults to local host.
+      "port": "amqps",     // [string] "amqp", "amqps" or port number. Defaults to value of 'scheme'.
+      "user": null,        // [string] Authentication user name
+      "password": null,    // [string] Authentication password
+
+      "sasl": {
+        "enable": true,         // [bool] Enable or disable SASL
+        "mechanisms": null,     // [list] List of allowed SASL mechanism names.
+                                // If null the library determines the default list.
+        "allow_insecure": false // [boolean] Allow mechanisms that send unencrypted clear-text passwords
+      },
+
+      // Note: it is an error to have a "tls" object unless scheme="amqps"
+      "tls": {
+        "cert": null,   // [string] name of client certificate or database
+        "key": null     // [string] private key or identity for client certificate
+        "ca": null,     // [string] name of CA certificate or database
+        "verify": true, // [bool] if true, require a valid cert with matching host name
+      }
+    }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e7930c05/docs/connect_config.md
----------------------------------------------------------------------
diff --git a/docs/connect_config.md b/docs/connect_config.md
deleted file mode 100644
index 63044be..0000000
--- a/docs/connect_config.md
+++ /dev/null
@@ -1,42 +0,0 @@
-# Connection Configuration
-
-Proton clients can read default connection information from a
-configuration file.
-
-If the environment variable `MESSAGING_CONNECT_FILE` is set, it is the
-path to the file. Otherwise the client looks for a file named
-`connect.json` in the following locations, using the first one found:
-
-* Current working directory of client process.
-* `$HOME/.config/messaging/` - $HOME is user's home directory.
-* `$PREFIX/etc/messaging/` - $PREFIX is the prefix where the proton library is installed
-* `/etc/messaging/`
-
-The configuration file is in JSON object format. Comments are allowed,
-as defined by the [JavaScript Minifier](https://www.crockford.com/javascript/jsmin.html)
-
-The file format is as follows. Properties are shown with their default
-values, all properties are optional.
-
-    {
-      "scheme": "amqps",   // [string] "amqp" (no TLS) or "amqps"
-      "host": "",          // [string] DNS or IP address for connection. Defaults to local host.
-      "port": "amqps",     // [string] "amqp", "amqps" or port number. Defaults to value of 'scheme'.
-      "user": null,        // [string] Authentication user name
-      "password": null,    // [string] Authentication password
-
-      "sasl": {
-        "enable": true,         // [bool] Enable or disable SASL
-        "mechanisms": null,     // [list] List of allowed SASL mechanism names.
-                                // If null the library determines the default list.
-        "allow_insecure": false // [boolean] Allow mechanisms that send unencrypted clear-text passwords
-      },
-
-      // Note: it is an error to have a "tls" object unless scheme="amqps"
-      "tls": {
-        "cert": null,   // [string] name of client certificate or database
-        "key": null     // [string] private key or identity for client certificate
-        "ca": null,     // [string] name of CA certificate or database
-        "verify": true, // [bool] if true, require a valid cert with matching host name
-      }
-    }


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


[25/50] qpid-proton git commit: NO-JIRA: Revert use of cmake ENVIRONMENT test property

Posted by ac...@apache.org.
NO-JIRA: Revert use of cmake ENVIRONMENT test property

Does not work on some older versions of CMake, even though the 2.8.12
documentation says it should.


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

Branch: refs/heads/go1
Commit: 5cd006f96c51f9079fc4a25ca60740c4008a9e95
Parents: 9697287
Author: Alan Conway <ac...@redhat.com>
Authored: Wed Sep 19 12:17:14 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Wed Sep 19 12:17:40 2018 -0400

----------------------------------------------------------------------
 cpp/examples/CMakeLists.txt | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5cd006f9/cpp/examples/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/cpp/examples/CMakeLists.txt b/cpp/examples/CMakeLists.txt
index 35ad01c..226f6b2 100644
--- a/cpp/examples/CMakeLists.txt
+++ b/cpp/examples/CMakeLists.txt
@@ -121,14 +121,12 @@ if (PYTHON_EXECUTABLE)
   add_test(
     NAME cpp-example-container
     WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-    COMMAND ${PYTHON_EXECUTABLE} testme -v ContainerExampleTest)
-  set_tests_properties(cpp-example-container PROPERTIES ENVIRONMENT "${test_env}")
+    COMMAND ${PN_ENV_SCRIPT} -- ${test_env} ${PYTHON_EXECUTABLE} testme -v ContainerExampleTest)
 
   if (NOT SSL_IMPL STREQUAL none)
     add_test(
       NAME cpp-example-container-ssl
       WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-      COMMAND ${PYTHON_EXECUTABLE}  testme -v ContainerExampleSSLTest)
-    set_tests_properties(cpp-example-container-ssl PROPERTIES ENVIRONMENT "${test_env}")
+      COMMAND ${PN_ENV_SCRIPT} -- ${test_env} ${PYTHON_EXECUTABLE}  testme -v ContainerExampleSSLTest)
   endif()
 endif()


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


[14/50] qpid-proton git commit: NO-JIRA: [c] Fix link error in fuzz tests.

Posted by ac...@apache.org.
NO-JIRA: [c] Fix link error in fuzz tests.

Linking the URL fuzz test directly with util.c breaks as it now depends on
private symbols in the core library. Instead link with libqpid-proton which
includes everything required.


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

Branch: refs/heads/go1
Commit: f963e4fc4684a92557bfb353f6470ffafc7487ae
Parents: 393f8a6
Author: Alan Conway <ac...@redhat.com>
Authored: Tue Sep 11 15:17:16 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Tue Sep 11 15:17:16 2018 -0400

----------------------------------------------------------------------
 c/tests/fuzz/CMakeLists.txt | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/f963e4fc/c/tests/fuzz/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/c/tests/fuzz/CMakeLists.txt b/c/tests/fuzz/CMakeLists.txt
index 5d4187d..1af7e50 100644
--- a/c/tests/fuzz/CMakeLists.txt
+++ b/c/tests/fuzz/CMakeLists.txt
@@ -30,10 +30,9 @@ endif ()
 
 add_library (StandaloneFuzzTargetMain STATIC StandaloneFuzzTargetMain.c StandaloneFuzzTargetInit.c)
 
-macro (pn_add_fuzz_test test)
+macro (pn_add_fuzz_test_no_proton test)
   add_executable (${test} ${ARGN})
-  target_link_libraries (${test} qpid-proton-core ${FUZZING_LIBRARY})
-
+  target_link_libraries (${test} ${FUZZING_LIBRARY})
   if (FUZZ_REGRESSION_TESTS)
     # StandaloneFuzzTargetMain cannot walk directory trees
     file(GLOB_RECURSE files ${CMAKE_CURRENT_SOURCE_DIR}/${test}/*)
@@ -41,14 +40,20 @@ macro (pn_add_fuzz_test test)
   else ()
     add_test (NAME ${test} COMMAND $<TARGET_FILE:${test}> -runs=1 ${CMAKE_CURRENT_SOURCE_DIR}/${test}>)
   endif ()
-endmacro(pn_add_fuzz_test)
+endmacro(pn_add_fuzz_test_no_proton)
+
+macro (pn_add_fuzz_test test)
+  pn_add_fuzz_test_no_proton (${test} ${ARGN})
+  target_link_libraries (${test} qpid-proton-core ${FUZZING_LIBRARY})
+endmacro (pn_add_fuzz_test)
 
 # Fuzz tests at the User API level
 pn_add_fuzz_test (fuzz-connection-driver fuzz-connection-driver.c)
 pn_add_fuzz_test (fuzz-message-decode fuzz-message-decode.c)
 
-# pn_url_parse is not in proton core and is only used by messenger so compile specially
-pn_add_fuzz_test (fuzz-url fuzz-url.c ${PN_C_SOURCE_DIR}/extra/url.c ${PN_C_SOURCE_DIR}/core/util.c)
+# pn_url_parse is not in qpid-proton-core so link with qpid-proton instead
+pn_add_fuzz_test_no_proton (fuzz-url fuzz-url.c)
+target_link_libraries (fuzz-url qpid-proton ${FUZZING_LIBRARY})
 
 # This regression test can take a very long time so don't run by default
 if(HAS_PROACTOR AND FUZZ_LONG_TESTS)


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


[46/50] qpid-proton git commit: NO-JIRA: call out the repo cleanup step

Posted by ac...@apache.org.
NO-JIRA: call out the repo cleanup step


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

Branch: refs/heads/go1
Commit: 555878d018949011443c4857128c3dda82b97494
Parents: aa85a1f
Author: Robbie Gemmell <ro...@apache.org>
Authored: Wed Oct 3 14:39:46 2018 +0100
Committer: Robbie Gemmell <ro...@apache.org>
Committed: Wed Oct 3 14:39:46 2018 +0100

----------------------------------------------------------------------
 docs/release.md | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/555878d0/docs/release.md
----------------------------------------------------------------------
diff --git a/docs/release.md b/docs/release.md
index 946a46f..919cf5d 100644
--- a/docs/release.md
+++ b/docs/release.md
@@ -28,3 +28,4 @@
   - Status is visible at: https://www.apache.org/mirrors/
 4. Update the website with release content.
 5. Send release announcement email.
+6. Clean out older release(s) from release repo as appropriate.


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


[39/50] qpid-proton git commit: Partially revert "NO-JIRA: Remove unused deprecated reactor functionality" - Retain the symbols for linkage, but remove them from the header file

Posted by ac...@apache.org.
Partially revert "NO-JIRA: Remove unused deprecated reactor functionality"
- Retain the symbols for linkage, but remove them from the header file

This reverts commit 57f5ec14aebe374d718cbb87c079a7b56cb6b705.


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

Branch: refs/heads/go1
Commit: dc96ae50fd699eb3f2d3a0cc6f01c00ecd6cc689
Parents: ae96bce
Author: Andrew Stitcher <as...@apache.org>
Authored: Thu Sep 27 11:52:17 2018 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Fri Sep 28 17:35:04 2018 -0400

----------------------------------------------------------------------
 c/src/reactor/selectable.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/dc96ae50/c/src/reactor/selectable.c
----------------------------------------------------------------------
diff --git a/c/src/reactor/selectable.c b/c/src/reactor/selectable.c
index 473f113..dffd1db 100644
--- a/c/src/reactor/selectable.c
+++ b/c/src/reactor/selectable.c
@@ -28,6 +28,26 @@
 #include <assert.h>
 #include <stdlib.h>
 
+/*
+ * These are totally unused (and unusable) but these definitions have been
+ * retained to maintain the external linkage symbols
+ */
+
+PNX_EXTERN pn_iterator_t *pn_selectables(void)
+{
+  return pn_iterator();
+}
+
+PNX_EXTERN void *pn_selectables_next(pn_iterator_t *selectables)
+{
+  return pn_iterator_next(selectables);
+}
+
+PNX_EXTERN void pn_selectables_free(pn_iterator_t *selectables)
+{
+  pn_free(selectables);
+}
+
 struct pn_selectable_t {
   pn_socket_t fd;
   int index;


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


[13/50] qpid-proton git commit: PROTON-1798: [c, cpp, ruby] Installable tests for proton

Posted by ac...@apache.org.
PROTON-1798: [c, cpp, ruby] Installable tests for proton

Tests can be executed from install for c, cpp, ruby.
See tests/share/examples-README.md

RUNTIME_CHECK=memcheck, helgrind are supported for normal builds.
asan, tsan require a special library build so less likely to be useful for install tests.

TODO:
- python, go examples
- non-example tests installed under share/pronton-VERSION/tests/<language>


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

Branch: refs/heads/go1
Commit: 393f8a67712d126f98b3a87e83fdafab57011239
Parents: 6c765bc
Author: Alan Conway <ac...@redhat.com>
Authored: Mon Sep 10 17:13:09 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Tue Sep 11 12:07:56 2018 -0400

----------------------------------------------------------------------
 CMakeLists.txt                 |   7 +-
 c/CMakeLists.txt               |   1 +
 c/examples/CMakeLists.txt      |  33 +++---
 c/examples/example_test.py     | 115 -------------------
 c/examples/testme              | 111 ++++++++++++++++++
 cpp/CMakeLists.txt             |   1 +
 cpp/examples/CMakeLists.txt    |  40 ++++---
 cpp/examples/example_test.py   | 216 ------------------------------------
 cpp/examples/testme            | 213 +++++++++++++++++++++++++++++++++++
 go/CMakeLists.txt              |   5 +-
 python/CMakeLists.txt          |   5 +-
 ruby/CMakeLists.txt            |  20 ++--
 ruby/examples/example_test.rb  | 110 ------------------
 ruby/examples/testme           | 110 ++++++++++++++++++
 runtime_check.cmake            | 123 --------------------
 tests/py/test_subprocess.py    |  10 +-
 tests/runtime_check.cmake      | 123 ++++++++++++++++++++
 tests/share/CMakeLists.txt     |  42 +++++++
 tests/share/README.txt         |   3 +
 tests/share/examples-README.md |  20 ++++
 20 files changed, 692 insertions(+), 616 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/393f8a67/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 105f22e..b9e1656 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -39,7 +39,7 @@ find_package (CyrusSASL)
 enable_testing ()
 
 # Set up runtime checks (valgrind, sanitizers etc.)
-include(runtime_check.cmake)  
+include(tests/runtime_check.cmake)  
 
 ## Variables used across components
 
@@ -394,8 +394,9 @@ endforeach(BINDING)
 
 unset(BUILD_BINDINGS CACHE) # Remove from cache, only relevant when creating the initial cache.
 
-install (FILES LICENSE.txt README.md
-         DESTINATION ${PROTON_SHARE})
+install (FILES LICENSE.txt README.md tests/share/CMakeLists.txt DESTINATION ${PROTON_SHARE})
+install (FILES tests/share/examples-README.md RENAME README.md DESTINATION ${PROTON_SHARE}/examples)
+install (DIRECTORY tests DESTINATION ${PROTON_SHARE} PATTERN share EXCLUDE)
 
 # Generate test environment settings
 configure_file(${CMAKE_SOURCE_DIR}/misc/config.sh.in

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/393f8a67/c/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/c/CMakeLists.txt b/c/CMakeLists.txt
index a16f46b..effb96b 100644
--- a/c/CMakeLists.txt
+++ b/c/CMakeLists.txt
@@ -601,4 +601,5 @@ add_subdirectory(tools)
 
 install (DIRECTORY examples/
          DESTINATION "${PROTON_SHARE}/examples/c"
+         USE_SOURCE_PERMISSIONS
          PATTERN ProtonConfig.cmake EXCLUDE)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/393f8a67/c/examples/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/c/examples/CMakeLists.txt b/c/examples/CMakeLists.txt
index b04e444..8526ffe 100644
--- a/c/examples/CMakeLists.txt
+++ b/c/examples/CMakeLists.txt
@@ -34,20 +34,23 @@ foreach (name broker send receive direct send-abort send-ssl)
 endforeach()
 
 
-# Add a test to run all examples
+find_package (PythonInterp)     # For test-driver script
+if (PYTHON_EXECUTABLE)
+  if(WIN32)
+    # NOTE: need to escape semicolons as cmake uses them as list separators.
+    set(test_path "$<TARGET_FILE_DIR:c-broker>\;$<TARGET_FILE_DIR:qpid-proton-core>\;$<TARGET_FILE_DIR:qpid-proton-proactor>")
+  else()
+    set(test_path "$<TARGET_FILE_DIR:c-broker>:$ENV{PATH}")
+  endif()
 
-# Make correct environment to find test executables and valgrind.
-if(WIN32)
-  set(test_path "$<TARGET_FILE_DIR:c-broker>;$<TARGET_FILE_DIR:qpid-proton-core>;$<TARGET_FILE_DIR:qpid-proton-proactor>")
-else()
-  set(test_path "$<TARGET_FILE_DIR:c-broker>:$ENV{PATH}")
-endif()
+  set(test_env
+    "PATH=${test_path}"
+    "PYTHONPATH=../../tests/py"
+    ${TEST_ENV})
 
-add_test(
-  NAME c-example-tests
-  COMMAND ${PN_ENV_SCRIPT}
-  "PATH=${test_path}"
-  "PYTHONPATH=${CMAKE_SOURCE_DIR}/tests/py"
-  ${TEST_ENV} --
-  ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/example_test.py -v
-  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+  add_test(
+    NAME c-example-tests
+    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+    COMMAND ${PYTHON_EXECUTABLE} testme -v)
+  set_tests_properties(c-example-tests PROPERTIES ENVIRONMENT "${test_env}")
+endif()

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/393f8a67/c/examples/example_test.py
----------------------------------------------------------------------
diff --git a/c/examples/example_test.py b/c/examples/example_test.py
deleted file mode 100644
index 35a8993..0000000
--- a/c/examples/example_test.py
+++ /dev/null
@@ -1,115 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License
-#
-
-# Run the C examples and verify that they behave as expected.
-# Example executables must be in PATH
-
-import unittest
-
-from test_subprocess import Popen, TestProcessError, check_output
-
-class Server(Popen):
-    def __init__(self, *args, **kwargs):
-        super(Server, self).__init__(*args, **kwargs)
-        self.port = self.expect("listening on ([0-9]+)$").group(1)
-
-MESSAGES=10
-
-def receive_expect_messages(n=MESSAGES): return ''.join(['{"sequence"=%s}\n'%i for i in range(1, n+1)])
-def receive_expect_total(n=MESSAGES): return "%s messages received\n"%n
-def receive_expect(n=MESSAGES): return receive_expect_messages(n)+receive_expect_total(n)
-def send_expect(n=MESSAGES): return "%s messages sent and acknowledged\n" % n
-def send_abort_expect(n=MESSAGES): return "%s messages started and aborted\n" % n
-
-class Broker(Server):
-    def __init__(self):
-        super(Broker, self).__init__(["broker", "", "0"], kill_me=True)
-
-class ExampleTest(unittest.TestCase):
-
-    def runex(self, name, port, messages=MESSAGES):
-        """Run an example with standard arguments, return output"""
-        return check_output([name, "", port, "xtest", str(messages)])
-
-    def startex(self, name, port, messages=MESSAGES):
-        """Start an example sub-process with standard arguments"""
-        return Popen([name, "", port, "xtest", str(messages)])
-
-    def test_send_receive(self):
-        """Send first then receive"""
-        with Broker() as b:
-            self.assertEqual(send_expect(), self.runex("send", b.port))
-            self.assertMultiLineEqual(receive_expect(), self.runex("receive", b.port))
-
-    def test_receive_send(self):
-        """Start receiving  first, then send."""
-        with Broker() as b:
-            r = self.startex("receive", b.port)
-            self.assertEqual(send_expect(), self.runex("send", b.port))
-            self.assertMultiLineEqual(receive_expect(), r.communicate()[0])
-
-    def test_send_direct(self):
-        """Send to direct server"""
-        d = Server(["direct", "", "0"])
-        self.assertEqual(send_expect(), self.runex("send", d.port))
-        self.assertMultiLineEqual(receive_expect(), d.communicate()[0])
-
-    def test_receive_direct(self):
-        """Receive from direct server"""
-        d =  Server(["direct", "", "0"])
-        self.assertMultiLineEqual(receive_expect(), self.runex("receive", d.port))
-        self.assertEqual("10 messages sent and acknowledged\n", d.communicate()[0])
-
-    def test_send_abort_broker(self):
-        """Sending aborted messages to a broker"""
-        with Broker() as b:
-            self.assertEqual(send_expect(), self.runex("send", b.port))
-            self.assertEqual(send_abort_expect(), self.runex("send-abort", b.port))
-            for i in range(MESSAGES):
-                self.assertEqual("Message aborted\n", b.stdout.readline())
-            self.assertEqual(send_expect(), self.runex("send", b.port))
-            expect = receive_expect_messages(MESSAGES)+receive_expect_messages(MESSAGES)+receive_expect_total(20)
-            self.assertMultiLineEqual(expect, self.runex("receive", b.port, "20"))
-
-    def test_send_abort_direct(self):
-        """Send aborted messages to the direct server"""
-        d = Server(["direct", "", "0", "examples", "20"])
-        self.assertEqual(send_expect(), self.runex("send", d.port))
-        self.assertEqual(send_abort_expect(), self.runex("send-abort", d.port))
-        self.assertEqual(send_expect(), self.runex("send", d.port))
-        expect = receive_expect_messages() + "Message aborted\n"*MESSAGES + receive_expect_messages()+receive_expect_total(20)
-        self.maxDiff = None
-        self.assertMultiLineEqual(expect, d.communicate()[0])
-
-    def test_send_ssl_receive(self):
-        """Send with SSL, then receive"""
-        try:
-            with Broker() as b:
-                got = self.runex("send-ssl", b.port)
-                self.assertIn("secure connection:", got)
-                self.assertIn(send_expect(), got)
-                self.assertMultiLineEqual(receive_expect(), self.runex("receive", b.port))
-        except TestProcessError as e:
-            if e.output and e.output.startswith(b"error initializing SSL"):
-                print("Skipping %s: SSL not available" % self.id())
-            else:
-                raise
-
-if __name__ == "__main__":
-    unittest.main()

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/393f8a67/c/examples/testme
----------------------------------------------------------------------
diff --git a/c/examples/testme b/c/examples/testme
new file mode 100755
index 0000000..c498293
--- /dev/null
+++ b/c/examples/testme
@@ -0,0 +1,111 @@
+#!/usr/bin/python
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License
+#
+
+# Run the C examples and verify that they behave as expected.
+# Example executables must be in PATH
+
+import unittest
+
+from test_subprocess import Popen, Server, TestProcessError, check_output
+
+MESSAGES=10
+
+def receive_expect_messages(n=MESSAGES): return ''.join(['{"sequence"=%s}\n'%i for i in range(1, n+1)])
+def receive_expect_total(n=MESSAGES): return "%s messages received\n"%n
+def receive_expect(n=MESSAGES): return receive_expect_messages(n)+receive_expect_total(n)
+def send_expect(n=MESSAGES): return "%s messages sent and acknowledged\n" % n
+def send_abort_expect(n=MESSAGES): return "%s messages started and aborted\n" % n
+
+class Broker(Server):
+    def __init__(self):
+        super(Broker, self).__init__(["broker", "", "0"], kill_me=True)
+
+class ExampleTest(unittest.TestCase):
+
+    def runex(self, name, port, messages=MESSAGES):
+        """Run an example with standard arguments, return output"""
+        return check_output([name, "", port, "xtest", str(messages)])
+
+    def startex(self, name, port, messages=MESSAGES):
+        """Start an example sub-process with standard arguments"""
+        return Popen([name, "", port, "xtest", str(messages)])
+
+    def test_send_receive(self):
+        """Send first then receive"""
+        with Broker() as b:
+            self.assertEqual(send_expect(), self.runex("send", b.port))
+            self.assertMultiLineEqual(receive_expect(), self.runex("receive", b.port))
+
+    def test_receive_send(self):
+        """Start receiving  first, then send."""
+        with Broker() as b:
+            r = self.startex("receive", b.port)
+            self.assertEqual(send_expect(), self.runex("send", b.port))
+            self.assertMultiLineEqual(receive_expect(), r.communicate()[0])
+
+    def test_send_direct(self):
+        """Send to direct server"""
+        d = Server(["direct", "", "0"])
+        self.assertEqual(send_expect(), self.runex("send", d.port))
+        self.assertMultiLineEqual(receive_expect(), d.communicate()[0])
+
+    def test_receive_direct(self):
+        """Receive from direct server"""
+        d =  Server(["direct", "", "0"])
+        self.assertMultiLineEqual(receive_expect(), self.runex("receive", d.port))
+        self.assertEqual("10 messages sent and acknowledged\n", d.communicate()[0])
+
+    def test_send_abort_broker(self):
+        """Sending aborted messages to a broker"""
+        with Broker() as b:
+            self.assertEqual(send_expect(), self.runex("send", b.port))
+            self.assertEqual(send_abort_expect(), self.runex("send-abort", b.port))
+            for i in range(MESSAGES):
+                self.assertEqual("Message aborted\n", b.stdout.readline())
+            self.assertEqual(send_expect(), self.runex("send", b.port))
+            expect = receive_expect_messages(MESSAGES)+receive_expect_messages(MESSAGES)+receive_expect_total(20)
+            self.assertMultiLineEqual(expect, self.runex("receive", b.port, "20"))
+
+    def test_send_abort_direct(self):
+        """Send aborted messages to the direct server"""
+        d = Server(["direct", "", "0", "examples", "20"])
+        self.assertEqual(send_expect(), self.runex("send", d.port))
+        self.assertEqual(send_abort_expect(), self.runex("send-abort", d.port))
+        self.assertEqual(send_expect(), self.runex("send", d.port))
+        expect = receive_expect_messages() + "Message aborted\n"*MESSAGES + receive_expect_messages()+receive_expect_total(20)
+        self.maxDiff = None
+        self.assertMultiLineEqual(expect, d.communicate()[0])
+
+    def test_send_ssl_receive(self):
+        """Send with SSL, then receive"""
+        try:
+            with Broker() as b:
+                got = self.runex("send-ssl", b.port)
+                self.assertIn("secure connection:", got)
+                self.assertIn(send_expect(), got)
+                self.assertMultiLineEqual(receive_expect(), self.runex("receive", b.port))
+        except TestProcessError as e:
+            if e.output and e.output.startswith(b"error initializing SSL"):
+                print("Skipping %s: SSL not available" % self.id())
+            else:
+                raise
+
+if __name__ == "__main__":
+    unittest.main()

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/393f8a67/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index a06e67d..d0b3cfb 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -198,6 +198,7 @@ install (DIRECTORY "include/proton" DESTINATION ${INCLUDE_INSTALL_DIR} FILES_MAT
 install (FILES "${CMAKE_CURRENT_BINARY_DIR}/config_presets.hpp" DESTINATION "${INCLUDE_INSTALL_DIR}/proton/internal")
 install (DIRECTORY "examples/"
   DESTINATION "${PROTON_SHARE}/examples/cpp"
+  USE_SOURCE_PERMISSIONS
   PATTERN "ProtonCppConfig.cmake" EXCLUDE)
 
 add_subdirectory(examples)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/393f8a67/cpp/examples/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/cpp/examples/CMakeLists.txt b/cpp/examples/CMakeLists.txt
index ba18d83..35ad01c 100644
--- a/cpp/examples/CMakeLists.txt
+++ b/cpp/examples/CMakeLists.txt
@@ -23,7 +23,7 @@ enable_language(CXX)
 set (ProtonCpp_DIR ${CMAKE_CURRENT_SOURCE_DIR})
 find_package(ProtonCpp REQUIRED)
 set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
-find_package(Threads)
+find_package(Threads REQUIRED)
 
 include_directories(${ProtonCpp_INCLUDE_DIRS})
 link_libraries(${ProtonCpp_LIBRARIES})
@@ -103,26 +103,32 @@ if(HAS_ENOUGH_CPP11)
   endif()
 endif()
 
-# Add a test with the correct environment to find test executables and valgrind.
-macro(add_cpp_example_test name)
+find_package (PythonInterp)     # For test-driver script
+if (PYTHON_EXECUTABLE)
   if(WIN32)
-    set(test_path "$<TARGET_FILE_DIR:broker>;$<TARGET_FILE_DIR:qpid-proton>;$<TARGET_FILE_DIR:qpid-proton-cpp>")
-  else(WIN32)
+    # NOTE: need to escape semicolons as cmake uses them as list separators.
+    set(test_path "$<TARGET_FILE_DIR:broker>\;$<TARGET_FILE_DIR:qpid-proton-core>\;$<TARGET_FILE_DIR:qpid-proton-cpp>")
+  else()
     set(test_path "$<TARGET_FILE_DIR:broker>:$ENV{PATH}")
-  endif(WIN32)
-  add_test(
-    NAME ${name}
-    COMMAND ${PN_ENV_SCRIPT}
+  endif()
+
+  set(test_env
     "PATH=${test_path}"
-    "PYTHONPATH=${CMAKE_SOURCE_DIR}/tests/py"
+    "PYTHONPATH=../../tests/py"
     "HAS_CPP11=$<$<BOOL:${HAS_ENOUGH_CPP11}>:1>"
-    ${TEST_ENV} --
-    ${ARGN}
-    )
-endmacro()
+    ${TEST_ENV})
 
-add_cpp_example_test(cpp-example-container ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/example_test.py -v ContainerExampleTest)
+  add_test(
+    NAME cpp-example-container
+    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+    COMMAND ${PYTHON_EXECUTABLE} testme -v ContainerExampleTest)
+  set_tests_properties(cpp-example-container PROPERTIES ENVIRONMENT "${test_env}")
 
-if (NOT SSL_IMPL STREQUAL none)
-add_cpp_example_test(cpp-example-container-ssl ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/example_test.py -v ContainerExampleSSLTest)
+  if (NOT SSL_IMPL STREQUAL none)
+    add_test(
+      NAME cpp-example-container-ssl
+      WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+      COMMAND ${PYTHON_EXECUTABLE}  testme -v ContainerExampleSSLTest)
+    set_tests_properties(cpp-example-container-ssl PROPERTIES ENVIRONMENT "${test_env}")
+  endif()
 endif()

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/393f8a67/cpp/examples/example_test.py
----------------------------------------------------------------------
diff --git a/cpp/examples/example_test.py b/cpp/examples/example_test.py
deleted file mode 100644
index 38a9a6e..0000000
--- a/cpp/examples/example_test.py
+++ /dev/null
@@ -1,216 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License
-#
-
-# Run the C++ examples and verify that they behave as expected.
-# Example executables must be in PATH
-
-import unittest, sys, shutil, os
-from test_subprocess import Popen, TestProcessError, check_output
-from os.path import dirname
-from string import Template
-
-class Server(Popen):
-    """A process that prints 'listening on <port>' to stdout"""
-    def __init__(self, *args, **kwargs):
-        super(Server, self).__init__(*args, **kwargs)
-        self.port = self.expect("listening on ([0-9]+)$").group(1)
-
-    @property
-    def addr(self):
-        return ":%s/example" % self.port
-
-def _cyrusSetup(conf_dir):
-  """Write out simple SASL config.tests
-  """
-  saslpasswd = os.getenv('SASLPASSWD')
-  if saslpasswd:
-    t = Template("""sasldb_path: ${db}
-mech_list: EXTERNAL DIGEST-MD5 SCRAM-SHA-1 CRAM-MD5 PLAIN ANONYMOUS
-""")
-    abs_conf_dir = os.path.abspath(conf_dir)
-    shutil.rmtree(abs_conf_dir, True)
-    os.mkdir(abs_conf_dir)
-    db = os.path.join(abs_conf_dir,'proton.sasldb')
-    conf = os.path.join(abs_conf_dir,'proton-server.conf')
-    with open(conf, 'w') as f:
-        f.write(t.substitute(db=db))
-    cmd_template = Template("echo password | ${saslpasswd} -c -p -f ${db} -u proton user")
-    cmd = cmd_template.substitute(db=db, saslpasswd=saslpasswd)
-    check_output(args=cmd, shell=True)
-    os.environ['PN_SASL_CONFIG_PATH'] = abs_conf_dir
-
-# Globally initialize Cyrus SASL configuration
-_cyrusSetup('sasl-conf')
-
-class Broker(Server):
-    def __init__(self):
-        super(Broker, self).__init__(["broker", "-a", "//:0"], kill_me=True)
-
-CLIENT_EXPECT="""Twas brillig, and the slithy toves => TWAS BRILLIG, AND THE SLITHY TOVES
-Did gire and gymble in the wabe. => DID GIRE AND GYMBLE IN THE WABE.
-All mimsy were the borogroves, => ALL MIMSY WERE THE BOROGROVES,
-And the mome raths outgrabe. => AND THE MOME RATHS OUTGRABE.
-"""
-
-def recv_expect():
-    return "".join(['{"sequence"=%s}\n' % (i+1) for i in range(100)])
-
-class ContainerExampleTest(unittest.TestCase):
-    """Run the container examples, verify they behave as expected."""
-
-    def test_helloworld(self):
-      self.assertMultiLineEqual('Hello World!\n', check_output(["helloworld", Broker.addr]))
-
-    def test_simple_send_recv(self):
-        self.assertMultiLineEqual("all messages confirmed\n", check_output(["simple_send", "-a", Broker.addr]))
-        self.assertMultiLineEqual(recv_expect(), check_output(["simple_recv", "-a", Broker.addr]))
-
-    def test_simple_recv_send(self):
-        recv = Popen(["simple_recv", "-a", Broker.addr])
-        self.assertMultiLineEqual("all messages confirmed\n", check_output(["simple_send", "-a", Broker.addr]))
-        self.assertMultiLineEqual(recv_expect(), recv.communicate()[0])
-
-    def test_simple_send_direct_recv(self):
-        recv = Server(["direct_recv", "-a", "//:0"])
-        self.assertMultiLineEqual("all messages confirmed\n", check_output(["simple_send", "-a", recv.addr]))
-        self.assertMultiLineEqual(recv_expect(), recv.communicate()[0])
-
-    def test_simple_recv_direct_send(self):
-        send = Server(["direct_send", "-a", "//:0"])
-        self.assertMultiLineEqual(recv_expect(), check_output(["simple_recv", "-a", send.addr]))
-        self.assertMultiLineEqual("all messages confirmed\n", send.communicate()[0])
-
-    def test_request_response(self):
-        with Popen(["server", Broker.addr, "example"], kill_me=True) as server:
-            server.expect("connected to %s" % Broker.addr)
-            self.assertMultiLineEqual(CLIENT_EXPECT, check_output(["client", "-a", Broker.addr]))
-
-    def test_request_response_direct(self):
-        with Server(["server_direct", "-a", "//:0"], kill_me=True) as server:
-            self.assertMultiLineEqual(CLIENT_EXPECT, check_output(["client", "-a", server.addr]))
-
-    def test_flow_control(self):
-        want="""success: Example 1: simple credit
-success: Example 2: basic drain
-success: Example 3: drain without credit
-success: Example 4: high/low watermark
-"""
-        self.assertMultiLineEqual(want, check_output(["flow_control", "--quiet"]))
-
-    def test_encode_decode(self):
-        want="""
-== Array, list and map of uniform type.
-array<int>[int(1), int(2), int(3)]
-[ 1 2 3 ]
-list[int(1), int(2), int(3)]
-[ 1 2 3 ]
-map{string(one):int(1), string(two):int(2)}
-{ one:1 two:2 }
-map{string(z):int(3), string(a):int(4)}
-[ z:3 a:4 ]
-list[string(a), string(b), string(c)]
-
-== List and map of mixed type values.
-list[int(42), string(foo)]
-[ 42 foo ]
-map{int(4):string(four), string(five):int(5)}
-{ 4:four five:5 }
-
-== Insert with stream operators.
-array<int>[int(1), int(2), int(3)]
-list[int(42), boolean(0), symbol(x)]
-map{string(k1):int(42), symbol(k2):boolean(0)}
-"""
-        self.maxDiff = None
-        self.assertMultiLineEqual(want, check_output(["encode_decode"]))
-
-    def test_scheduled_send_03(self):
-        # Output should be a bunch of "send" lines but can't guarantee exactly how many.
-        out = check_output(["scheduled_send_03", "-a", Broker.addr+"scheduled_send", "-t", "0.1", "-i", "0.001"]).split()
-        self.assertTrue(len(out) > 0);
-        self.assertEqual(["send"]*len(out), out)
-
-    @unittest.skipUnless(os.getenv('HAS_CPP11'), "not a  C++11 build")
-    def test_scheduled_send(self):
-        out = check_output(["scheduled_send", "-a", Broker.addr+"scheduled_send", "-t", "0.1", "-i", "0.001"]).split()
-        self.assertTrue(len(out) > 0);
-        self.assertEqual(["send"]*len(out), out)
-
-    def test_message_properties(self):
-        expect="""using put/get: short=123 string=foo symbol=sym
-using coerce: short(as long)=123
-props[short]=123
-props[string]=foo
-props[symbol]=sym
-short=42 string=bar
-expected conversion_error: "unexpected type, want: uint got: int"
-expected conversion_error: "unexpected type, want: uint got: string"
-"""
-        self.assertMultiLineEqual(expect, check_output(["message_properties"]))
-
-    @unittest.skipUnless(os.getenv('HAS_CPP11'), "not a  C++11 build")
-    def test_multithreaded_client(self):
-        got = check_output(["multithreaded_client", Broker.addr, "examples", "10"])
-        self.maxDiff = None
-        self.assertIn("10 messages sent and received", got);
-
-#    @unittest.skipUnless(os.getenv('HAS_CPP11'), "not a  C++11 build")
-    @unittest.skip("Test is unstable, will enable when fixed")
-    def test_multithreaded_client_flow_control(self):
-        got = check_output(["multithreaded_client_flow_control", Broker.addr, "examples", "10", "2"])
-        self.maxDiff = None
-        self.assertIn("20 messages sent and received", got);
-
-class ContainerExampleSSLTest(unittest.TestCase):
-    """Run the SSL container examples, verify they behave as expected."""
-
-    def ssl_certs_dir(self):
-        """Absolute path to the test SSL certificates"""
-        return os.path.join(dirname(sys.argv[0]), "ssl-certs")
-
-    def test_ssl(self):
-        # SSL without SASL, VERIFY_PEER_NAME
-        out = check_output(["ssl", "-c", self.ssl_certs_dir()])
-        expect = "Server certificate identity CN=test_server\nHello World!"
-        self.assertIn(expect, out)
-
-    def test_ssl_no_name(self):
-        out = check_output(["ssl", "-c", self.ssl_certs_dir(), "-v", "noname"])
-        expect = "Outgoing client connection connected via SSL.  Server certificate identity CN=test_server\nHello World!"
-        self.assertIn(expect, out)
-
-    def test_ssl_bad_name(self):
-        # VERIFY_PEER
-        out = check_output(["ssl", "-c", self.ssl_certs_dir(), "-v", "fail"])
-        expect = "Expected failure of connection with wrong peer name"
-        self.assertIn(expect, out)
-
-    def test_ssl_client_cert(self):
-        # SSL with SASL EXTERNAL
-        expect="""Inbound client certificate identity CN=test_client
-Outgoing client connection connected via SSL.  Server certificate identity CN=test_server
-Hello World!
-"""
-        out = check_output(["ssl_client_cert", self.ssl_certs_dir()])
-        self.assertIn(expect, out)
-
-if __name__ == "__main__":
-    with Broker() as b:
-      Broker.addr = b.addr
-      unittest.main()

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/393f8a67/cpp/examples/testme
----------------------------------------------------------------------
diff --git a/cpp/examples/testme b/cpp/examples/testme
new file mode 100755
index 0000000..d4abc0a
--- /dev/null
+++ b/cpp/examples/testme
@@ -0,0 +1,213 @@
+#!/usr/bin/python
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License
+#
+
+# Run the C++ examples and verify that they behave as expected.
+# Example executables must be in PATH
+
+import unittest, sys, shutil, os
+from test_subprocess import Popen, TestProcessError, check_output
+import test_subprocess
+from os.path import dirname
+from string import Template
+
+class Server(test_subprocess.Server):
+    @property
+    def addr(self):
+        return ":%s/example" % self.port
+
+def _cyrusSetup(conf_dir):
+  """Write out simple SASL config.tests
+  """
+  saslpasswd = os.getenv('SASLPASSWD')
+  if saslpasswd:
+    t = Template("""sasldb_path: ${db}
+mech_list: EXTERNAL DIGEST-MD5 SCRAM-SHA-1 CRAM-MD5 PLAIN ANONYMOUS
+""")
+    abs_conf_dir = os.path.abspath(conf_dir)
+    shutil.rmtree(abs_conf_dir, True)
+    os.mkdir(abs_conf_dir)
+    db = os.path.join(abs_conf_dir,'proton.sasldb')
+    conf = os.path.join(abs_conf_dir,'proton-server.conf')
+    with open(conf, 'w') as f:
+        f.write(t.substitute(db=db))
+    cmd_template = Template("echo password | ${saslpasswd} -c -p -f ${db} -u proton user")
+    cmd = cmd_template.substitute(db=db, saslpasswd=saslpasswd)
+    check_output(args=cmd, shell=True)
+    os.environ['PN_SASL_CONFIG_PATH'] = abs_conf_dir
+
+# Globally initialize Cyrus SASL configuration
+_cyrusSetup('sasl-conf')
+
+class Broker(Server):
+    def __init__(self):
+        super(Broker, self).__init__(["broker", "-a", "//:0"], kill_me=True)
+
+CLIENT_EXPECT="""Twas brillig, and the slithy toves => TWAS BRILLIG, AND THE SLITHY TOVES
+Did gire and gymble in the wabe. => DID GIRE AND GYMBLE IN THE WABE.
+All mimsy were the borogroves, => ALL MIMSY WERE THE BOROGROVES,
+And the mome raths outgrabe. => AND THE MOME RATHS OUTGRABE.
+"""
+
+def recv_expect():
+    return "".join(['{"sequence"=%s}\n' % (i+1) for i in range(100)])
+
+class ContainerExampleTest(unittest.TestCase):
+    """Run the container examples, verify they behave as expected."""
+
+    def test_helloworld(self):
+      self.assertMultiLineEqual('Hello World!\n', check_output(["helloworld", Broker.addr]))
+
+    def test_simple_send_recv(self):
+        self.assertMultiLineEqual("all messages confirmed\n", check_output(["simple_send", "-a", Broker.addr]))
+        self.assertMultiLineEqual(recv_expect(), check_output(["simple_recv", "-a", Broker.addr]))
+
+    def test_simple_recv_send(self):
+        recv = Popen(["simple_recv", "-a", Broker.addr])
+        self.assertMultiLineEqual("all messages confirmed\n", check_output(["simple_send", "-a", Broker.addr]))
+        self.assertMultiLineEqual(recv_expect(), recv.communicate()[0])
+
+    def test_simple_send_direct_recv(self):
+        recv = Server(["direct_recv", "-a", "//:0"])
+        self.assertMultiLineEqual("all messages confirmed\n", check_output(["simple_send", "-a", recv.addr]))
+        self.assertMultiLineEqual(recv_expect(), recv.communicate()[0])
+
+    def test_simple_recv_direct_send(self):
+        send = Server(["direct_send", "-a", "//:0"])
+        self.assertMultiLineEqual(recv_expect(), check_output(["simple_recv", "-a", send.addr]))
+        self.assertMultiLineEqual("all messages confirmed\n", send.communicate()[0])
+
+    def test_request_response(self):
+        with Popen(["server", Broker.addr, "example"], kill_me=True) as server:
+            server.expect("connected to %s" % Broker.addr)
+            self.assertMultiLineEqual(CLIENT_EXPECT, check_output(["client", "-a", Broker.addr]))
+
+    def test_request_response_direct(self):
+        with Server(["server_direct", "-a", "//:0"], kill_me=True) as server:
+            self.assertMultiLineEqual(CLIENT_EXPECT, check_output(["client", "-a", server.addr]))
+
+    def test_flow_control(self):
+        want="""success: Example 1: simple credit
+success: Example 2: basic drain
+success: Example 3: drain without credit
+success: Example 4: high/low watermark
+"""
+        self.assertMultiLineEqual(want, check_output(["flow_control", "--quiet"]))
+
+    def test_encode_decode(self):
+        want="""
+== Array, list and map of uniform type.
+array<int>[int(1), int(2), int(3)]
+[ 1 2 3 ]
+list[int(1), int(2), int(3)]
+[ 1 2 3 ]
+map{string(one):int(1), string(two):int(2)}
+{ one:1 two:2 }
+map{string(z):int(3), string(a):int(4)}
+[ z:3 a:4 ]
+list[string(a), string(b), string(c)]
+
+== List and map of mixed type values.
+list[int(42), string(foo)]
+[ 42 foo ]
+map{int(4):string(four), string(five):int(5)}
+{ 4:four five:5 }
+
+== Insert with stream operators.
+array<int>[int(1), int(2), int(3)]
+list[int(42), boolean(0), symbol(x)]
+map{string(k1):int(42), symbol(k2):boolean(0)}
+"""
+        self.maxDiff = None
+        self.assertMultiLineEqual(want, check_output(["encode_decode"]))
+
+    def test_scheduled_send_03(self):
+        # Output should be a bunch of "send" lines but can't guarantee exactly how many.
+        out = check_output(["scheduled_send_03", "-a", Broker.addr+"scheduled_send", "-t", "0.1", "-i", "0.001"]).split()
+        self.assertTrue(len(out) > 0);
+        self.assertEqual(["send"]*len(out), out)
+
+    @unittest.skipUnless(os.getenv('HAS_CPP11'), "not a  C++11 build")
+    def test_scheduled_send(self):
+        out = check_output(["scheduled_send", "-a", Broker.addr+"scheduled_send", "-t", "0.1", "-i", "0.001"]).split()
+        self.assertTrue(len(out) > 0);
+        self.assertEqual(["send"]*len(out), out)
+
+    def test_message_properties(self):
+        expect="""using put/get: short=123 string=foo symbol=sym
+using coerce: short(as long)=123
+props[short]=123
+props[string]=foo
+props[symbol]=sym
+short=42 string=bar
+expected conversion_error: "unexpected type, want: uint got: int"
+expected conversion_error: "unexpected type, want: uint got: string"
+"""
+        self.assertMultiLineEqual(expect, check_output(["message_properties"]))
+
+    @unittest.skipUnless(os.getenv('HAS_CPP11'), "not a  C++11 build")
+    def test_multithreaded_client(self):
+        got = check_output(["multithreaded_client", Broker.addr, "examples", "10"])
+        self.maxDiff = None
+        self.assertIn("10 messages sent and received", got);
+
+#    @unittest.skipUnless(os.getenv('HAS_CPP11'), "not a  C++11 build")
+    @unittest.skip("Test is unstable, will enable when fixed")
+    def test_multithreaded_client_flow_control(self):
+        got = check_output(["multithreaded_client_flow_control", Broker.addr, "examples", "10", "2"])
+        self.maxDiff = None
+        self.assertIn("20 messages sent and received", got);
+
+class ContainerExampleSSLTest(unittest.TestCase):
+    """Run the SSL container examples, verify they behave as expected."""
+
+    def ssl_certs_dir(self):
+        """Absolute path to the test SSL certificates"""
+        return os.path.join(dirname(sys.argv[0]), "ssl-certs")
+
+    def test_ssl(self):
+        # SSL without SASL, VERIFY_PEER_NAME
+        out = check_output(["ssl", "-c", self.ssl_certs_dir()])
+        expect = "Server certificate identity CN=test_server\nHello World!"
+        self.assertIn(expect, out)
+
+    def test_ssl_no_name(self):
+        out = check_output(["ssl", "-c", self.ssl_certs_dir(), "-v", "noname"])
+        expect = "Outgoing client connection connected via SSL.  Server certificate identity CN=test_server\nHello World!"
+        self.assertIn(expect, out)
+
+    def test_ssl_bad_name(self):
+        # VERIFY_PEER
+        out = check_output(["ssl", "-c", self.ssl_certs_dir(), "-v", "fail"])
+        expect = "Expected failure of connection with wrong peer name"
+        self.assertIn(expect, out)
+
+    def test_ssl_client_cert(self):
+        # SSL with SASL EXTERNAL
+        expect="""Inbound client certificate identity CN=test_client
+Outgoing client connection connected via SSL.  Server certificate identity CN=test_server
+Hello World!
+"""
+        out = check_output(["ssl_client_cert", self.ssl_certs_dir()])
+        self.assertIn(expect, out)
+
+if __name__ == "__main__":
+    with Broker() as b:
+      Broker.addr = b.addr
+      unittest.main()

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/393f8a67/go/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/go/CMakeLists.txt b/go/CMakeLists.txt
index 951f8a3..5887635 100644
--- a/go/CMakeLists.txt
+++ b/go/CMakeLists.txt
@@ -84,4 +84,7 @@ set (GO_INSTALL_DIR ${SHARE_INSTALL_DIR}/gocode/src CACHE PATH "Installation dir
 mark_as_advanced (GO_INSTALL_DIR)
 
 install(DIRECTORY src/qpid.apache.org DESTINATION ${GO_INSTALL_DIR} COMPONENT Go)
-install(DIRECTORY examples/ DESTINATION "${PROTON_SHARE}/examples/go" COMPONENT Go)
+install(DIRECTORY examples/
+  DESTINATION "${PROTON_SHARE}/examples/go"
+  COMPONENT Go
+  PATTERN "CMakeLists.txt" EXCLUDE)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/393f8a67/python/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt
index 181128c..c9e659e 100644
--- a/python/CMakeLists.txt
+++ b/python/CMakeLists.txt
@@ -151,10 +151,7 @@ install(TARGETS ${SWIG_MODULE_cproton_REAL_NAME}
 install(DIRECTORY examples/
         DESTINATION "${PROTON_SHARE}/examples/python"
         COMPONENT Python
-        PATTERN "*.py"
-        PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
-                    GROUP_EXECUTE GROUP_READ
-                    WORLD_EXECUTE WORLD_READ)
+        USE_SOURCE_PERMISSIONS)
 
 set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "html;tutorial")
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/393f8a67/ruby/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/ruby/CMakeLists.txt b/ruby/CMakeLists.txt
index eb99907..ca342dc 100644
--- a/ruby/CMakeLists.txt
+++ b/ruby/CMakeLists.txt
@@ -112,11 +112,7 @@ install(DIRECTORY lib/ DESTINATION ${RUBY_ARCHLIB_DIR} COMPONENT Ruby)
 install(DIRECTORY examples/
         DESTINATION "${PROTON_SHARE}/examples/ruby"
         COMPONENT Ruby
-        PATTERN "*.rb"
-        PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
-                    GROUP_EXECUTE GROUP_READ
-                    WORLD_EXECUTE WORLD_READ)
-
+        USE_SOURCE_PERMISSIONS)
 ## Tests
 
 to_native_path("${src}/lib;${src}/tests;${src}/spec;${bin};${c_lib_dir};$ENV{RUBYLIB}" RUBYLIB)
@@ -138,10 +134,18 @@ if (result EQUAL 0)  # Have minitest
       NAME ${name}
       COMMAND ${test_env} ${TEST_WRAP_PREFIX_CMD} ${RUBY_EXECUTABLE} ${script} -v
       ${ARGN})
-
   endmacro()
-  add_ruby_test(example_test.rb WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/examples)
-  add_ruby_test(old_example_test.rb WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests/old-examples)
+
+  add_test(
+    NAME ruby-example-test
+    COMMAND ${test_env} ${RUBY_EXECUTABLE} testme -v
+    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/examples)
+
+  add_test(
+    NAME ruby-old-example-test
+    COMMAND ${test_env} ${RUBY_EXECUTABLE} old_example_test.rb -v
+    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests/old-examples)
+
   file(GLOB TESTS tests/test_*.rb)
   file(GLOB SPECS spec/*_spec.rb)
   foreach(t ${TESTS} ${SPECS})

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/393f8a67/ruby/examples/example_test.rb
----------------------------------------------------------------------
diff --git a/ruby/examples/example_test.rb b/ruby/examples/example_test.rb
deleted file mode 100755
index 576acf2..0000000
--- a/ruby/examples/example_test.rb
+++ /dev/null
@@ -1,110 +0,0 @@
-#!/usr/bin/env ruby
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-require 'minitest/autorun'
-require 'qpid_proton'
-require 'socket'
-require 'rbconfig'
-
-begin
-  MiniTest::Test
-rescue NameError                # For older versions of MiniTest
-  MiniTest::Test = MiniTest::Unit::TestCase
-end
-
-def listening_port(s)
-  /Listening on ([0-9]+)/.match(s)[1]
-end
-
-def listening_url(s)
-  ":#{listening_port s}"
-end
-
-class ExampleTest < MiniTest::Test
-
-  def run_script(*args)
-    return IO.popen([ RbConfig.ruby ] + args.map { |a| a.to_s })
-  end
-
-  def assert_output(want, *args)
-    assert_equal(want.strip, run_script(*args).read.strip)
-  end
-
-  def test_helloworld
-    assert_output("Hello world!", "helloworld.rb", $url, "examples")
-  end
-
-  def test_client_server
-    want =  <<EOS
--> Twas brillig, and the slithy toves
-<- TWAS BRILLIG, AND THE SLITHY TOVES
--> Did gire and gymble in the wabe.
-<- DID GIRE AND GYMBLE IN THE WABE.
--> All mimsy were the borogroves,
-<- ALL MIMSY WERE THE BOROGROVES,
--> And the mome raths outgrabe.
-<- AND THE MOME RATHS OUTGRABE.
-EOS
-    server = run_script("server.rb", $url, "examples")
-    assert_output(want.strip, "client.rb", $url, "examples")
-  ensure
-    Process.kill :TERM, server.pid if server
-  end
-
-  def test_send_recv
-    assert_output("All 10 messages confirmed!", "simple_send.rb", $url, "examples")
-    want = (0..9).reduce("") { |x,y| x << "Received: sequence #{y}\n" }
-    assert_output(want.strip, "simple_recv.rb", $url, "examples")
-  end
-
-  def test_ssl_send_recv
-    skip 'SSL not available' unless Qpid::Proton::SSL.present?
-    out = run_script("ssl_send.rb", $url, "examples").read.strip
-    assert_match(/Connection secured with "...*\"\nAll 10 messages confirmed!/, out)
-    want = (0..9).reduce("") { |x,y| x << "Received: sequence #{y}\n" }
-    assert_output(want.strip, "simple_recv.rb", $url, "examples")
-  end
-
-  def test_direct_recv
-    p = run_script("direct_recv.rb", ":0", "examples")
-    url = listening_url(p.readline) # Wait till ready
-    assert_output("All 10 messages confirmed!", "simple_send.rb", url, "examples")
-    want = (0..9).reduce("") { |x,y| x << "Received: sequence #{y}\n" }
-    assert_equal(want.strip, p.read.strip)
-  end
-
-  def test_direct_send
-    p = run_script("direct_send.rb", ":0", "examples")
-    url = listening_url(p.readline) # Wait till ready
-    want = (0..9).reduce("") { |x,y| x << "Received: sequence #{y}\n" }
-    assert_output(want.strip, "simple_recv.rb", url, "examples")
-    assert_equal("All 10 messages confirmed!", p.read.strip)
-  end
-end
-
-# Start the broker before all tests.
-$broker = IO.popen([RbConfig.ruby, 'broker.rb', ":0"])
-l = $broker.readline
-$url = listening_url(l)
-
-# Kill the broker after all tests
-MiniTest.after_run do
-  Process.kill(:TERM, $broker.pid) if $broker
-end

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/393f8a67/ruby/examples/testme
----------------------------------------------------------------------
diff --git a/ruby/examples/testme b/ruby/examples/testme
new file mode 100755
index 0000000..5c0c59d
--- /dev/null
+++ b/ruby/examples/testme
@@ -0,0 +1,110 @@
+#!/usr/bin/ruby
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+require 'minitest/autorun'
+require 'qpid_proton'
+require 'socket'
+require 'rbconfig'
+
+begin
+  MiniTest::Test
+rescue NameError                # For older versions of MiniTest
+  MiniTest::Test = MiniTest::Unit::TestCase
+end
+
+def listening_port(s)
+  /Listening on ([0-9]+)/.match(s)[1]
+end
+
+def listening_url(s)
+  ":#{listening_port s}"
+end
+
+class ExampleTest < MiniTest::Test
+
+  def run_script(*args)
+    return IO.popen([ RbConfig.ruby ] + args.map { |a| a.to_s })
+  end
+
+  def assert_output(want, *args)
+    assert_equal(want.strip, run_script(*args).read.strip)
+  end
+
+  def test_helloworld
+    assert_output("Hello world!", "helloworld.rb", $url, "examples")
+  end
+
+  def test_client_server
+    want =  <<EOS
+-> Twas brillig, and the slithy toves
+<- TWAS BRILLIG, AND THE SLITHY TOVES
+-> Did gire and gymble in the wabe.
+<- DID GIRE AND GYMBLE IN THE WABE.
+-> All mimsy were the borogroves,
+<- ALL MIMSY WERE THE BOROGROVES,
+-> And the mome raths outgrabe.
+<- AND THE MOME RATHS OUTGRABE.
+EOS
+    server = run_script("server.rb", $url, "examples")
+    assert_output(want.strip, "client.rb", $url, "examples")
+  ensure
+    Process.kill :TERM, server.pid if server
+  end
+
+  def test_send_recv
+    assert_output("All 10 messages confirmed!", "simple_send.rb", $url, "examples")
+    want = (0..9).reduce("") { |x,y| x << "Received: sequence #{y}\n" }
+    assert_output(want.strip, "simple_recv.rb", $url, "examples")
+  end
+
+  def test_ssl_send_recv
+    skip 'SSL not available' unless Qpid::Proton::SSL.present?
+    out = run_script("ssl_send.rb", $url, "examples").read.strip
+    assert_match(/Connection secured with "...*\"\nAll 10 messages confirmed!/, out)
+    want = (0..9).reduce("") { |x,y| x << "Received: sequence #{y}\n" }
+    assert_output(want.strip, "simple_recv.rb", $url, "examples")
+  end
+
+  def test_direct_recv
+    p = run_script("direct_recv.rb", ":0", "examples")
+    url = listening_url(p.readline) # Wait till ready
+    assert_output("All 10 messages confirmed!", "simple_send.rb", url, "examples")
+    want = (0..9).reduce("") { |x,y| x << "Received: sequence #{y}\n" }
+    assert_equal(want.strip, p.read.strip)
+  end
+
+  def test_direct_send
+    p = run_script("direct_send.rb", ":0", "examples")
+    url = listening_url(p.readline) # Wait till ready
+    want = (0..9).reduce("") { |x,y| x << "Received: sequence #{y}\n" }
+    assert_output(want.strip, "simple_recv.rb", url, "examples")
+    assert_equal("All 10 messages confirmed!", p.read.strip)
+  end
+end
+
+# Start the broker before all tests.
+$broker = IO.popen([RbConfig.ruby, 'broker.rb', ":0"])
+l = $broker.readline
+$url = listening_url(l)
+
+# Kill the broker after all tests
+MiniTest.after_run do
+  Process.kill(:TERM, $broker.pid) if $broker
+end

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/393f8a67/runtime_check.cmake
----------------------------------------------------------------------
diff --git a/runtime_check.cmake b/runtime_check.cmake
deleted file mode 100644
index e1d76c3..0000000
--- a/runtime_check.cmake
+++ /dev/null
@@ -1,123 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-# Configuration for code analysis tools: runtime checking and coverage.
-
-# Any test that needs runtime checks should use TEST_EXE_PREFIX and TEST_ENV.
-# Normally they are set as a result of the RUNTIME_CHECK value,
-# but can be set directly for unsupported tools or unusual flags
-# e.g. -DTEST_EXE_PREFIX=rr or -DTEST_EXE_PREFIX="valgrind --tool=massif"
-
-set(TEST_EXE_PREFIX "" CACHE STRING "Prefix for test executable command line")
-set(TEST_WRAP_PREFIX "" CACHE STRING "Prefix for interpreter tests (e.g. python, ruby) that load proton as an extension")
-set(TEST_ENV "" CACHE STRING "Extra environment for tests: name1=value1;name2=value2")
-mark_as_advanced(TEST_EXE_PREFIX TEST_WRAP_PREFIX TEST_ENV)
-
-# Check for valgrind
-find_program(VALGRIND_EXECUTABLE valgrind DOC "location of valgrind program")
-set(VALGRIND_SUPPRESSIONS "${CMAKE_SOURCE_DIR}/tests/valgrind.supp" CACHE STRING "Suppressions file for valgrind")
-set(VALGRIND_COMMON_ARGS "--error-exitcode=42 --quiet --suppressions=${VALGRIND_SUPPRESSIONS}")
-mark_as_advanced(VALGRIND_EXECUTABLE VALGRIND_SUPPRESSIONS VALGRIND_COMMON_ARGS)
-
-# Check for compiler sanitizers
-if((CMAKE_C_COMPILER_ID MATCHES "GNU"
-      AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.8)
-    OR (CMAKE_C_COMPILER_ID MATCHES "Clang"
-      AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.1))
-  set(HAS_SANITIZERS TRUE)
-endif()
-
-# Valid values for RUNTIME_CHECK
-set(runtime_checks OFF asan tsan memcheck helgrind)
-
-# Set the default
-if(NOT CMAKE_BUILD_TYPE MATCHES "Coverage" AND VALGRIND_EXECUTABLE)
-  set(RUNTIME_CHECK_DEFAULT "memcheck")
-endif()
-
-# Deprecated options to enable runtime checks
-macro(deprecated_enable_check old new doc)
-  option(${old} ${doc} OFF)
-  if (${old})
-    message("WARNING: option ${old} is deprecated, use RUNTIME_CHECK=${new} instead")
-    set(RUNTIME_CHECK_DEFAULT ${new})
-  endif()
-endmacro()
-deprecated_enable_check(ENABLE_VALGRIND memcheck "Use valgrind to detect run-time problems")
-deprecated_enable_check(ENABLE_SANITIZERS asan "Compile with memory sanitizers (asan, ubsan)")
-deprecated_enable_check(ENABLE_TSAN tsan "Compile with thread sanitizer (tsan)")
-
-set(RUNTIME_CHECK ${RUNTIME_CHECK_DEFAULT} CACHE string "Enable runtime checks. Valid values: ${runtime_checks}")
-
-if(CMAKE_BUILD_TYPE MATCHES "Coverage" AND RUNTIME_CHECK)
-  message(FATAL_ERROR "Cannot set RUNTIME_CHECK with CMAKE_BUILD_TYPE=Coverage")
-endif()
-
-macro(assert_has_sanitizers)
-  if(NOT HAS_SANITIZERS)
-    message(FATAL_ERROR "compiler sanitizers are not available")
-  endif()
-endmacro()
-
-macro(assert_has_valgrind)
-  if(NOT VALGRIND_EXECUTABLE)
-    message(FATAL_ERROR "valgrind is not available")
-  endif()
-endmacro()
-
-if(RUNTIME_CHECK STREQUAL "memcheck")
-  assert_has_valgrind()
-  message(STATUS "Runtime memory checker: valgrind memcheck")
-  set(TEST_EXE_PREFIX "${VALGRIND_EXECUTABLE} --tool=memcheck --leak-check=full ${VALGRIND_COMMON_ARGS}")
-  # FIXME aconway 2018-09-06: NO TEST_WRAP_PREFIX, need --trace-children + many suppressions
-
-elseif(RUNTIME_CHECK STREQUAL "helgrind")
-  assert_has_valgrind()
-  message(STATUS "Runtime race checker: valgrind helgrind")
-  set(TEST_EXE_PREFIX "${VALGRIND_EXECUTABLE} --tool=helgrind ${VALGRIND_COMMON_ARGS}")
-  # FIXME aconway 2018-09-06: NO TEST_WRAP_PREFIX, need --trace-children + many suppressions
-
-elseif(RUNTIME_CHECK STREQUAL "asan")
-  assert_has_sanitizers()
-  message(STATUS "Runtime memory checker: gcc/clang memory sanitizers")
-  set(SANITIZE_FLAGS "-g -fno-omit-frame-pointer -fsanitize=address,undefined")
-  set(TEST_WRAP_PREFIX "${CMAKE_SOURCE_DIR}/tests/preload_asan.sh $<TARGET_FILE:qpid-proton-core>")
-
-elseif(RUNTIME_CHECK STREQUAL "tsan")
-  assert_has_sanitizers()
-  message(STATUS "Runtime race checker: gcc/clang thread sanitizer")
-  set(SANITIZE_FLAGS "-g -fno-omit-frame-pointer -fsanitize=thread")
-
-elseif(RUNTIME_CHECK)
-  message(FATAL_ERROR "'RUNTIME_CHECK=${RUNTIME_CHECK}' is invalid, valid values: ${runtime_checks}")
-endif()
-
-if(SANITIZE_FLAGS)
-  set(ENABLE_UNDEFINED_ERROR OFF CACHE BOOL "Disabled for sanitizers" FORCE)
-  string(APPEND CMAKE_C_FLAGS " ${SANITIZE_FLAGS}")
-  string(APPEND CMAKE_CXX_FLAGS "${SANITIZE_FLAGS}")
-endif()
-
-if(TEST_EXE_PREFIX)
-  # Add TEST_EXE_PREFIX to TEST_ENV so test runner scripts can use it.
-  list(APPEND TEST_ENV "TEST_EXE_PREFIX=${TEST_EXE_PREFIX}")
-  # Make a CMake-list form of TEST_EXE_PREFIX for add_test() commands
-  separate_arguments(TEST_EXE_PREFIX_CMD UNIX_COMMAND "${TEST_EXE_PREFIX}")
-endif()
-separate_arguments(TEST_WRAP_PREFIX_CMD UNIX_COMMAND "${TEST_WRAP_PREFIX}")

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/393f8a67/tests/py/test_subprocess.py
----------------------------------------------------------------------
diff --git a/tests/py/test_subprocess.py b/tests/py/test_subprocess.py
index 1c7d2b9..512123f 100644
--- a/tests/py/test_subprocess.py
+++ b/tests/py/test_subprocess.py
@@ -33,7 +33,7 @@ class TestProcessError(Exception):
 
 class Popen(subprocess.Popen):
     """
-    Adds TEST_EXE_PREFIX to the command and checks stderr for runtime checker output.
+    Add TEST_EXE_PREFIX to the command, check stderr for runtime checker output.
     In a 'with' statement it runs check_wait() on exit from the block, or
     check_kill() if initialized with kill_me=True
     """
@@ -43,11 +43,13 @@ class Popen(subprocess.Popen):
         Takes all args and kwargs of subprocess.Popen except stdout, stderr, universal_newlines
         kill_me=True runs check_kill() in __exit__() instead of check_wait()
         """
-        self.cmd = args[0]
         self.on_exit = self.check_kill if kwargs.pop('kill_me', False) else self.check_wait
         self.errfile = tempfile.NamedTemporaryFile(delete=False)
         kwargs.update({'universal_newlines': True, 'stdout': PIPE, 'stderr': self.errfile})
-        args = ((os.environ.get("TEST_EXE_PREFIX", "").split() + args[0]),) + args[1:]
+        prefix = os.environ.get("TEST_EXE_PREFIX")
+        if prefix:
+            args = [prefix.split() + args[0]] + list(args[1:])
+        self.cmd = args[0]
         super(Popen, self).__init__(*args, **kwargs)
 
     def check_wait(self):
@@ -75,7 +77,7 @@ class Popen(subprocess.Popen):
         line = self.stdout.readline()
         match = re.search(pattern, line)
         if not match:
-            raise Exception("%s: can't find '%s' in '%s'" % (self.cmd, pattern, line))
+            raise TestProcessError(self, "can't find '%s' in '%s'" % (pattern, line))
         return match
 
     @property

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/393f8a67/tests/runtime_check.cmake
----------------------------------------------------------------------
diff --git a/tests/runtime_check.cmake b/tests/runtime_check.cmake
new file mode 100644
index 0000000..e1d76c3
--- /dev/null
+++ b/tests/runtime_check.cmake
@@ -0,0 +1,123 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# Configuration for code analysis tools: runtime checking and coverage.
+
+# Any test that needs runtime checks should use TEST_EXE_PREFIX and TEST_ENV.
+# Normally they are set as a result of the RUNTIME_CHECK value,
+# but can be set directly for unsupported tools or unusual flags
+# e.g. -DTEST_EXE_PREFIX=rr or -DTEST_EXE_PREFIX="valgrind --tool=massif"
+
+set(TEST_EXE_PREFIX "" CACHE STRING "Prefix for test executable command line")
+set(TEST_WRAP_PREFIX "" CACHE STRING "Prefix for interpreter tests (e.g. python, ruby) that load proton as an extension")
+set(TEST_ENV "" CACHE STRING "Extra environment for tests: name1=value1;name2=value2")
+mark_as_advanced(TEST_EXE_PREFIX TEST_WRAP_PREFIX TEST_ENV)
+
+# Check for valgrind
+find_program(VALGRIND_EXECUTABLE valgrind DOC "location of valgrind program")
+set(VALGRIND_SUPPRESSIONS "${CMAKE_SOURCE_DIR}/tests/valgrind.supp" CACHE STRING "Suppressions file for valgrind")
+set(VALGRIND_COMMON_ARGS "--error-exitcode=42 --quiet --suppressions=${VALGRIND_SUPPRESSIONS}")
+mark_as_advanced(VALGRIND_EXECUTABLE VALGRIND_SUPPRESSIONS VALGRIND_COMMON_ARGS)
+
+# Check for compiler sanitizers
+if((CMAKE_C_COMPILER_ID MATCHES "GNU"
+      AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.8)
+    OR (CMAKE_C_COMPILER_ID MATCHES "Clang"
+      AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.1))
+  set(HAS_SANITIZERS TRUE)
+endif()
+
+# Valid values for RUNTIME_CHECK
+set(runtime_checks OFF asan tsan memcheck helgrind)
+
+# Set the default
+if(NOT CMAKE_BUILD_TYPE MATCHES "Coverage" AND VALGRIND_EXECUTABLE)
+  set(RUNTIME_CHECK_DEFAULT "memcheck")
+endif()
+
+# Deprecated options to enable runtime checks
+macro(deprecated_enable_check old new doc)
+  option(${old} ${doc} OFF)
+  if (${old})
+    message("WARNING: option ${old} is deprecated, use RUNTIME_CHECK=${new} instead")
+    set(RUNTIME_CHECK_DEFAULT ${new})
+  endif()
+endmacro()
+deprecated_enable_check(ENABLE_VALGRIND memcheck "Use valgrind to detect run-time problems")
+deprecated_enable_check(ENABLE_SANITIZERS asan "Compile with memory sanitizers (asan, ubsan)")
+deprecated_enable_check(ENABLE_TSAN tsan "Compile with thread sanitizer (tsan)")
+
+set(RUNTIME_CHECK ${RUNTIME_CHECK_DEFAULT} CACHE string "Enable runtime checks. Valid values: ${runtime_checks}")
+
+if(CMAKE_BUILD_TYPE MATCHES "Coverage" AND RUNTIME_CHECK)
+  message(FATAL_ERROR "Cannot set RUNTIME_CHECK with CMAKE_BUILD_TYPE=Coverage")
+endif()
+
+macro(assert_has_sanitizers)
+  if(NOT HAS_SANITIZERS)
+    message(FATAL_ERROR "compiler sanitizers are not available")
+  endif()
+endmacro()
+
+macro(assert_has_valgrind)
+  if(NOT VALGRIND_EXECUTABLE)
+    message(FATAL_ERROR "valgrind is not available")
+  endif()
+endmacro()
+
+if(RUNTIME_CHECK STREQUAL "memcheck")
+  assert_has_valgrind()
+  message(STATUS "Runtime memory checker: valgrind memcheck")
+  set(TEST_EXE_PREFIX "${VALGRIND_EXECUTABLE} --tool=memcheck --leak-check=full ${VALGRIND_COMMON_ARGS}")
+  # FIXME aconway 2018-09-06: NO TEST_WRAP_PREFIX, need --trace-children + many suppressions
+
+elseif(RUNTIME_CHECK STREQUAL "helgrind")
+  assert_has_valgrind()
+  message(STATUS "Runtime race checker: valgrind helgrind")
+  set(TEST_EXE_PREFIX "${VALGRIND_EXECUTABLE} --tool=helgrind ${VALGRIND_COMMON_ARGS}")
+  # FIXME aconway 2018-09-06: NO TEST_WRAP_PREFIX, need --trace-children + many suppressions
+
+elseif(RUNTIME_CHECK STREQUAL "asan")
+  assert_has_sanitizers()
+  message(STATUS "Runtime memory checker: gcc/clang memory sanitizers")
+  set(SANITIZE_FLAGS "-g -fno-omit-frame-pointer -fsanitize=address,undefined")
+  set(TEST_WRAP_PREFIX "${CMAKE_SOURCE_DIR}/tests/preload_asan.sh $<TARGET_FILE:qpid-proton-core>")
+
+elseif(RUNTIME_CHECK STREQUAL "tsan")
+  assert_has_sanitizers()
+  message(STATUS "Runtime race checker: gcc/clang thread sanitizer")
+  set(SANITIZE_FLAGS "-g -fno-omit-frame-pointer -fsanitize=thread")
+
+elseif(RUNTIME_CHECK)
+  message(FATAL_ERROR "'RUNTIME_CHECK=${RUNTIME_CHECK}' is invalid, valid values: ${runtime_checks}")
+endif()
+
+if(SANITIZE_FLAGS)
+  set(ENABLE_UNDEFINED_ERROR OFF CACHE BOOL "Disabled for sanitizers" FORCE)
+  string(APPEND CMAKE_C_FLAGS " ${SANITIZE_FLAGS}")
+  string(APPEND CMAKE_CXX_FLAGS "${SANITIZE_FLAGS}")
+endif()
+
+if(TEST_EXE_PREFIX)
+  # Add TEST_EXE_PREFIX to TEST_ENV so test runner scripts can use it.
+  list(APPEND TEST_ENV "TEST_EXE_PREFIX=${TEST_EXE_PREFIX}")
+  # Make a CMake-list form of TEST_EXE_PREFIX for add_test() commands
+  separate_arguments(TEST_EXE_PREFIX_CMD UNIX_COMMAND "${TEST_EXE_PREFIX}")
+endif()
+separate_arguments(TEST_WRAP_PREFIX_CMD UNIX_COMMAND "${TEST_WRAP_PREFIX}")

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/393f8a67/tests/share/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/tests/share/CMakeLists.txt b/tests/share/CMakeLists.txt
new file mode 100644
index 0000000..a50c0e9
--- /dev/null
+++ b/tests/share/CMakeLists.txt
@@ -0,0 +1,42 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+cmake_minimum_required(VERSION 2.8.12)
+
+project(ProtonExamples)
+include(CTest)
+enable_testing()
+include("tests/runtime_check.cmake")
+
+# ind example sub-directories that contain "CMakeLists.txt" or "testme"
+set(ex_dir "${CMAKE_SOURCE_DIR}/examples")
+file(GLOB subs ${ex_dir}/*)
+foreach(dir ${subs})
+  get_filename_component(ex "${dir}" NAME)
+  if(EXISTS ${dir}/CMakeLists.txt)
+    # Has CMakeLists.txt to define example tests.
+    add_subdirectory(${dir})
+  elseif(EXISTS ${dir}/testme)
+    # Has a "testme" script to run example tests.
+    add_test(
+      NAME ${ex}-example-tests
+      COMMAND ${dir}/testme
+      WORKING_DIRECTORY ${dir})
+  endif()
+ endforeach()

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/393f8a67/tests/share/README.txt
----------------------------------------------------------------------
diff --git a/tests/share/README.txt b/tests/share/README.txt
new file mode 100644
index 0000000..f7864b6
--- /dev/null
+++ b/tests/share/README.txt
@@ -0,0 +1,3 @@
+This directory is for files that should be installed at the top level
+of the INSTALL_PREFIX/share/proton-VERSION directory to support
+installed testing.

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/393f8a67/tests/share/examples-README.md
----------------------------------------------------------------------
diff --git a/tests/share/examples-README.md b/tests/share/examples-README.md
new file mode 100644
index 0000000..6f7404c
--- /dev/null
+++ b/tests/share/examples-README.md
@@ -0,0 +1,20 @@
+Verifying the examples 
+======================
+
+If you have installed support for self-testing a proton installation you can
+automatically run and verify the examples.
+
+To build C, C++ tests and run all tests:
+
+    cd TEMP-BUILD-DIR
+    cmake INSTALL-PREFIX/share/proton-VERSION/examples
+    make
+    ctest
+
+To run an individual test that does not require CMake, (e.g. ruby):
+
+    cd  INSTALL-PREFIX/share/proton-VERSION/examples/ruby
+    ./testme
+
+Some testme scripts accept additional arguments (e.g. -v for verbose)
+


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


[22/50] qpid-proton git commit: PROTON-1935: minor correction to docs/connect_config.md

Posted by ac...@apache.org.
PROTON-1935: minor correction to docs/connect_config.md


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

Branch: refs/heads/go1
Commit: 23a4b4f8993fb3814e7be4b2c851034339febfc1
Parents: b164d99
Author: Alan Conway <ac...@redhat.com>
Authored: Tue Sep 18 14:51:55 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Tue Sep 18 14:51:55 2018 -0400

----------------------------------------------------------------------
 docs/connect_config.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/23a4b4f8/docs/connect_config.md
----------------------------------------------------------------------
diff --git a/docs/connect_config.md b/docs/connect_config.md
index f0419cc..63044be 100644
--- a/docs/connect_config.md
+++ b/docs/connect_config.md
@@ -29,7 +29,7 @@ values, all properties are optional.
         "enable": true,         // [bool] Enable or disable SASL
         "mechanisms": null,     // [list] List of allowed SASL mechanism names.
                                 // If null the library determines the default list.
-        "allow_insecure": false // [boolean] Allow mechanisms that send clear-text passwords
+        "allow_insecure": false // [boolean] Allow mechanisms that send unencrypted clear-text passwords
       },
 
       // Note: it is an error to have a "tls" object unless scheme="amqps"


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


[10/50] qpid-proton git commit: PROTON-1798: cmake runtime-check improvements

Posted by ac...@apache.org.
PROTON-1798: cmake runtime-check improvements

Usage notes:
- new CMake variable: RUNTIME_CHECK, choose from [memcheck helgrind asan tsan OFF]
- defaults to 'memcheck' if available, else OFF
- old ENABLE_ variables for valgrind/sanitizers are deprecated
- example_test scripts check for stderr output including from killed processes

Implementation details:

- moved all runtime-check setup code to seprate runtime-check.cmake
- tool-agnostic internal CMake variables for running tests
- removed all valgrind-specific code outside of runtime-check.cmake
- example_test.py check stderr as well as exit status to catch broker issues.

NOTE: asan,tsan not yet working for python/ruby bindings, they are disabled in
san builds. See tests/preload_asan.sh for current status of the work.

NOTE: Some python soak tests for obscure messenger features were removed, they
have faulty start-up timing logic and can fail under valgrind. We can restore
them if needed but we'll need to fix the -X feature of msgr-recv to report ready
only after connections are remote open.


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

Branch: refs/heads/go1
Commit: 27edd9aca3b2b1078089ceaa2a387f0016ac6f0a
Parents: 7885bd3
Author: Alan Conway <ac...@redhat.com>
Authored: Fri Sep 7 13:20:42 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Mon Sep 10 15:41:24 2018 -0400

----------------------------------------------------------------------
 CMakeLists.txt                      |  71 +++------------
 c/examples/CMakeLists.txt           |   7 +-
 c/examples/example_test.py          |  58 +++++-------
 c/tests/CMakeLists.txt              |   4 +-
 c/tests/fuzz/CMakeLists.txt         |   2 +-
 c/tests/threaderciser.supp          |  18 ----
 c/tests/threaderciser.tsupp         |   5 -
 cpp/CMakeLists.txt                  |   2 +-
 cpp/examples/CMakeLists.txt         |  14 ++-
 cpp/examples/broker.cpp             |   4 +-
 cpp/examples/example_test.py        |  42 ++-------
 misc/config.sh.in                   |   6 --
 python/CMakeLists.txt               |   8 +-
 python/tests/proton_tests/common.py |  35 +------
 python/tests/proton_tests/soak.py   |  83 ++---------------
 python/tests/proton_tests/ssl.py    |  33 -------
 python/tox.ini.in                   |   2 +-
 ruby/CMakeLists.txt                 |   8 +-
 runtime_check.cmake                 | 123 +++++++++++++++++++++++++
 scripts/env.py                      |   5 -
 tests/preload_asan.sh               |  51 +++++++++++
 tests/py/test_subprocess.py         | 105 +++++++++++++++++++++
 tests/valgrind.supp                 | 151 +++++++++++++++++++++++++++++++
 23 files changed, 517 insertions(+), 320 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/27edd9ac/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 560dc05..105f22e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,6 +38,9 @@ find_package (CyrusSASL)
 
 enable_testing ()
 
+# Set up runtime checks (valgrind, sanitizers etc.)
+include(runtime_check.cmake)  
+
 ## Variables used across components
 
 set (PN_ENV_SCRIPT "${PYTHON_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/scripts/env.py")
@@ -188,23 +191,6 @@ if (CMAKE_C_COMPILER_ID MATCHES "Clang")
   set (CXX_WARNING_FLAGS "${COMPILE_WARNING_FLAGS} -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-float-equal -Wno-padded -Wno-sign-conversion -Wno-switch-enum -Wno-weak-vtables -Wno-exit-time-destructors -Wno-global-constructors -Wno-shorten-64-to-32 -Wno-documentation -Wno-documentation-unknown-command -Wno-old-style-cast -Wno-missing-noreturn")
 endif()
 
-# Sanitizer flags apply to to both GNU and clang, C and C++
-if(ENABLE_SANITIZERS)
-  set(SANITIZE_FLAGS "-g -fno-omit-frame-pointer -fsanitize=address -fsanitize=leak -fsanitize=undefined")
-endif()
-if(ENABLE_TSAN)
-  set(SANITIZE_FLAGS "-g -fno-omit-frame-pointer -fsanitize=thread")
-endif()
-if (SANITIZE_FLAGS)
-  mark_as_advanced(SANITIZE_FLAGS)
-  if(CMAKE_C_COMPILER_ID MATCHES "Clang|GNU")
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SANITIZE_FLAGS}")
-  endif()
-  if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU")
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SANITIZE_FLAGS}")
-  endif()
-endif()
-
 if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
   if (NOT CMAKE_OSX_ARCHITECTURES)
     set(CMAKE_OSX_ARCHITECTURES "x86_64")
@@ -300,41 +286,6 @@ endforeach()
 set (PROTON_SHARE ${SHARE_INSTALL_DIR}/proton-${PN_VERSION})
 # End of variables used during install
 
-# Can't do valgrind and coverage at athe same time - coverage takes precedence
-if (CMAKE_BUILD_TYPE MATCHES "Coverage")
-  message(STATUS "Building for coverage analysis; no run-time error detection")
-else ()
-  find_program(VALGRIND_EXECUTABLE valgrind DOC "Location of the valgrind program")
-  mark_as_advanced (VALGRIND_EXECUTABLE)
-
-  option(ENABLE_VALGRIND "Use valgrind to detect run-time problems" ON)
-  if (ENABLE_VALGRIND)
-    if (VALGRIND_EXECUTABLE)
-      set (VALGRIND_SUPPRESSIONS ${CMAKE_SOURCE_DIR}/c/tests/valgrind.supp CACHE STRING "Default valgrind suppressions")
-      set (VALGRIND_OPTIONS "--error-exitcode=42 --quiet --leak-check=full --trace-children=yes" CACHE STRING "Default valgrind options")
-      mark_as_advanced(VALGRIND_SUPPRESSIONS VALGRIND_OPTIONS)
-      set (VALGRIND_ENV "VALGRIND=${VALGRIND_EXECUTABLE}" "VALGRIND_ARGS=${VALGRIND_OPTIONS} --suppressions=${VALGRIND_SUPPRESSIONS}")
-      separate_arguments(VALGRIND_OPTIONS_LIST UNIX_COMMAND ${VALGRIND_OPTIONS})
-      set (memcheck-cmd ${VALGRIND_EXECUTABLE} ${VALGRIND_OPTIONS_LIST} "--suppressions=${VALGRIND_SUPPRESSIONS}")
-      set (racecheck-cmd ${VALGRIND_EXECUTABLE} --tool=helgrind --error-exitcode=42 --quiet)
-    else ()
-      message(STATUS "Can't locate the valgrind command; no run-time error detection")
-    endif ()
-  endif ()
-endif ()
-
-# Options to enable sanitizing compile flags. Compile flags are set in c/CMakeLists.txt
-option(ENABLE_SANITIZERS "Compile with sanitizers (ASan, UBSan, TSan); incompatible with Valgrind" OFF)
-option(ENABLE_TSAN "Compile with Thread Sanitizer (TSan); incompatible with Valgrind" OFF)
-if (ENABLE_SANITIZERS OR ENABLE_TSAN)
-  set(DISABLE ENABLE_VALGRIND ENABLE_UNDEFINED_ERROR BUILD_GO)
-  message(STATUS "Building with sanitizers; disables ${DISABLE}")
-  foreach(d ${DISABLE})
-    set(${d} OFF CACHE BOOL "Disabled to run sanitizers" FORCE)
-  endforeach()
-  unset(VALGRIND_ENV)
-endif()
-
 # Set result to a native search path - used by examples and binding tests.
 # args after result are directories or search paths.
 macro(set_search_path result)
@@ -379,11 +330,11 @@ endif()
 find_program(GO_EXE go)
 mark_as_advanced(GO_EXE)
 if (GO_EXE)
-  if(WIN32)
+  set (DEFAULT_GO ON)
+  if(WIN32 OR RUNTIME_CHECK)
     # Go on windows requires gcc tool chain
+    # Go does not work with C-based runtime checkers.
     set (DEFAULT_GO OFF)
-  else()
-    set (DEFAULT_GO ON)
   endif()
 endif (GO_EXE)
 
@@ -405,15 +356,17 @@ if(SWIG_FOUND)
 
   # Prerequisites for Python wrapper:
   find_package (PythonLibs ${PYTHON_VERSION_STRING} EXACT)
-  if (PYTHONLIBS_FOUND)
+  # TODO aconway 2018-09-07: get python binding tests working with sanitizers
+  if (PYTHONLIBS_FOUND AND NOT SANITIZE_FLAGS)
     set (DEFAULT_PYTHON ON)
-  endif (PYTHONLIBS_FOUND)
+  endif ()
 
   # Prerequisites for Ruby:
   find_package(Ruby)
-  if (RUBY_FOUND)
+  # TODO aconway 2018-09-07: get ruby binding tests working with sanitizers
+  if (RUBY_FOUND AND NOT SANITIZE_FLAGS)
     set (DEFAULT_RUBY ON)
-  endif (RUBY_FOUND)
+  endif ()
 endif()
 
 # To kick-start a build with just a few bindings enabled by default, e.g. ruby and go:

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/27edd9ac/c/examples/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/c/examples/CMakeLists.txt b/c/examples/CMakeLists.txt
index 6128f62..b04e444 100644
--- a/c/examples/CMakeLists.txt
+++ b/c/examples/CMakeLists.txt
@@ -45,6 +45,9 @@ endif()
 
 add_test(
   NAME c-example-tests
-  COMMAND ${PN_ENV_SCRIPT} "PATH=${test_path}" ${VALGRIND_ENV} --
-          ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/example_test.py -v
+  COMMAND ${PN_ENV_SCRIPT}
+  "PATH=${test_path}"
+  "PYTHONPATH=${CMAKE_SOURCE_DIR}/tests/py"
+  ${TEST_ENV} --
+  ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/example_test.py -v
   WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/27edd9ac/c/examples/example_test.py
----------------------------------------------------------------------
diff --git a/c/examples/example_test.py b/c/examples/example_test.py
index 1834989..35a8993 100644
--- a/c/examples/example_test.py
+++ b/c/examples/example_test.py
@@ -20,31 +20,14 @@
 # Run the C examples and verify that they behave as expected.
 # Example executables must be in PATH
 
-import unittest, sys, time, re
+import unittest
 
-import subprocess
+from test_subprocess import Popen, TestProcessError, check_output
 
-class Server(subprocess.Popen):
+class Server(Popen):
     def __init__(self, *args, **kwargs):
-        self.kill_me = kwargs.pop('kill_me', False)
-        kwargs.update({'universal_newlines': True,
-                       'stdout': subprocess.PIPE})
         super(Server, self).__init__(*args, **kwargs)
-
-    def __enter__(self):
-        line = self.stdout.readline()
-        self.port = re.search("listening on ([0-9]+)$", line).group(1)
-        return self
-
-    def __exit__(self, *args):
-        if self.kill_me:
-            self.kill()
-            self.stdout.close() # Doesn't get closed if killed
-        self.wait()
-
-def check_output(*args, **kwargs):
-    kwargs.update({'universal_newlines': True})
-    return subprocess.check_output(*args, **kwargs)
+        self.port = self.expect("listening on ([0-9]+)$").group(1)
 
 MESSAGES=10
 
@@ -64,6 +47,10 @@ class ExampleTest(unittest.TestCase):
         """Run an example with standard arguments, return output"""
         return check_output([name, "", port, "xtest", str(messages)])
 
+    def startex(self, name, port, messages=MESSAGES):
+        """Start an example sub-process with standard arguments"""
+        return Popen([name, "", port, "xtest", str(messages)])
+
     def test_send_receive(self):
         """Send first then receive"""
         with Broker() as b:
@@ -73,20 +60,21 @@ class ExampleTest(unittest.TestCase):
     def test_receive_send(self):
         """Start receiving  first, then send."""
         with Broker() as b:
+            r = self.startex("receive", b.port)
             self.assertEqual(send_expect(), self.runex("send", b.port))
-            self.assertMultiLineEqual(receive_expect(), self.runex("receive", b.port))
+            self.assertMultiLineEqual(receive_expect(), r.communicate()[0])
 
     def test_send_direct(self):
         """Send to direct server"""
-        with Server(["direct", "", "0"]) as d:
-            self.assertEqual(send_expect(), self.runex("send", d.port))
-            self.assertMultiLineEqual(receive_expect(), d.communicate()[0])
+        d = Server(["direct", "", "0"])
+        self.assertEqual(send_expect(), self.runex("send", d.port))
+        self.assertMultiLineEqual(receive_expect(), d.communicate()[0])
 
     def test_receive_direct(self):
         """Receive from direct server"""
-        with Server(["direct", "", "0"]) as d:
-            self.assertMultiLineEqual(receive_expect(), self.runex("receive", d.port))
-            self.assertEqual("10 messages sent and acknowledged\n", d.communicate()[0])
+        d =  Server(["direct", "", "0"])
+        self.assertMultiLineEqual(receive_expect(), self.runex("receive", d.port))
+        self.assertEqual("10 messages sent and acknowledged\n", d.communicate()[0])
 
     def test_send_abort_broker(self):
         """Sending aborted messages to a broker"""
@@ -101,13 +89,13 @@ class ExampleTest(unittest.TestCase):
 
     def test_send_abort_direct(self):
         """Send aborted messages to the direct server"""
-        with Server(["direct", "", "0", "examples", "20"]) as d:
-            self.assertEqual(send_expect(), self.runex("send", d.port))
-            self.assertEqual(send_abort_expect(), self.runex("send-abort", d.port))
-            self.assertEqual(send_expect(), self.runex("send", d.port))
-            expect = receive_expect_messages() + "Message aborted\n"*MESSAGES + receive_expect_messages()+receive_expect_total(20)
-            self.maxDiff = None
-            self.assertMultiLineEqual(expect, d.communicate()[0])
+        d = Server(["direct", "", "0", "examples", "20"])
+        self.assertEqual(send_expect(), self.runex("send", d.port))
+        self.assertEqual(send_abort_expect(), self.runex("send-abort", d.port))
+        self.assertEqual(send_expect(), self.runex("send", d.port))
+        expect = receive_expect_messages() + "Message aborted\n"*MESSAGES + receive_expect_messages()+receive_expect_total(20)
+        self.maxDiff = None
+        self.assertMultiLineEqual(expect, d.communicate()[0])
 
     def test_send_ssl_receive(self):
         """Send with SSL, then receive"""

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/27edd9ac/c/tests/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/c/tests/CMakeLists.txt b/c/tests/CMakeLists.txt
index 87dfdb6..a4bfb67 100644
--- a/c/tests/CMakeLists.txt
+++ b/c/tests/CMakeLists.txt
@@ -32,7 +32,7 @@ macro (pn_add_c_test_nolib test)
   if (BUILD_WITH_CXX)
     set_source_files_properties (${ARGN} PROPERTIES LANGUAGE CXX)
   endif (BUILD_WITH_CXX)
-  add_test(NAME ${test} COMMAND ${test_env} ${memcheck-cmd} $<TARGET_FILE:${test}>)
+  add_test(NAME ${test} COMMAND ${test_env} ${TEST_EXE_PREFIX_CMD} $<TARGET_FILE:${test}>)
 endmacro (pn_add_c_test_nolib)
 
 # Add test with qpid-proton-core linked
@@ -58,7 +58,7 @@ if(HAS_PROACTOR)
   pn_add_c_test (c-proactor-tests proactor.c)
   target_link_libraries (c-proactor-tests qpid-proton-proactor)
 
-  # TODO Enable by default when races are cleared up
+  # TODO Enable by default when races and xcode problems are cleared up
   option(THREADERCISER "Run the threaderciser concurrency tests" OFF)
   if (THREADERCISER)
     pn_add_c_test(c-threaderciser threaderciser.c)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/27edd9ac/c/tests/fuzz/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/c/tests/fuzz/CMakeLists.txt b/c/tests/fuzz/CMakeLists.txt
index 19825b6..5d4187d 100644
--- a/c/tests/fuzz/CMakeLists.txt
+++ b/c/tests/fuzz/CMakeLists.txt
@@ -37,7 +37,7 @@ macro (pn_add_fuzz_test test)
   if (FUZZ_REGRESSION_TESTS)
     # StandaloneFuzzTargetMain cannot walk directory trees
     file(GLOB_RECURSE files ${CMAKE_CURRENT_SOURCE_DIR}/${test}/*)
-    add_test (NAME ${test} COMMAND ${memcheck-cmd} $<TARGET_FILE:${test}> ${files})
+    add_test (NAME ${test} COMMAND ${TEST_EXE_PREFIX_CMD} $<TARGET_FILE:${test}> ${files})
   else ()
     add_test (NAME ${test} COMMAND $<TARGET_FILE:${test}> -runs=1 ${CMAKE_CURRENT_SOURCE_DIR}/${test}>)
   endif ()

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/27edd9ac/c/tests/threaderciser.supp
----------------------------------------------------------------------
diff --git a/c/tests/threaderciser.supp b/c/tests/threaderciser.supp
deleted file mode 100644
index d14ff61..0000000
--- a/c/tests/threaderciser.supp
+++ /dev/null
@@ -1,18 +0,0 @@
-{
-   IGNORE: benign race in pni_log_enabled
-   Helgrind:Race
-   fun:pni_log_enabled
-}
-
-{
-   IGNORE: NSS library poking around in its own data segment upsets helgrind
-   Helgrind:Race
-   fun:strpbrk
-   fun:_nss_files_parse_servent
-}
-{
-   IGNORE: NSS library poking around in its own text segment upsets helgrind
-   Helgrind:Race
-   fun:*
-   fun:_nss_files_getservbyname_r
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/27edd9ac/c/tests/threaderciser.tsupp
----------------------------------------------------------------------
diff --git a/c/tests/threaderciser.tsupp b/c/tests/threaderciser.tsupp
deleted file mode 100644
index 18ceb23..0000000
--- a/c/tests/threaderciser.tsupp
+++ /dev/null
@@ -1,5 +0,0 @@
-# TSAN suppressions for threaderciser
-
-# Benign race in pni_log_enabled
-race:pni_log_enabled
-

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/27edd9ac/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index 0dcede2..a06e67d 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -242,7 +242,7 @@ macro(add_cpp_test test)
       "PATH=$<TARGET_FILE_DIR:qpid-proton>"
       $<TARGET_FILE:${test}> ${ARGN})
   else ()
-    add_test (NAME cpp-${test} COMMAND ${memcheck-cmd} $<TARGET_FILE:${test}> ${ARGN})
+    add_test (NAME cpp-${test} COMMAND ${TEST_EXE_PREFIX_CMD} $<TARGET_FILE:${test}> ${ARGN})
   endif ()
 endmacro(add_cpp_test)
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/27edd9ac/cpp/examples/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/cpp/examples/CMakeLists.txt b/cpp/examples/CMakeLists.txt
index 18d922e..ba18d83 100644
--- a/cpp/examples/CMakeLists.txt
+++ b/cpp/examples/CMakeLists.txt
@@ -104,7 +104,7 @@ if(HAS_ENOUGH_CPP11)
 endif()
 
 # Add a test with the correct environment to find test executables and valgrind.
-macro(add_cpp_test name)
+macro(add_cpp_example_test name)
   if(WIN32)
     set(test_path "$<TARGET_FILE_DIR:broker>;$<TARGET_FILE_DIR:qpid-proton>;$<TARGET_FILE_DIR:qpid-proton-cpp>")
   else(WIN32)
@@ -112,13 +112,17 @@ macro(add_cpp_test name)
   endif(WIN32)
   add_test(
     NAME ${name}
-    COMMAND ${PN_ENV_SCRIPT} "PATH=${test_path}" ${VALGRIND_ENV}
-            "HAS_CPP11=$<$<BOOL:${HAS_ENOUGH_CPP11}>:1>" -- ${ARGN}
+    COMMAND ${PN_ENV_SCRIPT}
+    "PATH=${test_path}"
+    "PYTHONPATH=${CMAKE_SOURCE_DIR}/tests/py"
+    "HAS_CPP11=$<$<BOOL:${HAS_ENOUGH_CPP11}>:1>"
+    ${TEST_ENV} --
+    ${ARGN}
     )
 endmacro()
 
-add_cpp_test(cpp-example-container ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/example_test.py -v ContainerExampleTest)
+add_cpp_example_test(cpp-example-container ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/example_test.py -v ContainerExampleTest)
 
 if (NOT SSL_IMPL STREQUAL none)
-add_cpp_test(cpp-example-container-ssl ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/example_test.py -v ContainerExampleSSLTest)
+add_cpp_example_test(cpp-example-container-ssl ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/example_test.py -v ContainerExampleSSLTest)
 endif()

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/27edd9ac/cpp/examples/broker.cpp
----------------------------------------------------------------------
diff --git a/cpp/examples/broker.cpp b/cpp/examples/broker.cpp
index d45309e..b15ac39 100644
--- a/cpp/examples/broker.cpp
+++ b/cpp/examples/broker.cpp
@@ -355,7 +355,7 @@ public:
     }
 
     void on_error(const proton::error_condition& e) OVERRIDE {
-        std::cerr << "error: " << e.what() << std::endl;
+        std::cout << "protocol error: " << e.what() << std::endl;
     }
 
     // The container calls on_transport_close() last.
@@ -429,7 +429,7 @@ int main(int argc, char **argv) {
     } catch (const example::bad_option& e) {
         std::cout << opts << std::endl << e.what() << std::endl;
     } catch (const std::exception& e) {
-        std::cerr << "broker shutdown: " << e.what() << std::endl;
+        std::cout << "broker shutdown: " << e.what() << std::endl;
     }
     return 1;
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/27edd9ac/cpp/examples/example_test.py
----------------------------------------------------------------------
diff --git a/cpp/examples/example_test.py b/cpp/examples/example_test.py
index edcde27..38a9a6e 100644
--- a/cpp/examples/example_test.py
+++ b/cpp/examples/example_test.py
@@ -20,40 +20,21 @@
 # Run the C++ examples and verify that they behave as expected.
 # Example executables must be in PATH
 
-import unittest, sys, time, re, shutil, os
+import unittest, sys, shutil, os
+from test_subprocess import Popen, TestProcessError, check_output
 from os.path import dirname
 from string import Template
 
-import subprocess
-
-class Server(subprocess.Popen):
+class Server(Popen):
+    """A process that prints 'listening on <port>' to stdout"""
     def __init__(self, *args, **kwargs):
-        self.port = None
-        self.kill_me = kwargs.pop('kill_me', False)
-        kwargs.update({'universal_newlines': True,
-                       'stdout': subprocess.PIPE})
         super(Server, self).__init__(*args, **kwargs)
-
-    def __enter__(self):
-        return self
-
-    def __exit__(self, *args):
-        if self.kill_me:
-            self.kill()
-            self.stdout.close() # Doesn't get closed if killed
-        self.wait()
+        self.port = self.expect("listening on ([0-9]+)$").group(1)
 
     @property
     def addr(self):
-        if not self.port:
-            line = self.stdout.readline()
-            self.port = re.search("listening on ([0-9]+)$", line).group(1)
         return ":%s/example" % self.port
 
-def check_output(*args, **kwargs):
-    kwargs.update({'universal_newlines': True})
-    return subprocess.check_output(*args, **kwargs)
-
 def _cyrusSetup(conf_dir):
   """Write out simple SASL config.tests
   """
@@ -77,12 +58,9 @@ mech_list: EXTERNAL DIGEST-MD5 SCRAM-SHA-1 CRAM-MD5 PLAIN ANONYMOUS
 # Globally initialize Cyrus SASL configuration
 _cyrusSetup('sasl-conf')
 
-def wait_listening(p):
-    return re.search(b"listening on ([0-9]+)$", p.stdout.readline()).group(1)
-
 class Broker(Server):
-  def __init__(self):
-    super(Broker, self).__init__(["broker", "-a", "//:0"], kill_me=True)
+    def __init__(self):
+        super(Broker, self).__init__(["broker", "-a", "//:0"], kill_me=True)
 
 CLIENT_EXPECT="""Twas brillig, and the slithy toves => TWAS BRILLIG, AND THE SLITHY TOVES
 Did gire and gymble in the wabe. => DID GIRE AND GYMBLE IN THE WABE.
@@ -104,7 +82,7 @@ class ContainerExampleTest(unittest.TestCase):
         self.assertMultiLineEqual(recv_expect(), check_output(["simple_recv", "-a", Broker.addr]))
 
     def test_simple_recv_send(self):
-        recv = Server(["simple_recv", "-a", Broker.addr])
+        recv = Popen(["simple_recv", "-a", Broker.addr])
         self.assertMultiLineEqual("all messages confirmed\n", check_output(["simple_send", "-a", Broker.addr]))
         self.assertMultiLineEqual(recv_expect(), recv.communicate()[0])
 
@@ -119,8 +97,8 @@ class ContainerExampleTest(unittest.TestCase):
         self.assertMultiLineEqual("all messages confirmed\n", send.communicate()[0])
 
     def test_request_response(self):
-        with Server(["server", Broker.addr, "example"], kill_me=True) as server:
-            self.assertIn("connected to", server.stdout.readline())
+        with Popen(["server", Broker.addr, "example"], kill_me=True) as server:
+            server.expect("connected to %s" % Broker.addr)
             self.assertMultiLineEqual(CLIENT_EXPECT, check_output(["client", "-a", Broker.addr]))
 
     def test_request_response_direct(self):

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/27edd9ac/misc/config.sh.in
----------------------------------------------------------------------
diff --git a/misc/config.sh.in b/misc/config.sh.in
index a61c757..dd23602 100755
--- a/misc/config.sh.in
+++ b/misc/config.sh.in
@@ -52,12 +52,6 @@ export LD_LIBRARY_PATH="$(merge_paths $PROTON_BUILD $LD_LIBRARY_PATH)"
 # Test applications
 export PATH="$(merge_paths $PATH $PROTON_BUILD/c/tools $PROTON_HOME/python/tests)"
 
-# Can the test harness use valgrind?
-if [[ -x "$(type -p valgrind)" && "@ENABLE_VALGRIND@" == "ON" ]] ; then
-    export VALGRIND=$(type -p valgrind)
-    export VALGRIND_ARGS="@VALGRIND_OPTIONS@"
-fi
-
 # Can the test harness use saslpasswd2?
 if [[ -x "$(type -p saslpasswd2)" ]] ; then
     export SASLPASSWD=$(type -p saslpasswd2)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/27edd9ac/python/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt
index d63ab96..181128c 100644
--- a/python/CMakeLists.txt
+++ b/python/CMakeLists.txt
@@ -208,8 +208,8 @@ add_test (NAME python-test
   COMMAND ${PN_ENV_SCRIPT}
   "PATH=${py_path}" "PYTHONPATH=${py_pythonpath}"
   "SASLPASSWD=${CyrusSASL_Saslpasswd_EXECUTABLE}"
-  ${VALGRIND_ENV}
-  ${PYTHON_EXECUTABLE} -- ${python_coverage_options} "${py_tests}/proton-test")
+  ${TEST_ENV}
+  ${TEST_WRAP_PREFIX_CMD} ${PYTHON_EXECUTABLE} -- ${python_coverage_options} "${py_tests}/proton-test")
 set_tests_properties(python-test PROPERTIES PASS_REGULAR_EXPRESSION "Totals: .* 0 failed")
 
 check_python_module("tox" TOX_MODULE_FOUND)
@@ -237,8 +237,8 @@ else ()
         "PATH=${py_path}"
         "SASLPASSWD=${CyrusSASL_Saslpasswd_EXECUTABLE}"
         "SWIG=${SWIG_EXECUTABLE}"
-        ${VALGRIND_ENV} --
-        ${PYTHON_EXECUTABLE} -m tox)
+        ${TEST_ENV} --
+        ${TEST_WRAP_PREFIX_CMD} ${PYTHON_EXECUTABLE} -m tox)
       set_tests_properties(python-tox-test
         PROPERTIES
         PASS_REGULAR_EXPRESSION "Totals: .* ignored, 0 failed"

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/27edd9ac/python/tests/proton_tests/common.py
----------------------------------------------------------------------
diff --git a/python/tests/proton_tests/common.py b/python/tests/proton_tests/common.py
index fd4decc..a56a2c0 100644
--- a/python/tests/proton_tests/common.py
+++ b/python/tests/proton_tests/common.py
@@ -281,7 +281,7 @@ class MessengerApp(object):
                 del cmd[0:1]
                 cmd.insert(0, foundfile)
                 cmd.insert(0, sys.executable)
-            self._process = Popen(cmd, stdout=PIPE, stderr=STDOUT,
+            self._process = Popen(cmd, stdout=PIPE,
                                   bufsize=4096, universal_newlines=True)
         except OSError:
             e = sys.exc_info()[1]
@@ -425,7 +425,8 @@ class MessengerReceiver(MessengerApp):
 
     # command string?
     def _build_command(self):
-        self._cmdline = self._command
+        self._cmdline = os.environ.get("TEST_EXE_PREFIX", "").split()
+        self._cmdline += self._command
         self._do_common_options()
         self._cmdline += ["-X", "READY"]
         assert self.subscriptions, "Missing subscriptions, required for receiver!"
@@ -468,47 +469,17 @@ class MessengerSenderC(MessengerSender):
         MessengerSender.__init__(self)
         self._command = ["msgr-send"]
 
-def setup_valgrind(self):
-    if "VALGRIND" not in os.environ:
-        raise Skipped("Skipping test - $VALGRIND not set.")
-    super(type(self), self).__init__()
-    self._command = [os.environ["VALGRIND"]] + os.environ["VALGRIND_ARGS"].split(' ') + self._command
-
-class MessengerSenderValgrind(MessengerSenderC):
-    """ Run the C sender under Valgrind
-    """
-    def __init__(self, suppressions=None):
-        setup_valgrind(self)
-
 class MessengerReceiverC(MessengerReceiver):
     def __init__(self):
         MessengerReceiver.__init__(self)
         self._command = ["msgr-recv"]
 
-class MessengerReceiverValgrind(MessengerReceiverC):
-    """ Run the C receiver under Valgrind
-    """
-    def __init__(self, suppressions=None):
-        setup_valgrind(self)
-
 class ReactorSenderC(MessengerSender):
     def __init__(self):
         MessengerSender.__init__(self)
         self._command = ["reactor-send"]
 
-class ReactorSenderValgrind(ReactorSenderC):
-    """ Run the C sender under Valgrind
-    """
-    def __init__(self, suppressions=None):
-        setup_valgrind(self)
-
 class ReactorReceiverC(MessengerReceiver):
     def __init__(self):
         MessengerReceiver.__init__(self)
         self._command = ["reactor-recv"]
-
-class ReactorReceiverValgrind(ReactorReceiverC):
-    """ Run the C receiver under Valgrind
-    """
-    def __init__(self, suppressions=None):
-        setup_valgrind(self)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/27edd9ac/python/tests/proton_tests/soak.py
----------------------------------------------------------------------
diff --git a/python/tests/proton_tests/soak.py b/python/tests/proton_tests/soak.py
index 5e103fd..e015db5 100644
--- a/python/tests/proton_tests/soak.py
+++ b/python/tests/proton_tests/soak.py
@@ -24,9 +24,7 @@ import os
 
 from .common import Test, Skipped, free_tcp_ports, \
     MessengerReceiverC, MessengerSenderC, \
-    MessengerReceiverValgrind, MessengerSenderValgrind, \
     ReactorReceiverC, ReactorSenderC, \
-    ReactorReceiverValgrind, ReactorSenderValgrind, \
     isSSLPresent
 
 #
@@ -192,52 +190,14 @@ class MessengerTests(AppTests):
 
         self._do_test(iterations)
 
-    def _do_relay_test(self, receiver, relay, sender, domain="amqp"):
-        """ Send N messages to a receiver, which replies to each and forwards
-        each of them to different receiver.
-        Parameters:
-        iterations - repeat the senders this many times
-        target_count - # targets to send to
-        send_count = # messages sent to each target
-        send_batch - wait for replies after this many messages sent
-        forward_count - forward to this many targets
-        """
-        iterations = self.iterations
-        send_count = self.send_count
-        target_count = self.target_count
-        send_batch = self.send_batch
-        forward_count = self.forward_count
-
-        send_total = send_count * target_count
-        receive_total = send_total * iterations
-
-        port = free_tcp_ports()[0]
-
-        receiver.subscriptions = ["%s://~0.0.0.0:%s" % (domain, port)]
-        receiver.receive_count = receive_total
-        receiver.send_reply = True
-        # forward to 'relay' - uses two links
-        # ## THIS FAILS:
-        # receiver.forwards = ["amqp://Relay/%d" % j for j in range(forward_count)]
-        receiver.forwards = ["%s://Relay" % domain]
-        receiver.timeout = MessengerTests._timeout
-        self.receivers.append( receiver )
-
-        relay.subscriptions = ["%s://0.0.0.0:%s" % (domain, port)]
-        relay.name = "Relay"
-        relay.receive_count = receive_total
-        relay.timeout = MessengerTests._timeout
-        self.receivers.append( relay )
-
-        # send to 'receiver'
-        sender.targets = ["%s://0.0.0.0:%s/X%dY" % (domain, port, j) for j in range(target_count)]
-        sender.send_count = send_total
-        sender.get_reply = True
-        sender.timeout = MessengerTests._timeout
-        self.senders.append( sender )
-
-        self._do_test(iterations)
-
+    # Removed messenger "relay" tests. The test start-up is faulty:
+    # msgr-recv prints it's -X ready message when it starts to open a
+    # connection but it does not wait for the remote open. The relay
+    # tests depends on mapping a container name from an incoming
+    # connection. They can fail under if the sender starts before the
+    # connection is complete (esp. valgrind with SSL connections) We
+    # could fix the tests but since messenger is deprecated it does
+    # not seem worthwhile.
 
     def _do_star_topology_test(self, r_factory, s_factory, domain="amqp"):
         """
@@ -291,10 +251,6 @@ class MessengerTests(AppTests):
         self._ssl_check()
         self._do_oneway_test(MessengerReceiverC(), MessengerSenderC(), "amqps")
 
-    def test_oneway_valgrind(self):
-        self.valgrind_test()
-        self._do_oneway_test(MessengerReceiverValgrind(), MessengerSenderValgrind())
-
     def test_echo_C(self):
         self._do_echo_test(MessengerReceiverC(), MessengerSenderC())
 
@@ -302,21 +258,6 @@ class MessengerTests(AppTests):
         self._ssl_check()
         self._do_echo_test(MessengerReceiverC(), MessengerSenderC(), "amqps")
 
-    def test_echo_valgrind(self):
-        self.valgrind_test()
-        self._do_echo_test(MessengerReceiverValgrind(), MessengerSenderValgrind())
-
-    def test_relay_C(self):
-        self._do_relay_test(MessengerReceiverC(), MessengerReceiverC(), MessengerSenderC())
-
-    def test_relay_C_SSL(self):
-        self._ssl_check()
-        self._do_relay_test(MessengerReceiverC(), MessengerReceiverC(), MessengerSenderC(), "amqps")
-
-    def test_relay_valgrind(self):
-        self.valgrind_test()
-        self._do_relay_test(MessengerReceiverValgrind(), MessengerReceiverValgrind(), MessengerSenderValgrind())
-
     def test_star_topology_C(self):
         self._do_star_topology_test( MessengerReceiverC, MessengerSenderC )
 
@@ -324,13 +265,5 @@ class MessengerTests(AppTests):
         self._ssl_check()
         self._do_star_topology_test( MessengerReceiverC, MessengerSenderC, "amqps" )
 
-    def test_star_topology_valgrind(self):
-        self.valgrind_test()
-        self._do_star_topology_test( MessengerReceiverValgrind, MessengerSenderValgrind )
-
     def test_oneway_reactor(self):
         self._do_oneway_test(ReactorReceiverC(), ReactorSenderC())
-
-    def test_oneway_reactor_valgrind(self):
-        self.valgrind_test()
-        self._do_oneway_test(ReactorReceiverValgrind(), ReactorSenderValgrind())

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/27edd9ac/python/tests/proton_tests/ssl.py
----------------------------------------------------------------------
diff --git a/python/tests/proton_tests/ssl.py b/python/tests/proton_tests/ssl.py
index fcc3795..9419292 100644
--- a/python/tests/proton_tests/ssl.py
+++ b/python/tests/proton_tests/ssl.py
@@ -882,39 +882,6 @@ class SslTest(common.Test):
         receiver.wait()
         assert receiver.status() == 0, "Command '%s' failed" % str(receiver.cmdline())
 
-    def DISABLED_test_defaults_valgrind(self):
-        """ Run valgrind over a simple SSL connection (no certificates)
-        """
-        # the openssl libraries produce far too many valgrind errors to be
-        # useful.  AFAIK, there is no way to wriate a valgrind suppression
-        # expression that will ignore all errors from a given library.
-        # Until we can, skip this test.
-        port = common.free_tcp_ports()[0]
-
-        receiver = common.MessengerReceiverValgrind()
-        receiver.subscriptions = ["amqps://~127.0.0.1:%s" % port]
-        receiver.receive_count = 1
-        receiver.timeout = self.timeout
-        receiver.start()
-
-        sender = common.MessengerSenderValgrind()
-        sender.targets = ["amqps://127.0.0.1:%s/X" % port]
-        sender.send_count = 1
-        sender.timeout = self.timeout
-        sender.start()
-        sender.wait()
-        assert sender.status() == 0, "Command '%s' failed" % str(sender.cmdline())
-
-        receiver.wait()
-        assert receiver.status() == 0, "Command '%s' failed" % str(receiver.cmdline())
-
-        # self.server_domain.set_credentials(self._testpath("client-certificate.pem"),
-        #                                    self._testpath("client-private-key.pem"),
-        #                                    "client-password")
-
-        # self.client_domain.set_trusted_ca_db(self._testpath("ca-certificate.pem"))
-        # self.client_domain.set_peer_authentication( SSLDomain.VERIFY_PEER )
-
     def test_singleton(self):
         """Verify that only a single instance of SSL can exist per Transport"""
         transport = Transport()

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/27edd9ac/python/tox.ini.in
----------------------------------------------------------------------
diff --git a/python/tox.ini.in b/python/tox.ini.in
index c514078..ec4a77d 100644
--- a/python/tox.ini.in
+++ b/python/tox.ini.in
@@ -13,7 +13,7 @@ passenv =
     PKG_CONFIG_PATH
     CFLAGS
     SASLPASSWD
-    VALGRIND
+    TEST_EXE_PREFIX
 commands =
     @CMAKE_SOURCE_DIR@/python/tests/proton-test '{posargs:--ignore-file=@CMAKE_SOURCE_DIR@/python/tests/tox-blacklist}'
 deps =

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/27edd9ac/ruby/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/ruby/CMakeLists.txt b/ruby/CMakeLists.txt
index e205250..eb99907 100644
--- a/ruby/CMakeLists.txt
+++ b/ruby/CMakeLists.txt
@@ -125,14 +125,18 @@ to_native_path("${bin};${c_lib_dir};$ENV{PATH}" PATH)
 execute_process(COMMAND ${RUBY_EXECUTABLE} -r minitest -e ""
   RESULT_VARIABLE result OUTPUT_QUIET ERROR_QUIET)
 if (result EQUAL 0)  # Have minitest
-  set(test_env ${PN_ENV_SCRIPT} -- "PATH=${PATH}" "RUBYLIB=${RUBYLIB}" "SASLPASSWD=${CyrusSASL_Saslpasswd_EXECUTABLE}")
+  set(test_env ${PN_ENV_SCRIPT} --
+    "PATH=${PATH}"
+    "RUBYLIB=${RUBYLIB}"
+    "SASLPASSWD=${CyrusSASL_Saslpasswd_EXECUTABLE}"
+    ${TEST_ENV})
 
   macro(add_ruby_test script)
     get_filename_component(name ${script} NAME_WE)
     string(REPLACE "_" "-" name "ruby-${name}")
     add_test(
       NAME ${name}
-      COMMAND ${test_env} ${RUBY_EXECUTABLE} ${script} -v
+      COMMAND ${test_env} ${TEST_WRAP_PREFIX_CMD} ${RUBY_EXECUTABLE} ${script} -v
       ${ARGN})
 
   endmacro()

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/27edd9ac/runtime_check.cmake
----------------------------------------------------------------------
diff --git a/runtime_check.cmake b/runtime_check.cmake
new file mode 100644
index 0000000..e1d76c3
--- /dev/null
+++ b/runtime_check.cmake
@@ -0,0 +1,123 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# Configuration for code analysis tools: runtime checking and coverage.
+
+# Any test that needs runtime checks should use TEST_EXE_PREFIX and TEST_ENV.
+# Normally they are set as a result of the RUNTIME_CHECK value,
+# but can be set directly for unsupported tools or unusual flags
+# e.g. -DTEST_EXE_PREFIX=rr or -DTEST_EXE_PREFIX="valgrind --tool=massif"
+
+set(TEST_EXE_PREFIX "" CACHE STRING "Prefix for test executable command line")
+set(TEST_WRAP_PREFIX "" CACHE STRING "Prefix for interpreter tests (e.g. python, ruby) that load proton as an extension")
+set(TEST_ENV "" CACHE STRING "Extra environment for tests: name1=value1;name2=value2")
+mark_as_advanced(TEST_EXE_PREFIX TEST_WRAP_PREFIX TEST_ENV)
+
+# Check for valgrind
+find_program(VALGRIND_EXECUTABLE valgrind DOC "location of valgrind program")
+set(VALGRIND_SUPPRESSIONS "${CMAKE_SOURCE_DIR}/tests/valgrind.supp" CACHE STRING "Suppressions file for valgrind")
+set(VALGRIND_COMMON_ARGS "--error-exitcode=42 --quiet --suppressions=${VALGRIND_SUPPRESSIONS}")
+mark_as_advanced(VALGRIND_EXECUTABLE VALGRIND_SUPPRESSIONS VALGRIND_COMMON_ARGS)
+
+# Check for compiler sanitizers
+if((CMAKE_C_COMPILER_ID MATCHES "GNU"
+      AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.8)
+    OR (CMAKE_C_COMPILER_ID MATCHES "Clang"
+      AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.1))
+  set(HAS_SANITIZERS TRUE)
+endif()
+
+# Valid values for RUNTIME_CHECK
+set(runtime_checks OFF asan tsan memcheck helgrind)
+
+# Set the default
+if(NOT CMAKE_BUILD_TYPE MATCHES "Coverage" AND VALGRIND_EXECUTABLE)
+  set(RUNTIME_CHECK_DEFAULT "memcheck")
+endif()
+
+# Deprecated options to enable runtime checks
+macro(deprecated_enable_check old new doc)
+  option(${old} ${doc} OFF)
+  if (${old})
+    message("WARNING: option ${old} is deprecated, use RUNTIME_CHECK=${new} instead")
+    set(RUNTIME_CHECK_DEFAULT ${new})
+  endif()
+endmacro()
+deprecated_enable_check(ENABLE_VALGRIND memcheck "Use valgrind to detect run-time problems")
+deprecated_enable_check(ENABLE_SANITIZERS asan "Compile with memory sanitizers (asan, ubsan)")
+deprecated_enable_check(ENABLE_TSAN tsan "Compile with thread sanitizer (tsan)")
+
+set(RUNTIME_CHECK ${RUNTIME_CHECK_DEFAULT} CACHE string "Enable runtime checks. Valid values: ${runtime_checks}")
+
+if(CMAKE_BUILD_TYPE MATCHES "Coverage" AND RUNTIME_CHECK)
+  message(FATAL_ERROR "Cannot set RUNTIME_CHECK with CMAKE_BUILD_TYPE=Coverage")
+endif()
+
+macro(assert_has_sanitizers)
+  if(NOT HAS_SANITIZERS)
+    message(FATAL_ERROR "compiler sanitizers are not available")
+  endif()
+endmacro()
+
+macro(assert_has_valgrind)
+  if(NOT VALGRIND_EXECUTABLE)
+    message(FATAL_ERROR "valgrind is not available")
+  endif()
+endmacro()
+
+if(RUNTIME_CHECK STREQUAL "memcheck")
+  assert_has_valgrind()
+  message(STATUS "Runtime memory checker: valgrind memcheck")
+  set(TEST_EXE_PREFIX "${VALGRIND_EXECUTABLE} --tool=memcheck --leak-check=full ${VALGRIND_COMMON_ARGS}")
+  # FIXME aconway 2018-09-06: NO TEST_WRAP_PREFIX, need --trace-children + many suppressions
+
+elseif(RUNTIME_CHECK STREQUAL "helgrind")
+  assert_has_valgrind()
+  message(STATUS "Runtime race checker: valgrind helgrind")
+  set(TEST_EXE_PREFIX "${VALGRIND_EXECUTABLE} --tool=helgrind ${VALGRIND_COMMON_ARGS}")
+  # FIXME aconway 2018-09-06: NO TEST_WRAP_PREFIX, need --trace-children + many suppressions
+
+elseif(RUNTIME_CHECK STREQUAL "asan")
+  assert_has_sanitizers()
+  message(STATUS "Runtime memory checker: gcc/clang memory sanitizers")
+  set(SANITIZE_FLAGS "-g -fno-omit-frame-pointer -fsanitize=address,undefined")
+  set(TEST_WRAP_PREFIX "${CMAKE_SOURCE_DIR}/tests/preload_asan.sh $<TARGET_FILE:qpid-proton-core>")
+
+elseif(RUNTIME_CHECK STREQUAL "tsan")
+  assert_has_sanitizers()
+  message(STATUS "Runtime race checker: gcc/clang thread sanitizer")
+  set(SANITIZE_FLAGS "-g -fno-omit-frame-pointer -fsanitize=thread")
+
+elseif(RUNTIME_CHECK)
+  message(FATAL_ERROR "'RUNTIME_CHECK=${RUNTIME_CHECK}' is invalid, valid values: ${runtime_checks}")
+endif()
+
+if(SANITIZE_FLAGS)
+  set(ENABLE_UNDEFINED_ERROR OFF CACHE BOOL "Disabled for sanitizers" FORCE)
+  string(APPEND CMAKE_C_FLAGS " ${SANITIZE_FLAGS}")
+  string(APPEND CMAKE_CXX_FLAGS "${SANITIZE_FLAGS}")
+endif()
+
+if(TEST_EXE_PREFIX)
+  # Add TEST_EXE_PREFIX to TEST_ENV so test runner scripts can use it.
+  list(APPEND TEST_ENV "TEST_EXE_PREFIX=${TEST_EXE_PREFIX}")
+  # Make a CMake-list form of TEST_EXE_PREFIX for add_test() commands
+  separate_arguments(TEST_EXE_PREFIX_CMD UNIX_COMMAND "${TEST_EXE_PREFIX}")
+endif()
+separate_arguments(TEST_WRAP_PREFIX_CMD UNIX_COMMAND "${TEST_WRAP_PREFIX}")

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/27edd9ac/scripts/env.py
----------------------------------------------------------------------
diff --git a/scripts/env.py b/scripts/env.py
index 04fa8bb..14df6d1 100644
--- a/scripts/env.py
+++ b/scripts/env.py
@@ -58,11 +58,6 @@ def main(argv=None):
     if len(args) == 0 or len(args[0]) == 0:
         raise Exception("Error: syntax error in command arguments")
 
-    if new_env.get("VALGRIND") and new_env.get("VALGRIND_ALL"):
-        # Python generates a lot of possibly-lost errors that are not errors, don't show them.
-        args = [new_env.get("VALGRIND"), "--show-reachable=no", "--show-possibly-lost=no",
-                "--error-exitcode=42"] + args
-
     p = subprocess.Popen(args, env=new_env)
     return p.wait()
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/27edd9ac/tests/preload_asan.sh
----------------------------------------------------------------------
diff --git a/tests/preload_asan.sh b/tests/preload_asan.sh
new file mode 100755
index 0000000..e4928f9
--- /dev/null
+++ b/tests/preload_asan.sh
@@ -0,0 +1,51 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+if test $# -lt 2; then
+    echo <<EOF
+usage: $0 LIB EXE [args ...]
+Get the libasan linked to LIB and preload it to run `EXE args ...`
+EOF
+fi
+
+LIB=$1; shift
+EXE=$2
+
+case $EXE in
+    *ruby*|*.rb|*python*|*.py)
+        # ruby has spurious leaks and causes asan errors.
+        #
+        # python tests have many leaks that may be real, but need to be
+        # analysed & fixed or suppressed before turning this on
+
+        # Disable link order check to run with limited sanitizing
+        # Still seeing problems.
+        export ASAN_OPTIONS=verify_asan_link_order=0
+        ;;
+    *)
+        # Preload the asan library linked to LIB. Note we need to
+        # check the actual linkage, there may be multiple asan lib
+        # versions installed and we must use the same one.
+        libasan=$(ldd $LIB | awk "/(libasan\\.so[.0-9]*)/ { print \$1 }")
+        export LD_PRELOAD="$libasan:$LD_PRELOAD"
+        ;;
+esac
+
+exec "$@"

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/27edd9ac/tests/py/test_subprocess.py
----------------------------------------------------------------------
diff --git a/tests/py/test_subprocess.py b/tests/py/test_subprocess.py
new file mode 100644
index 0000000..1c7d2b9
--- /dev/null
+++ b/tests/py/test_subprocess.py
@@ -0,0 +1,105 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License
+#
+
+# Extends the subprocess module to use runtime checkers, and report stderr output.
+
+import subprocess, re, os, tempfile
+
+from subprocess import PIPE
+
+class TestProcessError(Exception):
+    def __init__(self, proc, what, output=None):
+        self.output = output
+        sep = "\n%s stderr(%s) %s\n" %("_" * 32, proc.pid, "_" * 32)
+        error = sep + proc.error + sep if proc.error else ""
+        super(TestProcessError, self).__init__("%s pid=%s exit=%s: %s%s" % (
+            proc.cmd, proc.pid, proc.returncode, what, error))
+
+class Popen(subprocess.Popen):
+    """
+    Adds TEST_EXE_PREFIX to the command and checks stderr for runtime checker output.
+    In a 'with' statement it runs check_wait() on exit from the block, or
+    check_kill() if initialized with kill_me=True
+    """
+
+    def __init__(self, *args, **kwargs):
+        """
+        Takes all args and kwargs of subprocess.Popen except stdout, stderr, universal_newlines
+        kill_me=True runs check_kill() in __exit__() instead of check_wait()
+        """
+        self.cmd = args[0]
+        self.on_exit = self.check_kill if kwargs.pop('kill_me', False) else self.check_wait
+        self.errfile = tempfile.NamedTemporaryFile(delete=False)
+        kwargs.update({'universal_newlines': True, 'stdout': PIPE, 'stderr': self.errfile})
+        args = ((os.environ.get("TEST_EXE_PREFIX", "").split() + args[0]),) + args[1:]
+        super(Popen, self).__init__(*args, **kwargs)
+
+    def check_wait(self):
+        if self.wait() or self.error:
+            raise TestProcessError(self, "check_wait")
+
+    def communicate(self, *args, **kwargs):
+        result = super(Popen, self).communicate(*args, **kwargs)
+        if self.returncode or self.error:
+            raise TestProcessError(self, "check_communicate", result[0])
+        return result
+
+    def check_kill(self):
+        """Raise if process has already exited, kill and raise if self.error is not empty"""
+        if self.poll() is None:
+            self.kill()
+            self.wait()
+            self.stdout.close()     # Doesn't get closed if killed
+            if self.error:
+                raise TestProcessError(self, "check_kill found error output")
+        else:
+            raise TestProcessError(self, "check_kill process not running")
+
+    def expect(self, pattern):
+        line = self.stdout.readline()
+        match = re.search(pattern, line)
+        if not match:
+            raise Exception("%s: can't find '%s' in '%s'" % (self.cmd, pattern, line))
+        return match
+
+    @property
+    def error(self):
+        """Return stderr as string, may only be used after process has terminated."""
+        assert(self.poll is not None)
+        if not hasattr(self, "_error"):
+            self.errfile.close() # Not auto-deleted
+            with open(self.errfile.name) as f: # Re-open to read
+                self._error = f.read().strip()
+            os.unlink(self.errfile.name)
+        return self._error
+
+    def __enter__(self):
+        return self
+
+    def __exit__(self, *args):
+        self.on_exit()
+
+def check_output(*args, **kwargs):
+    return Popen(*args, **kwargs).communicate()[0]
+
+class Server(Popen):
+    """A process that prints 'listening on <port>' to stdout"""
+    def __init__(self, *args, **kwargs):
+        super(Server, self).__init__(*args, **kwargs)
+        self.port = self.expect("listening on ([0-9]+)$").group(1)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/27edd9ac/tests/valgrind.supp
----------------------------------------------------------------------
diff --git a/tests/valgrind.supp b/tests/valgrind.supp
new file mode 100644
index 0000000..3fee095
--- /dev/null
+++ b/tests/valgrind.supp
@@ -0,0 +1,151 @@
+{
+   SSL does a number of uninitialized accesses (expected) 1
+   Memcheck:Cond
+   fun:BN_bin2bn
+   obj:*
+   obj:*
+}
+
+{
+   SSL does a number of uninitialized accesses (expected) 2
+   Memcheck:Cond
+   fun:BN_num_bits_word
+   fun:BN_num_bits
+}
+
+{
+   SSL does a number of uninitialized accesses (expected) 3
+   Memcheck:Value8
+   fun:BN_num_bits_word
+   fun:BN_num_bits
+   fun:BN_mod_exp_mont_consttime
+   obj:*
+   fun:ssl3_ctx_ctrl
+}
+
+{
+   SSL does a number of uninitialized accesses (expected) 4
+   Memcheck:Value8
+   fun:BN_mod_exp_mont_consttime
+   obj:*
+   fun:ssl3_ctx_ctrl
+}
+
+{
+   SSL does a number of uninitialized accesses (FreeBSD version)
+   Memcheck:Value8
+   fun:BN_num_bits_word
+   fun:BN_num_bits
+   fun:BN_mod_exp_mont_consttime
+   fun:BN_mod_exp_mont
+   obj:*libcrypto.so*
+   fun:ssl3_ctx_ctrl
+}
+
+{
+   SSL does a number of uninitialized accesses (FreeBSD version)
+   Memcheck:Value8
+   fun:BN_mod_exp_mont_consttime
+   fun:BN_mod_exp_mont
+   obj:*libcrypto.so*
+   fun:ssl3_ctx_ctrl
+}
+
+{
+   SSL does a number of uninitialized accesses (expected) 5
+   Memcheck:Value4
+   fun:BN_mod_exp_mont_consttime
+   fun:BN_mod_exp_mont
+   obj:*
+   obj:*
+}
+
+{
+   SSL does a number of uninitialized accesses (expected) 6
+   Memcheck:Value4
+   fun:BN_num_bits_word
+   fun:BN_mod_exp_mont_consttime
+   fun:BN_mod_exp_mont
+   obj:*
+   obj:*
+}
+
+{
+   SSL does a number of uninitialized accesses (expected) 7
+   Memcheck:Cond
+   fun:ASN1_STRING_set
+   fun:ASN1_mbstring_ncopy
+   fun:ASN1_mbstring_copy
+}
+
+{
+   Since we can never safely uninitialize SSL, allow this
+   Memcheck:Leak
+   fun:_vgrZU_libcZdsoZa_realloc
+   fun:CRYPTO_realloc
+   fun:lh_insert
+   obj:/lib64/libcrypto.so.0.9.8e
+   fun:ERR_load_strings
+   fun:ERR_load_X509V3_strings
+   fun:ERR_load_crypto_strings
+   fun:SSL_load_error_strings
+}
+
+{
+   Since we can never safely uninitialize SSL, allow this
+   Memcheck:Leak
+   fun:_vgrZU_libcZdsoZa_malloc
+   fun:CRYPTO_malloc
+   fun:lh_new
+   fun:OBJ_NAME_init
+   fun:OBJ_NAME_add
+   fun:EVP_add_cipher
+   fun:SSL_library_init
+}
+
+{
+   Since we can never safely uninitialize SSL, allow this
+   Memcheck:Leak
+   fun:malloc
+   obj:*
+   fun:CRYPTO_malloc
+}
+
+{
+   Known memory leak in cyrus-sasl (fixed in 2.1.26)
+   Memcheck:Leak
+   fun:malloc
+   fun:*
+   fun:sasl_config_init
+   fun:sasl_server_init
+}
+
+{
+   Known bug in glibc which tries to free ipv6 related static when getaddrinfo used
+   Memcheck:Free
+   fun:free
+   fun:__libc_freeres
+   fun:_vgnU_freeres
+   fun:__run_exit_handlers
+   fun:exit
+}
+
+{
+   Benign race in pni_log_enabled
+   Helgrind:Race
+   fun:pni_log_enabled
+}
+
+{
+   NSS library poking around in its own data segment upsets helgrind
+   Helgrind:Race
+   fun:strpbrk
+   fun:_nss_files_parse_servent
+}
+
+{
+   NSS library poking around in its own text segment upsets helgrind
+   Helgrind:Race
+   fun:*
+   fun:_nss_files_getservbyname_r
+}
\ No newline at end of file


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


[12/50] qpid-proton git commit: PROTON-1929: [c] library prints directly to stderr/stdout

Posted by ac...@apache.org.
PROTON-1929: [c] library prints directly to stderr/stdout

Replace direct use of stdout with pn_log calls.


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

Branch: refs/heads/go1
Commit: 6c765bc66461c17b02ce740804f4d9e171f0fe24
Parents: d3c1135
Author: Alan Conway <ac...@redhat.com>
Authored: Mon Sep 10 15:54:57 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Mon Sep 10 15:54:57 2018 -0400

----------------------------------------------------------------------
 c/src/core/log.c        |   1 +
 c/src/core/transport.c  |   1 +
 c/src/core/util.c       |  22 +++----
 c/src/core/util.h       |   3 +-
 c/src/sasl/cyrus_sasl.c |   4 +-
 c/src/ssl/openssl.c     |  27 ++++-----
 c/src/ssl/schannel.c    | 133 +++++++++++++++++++++----------------------
 7 files changed, 87 insertions(+), 104 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6c765bc6/c/src/core/log.c
----------------------------------------------------------------------
diff --git a/c/src/core/log.c b/c/src/core/log.c
index 754eed3..ed04573 100644
--- a/c/src/core/log.c
+++ b/c/src/core/log.c
@@ -51,6 +51,7 @@ void pn_log_logger(pn_logger_t new_logger) {
 void pni_vlogf_impl(const char *fmt, va_list ap) {
     vfprintf(stderr, fmt, ap);
     fprintf(stderr, "\n");
+    fflush(stderr);
 }
 
 /**@internal

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6c765bc6/c/src/core/transport.c
----------------------------------------------------------------------
diff --git a/c/src/core/transport.c b/c/src/core/transport.c
index 106a2c8..7dee571 100644
--- a/c/src/core/transport.c
+++ b/c/src/core/transport.c
@@ -135,6 +135,7 @@ static void pni_delivery_map_clear(pn_delivery_map_t *dm)
 static void pni_default_tracer(pn_transport_t *transport, const char *message)
 {
   fprintf(stderr, "[%p]:%s\n", (void *) transport, message);
+  fflush(stderr);
 }
 
 static ssize_t pn_io_layer_input_passthru(pn_transport_t *, unsigned int, const char *, size_t );

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6c765bc6/c/src/core/util.c
----------------------------------------------------------------------
diff --git a/c/src/core/util.c b/c/src/core/util.c
index a676e9f..2597d60 100644
--- a/c/src/core/util.c
+++ b/c/src/core/util.c
@@ -19,9 +19,9 @@
  *
  */
 
-#include "util.h"
-
 #include "buffer.h"
+#include "log_private.h"
+#include "util.h"
 
 #include <proton/error.h>
 #include <proton/types.h>
@@ -82,27 +82,19 @@ int pn_quote(pn_string_t *dst, const char *src, size_t size)
   }
 }
 
-void pn_fprint_data(FILE *stream, const char *bytes, size_t size)
+void pn_log_data(const char *msg, const char *bytes, size_t size)
 {
   char buf[256];
   ssize_t n = pn_quote_data(buf, 256, bytes, size);
   if (n >= 0) {
-    fputs(buf, stream);
+    pn_logf("%s: %s", msg, buf);
+  } else if (n == PN_OVERFLOW) {
+    pn_logf("%s: %s (truncated)", msg, buf);
   } else {
-    if (n == PN_OVERFLOW) {
-      fputs(buf, stream);
-      fputs("... (truncated)", stream);
-    }
-    else
-      fprintf(stderr, "pn_quote_data: %s\n", pn_code(n));
+    pn_logf("%s: cannot log data: %s", msg, pn_code(n));
   }
 }
 
-void pn_print_data(const char *bytes, size_t size)
-{
-  pn_fprint_data(stdout, bytes, size);
-}
-
 int pn_strcasecmp(const char *a, const char *b)
 {
   int diff;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6c765bc6/c/src/core/util.h
----------------------------------------------------------------------
diff --git a/c/src/core/util.h b/c/src/core/util.h
index 78b1c4d..559fbaa 100644
--- a/c/src/core/util.h
+++ b/c/src/core/util.h
@@ -36,8 +36,7 @@
 
 ssize_t pn_quote_data(char *dst, size_t capacity, const char *src, size_t size);
 int pn_quote(pn_string_t *dst, const char *src, size_t size);
-void pn_fprint_data(FILE *stream, const char *bytes, size_t size);
-void pn_print_data(const char *bytes, size_t size);
+void pn_log_data(const char *msg, const char *bytes, size_t size);
 bool pn_env_bool(const char *name);
 pn_timestamp_t pn_timestamp_min(pn_timestamp_t a, pn_timestamp_t b);
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6c765bc6/c/src/sasl/cyrus_sasl.c
----------------------------------------------------------------------
diff --git a/c/src/sasl/cyrus_sasl.c b/c/src/sasl/cyrus_sasl.c
index a7387e6..30c5784 100644
--- a/c/src/sasl/cyrus_sasl.c
+++ b/c/src/sasl/cyrus_sasl.c
@@ -22,6 +22,8 @@
 #define _GNU_SOURCE
 #endif
 
+#include "core/log_private.h"
+
 #include "proton/sasl.h"
 #include "proton/sasl-plugin.h"
 #include "proton/transport.h"
@@ -130,7 +132,7 @@ static void pni_cyrus_interact(pn_transport_t *transport, sasl_interact_t *inter
       break;
     }
     default:
-      fprintf(stderr, "(%s): %s - %s\n", i->challenge, i->prompt, i->defresult);
+      pn_logf("(%s): %s - %s", i->challenge, i->prompt, i->defresult);
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6c765bc6/c/src/ssl/openssl.c
----------------------------------------------------------------------
diff --git a/c/src/ssl/openssl.c b/c/src/ssl/openssl.c
index 2d086c7..c2b5869 100644
--- a/c/src/ssl/openssl.c
+++ b/c/src/ssl/openssl.c
@@ -20,8 +20,9 @@
  */
 
 #include "platform/platform.h"
-#include "core/util.h"
 #include "core/engine-internal.h"
+#include "core/log_private.h"
+#include "core/util.h"
 
 #include <proton/ssl.h>
 #include <proton/engine.h>
@@ -184,16 +185,13 @@ static void ssl_log_error(const char *fmt, ...)
     ssl_vlog(NULL, fmt, ap);
     va_end(ap);
   }
-
   ssl_log_flush(NULL);
 }
 
 static void ssl_log_clear_data(pn_transport_t *transport, const char *data, size_t len)
 {
   if (PN_TRACE_RAW & transport->trace) {
-    fprintf(stderr, "SSL decrypted data: \"");
-    pn_fprint_data( stderr, data, len );
-    fprintf(stderr, "\"\n");
+    pn_log_data("SSL decrypted data", data, len );
   }
 }
 
@@ -662,9 +660,6 @@ found:
   // Check if we found anything
   if (options==all_prots) return PN_ARG_ERR;
 
-  // Debug test only
-  //printf("%30s %016lx (~%016lx)\n", protocols, options, ~options&all_prots);
-
   SSL_CTX_clear_options(domain->ctx, all_prots);
   SSL_CTX_set_options(domain->ctx, options);
   return 0;
@@ -719,8 +714,7 @@ int pn_ssl_domain_set_peer_authentication(pn_ssl_domain_t *domain,
 #endif
 
     if (!domain->has_ca_db) {
-      pn_transport_logf(NULL, "Error: cannot verify peer without a trusted CA configured.\n"
-                        "       Use pn_ssl_domain_set_trusted_ca_db()");
+      pn_transport_logf(NULL, "Error: cannot verify peer without a trusted CA configured, use pn_ssl_domain_set_trusted_ca_db()");
       return -1;
     }
 
@@ -732,8 +726,7 @@ int pn_ssl_domain_set_peer_authentication(pn_ssl_domain_t *domain,
         return -1;
       }
       if (!domain->has_certificate) {
-        pn_transport_logf(NULL, "Error: Server cannot verify peer without configuring a certificate.\n"
-                          "       Use pn_ssl_domain_set_credentials()");
+        pn_transport_logf(NULL, "Error: Server cannot verify peer without configuring a certificate, use pn_ssl_domain_set_credentials()");
       }
 
       if (domain->trusted_CAs) free(domain->trusted_CAs);
@@ -1406,13 +1399,13 @@ int pn_ssl_get_cert_fingerprint(pn_ssl_t *ssl0, char *fingerprint, size_t finger
     digest_name = "md5";
     break;
    default:
-    ssl_log_error("Unknown or unhandled hash algorithm %i \n", hash_alg);
+    ssl_log_error("Unknown or unhandled hash algorithm %i ", hash_alg);
     return PN_ERR;
 
   }
 
   if(fingerprint_length < min_required_length) {
-    ssl_log_error("Insufficient fingerprint_length %i. fingerprint_length must be %i or above for %s digest\n",
+    ssl_log_error("Insufficient fingerprint_length %i. fingerprint_length must be %i or above for %s digest",
                   fingerprint_length, min_required_length, digest_name);
     return PN_ERR;
   }
@@ -1428,7 +1421,7 @@ int pn_ssl_get_cert_fingerprint(pn_ssl_t *ssl0, char *fingerprint, size_t finger
     unsigned char bytes[64]; // sha512 uses 64 octets, we will use that as the maximum.
 
     if (X509_digest(cert, digest, bytes, &len) != 1) {
-      ssl_log_error("Failed to extract X509 digest\n");
+      ssl_log_error("Failed to extract X509 digest");
       return PN_ERR;
     }
 
@@ -1442,7 +1435,7 @@ int pn_ssl_get_cert_fingerprint(pn_ssl_t *ssl0, char *fingerprint, size_t finger
     return PN_OK;
   }
   else {
-    ssl_log_error("No certificate is available yet \n");
+    ssl_log_error("No certificate is available yet ");
     return PN_ERR;
   }
 
@@ -1475,7 +1468,7 @@ const char* pn_ssl_get_remote_subject_subfield(pn_ssl_t *ssl0, pn_ssl_cert_subje
     openssl_field = NID_commonName;
     break;
    default:
-    ssl_log_error("Unknown or unhandled certificate subject subfield %i \n", field);
+    ssl_log_error("Unknown or unhandled certificate subject subfield %i", field);
     return NULL;
   }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6c765bc6/c/src/ssl/schannel.c
----------------------------------------------------------------------
diff --git a/c/src/ssl/schannel.c b/c/src/ssl/schannel.c
index b541c96..15e7d8a 100644
--- a/c/src/ssl/schannel.c
+++ b/c/src/ssl/schannel.c
@@ -32,12 +32,15 @@
  * the latter.
  */
 
-#include <proton/ssl.h>
-#include <proton/engine.h>
+#include "core/autodetect.h"
 #include "core/engine-internal.h"
-#include "platform/platform.h"
+#include "core/log_private.h"
 #include "core/util.h"
-#include "core/autodetect.h"
+
+#include "platform/platform.h"
+
+#include <proton/ssl.h>
+#include <proton/engine.h>
 
 #include <assert.h>
 
@@ -194,7 +197,7 @@ static int win_credential_load_cert(win_credential_t *cred, const char *store_na
       if (cert_count == 1) {
         found_ctx = CertDuplicateCertificateContext(tmpctx);
       } else {
-        ssl_log_error("Multiple certificates to choose from certificate store %s\n", store_name);
+        ssl_log_error("Multiple certificates to choose from certificate store %s", store_name);
         found_ctx = NULL;
         break;
       }
@@ -206,7 +209,7 @@ static int win_credential_load_cert(win_credential_t *cred, const char *store_na
     tmpctx = false;
   }
   if (!found_ctx && cert_name && cert_count == 1)
-    ssl_log_error("Could not find certificate %s in store %s\n", cert_name, store_name);
+    ssl_log_error("Could not find certificate %s in store %s", cert_name, store_name);
   cred->cert_context = found_ctx;
 
   free(fn);
@@ -366,9 +369,8 @@ static void ssl_log_error(const char *fmt, ...)
 {
   va_list ap;
   va_start(ap, fmt);
-  vfprintf(stderr, fmt, ap);
+  pn_vlogf(fmt, ap);
   va_end(ap);
-  fflush(stderr);
 }
 
 // @todo: used to avoid littering the code with calls to printf...
@@ -377,9 +379,8 @@ static void ssl_log(pn_transport_t *transport, const char *fmt, ...)
   if (PN_TRACE_DRV & transport->trace) {
     va_list ap;
     va_start(ap, fmt);
-    vfprintf(stderr, fmt, ap);
+    pn_vlogf(fmt, ap);
     va_end(ap);
-    fflush(stderr);
   }
 }
 
@@ -390,25 +391,21 @@ static void ssl_log_error_status(HRESULT status, const char *fmt, ...)
 
   if (fmt) {
     va_start(ap, fmt);
-    vfprintf(stderr, fmt, ap);
+    pn_vlogf(fmt, ap);
     va_end(ap);
   }
 
   if (FormatMessage(FORMAT_MESSAGE_MAX_WIDTH_MASK | FORMAT_MESSAGE_FROM_SYSTEM,
                     0, status, 0, buf, sizeof(buf), 0))
-    ssl_log_error(" : %s\n", buf);
+    ssl_log_error(" : %s", buf);
   else
-    fprintf(stderr, "pn internal Windows error: %x for %x\n", GetLastError(), status);
-
-  fflush(stderr);
+    pn_logf("pn internal Windows error: %x for %x", GetLastError(), status);
 }
 
 static void ssl_log_clear_data(pn_transport_t *transport, const char *data, size_t len)
 {
   if (PN_TRACE_RAW & transport->trace) {
-    fprintf(stderr, "SSL decrypted data: \"");
-    pn_fprint_data( stderr, data, len );
-    fprintf(stderr, "\"\n");
+    pn_log_data("SSL decrypted data", data, len);
   }
 }
 
@@ -473,7 +470,7 @@ pn_ssl_domain_t *pn_ssl_domain( pn_ssl_mode_t mode )
     break;
 
   default:
-    ssl_log_error("Invalid mode for pn_ssl_mode_t: %d\n", mode);
+    ssl_log_error("Invalid mode for pn_ssl_mode_t: %d", mode);
     free(domain);
     return NULL;
   }
@@ -568,8 +565,7 @@ int pn_ssl_domain_set_peer_authentication(pn_ssl_domain_t *domain,
   csguard g2(&domain->cred->cslock);
 
   if (!domain->has_ca_db && (mode == PN_SSL_VERIFY_PEER || mode == PN_SSL_VERIFY_PEER_NAME)) {
-    ssl_log_error("Error: cannot verify peer without a trusted CA configured.\n"
-                  "       Use pn_ssl_domain_set_trusted_ca_db()\n");
+    ssl_log_error("Error: cannot verify peer without a trusted CA configured, use pn_ssl_domain_set_trusted_ca_db()");
     return -1;
   }
 
@@ -585,8 +581,7 @@ int pn_ssl_domain_set_peer_authentication(pn_ssl_domain_t *domain,
         return -1;
       }
       if (!win_credential_has_certificate(domain->cred)) {
-        ssl_log_error("Error: Server cannot verify peer without configuring a certificate.\n"
-                   "       Use pn_ssl_domain_set_credentials()");
+        ssl_log_error("Error: Server cannot verify peer without configuring a certificate, use pn_ssl_domain_set_credentials()");
         return -1;
       }
       int ec = 0;
@@ -603,7 +598,7 @@ int pn_ssl_domain_set_peer_authentication(pn_ssl_domain_t *domain,
     break;
 
   default:
-    ssl_log_error("Invalid peer authentication mode given.\n");
+    ssl_log_error("Invalid peer authentication mode given.");
     return -1;
   }
 
@@ -711,7 +706,7 @@ int pn_ssl_domain_allow_unsecured_client(pn_ssl_domain_t *domain)
 {
   if (!domain) return -1;
   if (domain->mode != PN_SSL_MODE_SERVER) {
-    ssl_log_error("Cannot permit unsecured clients - not a server.\n");
+    ssl_log_error("Cannot permit unsecured clients - not a server.");
     return -1;
   }
   domain->allow_unsecured = true;
@@ -768,7 +763,7 @@ bool pn_ssl_get_protocol_name(pn_ssl_t *ssl0, char *buffer, size_t size )
     else if ((info.dwProtocol & 0xC00))
       pni_snprintf(buffer, size, "%s", "TLSv1.2");
     else {
-      ssl_log_error("unexpected protocol %x\n", info.dwProtocol);
+      ssl_log_error("unexpected protocol %x", info.dwProtocol);
       return false;
     }
     return true;
@@ -781,7 +776,7 @@ void pn_ssl_free( pn_transport_t *transport)
 {
   pni_ssl_t *ssl = transport->ssl;
   if (!ssl) return;
-  ssl_log( transport, "SSL socket freed.\n" );
+  ssl_log( transport, "SSL socket freed." );
   // clean up Windows per TLS session data before releasing the domain count
   csguard g(&ssl->domain->cslock);
   csguard g2(&ssl->cred->cslock);
@@ -978,7 +973,7 @@ static void ssl_encrypt(pn_transport_t *transport, char *app_data, size_t count)
   ssl->sc_out_count = buffs[0].cbBuffer + buffs[1].cbBuffer + buffs[2].cbBuffer;
   ssl->network_outp = ssl->sc_outbuf;
   ssl->network_out_pending = ssl->sc_out_count;
-  ssl_log(transport, "ssl_encrypt %d network bytes\n", ssl->network_out_pending);
+  ssl_log(transport, "ssl_encrypt %d network bytes", ssl->network_out_pending);
 }
 
 // Returns true if decryption succeeded (even for empty content)
@@ -1020,7 +1015,7 @@ static bool ssl_decrypt(pn_transport_t *transport)
       return false;
 
     case SEC_I_RENEGOTIATE:
-      ssl_log_error("unexpected TLS renegotiation\n");
+      ssl_log_error("unexpected TLS renegotiation");
       // TODO.  Fall through for now.
     default:
       ssl_failed(transport, 0);
@@ -1081,7 +1076,7 @@ static void client_handshake_init(pn_transport_t *transport)
     ssl->network_out_pending = ssl->sc_out_count;
     // the token is the whole quantity to send
     ssl->network_outp = ssl->sc_outbuf;
-    ssl_log(transport, "Sending client hello %d bytes\n", ssl->network_out_pending);
+    ssl_log(transport, "Sending client hello %d bytes", ssl->network_out_pending);
   } else {
     ssl_log_error_status(status, "InitializeSecurityContext failed");
     ssl_failed(transport, 0);
@@ -1137,7 +1132,7 @@ static void client_handshake( pn_transport_t* transport) {
   case SEC_E_INCOMPLETE_MESSAGE:
     // Not enough - get more data from the server then try again.
     // Leave input buffers untouched.
-    ssl_log(transport, "client handshake: incomplete record\n");
+    ssl_log(transport, "client handshake: incomplete record");
     ssl->sc_in_incomplete = true;
     return;
 
@@ -1147,7 +1142,7 @@ static void client_handshake( pn_transport_t* transport) {
     // the token is the whole quantity to send
     ssl->network_out_pending = ssl->sc_out_count;
     ssl->network_outp = ssl->sc_outbuf;
-    ssl_log(transport, "client handshake token %d bytes\n", ssl->network_out_pending);
+    ssl_log(transport, "client handshake token %d bytes", ssl->network_out_pending);
     break;
 
   case SEC_E_OK:
@@ -1158,7 +1153,7 @@ static void client_handshake( pn_transport_t* transport) {
         // the token is the whole quantity to send
         ssl->network_out_pending = ssl->sc_out_count;
         ssl->network_outp = ssl->sc_outbuf;
-        ssl_log(transport, "client shutdown token %d bytes\n", ssl->network_out_pending);
+        ssl_log(transport, "client shutdown token %d bytes", ssl->network_out_pending);
       } else {
         ssl->state = SSL_CLOSED;
       }
@@ -1178,9 +1173,9 @@ static void client_handshake( pn_transport_t* transport) {
       HRESULT ec = verify_peer(ssl, ssl->cred->trust_store, ssl->peer_hostname, tracing);
       if (ec) {
         if (ssl->peer_hostname)
-          ssl_log_error_status(ec, "certificate verification failed for host %s\n", ssl->peer_hostname);
+          ssl_log_error_status(ec, "certificate verification failed for host %s", ssl->peer_hostname);
         else
-          ssl_log_error_status(ec, "certificate verification failed\n");
+          ssl_log_error_status(ec, "certificate verification failed");
         ssl_failed(transport, "TLS certificate verification error");
         break;
       }
@@ -1197,7 +1192,7 @@ static void client_handshake( pn_transport_t* transport) {
                              SECPKG_ATTR_STREAM_SIZES, &ssl->sc_sizes);
     max = ssl->sc_sizes.cbMaximumMessage + ssl->sc_sizes.cbHeader + ssl->sc_sizes.cbTrailer;
     if (max > ssl->sc_out_size) {
-      ssl_log_error("Buffer size mismatch have %d, need %d\n", (int) ssl->sc_out_size, (int) max);
+      ssl_log_error("Buffer size mismatch have %d, need %d", (int) ssl->sc_out_size, (int) max);
       ssl->state = SHUTTING_DOWN;
       ssl->app_input_closed = ssl->app_output_closed = PN_ERR;
       start_ssl_shutdown(transport);
@@ -1207,13 +1202,13 @@ static void client_handshake( pn_transport_t* transport) {
 
     ssl->state = RUNNING;
     ssl->max_data_size = max - ssl->sc_sizes.cbHeader - ssl->sc_sizes.cbTrailer;
-    ssl_log(transport, "client handshake successful %d max record size\n", max);
+    ssl_log(transport, "client handshake successful %d max record size", max);
     break;
 
   case SEC_I_CONTEXT_EXPIRED:
     // ended before we got going
   default:
-    ssl_log(transport, "client handshake failed %d\n", (int) status);
+    ssl_log(transport, "client handshake failed %d", (int) status);
     ssl_failed(transport, 0);
     break;
   }
@@ -1238,7 +1233,7 @@ static void server_handshake(pn_transport_t* transport)
     // waiting for more bytes.  Help out here.
     pni_protocol_type_t type = pni_sniff_header(ssl->sc_inbuf, ssl->sc_in_count);
     if (type == PNI_PROTOCOL_INSUFFICIENT) {
-      ssl_log(transport, "server handshake: incomplete record\n");
+      ssl_log(transport, "server handshake: incomplete record");
       ssl->sc_in_incomplete = true;
       return;
     } else {
@@ -1300,7 +1295,7 @@ static void server_handshake(pn_transport_t* transport)
   case SEC_E_INCOMPLETE_MESSAGE:
     // Not enough - get more data from the client then try again.
     // Leave input buffers untouched.
-    ssl_log(transport, "server handshake: incomplete record\n");
+    ssl_log(transport, "server handshake: incomplete record");
     ssl->sc_in_incomplete = true;
     return;
 
@@ -1316,7 +1311,7 @@ static void server_handshake(pn_transport_t* transport)
         // the token is the whole quantity to send
         ssl->network_out_pending = ssl->sc_out_count;
         ssl->network_outp = ssl->sc_outbuf;
-        ssl_log(transport, "server shutdown token %d bytes\n", ssl->network_out_pending);
+        ssl_log(transport, "server shutdown token %d bytes", ssl->network_out_pending);
       } else {
         ssl->state = SSL_CLOSED;
       }
@@ -1333,7 +1328,7 @@ static void server_handshake(pn_transport_t* transport)
       bool tracing = PN_TRACE_DRV & transport->trace;
       HRESULT ec = verify_peer(ssl, ssl->cred->trust_store, NULL, tracing);
       if (ec) {
-        ssl_log_error_status(ec, "certificate verification failed\n");
+        ssl_log_error_status(ec, "certificate verification failed");
         ssl_failed(transport, "certificate verification error");
         break;
       }
@@ -1343,7 +1338,7 @@ static void server_handshake(pn_transport_t* transport)
                              SECPKG_ATTR_STREAM_SIZES, &ssl->sc_sizes);
     max = ssl->sc_sizes.cbMaximumMessage + ssl->sc_sizes.cbHeader + ssl->sc_sizes.cbTrailer;
     if (max > ssl->sc_out_size) {
-      ssl_log_error("Buffer size mismatch have %d, need %d\n", (int) ssl->sc_out_size, (int) max);
+      ssl_log_error("Buffer size mismatch have %d, need %d", (int) ssl->sc_out_size, (int) max);
       ssl->state = SHUTTING_DOWN;
       ssl->app_input_closed = ssl->app_output_closed = PN_ERR;
       start_ssl_shutdown(transport);
@@ -1356,13 +1351,13 @@ static void server_handshake(pn_transport_t* transport)
 
     ssl->state = RUNNING;
     ssl->max_data_size = max - ssl->sc_sizes.cbHeader - ssl->sc_sizes.cbTrailer;
-    ssl_log(transport, "server handshake successful %d max record size\n", max);
+    ssl_log(transport, "server handshake successful %d max record size", max);
     break;
 
   case SEC_I_CONTEXT_EXPIRED:
     // ended before we got going
   default:
-    ssl_log(transport, "server handshake failed %d\n", (int) status);
+    ssl_log(transport, "server handshake failed %d", (int) status);
     ssl_failed(transport, 0);
     break;
   }
@@ -1374,7 +1369,7 @@ static void server_handshake(pn_transport_t* transport)
     // the token is the whole quantity to send
     ssl->network_out_pending = ssl->sc_out_count;
     ssl->network_outp = ssl->sc_outbuf;
-    ssl_log(transport, "server handshake token %d bytes\n", ssl->network_out_pending);
+    ssl_log(transport, "server handshake token %d bytes", ssl->network_out_pending);
   }
 
   if (token_buffs[1].BufferType == SECBUFFER_EXTRA && token_buffs[1].cbBuffer > 0 &&
@@ -1408,7 +1403,7 @@ static bool grow_inbuf2(pn_transport_t *transport, size_t minimum_size) {
   if (max_frame != 0) {
     if (old_capacity >= max_frame) {
       //  already big enough
-      ssl_log(transport, "Application expecting %d bytes (> negotiated maximum frame)\n", new_capacity);
+      ssl_log(transport, "Application expecting %d bytes (> negotiated maximum frame)", new_capacity);
       ssl_failed(transport, "TLS: transport maximum frame size error");
       return false;
     }
@@ -1417,7 +1412,7 @@ static bool grow_inbuf2(pn_transport_t *transport, size_t minimum_size) {
   size_t extra_bytes = new_capacity - pn_buffer_size(ssl->inbuf2);
   int err = pn_buffer_ensure(ssl->inbuf2, extra_bytes);
   if (err) {
-    ssl_log(transport, "TLS memory allocation failed for %d bytes\n", max_frame);
+    ssl_log(transport, "TLS memory allocation failed for %d bytes", max_frame);
     ssl_failed(transport, "TLS memory allocation failed");
     return false;
   }
@@ -1437,7 +1432,7 @@ static void start_ssl_shutdown(pn_transport_t *transport)
   if (ssl->queued_shutdown)
     return;
   ssl->queued_shutdown = true;
-  ssl_log(transport, "Shutting down SSL connection...\n");
+  ssl_log(transport, "Shutting down SSL connection...");
 
   DWORD shutdown = SCHANNEL_SHUTDOWN;
   SecBuffer shutBuff;
@@ -1603,7 +1598,7 @@ static void read_closed(pn_transport_t *transport, unsigned int layer, ssize_t e
 static ssize_t process_input_ssl(pn_transport_t *transport, unsigned int layer, const char *input_data, size_t available)
 {
   pni_ssl_t *ssl = transport->ssl;
-  ssl_log( transport, "process_input_ssl( data size=%d )\n",available );
+  ssl_log( transport, "process_input_ssl( data size=%d )",available );
   ssize_t consumed = 0;
   ssize_t forwarded = 0;
   bool new_app_input;
@@ -1680,7 +1675,7 @@ static ssize_t process_input_ssl(pn_transport_t *transport, unsigned int layer,
             rewind_sc_inbuf(ssl);
           }
         }
-        ssl_log(transport, "Next decryption, %d left over\n", available);
+        ssl_log(transport, "Next decryption, %d left over", available);
       }
     }
 
@@ -1702,7 +1697,7 @@ static ssize_t process_input_ssl(pn_transport_t *transport, unsigned int layer,
             forwarded += count;
             // advance() can increase app_inbytes.size if double buffered
             app_inbytes_advance(transport, count);
-            ssl_log(transport, "Application consumed %d bytes from peer\n", (int) count);
+            ssl_log(transport, "Application consumed %d bytes from peer", (int) count);
           } else if (count == 0) {
             size_t old_size = ssl->app_inbytes.size;
             app_inbytes_advance(transport, 0);
@@ -1711,13 +1706,13 @@ static ssize_t process_input_ssl(pn_transport_t *transport, unsigned int layer,
             }
           } else {
             // count < 0
-            ssl_log(transport, "Application layer closed its input, error=%d (discarding %d bytes)\n",
+            ssl_log(transport, "Application layer closed its input, error=%d (discarding %d bytes)",
                  (int) count, (int)ssl->app_inbytes.size);
             app_inbytes_advance(transport, ssl->app_inbytes.size);    // discard
             read_closed(transport, layer, count);
           }
         } else {
-          ssl_log(transport, "Input closed discard %d bytes\n",
+          ssl_log(transport, "Input closed discard %d bytes",
                (int)ssl->app_inbytes.size);
           app_inbytes_advance(transport, ssl->app_inbytes.size);      // discard
         }
@@ -1737,7 +1732,7 @@ static ssize_t process_input_ssl(pn_transport_t *transport, unsigned int layer,
       }
     }
   }
-  ssl_log(transport, "process_input_ssl() returning %d, forwarded %d\n", (int) consumed, (int) forwarded);
+  ssl_log(transport, "process_input_ssl() returning %d, forwarded %d", (int) consumed, (int) forwarded);
   return consumed;
 }
 
@@ -1745,7 +1740,7 @@ static ssize_t process_output_ssl( pn_transport_t *transport, unsigned int layer
 {
   pni_ssl_t *ssl = transport->ssl;
   if (!ssl) return PN_EOS;
-  ssl_log( transport, "process_output_ssl( max_len=%d )\n",max_len );
+  ssl_log( transport, "process_output_ssl( max_len=%d )",max_len );
 
   ssize_t written = 0;
   ssize_t total_app_bytes = 0;
@@ -1784,17 +1779,17 @@ static ssize_t process_output_ssl( pn_transport_t *transport, unsigned int layer
         if (app_bytes > 0) {
           app_outp += app_bytes;
           remaining -= app_bytes;
-          ssl_log( transport, "Gathered %d bytes from app to send to peer\n", app_bytes );
+          ssl_log( transport, "Gathered %d bytes from app to send to peer", app_bytes );
         } else {
           if (app_bytes < 0) {
-            ssl_log(transport, "Application layer closed its output, error=%d (%d bytes pending send)\n",
+            ssl_log(transport, "Application layer closed its output, error=%d (%d bytes pending send)",
                  (int) app_bytes, (int) ssl->network_out_pending);
             ssl->app_output_closed = app_bytes;
             if (ssl->app_input_closed)
               ssl->state = SHUTTING_DOWN;
           } else if (total_app_bytes == 0 && ssl->app_input_closed) {
             // We've drained all the App layer can provide
-            ssl_log(transport, "Application layer blocked on input, closing\n");
+            ssl_log(transport, "Application layer blocked on input, closing");
             ssl->state = SHUTTING_DOWN;
             ssl->app_output_closed = PN_ERR;
           }
@@ -1830,7 +1825,7 @@ static ssize_t process_output_ssl( pn_transport_t *transport, unsigned int layer
       transport->io_layers[layer] = &ssl_output_closed_layer;
     }
   }
-  ssl_log(transport, "process_output_ssl() returning %d\n", (int) written);
+  ssl_log(transport, "process_output_ssl() returning %d", (int) written);
   return written;
 }
 
@@ -2099,7 +2094,7 @@ static HRESULT verify_peer(pni_ssl_t *ssl, HCERTSTORE root_store, const char *se
   wchar_t *nameUCS2 = 0;
 
   if (server_name && strlen(server_name) > 255) {
-    ssl_log_error("invalid server name: %s\n", server_name);
+    ssl_log_error("invalid server name: %s", server_name);
     return WSAENAMETOOLONG;
   }
 
@@ -2144,7 +2139,7 @@ static HRESULT verify_peer(pni_ssl_t *ssl, HCERTSTORE root_store, const char *se
     return st;
   }
   if (chain_context->cChain < 1 || chain_context->rgpChain[0]->cElement < 1) {
-    ssl_log_error("empty chain with status %x %x\n", chain_context->TrustStatus.dwErrorStatus,
+    ssl_log_error("empty chain with status %x %x", chain_context->TrustStatus.dwErrorStatus,
                  chain_context->TrustStatus.dwInfoStatus);
     return SEC_E_CERT_UNKNOWN;
   }
@@ -2154,7 +2149,7 @@ static HRESULT verify_peer(pni_ssl_t *ssl, HCERTSTORE root_store, const char *se
   PCCERT_CONTEXT trunk_cert = chain_context->rgpChain[0]->rgpElement[chain_len - 1]->pCertContext;
   if (tracing)
     // See doc for CERT_CHAIN_POLICY_STATUS for bit field error and info status values
-    ssl_log_error("status for complete chain: error bits %x info bits %x\n",
+    ssl_log_error("status for complete chain: error bits %x info bits %x",
                   chain_context->TrustStatus.dwErrorStatus, chain_context->TrustStatus.dwInfoStatus);
 
   // Supplement with checks against Proton's trusted_ca_db, custom revocation and usage.
@@ -2167,7 +2162,7 @@ static HRESULT verify_peer(pni_ssl_t *ssl, HCERTSTORE root_store, const char *se
       PCCERT_CONTEXT cc = ce->pCertContext;
       if (cc->pCertInfo->dwVersion != CERT_V3) {
         if (tracing)
-          ssl_log_error("certificate chain element %d is not version 3\n", i);
+          ssl_log_error("certificate chain element %d is not version 3", i);
         error = SEC_E_CERT_WRONG_USAGE; // A fossil
         break;
       }
@@ -2192,7 +2187,7 @@ static HRESULT verify_peer(pni_ssl_t *ssl, HCERTSTORE root_store, const char *se
         if (!CertNameToStr(cc->dwCertEncodingType, &cc->pCertInfo->Subject,
                            CERT_X500_NAME_STR | CERT_NAME_STR_NO_PLUS_FLAG, name, sizeof(name)))
           strcpy(name, "[too long]");
-        ssl_log_error("element %d (name: %s)%s error bits %x info bits %x\n", i, name, is_anchor,
+        ssl_log_error("element %d (name: %s)%s error bits %x info bits %x", i, name, is_anchor,
                       ce->TrustStatus.dwErrorStatus, ce->TrustStatus.dwInfoStatus);
       }
     }
@@ -2208,9 +2203,9 @@ static HRESULT verify_peer(pni_ssl_t *ssl, HCERTSTORE root_store, const char *se
       if (trust_anchor) {
         if (tracing) {
           if (flags & CERT_STORE_SIGNATURE_FLAG)
-            ssl_log_error("root certificate signature failure\n");
+            ssl_log_error("root certificate signature failure");
           if (flags & CERT_STORE_TIME_VALIDITY_FLAG)
-            ssl_log_error("root certificate time validity failure\n");
+            ssl_log_error("root certificate time validity failure");
         }
         if (flags) {
           CertFreeCertificateContext(trust_anchor);
@@ -2292,7 +2287,7 @@ static HRESULT verify_peer(pni_ssl_t *ssl, HCERTSTORE root_store, const char *se
         if (chain_status.lChainIndex == 0 && chain_status.lElementIndex != -1) {
           int idx = chain_status.lElementIndex;
           CERT_CHAIN_ELEMENT *ce = chain_context->rgpChain[0]->rgpElement[idx];
-          ssl_log_error("  chain failure at %d error/info: %x %x\n", idx,
+          ssl_log_error("  chain failure at %d error/info: %x %x", idx,
                         ce->TrustStatus.dwErrorStatus, ce->TrustStatus.dwInfoStatus);
         }
       }
@@ -2312,7 +2307,7 @@ static HRESULT verify_peer(pni_ssl_t *ssl, HCERTSTORE root_store, const char *se
   } while (0);
 
   if (tracing && !error)
-    ssl_log_error("peer certificate authenticated\n");
+    ssl_log_error("peer certificate authenticated");
 
   // Lots to clean up.
   if (peer_cc)


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


[49/50] qpid-proton git commit: PROTON-1926, PROTON-1944: restore versions for 0.26.0-rc2

Posted by ac...@apache.org.
PROTON-1926, PROTON-1944: restore versions for 0.26.0-rc2

This reverts commit 1b554aad70452d6501cb3e13a6c10186d14e9dc9.


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

Branch: refs/heads/go1
Commit: 5b5927de939c83162b543801532c61fdb0434826
Parents: 52bbe5f
Author: Robbie Gemmell <ro...@apache.org>
Authored: Thu Oct 4 11:09:02 2018 +0100
Committer: Robbie Gemmell <ro...@apache.org>
Committed: Thu Oct 4 11:09:02 2018 +0100

----------------------------------------------------------------------
 VERSION.txt         | 2 +-
 python/docs/conf.py | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5b5927de/VERSION.txt
----------------------------------------------------------------------
diff --git a/VERSION.txt b/VERSION.txt
index 7e9b4cf..4e8f395 100644
--- a/VERSION.txt
+++ b/VERSION.txt
@@ -1 +1 @@
-0.27.0-SNAPSHOT
+0.26.0

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5b5927de/python/docs/conf.py
----------------------------------------------------------------------
diff --git a/python/docs/conf.py b/python/docs/conf.py
index 476cf29..59317d4 100644
--- a/python/docs/conf.py
+++ b/python/docs/conf.py
@@ -48,9 +48,9 @@ copyright = u'2015, Apache Qpid'
 # built documents.
 #
 # The short X.Y version.
-version = '0.27.0'
+version = '0.26.0'
 # The full version, including alpha/beta/rc tags.
-release = '0.27.0-SNAPSHOT'
+release = '0.26.0'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.


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


[03/50] qpid-proton git commit: PROTON-1873, PROTON-1926: update versions for 0.26.0-SNAPSHOT

Posted by ac...@apache.org.
PROTON-1873, PROTON-1926: update versions for 0.26.0-SNAPSHOT


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

Branch: refs/heads/go1
Commit: a1b7d502a7cf2f2dd06757115af26b278499f5dd
Parents: 4b4a042
Author: Robbie Gemmell <ro...@apache.org>
Authored: Mon Sep 3 14:39:09 2018 +0100
Committer: Robbie Gemmell <ro...@apache.org>
Committed: Mon Sep 3 14:39:09 2018 +0100

----------------------------------------------------------------------
 VERSION.txt         | 2 +-
 python/docs/conf.py | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a1b7d502/VERSION.txt
----------------------------------------------------------------------
diff --git a/VERSION.txt b/VERSION.txt
index d21d277..a756457 100644
--- a/VERSION.txt
+++ b/VERSION.txt
@@ -1 +1 @@
-0.25.0
+0.26.0-SNAPSHOT

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a1b7d502/python/docs/conf.py
----------------------------------------------------------------------
diff --git a/python/docs/conf.py b/python/docs/conf.py
index 3b02e0c..30b16ce 100644
--- a/python/docs/conf.py
+++ b/python/docs/conf.py
@@ -48,9 +48,9 @@ copyright = u'2015, Apache Qpid'
 # built documents.
 #
 # The short X.Y version.
-version = '0.25.0'
+version = '0.26.0'
 # The full version, including alpha/beta/rc tags.
-release = '0.25.0'
+release = '0.26.0-SNAPSHOT'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.


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


[09/50] qpid-proton git commit: PROTON-1798: [c] Fix benign race in broker.c example found by tsan

Posted by ac...@apache.org.
PROTON-1798: [c] Fix benign race in broker.c example found by tsan


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

Branch: refs/heads/go1
Commit: c6db635838f0abb67eb37bf565d4072870e1fe9d
Parents: 407711a
Author: Alan Conway <ac...@redhat.com>
Authored: Tue Sep 4 19:32:59 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Fri Sep 7 11:26:25 2018 -0400

----------------------------------------------------------------------
 c/examples/broker.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c6db6358/c/examples/broker.c
----------------------------------------------------------------------
diff --git a/c/examples/broker.c b/c/examples/broker.c
index 69dc536..6ffe8ed 100644
--- a/c/examples/broker.c
+++ b/c/examples/broker.c
@@ -216,7 +216,6 @@ typedef struct broker_t {
   size_t threads;
   const char *container_id;     /* AMQP container-id */
   queues_t queues;
-  bool finished;
   pn_ssl_domain_t *ssl_domain;
 } broker_t;
 
@@ -276,14 +275,14 @@ static void session_unsub(broker_t *b, pn_session_t *ssn) {
 
 static void check_condition(pn_event_t *e, pn_condition_t *cond) {
   if (pn_condition_is_set(cond)) {
-    fprintf(stderr, "%s: %s: %s\n", pn_event_type_name(pn_event_type(e)),
-            pn_condition_get_name(cond), pn_condition_get_description(cond));
+    printf("%s: %s: %s\n", pn_event_type_name(pn_event_type(e)),
+           pn_condition_get_name(cond), pn_condition_get_description(cond));
   }
 }
 
 const int WINDOW=5; /* Very small incoming credit window, to show flow control in action */
 
-static void handle(broker_t* b, pn_event_t* e) {
+static bool handle(broker_t* b, pn_event_t* e) {
   pn_connection_t *c = pn_event_connection(e);
 
   switch (pn_event_type(e)) {
@@ -418,25 +417,26 @@ static void handle(broker_t* b, pn_event_t* e) {
     break;
 
    case PN_PROACTOR_INTERRUPT:
-    b->finished = true;
     pn_proactor_interrupt(b->proactor); /* Pass along the interrupt to the other threads */
-    break;
+    return false;
 
    default:
     break;
   }
+  return true;
 }
 
 static void* broker_thread(void *void_broker) {
   broker_t *b = (broker_t*)void_broker;
+  bool finished = false;
   do {
     pn_event_batch_t *events = pn_proactor_wait(b->proactor);
     pn_event_t *e;
     while ((e = pn_event_batch_next(events))) {
-      handle(b, e);
+        if (!handle(b, e)) finished = true;
     }
     pn_proactor_done(b->proactor, events);
-  } while(!b->finished);
+  } while(!finished);
   return NULL;
 }
 


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


[08/50] qpid-proton git commit: PROTON-1798: [cpp] C++ broker example, remove unused shutdown code.

Posted by ac...@apache.org.
PROTON-1798: [cpp] C++ broker example, remove unused shutdown code.


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

Branch: refs/heads/go1
Commit: e5aac0083bb1cc2a6e96a361ff6031066e4dc449
Parents: c6db635
Author: Alan Conway <ac...@redhat.com>
Authored: Wed Sep 5 13:56:46 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Fri Sep 7 11:26:25 2018 -0400

----------------------------------------------------------------------
 c/examples/example_test.py |  4 ++--
 cpp/examples/broker.cpp    | 14 ++------------
 2 files changed, 4 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e5aac008/c/examples/example_test.py
----------------------------------------------------------------------
diff --git a/c/examples/example_test.py b/c/examples/example_test.py
index 5d6322f..1834989 100644
--- a/c/examples/example_test.py
+++ b/c/examples/example_test.py
@@ -117,8 +117,8 @@ class ExampleTest(unittest.TestCase):
                 self.assertIn("secure connection:", got)
                 self.assertIn(send_expect(), got)
                 self.assertMultiLineEqual(receive_expect(), self.runex("receive", b.port))
-        except subprocess.CalledProcessError as e:
-            if e.output.startswith(b"error initializing SSL"):
+        except TestProcessError as e:
+            if e.output and e.output.startswith(b"error initializing SSL"):
                 print("Skipping %s: SSL not available" % self.id())
             else:
                 raise

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e5aac008/cpp/examples/broker.cpp
----------------------------------------------------------------------
diff --git a/cpp/examples/broker.cpp b/cpp/examples/broker.cpp
index 479ec01..d45309e 100644
--- a/cpp/examples/broker.cpp
+++ b/cpp/examples/broker.cpp
@@ -337,18 +337,8 @@ public:
     // A receiver receives messages from a publisher to a queue.
     void on_receiver_open(proton::receiver &receiver) OVERRIDE {
         std::string qname = receiver.target().address();
-        if (qname == "shutdown") {
-            std::cout << "broker shutting down" << std::endl;
-            // Sending to the special "shutdown" queue stops the broker.
-            receiver.connection().container().stop(
-                proton::error_condition("shutdown", "stop broker"));
-        } else {
-            if (qname.empty()) {
-                DOUT(std::cerr << "ODD - trying to attach to a empty address\n";);
-            }
-            Receiver* r = new Receiver(receiver);
-            queue_manager_.add(make_work(&QueueManager::findQueueReceiver, &queue_manager_, r, qname));
-        }
+        Receiver* r = new Receiver(receiver);
+        queue_manager_.add(make_work(&QueueManager::findQueueReceiver, &queue_manager_, r, qname));
     }
 
     void on_session_close(proton::session &session) OVERRIDE {


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


[19/50] qpid-proton git commit: NO-JIRA: Remove unused deprecated reactor functionality

Posted by ac...@apache.org.
NO-JIRA: Remove unused deprecated reactor functionality


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

Branch: refs/heads/go1
Commit: 57f5ec14aebe374d718cbb87c079a7b56cb6b705
Parents: 0800c19
Author: Andrew Stitcher <as...@apache.org>
Authored: Mon Sep 17 13:59:38 2018 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Mon Sep 17 13:59:38 2018 -0400

----------------------------------------------------------------------
 c/include/proton/selectable.h | 27 ---------------------------
 c/src/reactor/selectable.c    | 15 ---------------
 2 files changed, 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/57f5ec14/c/include/proton/selectable.h
----------------------------------------------------------------------
diff --git a/c/include/proton/selectable.h b/c/include/proton/selectable.h
index 9bfb867..c6d1722 100644
--- a/c/include/proton/selectable.h
+++ b/c/include/proton/selectable.h
@@ -36,11 +36,6 @@ extern "C" {
  */
 
 /**
- * An iterator for selectables.
- */
-typedef pn_iterator_t pn_selectables_t;
-
-/**
  * A ::pn_socket_t provides an abstract handle to an IO stream.  The
  * pipe version is uni-directional.  The network socket version is
  * bi-directional.  Both are non-blocking.
@@ -88,28 +83,6 @@ typedef int pn_socket_t;
  */
 typedef struct pn_selectable_t pn_selectable_t;
 
-/**
- * Construct a new selectables iterator.
- *
- * @return a pointer to a new selectables iterator
- */
-PNX_EXTERN pn_selectables_t *pn_selectables(void);
-
-/**
- * Get the next selectable from an iterator.
- *
- * @param[in] selectables a selectable iterator
- * @return the next selectable from the iterator
- */
-PNX_EXTERN pn_selectable_t *pn_selectables_next(pn_selectables_t *selectables);
-
-/**
- * Free a selectables iterator.
- *
- * @param[in] selectables a selectables iterator (or NULL)
- */
-PNX_EXTERN void pn_selectables_free(pn_selectables_t *selectables);
-
 PNX_EXTERN pn_selectable_t *pn_selectable(void);
 
 PNX_EXTERN void pn_selectable_on_readable(pn_selectable_t *sel, void (*readable)(pn_selectable_t *));

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/57f5ec14/c/src/reactor/selectable.c
----------------------------------------------------------------------
diff --git a/c/src/reactor/selectable.c b/c/src/reactor/selectable.c
index b42ad1f..473f113 100644
--- a/c/src/reactor/selectable.c
+++ b/c/src/reactor/selectable.c
@@ -28,21 +28,6 @@
 #include <assert.h>
 #include <stdlib.h>
 
-pn_selectables_t *pn_selectables(void)
-{
-  return pn_iterator();
-}
-
-pn_selectable_t *pn_selectables_next(pn_selectables_t *selectables)
-{
-  return (pn_selectable_t *) pn_iterator_next(selectables);
-}
-
-void pn_selectables_free(pn_selectables_t *selectables)
-{
-  pn_free(selectables);
-}
-
 struct pn_selectable_t {
   pn_socket_t fd;
   int index;


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


[20/50] qpid-proton git commit: NO-JIRA: [Python] Trivial pylint fixes

Posted by ac...@apache.org.
NO-JIRA: [Python] Trivial pylint fixes


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

Branch: refs/heads/go1
Commit: 348e9da8923f590c67a9fd01e91011987f238038
Parents: 57f5ec1
Author: Andrew Stitcher <as...@apache.org>
Authored: Thu Sep 13 17:23:26 2018 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Tue Sep 18 09:16:00 2018 -0400

----------------------------------------------------------------------
 python/proton/_reactor.py      | 22 +++++++++++-----------
 python/proton/_reactor_impl.py |  2 +-
 2 files changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/348e9da8/python/proton/_reactor.py
----------------------------------------------------------------------
diff --git a/python/proton/_reactor.py b/python/proton/_reactor.py
index 1d09b18..63e89c8 100644
--- a/python/proton/_reactor.py
+++ b/python/proton/_reactor.py
@@ -51,10 +51,10 @@ from ._handlers import OutgoingMessageHandler
 from . import _compat
 from ._compat import queue
 
-log = logging.getLogger("proton")
+Logger = logging.getLogger("proton")
 
 
-def generate_uuid():
+def _generate_uuid():
     return uuid.uuid4()
 
 
@@ -428,7 +428,7 @@ class Transaction(object):
             elif event.delivery.remote_state == Delivery.REJECTED:
                 self.handler.on_transaction_declare_failed(event)
             else:
-                log.warning("Unexpected outcome for declare: %s" % event.delivery.remote_state)
+                Logger.warning("Unexpected outcome for declare: %s" % event.delivery.remote_state)
                 self.handler.on_transaction_declare_failed(event)
         elif event.delivery == self._discharge:
             if event.delivery.remote_state == Delivery.REJECTED:
@@ -614,7 +614,7 @@ class Connector(Handler):
         # if virtual-host not set, use host from address as default
         if self.virtual_host is None:
             connection.hostname = url.host
-        log.debug("connecting to %r..." % url)
+        Logger.debug("connecting to %r..." % url)
 
         transport = Transport()
         if self.sasl_enabled:
@@ -645,7 +645,7 @@ class Connector(Handler):
         self._connect(event.connection, event.reactor)
 
     def on_connection_remote_open(self, event):
-        log.debug("connected to %s" % event.connection.hostname)
+        Logger.debug("connected to %s" % event.connection.hostname)
         if self.reconnect:
             self.reconnect.reset()
             self.transport = None
@@ -660,15 +660,15 @@ class Connector(Handler):
                 event.transport.unbind()
                 delay = self.reconnect.next()
                 if delay == 0:
-                    log.info("Disconnected, reconnecting...")
+                    Logger.info("Disconnected, reconnecting...")
                     self._connect(self.connection, event.reactor)
                     return
                 else:
-                    log.info("Disconnected will try to reconnect after %s seconds" % delay)
+                    Logger.info("Disconnected will try to reconnect after %s seconds" % delay)
                     event.reactor.schedule(delay, self)
                     return
             else:
-                log.debug("Disconnected")
+                Logger.debug("Disconnected")
         # See connector.cpp: conn.free()/pn_connection_release() here?
         self.connection = None
 
@@ -744,7 +744,7 @@ class Container(Reactor):
                 self.ssl = None
             self.global_handler = GlobalOverrides(kwargs.get('global_handler', self.global_handler))
             self.trigger = None
-            self.container_id = str(generate_uuid())
+            self.container_id = str(_generate_uuid())
             self.allow_insecure_mechs = True
             self.allowed_mechs = None
             self.sasl_enabled = True
@@ -802,7 +802,7 @@ class Container(Reactor):
 
         """
         conn = self.connection(handler)
-        conn.container = self.container_id or str(generate_uuid())
+        conn.container = self.container_id or str(_generate_uuid())
         conn.offered_capabilities = kwargs.get('offered_capabilities')
         conn.desired_capabilities = kwargs.get('desired_capabilities')
         conn.properties = kwargs.get('properties')
@@ -850,7 +850,7 @@ class Container(Reactor):
         elif remote:
             return "%s-%s" % (container, remote)
         else:
-            return "%s-%s" % (container, str(generate_uuid()))
+            return "%s-%s" % (container, str(_generate_uuid()))
 
     def _get_session(self, context):
         if isinstance(context, Url):

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/348e9da8/python/proton/_reactor_impl.py
----------------------------------------------------------------------
diff --git a/python/proton/_reactor_impl.py b/python/proton/_reactor_impl.py
index 175a650..4ffebcd 100644
--- a/python/proton/_reactor_impl.py
+++ b/python/proton/_reactor_impl.py
@@ -35,7 +35,7 @@ from ._wrapper import Wrapper
 
 from . import _compat
 
-_DEFAULT = object()
+_DEFAULT = False
 
 
 class Selectable(Wrapper):


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


[02/50] qpid-proton git commit: PROTON-1873: update versions for 0.25.0-rc1

Posted by ac...@apache.org.
PROTON-1873: update versions for 0.25.0-rc1


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

Branch: refs/heads/go1
Commit: 4b4a04230a9a8ac91cc6e73c8fc12ac5e7c6db49
Parents: 4c9395e
Author: Robbie Gemmell <ro...@apache.org>
Authored: Mon Sep 3 12:41:21 2018 +0100
Committer: Robbie Gemmell <ro...@apache.org>
Committed: Mon Sep 3 12:41:21 2018 +0100

----------------------------------------------------------------------
 VERSION.txt         | 2 +-
 python/docs/conf.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/4b4a0423/VERSION.txt
----------------------------------------------------------------------
diff --git a/VERSION.txt b/VERSION.txt
index 86159eb..d21d277 100644
--- a/VERSION.txt
+++ b/VERSION.txt
@@ -1 +1 @@
-0.25.0-SNAPSHOT
+0.25.0

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/4b4a0423/python/docs/conf.py
----------------------------------------------------------------------
diff --git a/python/docs/conf.py b/python/docs/conf.py
index 8501375..3b02e0c 100644
--- a/python/docs/conf.py
+++ b/python/docs/conf.py
@@ -50,7 +50,7 @@ copyright = u'2015, Apache Qpid'
 # The short X.Y version.
 version = '0.25.0'
 # The full version, including alpha/beta/rc tags.
-release = '0.25.0-SNAPSHOT'
+release = '0.25.0'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.


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


[45/50] qpid-proton git commit: PROTON-1974: [cpp] modify to work with older jsoncpp (1.7.4)

Posted by ac...@apache.org.
PROTON-1974: [cpp] modify to work with older jsoncpp (1.7.4)

- add jsoncpp to travis packages for CI testing
- fix string conversions - rules changed between 1.7.4 and 1.8
- better error handling/reporting


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

Branch: refs/heads/go1
Commit: aa85a1fe86827656501fe01f5695cd7ff4a842f3
Parents: ab82a8b
Author: Alan Conway <ac...@redhat.com>
Authored: Tue Oct 2 11:40:16 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Tue Oct 2 13:53:11 2018 -0400

----------------------------------------------------------------------
 .travis.yml                     |  1 +
 cpp/CMakeLists.txt              | 23 ++++++++++++++-------
 cpp/src/connect_config.cpp      | 39 ++++++++++++++++++++++++------------
 cpp/src/connect_config_test.cpp | 12 ++++++-----
 4 files changed, 50 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/aa85a1fe/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index d3fd7c9..6a8aa2e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -72,6 +72,7 @@ addons:
     - python3-dev
     - golang
     - lcov
+    - libjsoncpp-dev
 
 install:
 - python -m pip install --user --upgrade pip

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/aa85a1fe/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index f3c93fb..794fcbe 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -247,7 +247,22 @@ install (FILES
   DESTINATION ${LIB_INSTALL_DIR}/cmake/ProtonCpp)
 
 set(testdata "${CMAKE_CURRENT_BINARY_DIR}/testdata")
-set(test_env "PN_SASL_CONFIG_PATH=${testdata}/sasl-conf")
+
+# SASL configuration for tests
+if(CyrusSASL_Saslpasswd_EXECUTABLE)
+  configure_file("${CMAKE_CURRENT_SOURCE_DIR}/testdata/sasl-conf/proton-server.conf.in"
+    "${testdata}/sasl-conf/proton-server.conf")
+  execute_process(
+    COMMAND echo password
+    COMMAND ${CyrusSASL_Saslpasswd_EXECUTABLE} -c -p -f "${testdata}/sasl-conf/proton.sasldb" -u proton user
+    RESULT_VARIABLE ret)
+  if(ret)
+    message(WARNING "${CyrusSASL_Saslpasswd_EXECUTABLE}: error ${ret} - some SASL tests will be skipped")
+  else()
+    set(test_env ${test_env} "PN_SASL_CONFIG_PATH=${testdata}/sasl-conf")
+  endif()
+endif()
+
 if (CMAKE_SYSTEM_NAME STREQUAL Windows)
   set(test_env ${test_env} "PATH=$<TARGET_FILE_DIR:qpid-proton>")
 endif()
@@ -276,10 +291,4 @@ if (ENABLE_JSONCPP)
   set_tests_properties(cpp-connect_config_test PROPERTIES WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
   # Test data and output directories for connect_config_test
   file(COPY  "${CMAKE_CURRENT_SOURCE_DIR}/testdata" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
-  if(CyrusSASL_Saslpasswd_EXECUTABLE)
-    configure_file("${CMAKE_CURRENT_SOURCE_DIR}/testdata/sasl-conf/proton-server.conf.in"
-      "${testdata}/sasl-conf/proton-server.conf")
-    execute_process(COMMAND echo password
-      COMMAND ${CyrusSASL_Saslpasswd_EXECUTABLE} -c -p -f "${testdata}/sasl-conf/proton.sasldb" -u proton user)
-  endif()
 endif()

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/aa85a1fe/cpp/src/connect_config.cpp
----------------------------------------------------------------------
diff --git a/cpp/src/connect_config.cpp b/cpp/src/connect_config.cpp
index 2bcbfc2..d157d67 100644
--- a/cpp/src/connect_config.cpp
+++ b/cpp/src/connect_config.cpp
@@ -27,9 +27,11 @@
 
 #include <json/value.h>
 #include <json/reader.h>
+#include <json/writer.h>
 
 #include <cstdlib>
 #include <fstream>
+#include <sstream>
 
 using namespace Json;
 using std::string;
@@ -71,7 +73,7 @@ Value validate(ValueType t, const Value& v, const string& name) {
 
 Value get(ValueType t, const Value& obj, const char *key, const Value& dflt=Value()) {
     Value v = obj.get(key, dflt);
-    return v.type() == nullValue ? dflt : validate(t, v, key);
+    return v.isNull() ? dflt : validate(t, v, key);
 }
 
 bool get_bool(const Value& obj, const char *key, bool dflt) {
@@ -94,7 +96,7 @@ void parse_sasl(Value root, connection_options& opts) {
     Value sasl = get(objectValue, root, "sasl");
     opts.sasl_enabled(get_bool(sasl, "enable", true));
     opts.sasl_allow_insecure_mechs(get_bool(sasl, "allow_insecure", false));
-    if (sasl.type() != nullValue) {
+    if (!sasl.isNull()) {
         Value mechs = sasl.get("mechanisms", Value());
         switch (mechs.type()) {
           case nullValue:
@@ -106,9 +108,7 @@ void parse_sasl(Value root, connection_options& opts) {
               std::ostringstream s;
               for (ArrayIndex i= 0; i < mechs.size(); ++i) {
                   Value v = mechs.get(i, Value());
-                  if (v.type() != stringValue) {
-                      throw err(msg() << "'sasl/mechanisms' expect string elements, found " << v.type());
-                  }
+                  validate(stringValue, v, "sasl/mechanisms");
                   if (i > 0) s << " ";
                   s << v.asString();
               }
@@ -137,7 +137,7 @@ void parse_tls(const string& scheme, Value root, connection_options& opts) {
             ssl_opts = ssl_client_options(ca, mode);
         }
         opts.ssl_client_options(ssl_opts);
-    } else if (tls.type() != nullValue) {
+    } else if (!tls.isNull()) {
         throw err(msg() << "'tls' object not allowed unless scheme is \"amqps\"");
     }
 }
@@ -146,8 +146,11 @@ void parse_tls(const string& scheme, Value root, connection_options& opts) {
 
 std::string parse(std::istream& is, connection_options& opts) {
     try {
+        std::ostringstream addr;
+
         Value root;
         is >> root;
+        validate(objectValue, root, "configuration");
 
         string scheme = get_string(root, "scheme", "amqps");
         if (scheme != "amqp" && scheme != "amqps") {
@@ -156,20 +159,28 @@ std::string parse(std::istream& is, connection_options& opts) {
 
         string host = get_string(root, "host", "localhost");
         opts.virtual_host(host.c_str());
+        addr << host << ":";
 
         Value port = root.get("port", scheme);
-        if (!port.isIntegral() && !port.isString()) {
-            throw err(msg() << "'port' expected string or integer, found " << port.type());
+        switch (port.type()) {
+          case stringValue:
+            addr << port.asString(); break;
+          case intValue:
+          case uintValue:
+            addr << port.asUInt(); break;
+          default:
+            throw err(msg() << "'port' expected string or uint, found " << port.type());
         }
 
         Value user = get(stringValue, root, "user");
-        if (user.type() != nullValue) opts.user(user.asString());
+        if (!user.isNull()) opts.user(user.asString());
         Value password = get(stringValue, root, "password");
-        if (password.type() != nullValue) opts.password(password.asString());
+        if (!password.isNull()) opts.password(password.asString());
 
         parse_sasl(root, opts);
         parse_tls(scheme, root, opts);
-        return host + ":" + port.asString();
+
+        return addr.str();
     } catch (const std::exception& e) {
         throw err(e.what());
     } catch (...) {
@@ -203,17 +214,19 @@ string parse_default(connection_options& opts) {
     string name = default_file();
     std::ifstream f;
     try {
-        f.exceptions(~std::ifstream::goodbit);
+        f.exceptions(std::ifstream::badbit|std::ifstream::failbit);
         f.open(name.c_str());
     } catch (const std::exception& e) {
         throw err(msg() << "error opening '" << name << "': " << e.what());
     }
     try {
         return parse(f, opts);
+    } catch (const std::ifstream::failure& e) {
+        throw err(msg() << "io error parsing '" << name << "': " << e.what());
     } catch (const std::exception& e) {
         throw err(msg() << "error parsing '" << name << "': " << e.what());
     } catch (...) {
-        throw err(msg() << "error parsing '" << name);
+        throw err(msg() << "error parsing '" << name << "'");
     }
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/aa85a1fe/cpp/src/connect_config_test.cpp
----------------------------------------------------------------------
diff --git a/cpp/src/connect_config_test.cpp b/cpp/src/connect_config_test.cpp
index 0573f8f..8a17bba 100644
--- a/cpp/src/connect_config_test.cpp
+++ b/cpp/src/connect_config_test.cpp
@@ -38,8 +38,6 @@
 #include <fstream>
 #include <cstdio>
 
-#include <stdlib.h>
-
 namespace {
 
 using namespace std;
@@ -80,7 +78,7 @@ void test_addr() {
 
     ASSERT_THROWS_MSG(error, "'scheme' must be", configure(opts, "{\"scheme\":\"bad\"}"));
     ASSERT_THROWS_MSG(error, "'scheme' expected string, found boolean", configure(opts, "{\"scheme\":true}"));
-    ASSERT_THROWS_MSG(error, "'port' expected string or integer, found boolean", configure(opts, "{\"port\":true}"));
+    ASSERT_THROWS_MSG(error, "'port' expected string or uint, found boolean", configure(opts, "{\"port\":true}"));
     ASSERT_THROWS_MSG(error, "'host' expected string, found boolean", configure(opts, "{\"host\":true}"));
 }
 
@@ -270,14 +268,18 @@ int main(int argc, char** argv) {
     RUN_ARGV_TEST(failed, test_addr());
     RUN_ARGV_TEST(failed, test_invalid());
     RUN_ARGV_TEST(failed, test_default_connect().run());
-    RUN_ARGV_TEST(failed, test_host_user_pass().run());
 
+    bool have_sasl = pn_sasl_extended() && getenv("PN_SASL_CONFIG_PATH");
     pn_ssl_domain_t *have_ssl = pn_ssl_domain(PN_SSL_MODE_SERVER);
+
+    if (have_sasl) {
+        RUN_ARGV_TEST(failed, test_host_user_pass().run());
+    }
     if (have_ssl) {
         pn_ssl_domain_free(have_ssl);
         RUN_ARGV_TEST(failed, test_tls().run());
         RUN_ARGV_TEST(failed, test_tls_external().run());
-        if (pn_sasl_extended()) {
+        if (have_sasl) {
             RUN_ARGV_TEST(failed, test_tls_plain().run());
         }
     } else {


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


[05/50] qpid-proton git commit: PROTON-1798: [ruby] Use CMAKE_C_FLAGS to build ruby module

Posted by ac...@apache.org.
PROTON-1798: [ruby] Use CMAKE_C_FLAGS to build ruby module

Don't overwrite CMAKE_C_FLAGS when building ruby SWIG modules,
just remove the troublesome -fvisibility=* but keep the rest.


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

Branch: refs/heads/go1
Commit: 6275c986902fe2d16cefb1ae860f1d8af3caacd1
Parents: a1b7d50
Author: Alan Conway <ac...@redhat.com>
Authored: Thu Sep 6 16:57:41 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Fri Sep 7 09:45:50 2018 -0400

----------------------------------------------------------------------
 ruby/CMakeLists.txt | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6275c986/ruby/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/ruby/CMakeLists.txt b/ruby/CMakeLists.txt
index 848d1c9..e205250 100644
--- a/ruby/CMakeLists.txt
+++ b/ruby/CMakeLists.txt
@@ -41,12 +41,13 @@ swig_link_libraries(cproton-ruby ${BINDING_DEPS} ${RUBY_LIBRARY})
 if (RUBY_VERSION VERSION_LESS 1.9.0)
    # Don't have blocking control API
 elseif(RUBY_VERSION VERSION_LESS 2.0.0)
-  set(RUBY_C_FLAGS "-DRUBY_USE_rb_thread_blocking_region")
+  string(APPEND CMAKE_C_FLAGS " -DRUBY_USE_rb_thread_blocking_region")
 else()
-  set(RUBY_C_FLAGS "-DRUBY_USE_rb_thread_call_without_gvl")
+  string(APPEND CMAKE_C_FLAGS " -DRUBY_USE_rb_thread_call_without_gvl")
 endif()
-# Replace global CMAKE_C_FLAGS, -fvisibility=hidden causes an obscure failure with release builds.
-set(CMAKE_C_FLAGS "${RUBY_C_FLAGS}")
+
+# Remove -fvisibility=hidden, it causes an obscure failure in release builds.
+string(REGEX REPLACE "-fvisibility=[a-z]*" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
 
 set_target_properties(cproton-ruby
     PROPERTIES


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


[34/50] qpid-proton git commit: PROTON-1942: [c] decoding a message does not set the inferred flag.

Posted by ac...@apache.org.
PROTON-1942: [c] decoding a message does not set the inferred flag.


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

Branch: refs/heads/go1
Commit: b114344ffa2281b09af60b9635a79f7fb735a012
Parents: b429db0
Author: Alan Conway <ac...@redhat.com>
Authored: Thu Sep 27 14:04:48 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Thu Sep 27 14:08:00 2018 -0400

----------------------------------------------------------------------
 c/src/core/message.c |  6 +++++
 c/tests/message.c    | 57 +++++++++++++++++++++++++++++++++++++++++++----
 2 files changed, 59 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b114344f/c/src/core/message.c
----------------------------------------------------------------------
diff --git a/c/src/core/message.c b/c/src/core/message.c
index 41ccd08..a52dce8 100644
--- a/c/src/core/message.c
+++ b/c/src/core/message.c
@@ -737,7 +737,13 @@ int pn_message_decode(pn_message_t *msg, const char *bytes, size_t size)
       break;
     case DATA:
     case AMQP_SEQUENCE:
+      msg->inferred = true;
+      pn_data_narrow(msg->data);
+      err = pn_data_copy(msg->body, msg->data);
+      if (err) return err;
+      break;
     case AMQP_VALUE:
+      msg->inferred = false;
       pn_data_narrow(msg->data);
       err = pn_data_copy(msg->body, msg->data);
       if (err) return err;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b114344f/c/tests/message.c
----------------------------------------------------------------------
diff --git a/c/tests/message.c b/c/tests/message.c
index 5362b7d..7a6dc4f 100644
--- a/c/tests/message.c
+++ b/c/tests/message.c
@@ -19,6 +19,8 @@
  *
  */
 
+#include "test_tools.h"
+
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -28,20 +30,67 @@
 
 #define assert(E) ((E) ? 0 : (abort(), 0))
 
-static void test_overflow_error(void)
+static void test_overflow_error(test_t *t)
 {
   pn_message_t *message = pn_message();
   char buf[6];
   size_t size = 6;
 
   int err = pn_message_encode(message, buf, &size);
-  assert(err == PN_OVERFLOW);
-  assert(pn_message_errno(message) == 0);
+  TEST_INT_EQUAL(t,PN_OVERFLOW, err);
+  TEST_INT_EQUAL(t, 0, pn_message_errno(message));
   pn_message_free(message);
 }
 
+static void recode(pn_message_t *dst, pn_message_t *src) {
+  pn_rwbytes_t buf = { 0 };
+  int size = pn_message_encode2(src, &buf);
+  assert(size > 0);
+  pn_message_decode(dst, buf.start, size);
+  free(buf.start);
+}
+
+static void test_inferred(test_t *t) {
+  pn_message_t *src = pn_message();
+  pn_message_t *dst = pn_message();
+
+  TEST_CHECK(t, !pn_message_is_inferred(src));
+  pn_data_put_binary(pn_message_body(src), PN_BYTES_LITERAL("hello"));
+  recode(dst, src);
+  TEST_CHECK(t, !pn_message_is_inferred(dst));
+  pn_message_set_inferred(src, true);
+  recode(dst, src);
+  TEST_CHECK(t, pn_message_is_inferred(dst));
+
+  pn_message_clear(src);
+  TEST_CHECK(t, !pn_message_is_inferred(src));
+  pn_data_put_list(pn_message_body(src));
+  pn_data_enter(pn_message_body(src));
+  pn_data_put_binary(pn_message_body(src), PN_BYTES_LITERAL("hello"));
+  recode(dst, src);
+  TEST_CHECK(t, !pn_message_is_inferred(dst));
+  pn_message_set_inferred(src, true);
+  recode(dst, src);
+  TEST_CHECK(t, pn_message_is_inferred(dst));
+
+  pn_message_clear(src);
+  TEST_CHECK(t, !pn_message_is_inferred(src));
+  pn_data_put_string(pn_message_body(src), PN_BYTES_LITERAL("hello"));
+  recode(dst, src);
+  TEST_CHECK(t, !pn_message_is_inferred(dst));
+  pn_message_set_inferred(src, true);
+  recode(dst, src);
+  /* A value section is never considered to be inferred */
+  TEST_CHECK(t, !pn_message_is_inferred(dst));
+
+  pn_message_free(src);
+  pn_message_free(dst);
+}
+
 int main(int argc, char **argv)
 {
-  test_overflow_error();
+  int failed = 0;
+  RUN_ARGV_TEST(failed, t, test_overflow_error(&t));
+  RUN_ARGV_TEST(failed, t, test_inferred(&t));
   return 0;
 }


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


[18/50] qpid-proton git commit: NO-JIRA: Mark FIXME items as TODO

Posted by ac...@apache.org.
NO-JIRA: Mark FIXME items as TODO


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

Branch: refs/heads/go1
Commit: 0800c1995b25a422d371db6bc3809bfe5f9d13b9
Parents: 4acc81e
Author: Alan Conway <ac...@redhat.com>
Authored: Wed Sep 12 21:10:27 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Wed Sep 12 21:11:10 2018 -0400

----------------------------------------------------------------------
 tests/runtime_check.cmake | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0800c199/tests/runtime_check.cmake
----------------------------------------------------------------------
diff --git a/tests/runtime_check.cmake b/tests/runtime_check.cmake
index c0b7191..57ae2f5 100644
--- a/tests/runtime_check.cmake
+++ b/tests/runtime_check.cmake
@@ -85,13 +85,13 @@ if(RUNTIME_CHECK STREQUAL "memcheck")
   assert_has_valgrind()
   message(STATUS "Runtime memory checker: valgrind memcheck")
   set(TEST_EXE_PREFIX "${VALGRIND_EXECUTABLE} --tool=memcheck --leak-check=full ${VALGRIND_COMMON_ARGS}")
-  # FIXME aconway 2018-09-06: NO TEST_WRAP_PREFIX, need --trace-children + many suppressions
+  # TODO aconway 2018-09-06: NO TEST_WRAP_PREFIX, need --trace-children + many suppressions
 
 elseif(RUNTIME_CHECK STREQUAL "helgrind")
   assert_has_valgrind()
   message(STATUS "Runtime race checker: valgrind helgrind")
   set(TEST_EXE_PREFIX "${VALGRIND_EXECUTABLE} --tool=helgrind ${VALGRIND_COMMON_ARGS}")
-  # FIXME aconway 2018-09-06: NO TEST_WRAP_PREFIX, need --trace-children + many suppressions
+  # TODO aconway 2018-09-06: NO TEST_WRAP_PREFIX, need --trace-children + many suppressions
 
 elseif(RUNTIME_CHECK STREQUAL "asan")
   assert_has_sanitizers()


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


[42/50] qpid-proton git commit: PROTON-1944, PROTON-1926: update versions for 0.27.0-SNAPSHOT

Posted by ac...@apache.org.
PROTON-1944, PROTON-1926: update versions for 0.27.0-SNAPSHOT


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

Branch: refs/heads/go1
Commit: 1b554aad70452d6501cb3e13a6c10186d14e9dc9
Parents: fd518f2
Author: Robbie Gemmell <ro...@apache.org>
Authored: Mon Oct 1 12:50:30 2018 +0100
Committer: Robbie Gemmell <ro...@apache.org>
Committed: Mon Oct 1 12:50:30 2018 +0100

----------------------------------------------------------------------
 VERSION.txt         | 2 +-
 python/docs/conf.py | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1b554aad/VERSION.txt
----------------------------------------------------------------------
diff --git a/VERSION.txt b/VERSION.txt
index 4e8f395..7e9b4cf 100644
--- a/VERSION.txt
+++ b/VERSION.txt
@@ -1 +1 @@
-0.26.0
+0.27.0-SNAPSHOT

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1b554aad/python/docs/conf.py
----------------------------------------------------------------------
diff --git a/python/docs/conf.py b/python/docs/conf.py
index 59317d4..476cf29 100644
--- a/python/docs/conf.py
+++ b/python/docs/conf.py
@@ -48,9 +48,9 @@ copyright = u'2015, Apache Qpid'
 # built documents.
 #
 # The short X.Y version.
-version = '0.26.0'
+version = '0.27.0'
 # The full version, including alpha/beta/rc tags.
-release = '0.26.0'
+release = '0.27.0-SNAPSHOT'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.


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


[32/50] qpid-proton git commit: NO-JIRA: [cpp] document proton::condition operators == and <<

Posted by ac...@apache.org.
NO-JIRA: [cpp] document proton::condition operators == and <<


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

Branch: refs/heads/go1
Commit: 77c63547dbd8e22a8a69d188e9450f6e29554b0e
Parents: e2d1ffe
Author: Alan Conway <ac...@redhat.com>
Authored: Fri Jun 22 14:58:26 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Thu Sep 27 13:22:59 2018 -0400

----------------------------------------------------------------------
 cpp/include/proton/error_condition.hpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/77c63547/cpp/include/proton/error_condition.hpp
----------------------------------------------------------------------
diff --git a/cpp/include/proton/error_condition.hpp b/cpp/include/proton/error_condition.hpp
index cbd6e09..1ca7be8 100644
--- a/cpp/include/proton/error_condition.hpp
+++ b/cpp/include/proton/error_condition.hpp
@@ -101,11 +101,11 @@ class error_condition {
     /// @endcond
 };
 
-/// @cond INTERNAL
-// XXX Document these 
+/// @return true if name, description and properties are all equal
 PN_CPP_EXTERN bool operator==(const error_condition& x, const error_condition& y);
+
+/// Human readable string
 PN_CPP_EXTERN std::ostream& operator<<(std::ostream& o, const error_condition& err);
-/// @endcond
 
 } // proton
 


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


[48/50] qpid-proton git commit: NO-JIRA: merge update to Travis config to resolve pip issues. This closes #161.

Posted by ac...@apache.org.
NO-JIRA: merge update to Travis config to resolve pip issues. This closes #161.


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

Branch: refs/heads/go1
Commit: 52bbe5fcbeeab7d9a32d94afbcf4c2dc8e967e12
Parents: 555878d 386a88c
Author: Robbie Gemmell <ro...@apache.org>
Authored: Thu Oct 4 09:33:05 2018 +0100
Committer: Robbie Gemmell <ro...@apache.org>
Committed: Thu Oct 4 09:33:05 2018 +0100

----------------------------------------------------------------------
 .travis.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------



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


[28/50] qpid-proton git commit: PROTON-1937: Use value.type() to check for value presence or absence

Posted by ac...@apache.org.
PROTON-1937: Use value.type() to check for value presence or absence

This closes #158


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

Branch: refs/heads/go1
Commit: 436275a37349b7c909dc397ae3aff704e49b7ba0
Parents: e7930c0
Author: Chuck Rolke <cr...@redhat.com>
Authored: Mon Sep 24 16:06:29 2018 -0400
Committer: Chuck Rolke <cr...@redhat.com>
Committed: Mon Sep 24 16:06:29 2018 -0400

----------------------------------------------------------------------
 cpp/src/connect_config.cpp | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/436275a3/cpp/src/connect_config.cpp
----------------------------------------------------------------------
diff --git a/cpp/src/connect_config.cpp b/cpp/src/connect_config.cpp
index 3ec16fb..d85eb04 100644
--- a/cpp/src/connect_config.cpp
+++ b/cpp/src/connect_config.cpp
@@ -70,7 +70,7 @@ Value validate(ValueType t, const Value& v, const string& name) {
 }
 
 Value get(ValueType t, const Value& obj, const char *key, const Value& dflt=Value()) {
-    Value v = obj ? obj.get(key, dflt) : dflt;
+    Value v = (obj.type() != nullValue) ? obj.get(key, dflt) : dflt;
     return validate(t, v, key);
 }
 
@@ -93,7 +93,7 @@ bool exists(const string& name) { return std::ifstream(name.c_str()).good(); }
 void parse_sasl(Value root, connection_options& opts) {
     Value sasl = root.get("sasl", Value());
     opts.sasl_enabled(get_bool(sasl, "enable", true));
-    if (sasl) {
+    if (sasl.type() != nullValue) {
         validate(objectValue, sasl, "sasl");
         opts.sasl_allow_insecure_mechs(get_bool(sasl, "allow_insecure", false));
         Value mechs = sasl.get("mechanisms", Value());
@@ -124,7 +124,7 @@ void parse_sasl(Value root, connection_options& opts) {
 
 void parse_tls(const string& scheme, Value root, connection_options& opts) {
     Value tls = root.get("tls", Value());
-    if (tls) {
+    if (tls.type() != nullValue) {
         validate(objectValue, tls, "tls");
         if (scheme != "amqps") {
             raise(msg() << "'tls' object is not allowed unless scheme is \"amqps\"");
@@ -133,9 +133,9 @@ void parse_tls(const string& scheme, Value root, connection_options& opts) {
         bool verify = get_bool(tls, "verify", true);
         Value cert = get(stringValue, tls, "cert");
         ssl::verify_mode mode = verify ? ssl::VERIFY_PEER_NAME : ssl::ANONYMOUS_PEER;
-        if (cert) {
+        if (cert.type() != nullValue) {
             Value key = get(stringValue, tls, "key");
-            ssl_certificate cert2 = key ?
+            ssl_certificate cert2 = (key.type() != nullValue) ?
                 ssl_certificate(cert.asString(), key.asString()) :
                 ssl_certificate(cert.asString());
             opts.ssl_client_options(ssl_client_options(cert2, ca, mode));
@@ -165,9 +165,9 @@ std::string parse(std::istream& is, connection_options& opts) {
     }
 
     Value user = root.get("user", Value());
-    if (user) opts.user(validate(stringValue, user, "user").asString());
+    if (user.type() != nullValue) opts.user(validate(stringValue, user, "user").asString());
     Value password = root.get("password", Value());
-    if (password) opts.password(validate(stringValue, password, "password").asString());
+    if (password.type() != nullValue) opts.password(validate(stringValue, password, "password").asString());
 
     parse_sasl(root, opts);
     parse_tls(scheme, root, opts);


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


[31/50] qpid-proton git commit: PROTON-1888: allow configuration of connection details from file

Posted by ac...@apache.org.
PROTON-1888: allow configuration of connection details from file


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

Branch: refs/heads/go1
Commit: e2d1ffe52ad1f5688b5363ec9ceda54ae93a9d65
Parents: 3e227e1
Author: Gordon Sim <gs...@redhat.com>
Authored: Tue Sep 25 21:04:11 2018 +0100
Committer: Gordon Sim <gs...@redhat.com>
Committed: Wed Sep 26 01:19:15 2018 +0100

----------------------------------------------------------------------
 python/examples/helloworld.py                   |   7 +-
 python/proton/_reactor.py                       |  55 ++++++
 python/tests/proton_tests/__init__.py           |   1 +
 python/tests/proton_tests/connect.py            | 171 +++++++++++++++++++
 python/tests/proton_tests/ssl_db/README.txt     |   7 +
 .../ssl_db/client-private-key-no-password.pem   |  13 ++
 .../ssl_db/server-certificate-lh.pem            |  26 +++
 .../tests/proton_tests/ssl_db/server-lh.pkcs12  | Bin 0 -> 2199 bytes
 .../ssl_db/server-private-key-lh.pem            |  21 +++
 .../proton_tests/ssl_db/server-request-lh.pem   |  23 +++
 10 files changed, 320 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e2d1ffe5/python/examples/helloworld.py
----------------------------------------------------------------------
diff --git a/python/examples/helloworld.py b/python/examples/helloworld.py
index 7a91aa4..5b88462 100755
--- a/python/examples/helloworld.py
+++ b/python/examples/helloworld.py
@@ -24,13 +24,12 @@ from proton.handlers import MessagingHandler
 from proton.reactor import Container
 
 class HelloWorld(MessagingHandler):
-    def __init__(self, server, address):
+    def __init__(self, address):
         super(HelloWorld, self).__init__()
-        self.server = server
         self.address = address
 
     def on_start(self, event):
-        conn = event.container.connect(self.server)
+        conn = event.container.connect()
         event.container.create_receiver(conn, self.address)
         event.container.create_sender(conn, self.address)
 
@@ -42,4 +41,4 @@ class HelloWorld(MessagingHandler):
         print(event.message.body)
         event.connection.close()
 
-Container(HelloWorld("localhost:5672", "examples")).run()
+Container(HelloWorld("examples")).run()

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e2d1ffe5/python/proton/_reactor.py
----------------------------------------------------------------------
diff --git a/python/proton/_reactor.py b/python/proton/_reactor.py
index 63e89c8..a47625f 100644
--- a/python/proton/_reactor.py
+++ b/python/proton/_reactor.py
@@ -19,6 +19,7 @@
 
 from __future__ import absolute_import
 
+import json
 import os
 import logging
 import traceback
@@ -726,6 +727,28 @@ class SSLConfig(object):
         self.client.set_trusted_ca_db(certificate_db)
         self.server.set_trusted_ca_db(certificate_db)
 
+def find_config_file():
+    confname = 'connect.json'
+    confpath = ['.', '~/.config/messaging','/etc/messaging']
+    for d in confpath:
+        f = os.path.join(d, confname)
+        if os.path.isfile(f):
+            return f
+    return None
+
+def get_default_config():
+    conf = os.environ.get('MESSAGING_CONNECT_FILE') or find_config_file()
+    if conf and os.path.isfile(conf):
+        with open(conf, 'r') as f:
+            return json.load(f)
+    else:
+        return {}
+
+def get_default_port_for_scheme(scheme):
+    if scheme == 'amqps':
+        return 5671
+    else:
+        return 5672
 
 class Container(Reactor):
     """A representation of the AMQP concept of a 'container', which
@@ -801,6 +824,38 @@ class Container(Reactor):
         the authentication secret.
 
         """
+        if not url and not urls and not address:
+            config = get_default_config()
+            scheme = config.get('scheme', 'amqp')
+            _url = "%s://%s:%s" % (scheme, config.get('host', 'localhost'), config.get('port', get_default_port_for_scheme(scheme)))
+            _ssl_domain = None
+            _kwargs = kwargs
+            if config.get('user'):
+                _kwargs['user'] = config.get('user')
+                if config.get('password'):
+                    _kwargs['password'] = config.get('password')
+            sasl_config = config.get('sasl', {})
+            _kwargs['sasl_enabled'] = sasl_config.get('enabled', True)
+            if sasl_config.get('mechanisms'):
+                _kwargs['allowed_mechs'] = sasl_config.get('mechanisms')
+            tls_config = config.get('tls', {})
+            if scheme == 'amqps':
+                _ssl_domain = SSLDomain(SSLDomain.MODE_CLIENT)
+                ca = tls_config.get('ca')
+                cert = tls_config.get('cert')
+                key = tls_config.get('key')
+                if ca:
+                    _ssl_domain.set_trusted_ca_db(str(ca))
+                    if tls_config.get('verify', True):
+                        _ssl_domain.set_peer_authentication(SSLDomain.VERIFY_PEER_NAME, str(ca))
+                if cert and key:
+                    _ssl_domain.set_credentials(str(cert), str(key), None)
+
+            return self._connect(_url, handler=handler, reconnect=reconnect, heartbeat=heartbeat, ssl_domain=_ssl_domain, **_kwargs)
+        else:
+            return self._connect(url=url, urls=urls, handler=handler, reconnect=reconnect, heartbeat=heartbeat, ssl_domain=ssl_domain, **kwargs)
+
+    def _connect(self, url=None, urls=None, address=None, handler=None, reconnect=None, heartbeat=None, ssl_domain=None, **kwargs):
         conn = self.connection(handler)
         conn.container = self.container_id or str(_generate_uuid())
         conn.offered_capabilities = kwargs.get('offered_capabilities')

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e2d1ffe5/python/tests/proton_tests/__init__.py
----------------------------------------------------------------------
diff --git a/python/tests/proton_tests/__init__.py b/python/tests/proton_tests/__init__.py
index 672a43c..eca82fe 100644
--- a/python/tests/proton_tests/__init__.py
+++ b/python/tests/proton_tests/__init__.py
@@ -31,3 +31,4 @@ from . import interop
 from . import soak
 from . import url
 from . import utils
+from . import connect

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e2d1ffe5/python/tests/proton_tests/connect.py
----------------------------------------------------------------------
diff --git a/python/tests/proton_tests/connect.py b/python/tests/proton_tests/connect.py
new file mode 100644
index 0000000..f8d21b9
--- /dev/null
+++ b/python/tests/proton_tests/connect.py
@@ -0,0 +1,171 @@
+from __future__ import absolute_import
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+import time
+import sys
+import json
+from .common import Test, SkipTest, TestServer, free_tcp_port, ensureCanTestExtendedSASL
+from proton import SSLDomain
+from proton.reactor import Container
+from proton.handlers import MessagingHandler
+from .ssl import _testpath
+
+def write_connect_conf(obj):
+    with open('connect.json', 'w') as outfile:
+        json.dump(obj, outfile)
+
+class Server(MessagingHandler):
+    def __init__(self, expected_user=None, scheme='amqp'):
+        super(Server, self).__init__()
+        self.port = free_tcp_port()
+        self.scheme = scheme
+        self.url = '%s://localhost:%i' % (self.scheme, self.port)
+        self.expected_user = expected_user
+        self.verified_user = False
+
+    def on_start(self, event):
+        self.listener = event.container.listen(self.url)
+
+    def on_connection_opening(self, event):
+        if self.expected_user:
+            assert event.connection.transport.user == self.expected_user
+            self.verified_user = True
+
+    def on_connection_closing(self, event):
+        event.connection.close()
+        self.listener.close()
+
+class Client(MessagingHandler):
+    def __init__(self):
+        super(Client, self).__init__()
+        self.opened = False
+
+    def on_connection_opened(self, event):
+        self.opened = True
+        event.connection.close()
+
+class ConnectConfigTest(Test):
+    def test_port(self):
+        ensureCanTestExtendedSASL()
+        server = Server()
+        container = Container(server)
+        client = Client()
+        write_connect_conf({'port':server.port})
+        container.connect(handler=client, reconnect=False)
+        container.run()
+        assert client.opened == True
+
+    def test_user(self):
+        ensureCanTestExtendedSASL()
+        user = 'user@proton'
+        password = 'password'
+        server = Server(user)
+        container = Container(server)
+        client = Client()
+        write_connect_conf({'port':server.port, 'user':user, 'password':password})
+        container.connect(handler=client, reconnect=False)
+        container.run()
+        assert client.opened == True
+        assert server.verified_user == True
+
+    def test_ssl(self):
+        ensureCanTestExtendedSASL()
+        server = Server(scheme='amqps')
+        container = Container(server)
+        container.ssl.server.set_credentials(_testpath('server-certificate.pem'),
+                                             _testpath('server-private-key.pem'),
+                                             'server-password')
+        client = Client()
+        config = {
+            'scheme':'amqps',
+            'port':server.port,
+            'tls': {
+                'verify': False
+             }
+        }
+        write_connect_conf(config)
+        container.connect(handler=client, reconnect=False)
+        container.run()
+        assert client.opened == True
+
+    def test_ssl_external(self):
+        ensureCanTestExtendedSASL()
+        server = Server(scheme='amqps')
+        container = Container(server)
+        container.ssl.server.set_credentials(_testpath('server-certificate-lh.pem'),
+                                             _testpath('server-private-key-lh.pem'),
+                                             'server-password')
+        container.ssl.server.set_trusted_ca_db(_testpath('ca-certificate.pem'))
+        container.ssl.server.set_peer_authentication( SSLDomain.VERIFY_PEER,
+                                                      _testpath('ca-certificate.pem') )
+
+        client = Client()
+        config = {
+            'scheme':'amqps',
+            'port':server.port,
+            'sasl': {
+                'mechanisms': 'EXTERNAL'
+            },
+            'tls': {
+                'cert': _testpath('client-certificate.pem'),
+                'key': _testpath('client-private-key-no-password.pem'),
+                'ca': _testpath('ca-certificate.pem'),
+                'verify': True
+            }
+        }
+        write_connect_conf(config)
+        container.connect(handler=client, reconnect=False)
+        container.run()
+        assert client.opened == True
+
+    def test_ssl_plain(self):
+        ensureCanTestExtendedSASL()
+        user = 'user@proton'
+        password = 'password'
+        server = Server(expected_user=user, scheme='amqps')
+        container = Container(server)
+        container.ssl.server.set_credentials(_testpath('server-certificate-lh.pem'),
+                                             _testpath('server-private-key-lh.pem'),
+                                             'server-password')
+        container.ssl.server.set_trusted_ca_db(_testpath('ca-certificate.pem'))
+        container.ssl.server.set_peer_authentication( SSLDomain.VERIFY_PEER,
+                                                      _testpath('ca-certificate.pem') )
+
+        client = Client()
+        config = {
+            'scheme':'amqps',
+            'port':server.port,
+            'user':user,
+            'password':password,
+            'sasl': {
+                'mechanisms': 'PLAIN'
+             },
+            'tls': {
+                'cert': _testpath('client-certificate.pem'),
+                'key': _testpath('client-private-key-no-password.pem'),
+                'ca': _testpath('ca-certificate.pem'),
+                'verify': True
+            }
+        }
+        write_connect_conf(config)
+        container.connect(handler=client, reconnect=False)
+        container.run()
+        assert client.opened == True
+

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e2d1ffe5/python/tests/proton_tests/ssl_db/README.txt
----------------------------------------------------------------------
diff --git a/python/tests/proton_tests/ssl_db/README.txt b/python/tests/proton_tests/ssl_db/README.txt
index 20c92b2..8a6bd6a 100644
--- a/python/tests/proton_tests/ssl_db/README.txt
+++ b/python/tests/proton_tests/ssl_db/README.txt
@@ -42,11 +42,18 @@ keytool -storetype pkcs12 -keystore server.pkcs12 -storepass server-password -al
 keytool -storetype pkcs12 -keystore ca.pkcs12 -storepass ca-password -alias ca -keypass ca-password -gencert -rfc -validity 99999 -infile server-request.pem -outfile server-certificate.pem
 openssl pkcs12 -nocerts -passin pass:server-password -in server.pkcs12 -passout pass:server-password -out server-private-key.pem
 
+# Create a certificate request for a server certificate using localhost.  Use the CA's certificate to sign it:
+keytool -storetype pkcs12 -keystore server-lh.pkcs12 -storepass server-password -alias server-certificate -keypass server-password -genkey  -dname "CN=localhost" -validity 99999
+keytool -storetype pkcs12 -keystore server-lh.pkcs12 -storepass server-password -alias server-certificate -keypass server-password -certreq -file server-request-lh.pem
+keytool -storetype pkcs12 -keystore ca.pkcs12 -storepass ca-password -alias ca -keypass ca-password -gencert -rfc -validity 99999 -infile server-request-lh.pem -outfile server-certificate-lh.pem
+openssl pkcs12 -nocerts -passin pass:server-password -in server-lh.pkcs12 -passout pass:server-password -out server-private-key-lh.pem
+
 # Create a certificate request for the client certificate.  Use the CA's certificate to sign it:
 keytool -storetype pkcs12 -keystore client.pkcs12 -storepass client-password -alias client-certificate -keypass client-password -genkey  -dname "O=Client,CN=127.0.0.1" -validity 99999
 keytool -storetype pkcs12 -keystore client.pkcs12 -storepass client-password -alias client-certificate -keypass client-password -certreq -file client-request.pem
 keytool -storetype pkcs12 -keystore ca.pkcs12 -storepass ca-password -alias ca -keypass ca-password -gencert -rfc -validity 99999 -infile client-request.pem -outfile client-certificate.pem
 openssl pkcs12 -nocerts -passin pass:client-password -in client.pkcs12 -passout pass:client-password -out client-private-key.pem
+openssl pkcs12 -nocerts -passin pass:client-password -in client.pkcs12 -nodes -out client-private-key-no-password.pem
 
 # Create another client certificate with a different subject line
 keytool -storetype pkcs12 -keystore client1.pkcs12 -storepass client-password -alias client-certificate1 -keypass client-password -genkey  -dname "O=Client,CN=127.0.0.1,C=US,ST=ST,L=City,OU=Dev" -validity 99999

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e2d1ffe5/python/tests/proton_tests/ssl_db/client-private-key-no-password.pem
----------------------------------------------------------------------
diff --git a/python/tests/proton_tests/ssl_db/client-private-key-no-password.pem b/python/tests/proton_tests/ssl_db/client-private-key-no-password.pem
new file mode 100644
index 0000000..4609e17
--- /dev/null
+++ b/python/tests/proton_tests/ssl_db/client-private-key-no-password.pem
@@ -0,0 +1,13 @@
+Bag Attributes
+    friendlyName: client-certificate
+    localKeyID: 54 69 6D 65 20 31 35 30 31 37 31 30 38 31 37 32 33 39 
+Key Attributes: <No Attributes>
+-----BEGIN PRIVATE KEY-----
+MIIBSwIBADCCASwGByqGSM44BAEwggEfAoGBAP1/U4EddRIpUt9KnC7s5Of2EbdS
+PO9EAMMeP4C2USZpRV1AIlH7WT2NWPq/xfW6MPbLm1Vs14E7gB00b/JmYLdrmVCl
+pJ+f6AR7ECLCT7up1/63xhv4O1fnxqimFQ8E+4P208UewwI1VBNaFpEy9nXzrith
+1yrv8iIDGZ3RSAHHAhUAl2BQjxUjC8yykrmCouuEC/BYHPUCgYEA9+GghdabPd7L
+vKtcNrhXuXmUr7v6OuqC+VdMCz0HgmdRWVeOutRZT+ZxBxCBgLRJFnEj6EwoFhO3
+zwkyjMim4TwWeotUfI0o4KOuHiuzpnWRbqN/C/ohNWLx+2J6ASQ7zKTxvqhRkImo
+g9/hWuWfBpKLZl6Ae1UlZAFMO/7PSSoEFgIUagxvW3D50G8WfG2jBtMMVQRYXnY=
+-----END PRIVATE KEY-----

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e2d1ffe5/python/tests/proton_tests/ssl_db/server-certificate-lh.pem
----------------------------------------------------------------------
diff --git a/python/tests/proton_tests/ssl_db/server-certificate-lh.pem b/python/tests/proton_tests/ssl_db/server-certificate-lh.pem
new file mode 100644
index 0000000..6c9c7ff
--- /dev/null
+++ b/python/tests/proton_tests/ssl_db/server-certificate-lh.pem
@@ -0,0 +1,26 @@
+-----BEGIN CERTIFICATE-----
+MIIEUzCCBA+gAwIBAgIEHgDMyTANBglghkgBZQMEAwIFADAxMRcwFQYDVQQDEw5U
+cnVzdGVkLkNBLmNvbTEWMBQGA1UEChMNVHJ1c3QgTWUgSW5jLjAgFw0xODA5MjUy
+MDM4MzFaGA8yMjkyMDcwOTIwMzgzMVowFDESMBAGA1UEAxMJbG9jYWxob3N0MIID
+QjCCAjUGByqGSM44BAEwggIoAoIBAQCPeTXZuarpv6vtiHrPSVG28y7FnjuvNxjo
+6sSWHz79NgbnQ1GpxBgzObgJ58KuHFObp0dbhdARrbi0eYd1SYRpXKwOjxSzNggo
+oi/6JxEKPWKpk0U0CaD+aWxGWPhL3SCBnDcJoBBXsZWtzQAjPbpUhLYpH51kjviD
+RIZ3l5zsBLQ0pqwudemYXeI9sCkvwRGMn/qdgYHnM423krcw17njSVkvaAmYchU5
+Feo9a4tGU8YzRY+AOzKkwuDycpAlbk4/ijsIOKHEUOThjBopo33fXqFD3ktm/wSQ
+PtXPFiPhWNSHxgjpfyEc2B3KI8tuOAdl+CLjQr5ITAV2OTlgHNZnAh0AuvaWpoV4
+99/e5/pnyXfHhe8ysjO65YDAvNVpXQKCAQAWplxYIEhQcE51AqOXVwQNNNo6NHjB
+VNTkpcAtJC7gT5bmHkvQkEq9rI837rHgnzGC0jyQQ8tkL4gAQWDt+coJsyB2p5wy
+pifyRz6Rh5uixOdEvSCBVEy1W4AsNo0fqD7UielOD6BojjJCilx4xHjGjQUntxya
+OrsLC+EsRGiWOefTznTbEBplqiuH9kxoJts+xy9LVZmDS7TtsC98kOmkltOlXVNb
+6/xF1PYZ9j897buHOSXC8iTgdzEpbaiH7B5HSPh++1/et1SEMWsiMt7lU92vAhEr
+DR8C2jCXMiT+J67ai51LKSLZuovjntnhA6Y8UoELxoi34u1DFuHvF9veA4IBBQAC
+ggEAdVroB0ANoeIKYkkbTwxY8B1eIHDUX1Xa1tFCzfTBIzeP4K+5a2Km5UqkIDje
+a9p3MtJgSZMAW9iJ1EDLBFH+75JirTtiYmt78vx9gIhSZkE2l/oKoVKrG3W1AJpX
+b95RnfivKIETioLGSJWNuGk2X2T1u1w0xePMGRi+dmcsCa/2ci3bMNnkkHzqNtv9
+zqWJPtjcJaGjRn0ttzXdulpdRgNndSddjBhBbFGJc8wQzqnL0aHby8tgXYcAlKiG
+tgcwZGTTrpg27bHyt6sMuANJZmd8hdgQ1MrFzw07EOoLa+I+7VNAsyF32gzTH1vy
+wGXmCLHGOZLOGI3rBHVE55+2IaNCMEAwHwYDVR0jBBgwFoAUsjZ7PCKVgcZLkxE8
+xaWJ8cf5jmowHQYDVR0OBBYEFO4pNMdb7FfaJo8k5NZGlEGO0PnDMA0GCWCGSAFl
+AwQDAgUAAy8AMCwCFB9MMOywXxzgX/OYImNrAJvR2sWLAhRMlioucHg/hFw456Y/
+fgaL4qbZfA==
+-----END CERTIFICATE-----

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e2d1ffe5/python/tests/proton_tests/ssl_db/server-lh.pkcs12
----------------------------------------------------------------------
diff --git a/python/tests/proton_tests/ssl_db/server-lh.pkcs12 b/python/tests/proton_tests/ssl_db/server-lh.pkcs12
new file mode 100644
index 0000000..6d4c34f
Binary files /dev/null and b/python/tests/proton_tests/ssl_db/server-lh.pkcs12 differ

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e2d1ffe5/python/tests/proton_tests/ssl_db/server-private-key-lh.pem
----------------------------------------------------------------------
diff --git a/python/tests/proton_tests/ssl_db/server-private-key-lh.pem b/python/tests/proton_tests/ssl_db/server-private-key-lh.pem
new file mode 100644
index 0000000..44279a6
--- /dev/null
+++ b/python/tests/proton_tests/ssl_db/server-private-key-lh.pem
@@ -0,0 +1,21 @@
+Bag Attributes
+    friendlyName: server-certificate
+    localKeyID: 54 69 6D 65 20 31 35 33 37 39 30 37 39 31 30 32 39 39 
+Key Attributes: <No Attributes>
+-----BEGIN ENCRYPTED PRIVATE KEY-----
+MIICvDBOBgkqhkiG9w0BBQ0wQTApBgkqhkiG9w0BBQwwHAQInDWm8BaYfdQCAggA
+MAwGCCqGSIb3DQIJBQAwFAYIKoZIhvcNAwcECM0p5kC5QUKFBIICaJUTK4ZRiUBt
+g0YgRnrH1HE5f1h0tOHvnCND0wJmOmcwStqVtjIqVa5bkU4ZEEOOwWwO8n682Idd
+xc7c3Tfu86nGOFSNH3PpM5Urp8eb5yg3c+rrxdjbRfWKmFtup5CnmyIUHRwvpwKo
+4iBSyMTLuwB149OA10i7soB2xPH+5ZoutKIEG7HmSKBxAIYnt7awty3uQide+CKw
+PPcm+P4fGeNAKoZ0QLQFuTF8ZDOzWFv6+LJuIIlHNiRwCKGLVglFpysd22PFJ7GX
+nVjJ1wfdXyqixoFGSCa25e2VIwVL3OnMyzAsNKMzAoDc0kzs1wbnAAeGSO8mJsMp
+ea4KHu08YFuhI99FAOHvOh1UGDBdtQ5VLBoLD+K26FCIIb45IYxbpBNXvy8N+tdW
+1YrqlpjGrV0mr7mG7QTSlewowJF9KKj+YKDYjENJTjDf64S3xacNmRUbBrewGD4B
+6YJyyREhj8o/kl5IuLQtLoDx6t6zr80y45LG1zarzEn3ncwAMnOApQiYLO4R/K8Y
+T3jgQmZ2vqArr2dWyYN+fqoouEHr6MRbKiOhruimFC3+zVtKfNI0flHPxX4T74Xr
+gETirpfZandMcqsZb6DDvXmY230IUR17NiruyLX2269LfmyT4Q5nlbURgqBYQ7zI
+niM1EbTSzXVspE3x/HijJuR2nPX3k8VOmY/l87bHi9hOVen3SPt5lOYHnIhQ26jx
+c+/0c7vOONxnYnl9ucB9Kgk5ku+wqPbR/olsiB36Rsf7VjZtQlwibaY2Dtb/zt7C
+VvW+geNsIkbM/qlBh5isl8diuwx75e+tyLsnXRcQ8z8=
+-----END ENCRYPTED PRIVATE KEY-----

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e2d1ffe5/python/tests/proton_tests/ssl_db/server-request-lh.pem
----------------------------------------------------------------------
diff --git a/python/tests/proton_tests/ssl_db/server-request-lh.pem b/python/tests/proton_tests/ssl_db/server-request-lh.pem
new file mode 100644
index 0000000..14072f8
--- /dev/null
+++ b/python/tests/proton_tests/ssl_db/server-request-lh.pem
@@ -0,0 +1,23 @@
+-----BEGIN NEW CERTIFICATE REQUEST-----
+MIID5zCCA5ECAQAwFDESMBAGA1UEAxMJbG9jYWxob3N0MIIDQjCCAjUGByqGSM44
+BAEwggIoAoIBAQCPeTXZuarpv6vtiHrPSVG28y7FnjuvNxjo6sSWHz79NgbnQ1Gp
+xBgzObgJ58KuHFObp0dbhdARrbi0eYd1SYRpXKwOjxSzNggooi/6JxEKPWKpk0U0
+CaD+aWxGWPhL3SCBnDcJoBBXsZWtzQAjPbpUhLYpH51kjviDRIZ3l5zsBLQ0pqwu
+demYXeI9sCkvwRGMn/qdgYHnM423krcw17njSVkvaAmYchU5Feo9a4tGU8YzRY+A
+OzKkwuDycpAlbk4/ijsIOKHEUOThjBopo33fXqFD3ktm/wSQPtXPFiPhWNSHxgjp
+fyEc2B3KI8tuOAdl+CLjQr5ITAV2OTlgHNZnAh0AuvaWpoV499/e5/pnyXfHhe8y
+sjO65YDAvNVpXQKCAQAWplxYIEhQcE51AqOXVwQNNNo6NHjBVNTkpcAtJC7gT5bm
+HkvQkEq9rI837rHgnzGC0jyQQ8tkL4gAQWDt+coJsyB2p5wypifyRz6Rh5uixOdE
+vSCBVEy1W4AsNo0fqD7UielOD6BojjJCilx4xHjGjQUntxyaOrsLC+EsRGiWOefT
+znTbEBplqiuH9kxoJts+xy9LVZmDS7TtsC98kOmkltOlXVNb6/xF1PYZ9j897buH
+OSXC8iTgdzEpbaiH7B5HSPh++1/et1SEMWsiMt7lU92vAhErDR8C2jCXMiT+J67a
+i51LKSLZuovjntnhA6Y8UoELxoi34u1DFuHvF9veA4IBBQACggEAdVroB0ANoeIK
+YkkbTwxY8B1eIHDUX1Xa1tFCzfTBIzeP4K+5a2Km5UqkIDjea9p3MtJgSZMAW9iJ
+1EDLBFH+75JirTtiYmt78vx9gIhSZkE2l/oKoVKrG3W1AJpXb95RnfivKIETioLG
+SJWNuGk2X2T1u1w0xePMGRi+dmcsCa/2ci3bMNnkkHzqNtv9zqWJPtjcJaGjRn0t
+tzXdulpdRgNndSddjBhBbFGJc8wQzqnL0aHby8tgXYcAlKiGtgcwZGTTrpg27bHy
+t6sMuANJZmd8hdgQ1MrFzw07EOoLa+I+7VNAsyF32gzTH1vywGXmCLHGOZLOGI3r
+BHVE55+2IaAwMC4GCSqGSIb3DQEJDjEhMB8wHQYDVR0OBBYEFO4pNMdb7FfaJo8k
+5NZGlEGO0PnDMA0GCWCGSAFlAwQDAgUAA0EAMD4CHQCdi9BZ+4bJSteebZbHHIdV
+rsazxRXT3Jdq+JCZAh0AmqErYresnNvzucEWlQ2WcSHUvMc66e2DfIWplg==
+-----END NEW CERTIFICATE REQUEST-----


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


[26/50] qpid-proton git commit: NO-JIRA: [ruby] replace #sum with #reduce for ruby < 2.4

Posted by ac...@apache.org.
NO-JIRA: [ruby] replace #sum with #reduce for ruby < 2.4


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

Branch: refs/heads/go1
Commit: 5595c41c5972b35fc07c7b73d1aecd0bc402c741
Parents: 5cd006f
Author: Alan Conway <ac...@redhat.com>
Authored: Wed Sep 19 13:19:30 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Wed Sep 19 13:19:30 2018 -0400

----------------------------------------------------------------------
 ruby/tests/test_container.rb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5595c41c/ruby/tests/test_container.rb
----------------------------------------------------------------------
diff --git a/ruby/tests/test_container.rb b/ruby/tests/test_container.rb
index ae4e5d2..13e1fd5 100644
--- a/ruby/tests/test_container.rb
+++ b/ruby/tests/test_container.rb
@@ -351,7 +351,7 @@ class ContainerTest < MiniTest::Test
       x = a.shift
       assert_equal d, x[0]
     end
-    assert_equalish delays.sum, Time.now-start
+    assert_equalish delays.reduce(:+), Time.now-start
   end
 
   # Test container work queue finishes due tasks on external stop, drops future tasks
@@ -389,7 +389,7 @@ class ContainerTest < MiniTest::Test
     start = Time.now
     c.run
     assert_equal 3, a.size
-    assert_equalish delays.sum, Time.now-start
+    assert_equalish delays.reduce(:+), Time.now-start
   end
 
   # Schedule calls from handlers


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


[07/50] qpid-proton git commit: PROTON-1798: [cpp] add library destructors for main classes

Posted by ac...@apache.org.
PROTON-1798: [cpp] add library destructors for main classes

Add library destructors to anchor vtables and typeinfo for connection, session,
sender, recever and delivery.

Without them, the ubsan sanitizer reports mismatched types due to different
weak vtable symbols in scope at library and executable link time.


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

Branch: refs/heads/go1
Commit: 7885bd3b558dcf801e92ea866090d1110cc36aa1
Parents: e5aac00
Author: Alan Conway <ac...@redhat.com>
Authored: Wed Sep 5 14:12:20 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Fri Sep 7 11:26:25 2018 -0400

----------------------------------------------------------------------
 cpp/include/proton/connection.hpp | 2 ++
 cpp/include/proton/delivery.hpp   | 2 ++
 cpp/include/proton/receiver.hpp   | 2 ++
 cpp/include/proton/sender.hpp     | 2 ++
 cpp/include/proton/session.hpp    | 2 ++
 cpp/src/connection.cpp            | 2 ++
 cpp/src/delivery.cpp              | 1 +
 cpp/src/receiver.cpp              | 2 ++
 cpp/src/sender.cpp                | 2 ++
 cpp/src/session.cpp               | 2 ++
 10 files changed, 19 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/7885bd3b/cpp/include/proton/connection.hpp
----------------------------------------------------------------------
diff --git a/cpp/include/proton/connection.hpp b/cpp/include/proton/connection.hpp
index 77bf96d..de9c904 100644
--- a/cpp/include/proton/connection.hpp
+++ b/cpp/include/proton/connection.hpp
@@ -51,6 +51,8 @@ PN_CPP_CLASS_EXTERN connection : public internal::object<pn_connection_t>, publi
     /// Create an empty connection.
     connection() : internal::object<pn_connection_t>(0) {}
 
+    PN_CPP_EXTERN ~connection();
+
     PN_CPP_EXTERN bool uninitialized() const;
     PN_CPP_EXTERN bool active() const;
     PN_CPP_EXTERN bool closed() const;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/7885bd3b/cpp/include/proton/delivery.hpp
----------------------------------------------------------------------
diff --git a/cpp/include/proton/delivery.hpp b/cpp/include/proton/delivery.hpp
index 61a2fbe..c1823d9 100644
--- a/cpp/include/proton/delivery.hpp
+++ b/cpp/include/proton/delivery.hpp
@@ -44,6 +44,8 @@ class delivery : public transfer {
   public:
     delivery() {}
 
+    PN_CPP_EXTERN ~delivery();
+
     /// Return the receiver for this delivery.
     PN_CPP_EXTERN class receiver receiver() const;
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/7885bd3b/cpp/include/proton/receiver.hpp
----------------------------------------------------------------------
diff --git a/cpp/include/proton/receiver.hpp b/cpp/include/proton/receiver.hpp
index 6c8137d..7f78401 100644
--- a/cpp/include/proton/receiver.hpp
+++ b/cpp/include/proton/receiver.hpp
@@ -47,6 +47,8 @@ PN_CPP_CLASS_EXTERN receiver : public link {
     /// Create an empty receiver.
     receiver() {}
 
+    PN_CPP_EXTERN ~receiver();
+
     /// Open the receiver.
     ///
     /// @see endpoint_lifecycle

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/7885bd3b/cpp/include/proton/sender.hpp
----------------------------------------------------------------------
diff --git a/cpp/include/proton/sender.hpp b/cpp/include/proton/sender.hpp
index 840032c..5f7c7b5 100644
--- a/cpp/include/proton/sender.hpp
+++ b/cpp/include/proton/sender.hpp
@@ -46,6 +46,8 @@ PN_CPP_CLASS_EXTERN sender : public link {
     /// Create an empty sender.
     sender() {}
 
+    PN_CPP_EXTERN ~sender();
+
     /// Open the sender.
     ///
     /// @see endpoint_lifecycle

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/7885bd3b/cpp/include/proton/session.hpp
----------------------------------------------------------------------
diff --git a/cpp/include/proton/session.hpp b/cpp/include/proton/session.hpp
index 78a1fd4..7f289f5 100644
--- a/cpp/include/proton/session.hpp
+++ b/cpp/include/proton/session.hpp
@@ -49,6 +49,8 @@ PN_CPP_CLASS_EXTERN session : public internal::object<pn_session_t>, public endp
     /// Create an empty session.
     session() : internal::object<pn_session_t>(0) {}
 
+    PN_CPP_EXTERN ~session();
+
     PN_CPP_EXTERN bool uninitialized() const;
     PN_CPP_EXTERN bool active() const;
     PN_CPP_EXTERN bool closed() const;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/7885bd3b/cpp/src/connection.cpp
----------------------------------------------------------------------
diff --git a/cpp/src/connection.cpp b/cpp/src/connection.cpp
index b2dadae..223bb0c 100644
--- a/cpp/src/connection.cpp
+++ b/cpp/src/connection.cpp
@@ -45,6 +45,8 @@
 
 namespace proton {
 
+connection::~connection() {}
+
 transport connection::transport() const {
     return make_wrapper(pn_connection_transport(pn_object()));
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/7885bd3b/cpp/src/delivery.cpp
----------------------------------------------------------------------
diff --git a/cpp/src/delivery.cpp b/cpp/src/delivery.cpp
index 0562304..7baa475 100644
--- a/cpp/src/delivery.cpp
+++ b/cpp/src/delivery.cpp
@@ -40,6 +40,7 @@ namespace proton {
 
 delivery::delivery(pn_delivery_t* d): transfer(make_wrapper(d)) {}
 receiver delivery::receiver() const { return make_wrapper<class receiver>(pn_delivery_link(pn_object())); }
+delivery::~delivery() {}
 void delivery::accept() { settle_delivery(pn_object(), ACCEPTED); }
 void delivery::reject() { settle_delivery(pn_object(), REJECTED); }
 void delivery::release() { settle_delivery(pn_object(), RELEASED); }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/7885bd3b/cpp/src/receiver.cpp
----------------------------------------------------------------------
diff --git a/cpp/src/receiver.cpp b/cpp/src/receiver.cpp
index b7239a5..4d24c6f 100644
--- a/cpp/src/receiver.cpp
+++ b/cpp/src/receiver.cpp
@@ -39,6 +39,8 @@ namespace proton {
 
 receiver::receiver(pn_link_t* r): link(make_wrapper(r)) {}
 
+receiver::~receiver() {}
+
 void receiver::open() {
     attach();
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/7885bd3b/cpp/src/sender.cpp
----------------------------------------------------------------------
diff --git a/cpp/src/sender.cpp b/cpp/src/sender.cpp
index 70e9fa6..003adf8 100644
--- a/cpp/src/sender.cpp
+++ b/cpp/src/sender.cpp
@@ -40,6 +40,8 @@ namespace proton {
 
 sender::sender(pn_link_t *l): link(make_wrapper(l)) {}
 
+sender::~sender() {}
+
 void sender::open() {
     attach();
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/7885bd3b/cpp/src/session.cpp
----------------------------------------------------------------------
diff --git a/cpp/src/session.cpp b/cpp/src/session.cpp
index a64e0ad..fb2e6b3 100644
--- a/cpp/src/session.cpp
+++ b/cpp/src/session.cpp
@@ -36,6 +36,8 @@
 
 namespace proton {
 
+session::~session() {}
+
 void session::open() {
     pn_session_open(pn_object());
 }


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