You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kg...@apache.org on 2012/12/10 20:38:30 UTC

svn commit: r1419698 - in /qpid/proton/branches/kgiusti-proton-136: ./ proton-c/bindings/python/ proton-c/include/proton/ proton-c/src/codec/ proton-c/src/engine/ proton-j/proton/src/main/scripts/ tests/proton_tests/

Author: kgiusti
Date: Mon Dec 10 19:38:29 2012
New Revision: 1419698

URL: http://svn.apache.org/viewvc?rev=1419698&view=rev
Log:
PROTON-136: resync to trunk

Modified:
    qpid/proton/branches/kgiusti-proton-136/   (props changed)
    qpid/proton/branches/kgiusti-proton-136/proton-c/bindings/python/proton.py
    qpid/proton/branches/kgiusti-proton-136/proton-c/include/proton/engine.h
    qpid/proton/branches/kgiusti-proton-136/proton-c/src/codec/codec.c
    qpid/proton/branches/kgiusti-proton-136/proton-c/src/engine/engine-internal.h
    qpid/proton/branches/kgiusti-proton-136/proton-c/src/engine/engine.c
    qpid/proton/branches/kgiusti-proton-136/proton-j/proton/src/main/scripts/proton.py
    qpid/proton/branches/kgiusti-proton-136/tests/proton_tests/engine.py

Propchange: qpid/proton/branches/kgiusti-proton-136/
------------------------------------------------------------------------------
  Merged /qpid/proton/trunk:r1418449-1419687

Modified: qpid/proton/branches/kgiusti-proton-136/proton-c/bindings/python/proton.py
URL: http://svn.apache.org/viewvc/qpid/proton/branches/kgiusti-proton-136/proton-c/bindings/python/proton.py?rev=1419698&r1=1419697&r2=1419698&view=diff
==============================================================================
--- qpid/proton/branches/kgiusti-proton-136/proton-c/bindings/python/proton.py (original)
+++ qpid/proton/branches/kgiusti-proton-136/proton-c/bindings/python/proton.py Mon Dec 10 19:38:29 2012
@@ -1708,6 +1708,27 @@ class Endpoint(object):
   LOCAL_CLOSED = PN_LOCAL_CLOSED
   REMOTE_CLOSED  = PN_REMOTE_CLOSED
 
+  def __init__(self):
+    self.condition = None
+
+class Condition:
+
+  def __init__(self, name, description=None, info=None):
+    self.name = name
+    self.description = description
+    self.info = info
+
+  def __repr__(self):
+    return "Condition(%s)" % ", ".join([repr(x) for x in
+                                        (self.name, self.description, self.info)
+                                        if x])
+
+  def __eq__(self, o):
+    if not isinstance(o, Condition): return False
+    return self.name == o.name and \
+        self.description == o.description and \
+        self.info == o.info
+
 def wrap_connection(conn):
   if not conn: return None
   ctx = pn_connection_get_context(conn)
@@ -1718,6 +1739,7 @@ def wrap_connection(conn):
 class Connection(Endpoint):
 
   def __init__(self, _conn=None):
+    Endpoint.__init__(self)
     if _conn:
       self._conn = _conn
     else:
@@ -1736,6 +1758,19 @@ class Connection(Endpoint):
     else:
       return err
 
+  @property
+  def remote_condition(self):
+    impl = pn_connection_remote_condition(self._conn)
+    if pn_condition_is_set(impl):
+      info_impl = Data(pn_condition_info(impl))
+      info_impl.rewind()
+      info_impl.next()
+      info = info_impl.get_object()
+      info_impl.rewind()
+      return Condition(pn_condition_get_name(impl),
+                       pn_condition_get_description(impl),
+                       info)
+
   def _get_container(self):
     return pn_connection_get_container(self._conn)
   def _set_container(self, name):
@@ -1778,6 +1813,14 @@ class Connection(Endpoint):
     pn_connection_open(self._conn)
 
   def close(self):
+    if self.condition:
+      impl = pn_connection_condition(self._conn)
+      pn_condition_clear(impl)
+      pn_condition_set_name(impl, self.condition.name)
+      pn_condition_set_description(impl, self.condition.description)
+      info = Data(pn_condition_info(impl))
+      if self.condition.info:
+        info.put_object(self.condition.info)
     pn_connection_close(self._conn)
 
   @property
@@ -1817,6 +1860,7 @@ def wrap_session(ssn):
 class Session(Endpoint):
 
   def __init__(self, ssn):
+    Endpoint.__init__(self)
     self._ssn = ssn
 
   def __del__(self):
@@ -1863,6 +1907,7 @@ def wrap_link(link):
 class Link(Endpoint):
 
   def __init__(self, link):
+    Endpoint.__init__(self)
     self._link = link
 
   def __del__(self):
@@ -1887,7 +1932,7 @@ class Link(Endpoint):
   def state(self):
     return pn_link_state(self._link)
 
-  @property 
+  @property
   def source(self):
     return Terminus(pn_link_source(self._link))
 
@@ -2335,9 +2380,9 @@ class SSL(object):
 
 
 __all__ = ["Messenger", "Message", "ProtonException", "MessengerException",
-           "MessageException", "Timeout", "Data", "Endpoint", "Connection",
-           "Session", "Link", "Terminus", "Sender", "Receiver", "Delivery",
-           "Transport", "TransportException", "SASL", "UNDESCRIBED", "SSL",
-           "SSLDomain", "Described", "Array", "symbol", "char",
-           "timestamp", "ulong", "SSLUnavailable", "PN_SESSION_WINDOW",
+           "MessageException", "Timeout", "Condition", "Data", "Endpoint",
+           "Connection", "Session", "Link", "Terminus", "Sender", "Receiver",
+           "Delivery", "Transport", "TransportException", "SASL", "SSL",
+           "SSLDomain", "Described", "Array", "symbol", "char", "timestamp",
+           "ulong", "UNDESCRIBED", "SSLUnavailable", "PN_SESSION_WINDOW",
            "AUTOMATIC", "MANUAL", "PENDING", "ACCEPTED", "REJECTED"]

Modified: qpid/proton/branches/kgiusti-proton-136/proton-c/include/proton/engine.h
URL: http://svn.apache.org/viewvc/qpid/proton/branches/kgiusti-proton-136/proton-c/include/proton/engine.h?rev=1419698&r1=1419697&r2=1419698&view=diff
==============================================================================
--- qpid/proton/branches/kgiusti-proton-136/proton-c/include/proton/engine.h (original)
+++ qpid/proton/branches/kgiusti-proton-136/proton-c/include/proton/engine.h Mon Dec 10 19:38:29 2012
@@ -43,6 +43,8 @@ typedef struct pn_connection_t pn_connec
 typedef struct pn_session_t pn_session_t;       /**< Session */
 typedef struct pn_link_t pn_link_t;             /**< Link */
 typedef struct pn_terminus_t pn_terminus_t;
+typedef struct pn_condition_t pn_condition_t;
+
 typedef enum {
   PN_UNSPECIFIED = 0,
   PN_SOURCE = 1,
@@ -189,6 +191,8 @@ pn_transport_t *pn_transport(void);
 
 int pn_transport_bind(pn_transport_t *transport, pn_connection_t *connection);
 
+int pn_transport_unbind(pn_transport_t *transport);
+
 /** Retrieve the first Session that matches the given state mask.
  *
  * Examines the state of each session owned by the connection, and
@@ -249,6 +253,7 @@ pn_link_t *pn_link_head(pn_connection_t 
  */
 pn_link_t *pn_link_next(pn_link_t *link, pn_state_t state);
 
+void pn_connection_reset(pn_connection_t *connection);
 void pn_connection_open(pn_connection_t *connection);
 void pn_connection_close(pn_connection_t *connection);
 void pn_connection_free(pn_connection_t *connection);
@@ -394,6 +399,22 @@ void pn_delivery_dump(pn_delivery_t *del
 void *pn_delivery_get_context(pn_delivery_t *delivery);
 void pn_delivery_set_context(pn_delivery_t *delivery, void *context);
 
+pn_condition_t *pn_connection_condition(pn_connection_t *connection);
+pn_condition_t *pn_connection_remote_condition(pn_connection_t *connection);
+
+bool pn_condition_is_set(pn_condition_t *condition);
+void pn_condition_clear(pn_condition_t *condition);
+
+const char *pn_condition_get_name(pn_condition_t *condition);
+int pn_condition_set_name(pn_condition_t *condition, const char *name);
+
+const char *pn_condition_get_description(pn_condition_t *condition);
+int pn_condition_set_description(pn_condition_t *condition, const char *description);
+
+pn_data_t *pn_condition_info(pn_condition_t *condition);
+
+bool pn_condition_is_redirect(pn_condition_t *condition);
+
 #ifdef __cplusplus
 }
 #endif

Modified: qpid/proton/branches/kgiusti-proton-136/proton-c/src/codec/codec.c
URL: http://svn.apache.org/viewvc/qpid/proton/branches/kgiusti-proton-136/proton-c/src/codec/codec.c?rev=1419698&r1=1419697&r2=1419698&view=diff
==============================================================================
--- qpid/proton/branches/kgiusti-proton-136/proton-c/src/codec/codec.c (original)
+++ qpid/proton/branches/kgiusti-proton-136/proton-c/src/codec/codec.c Mon Dec 10 19:38:29 2012
@@ -1058,7 +1058,9 @@ ssize_t pn_data_intern(pn_data_t *data, 
   size_t offset = pn_buffer_size(data->buf);
   int err = pn_buffer_append(data->buf, start, size);
   if (err) return err;
-  else return offset;
+  err = pn_buffer_append(data->buf, "\0", 1);
+  if (err) return err;
+  return offset;
 }
 
 pn_bytes_t *pn_data_bytes(pn_data_t *data, pn_node_t *node)

Modified: qpid/proton/branches/kgiusti-proton-136/proton-c/src/engine/engine-internal.h
URL: http://svn.apache.org/viewvc/qpid/proton/branches/kgiusti-proton-136/proton-c/src/engine/engine-internal.h?rev=1419698&r1=1419697&r2=1419698&view=diff
==============================================================================
--- qpid/proton/branches/kgiusti-proton-136/proton-c/src/engine/engine-internal.h (original)
+++ qpid/proton/branches/kgiusti-proton-136/proton-c/src/engine/engine-internal.h Mon Dec 10 19:38:29 2012
@@ -32,10 +32,20 @@ typedef enum pn_endpoint_type_t {CONNECT
 
 typedef struct pn_endpoint_t pn_endpoint_t;
 
+#define COND_NAME_MAX (256)
+#define COND_DESC_MAX (1024)
+
+struct pn_condition_t {
+  char name[COND_NAME_MAX];
+  char description[COND_DESC_MAX];
+  pn_data_t *info;
+};
+
 struct pn_endpoint_t {
   pn_endpoint_type_t type;
   pn_state_t state;
   pn_error_t *error;
+  pn_condition_t condition;
   pn_endpoint_t *endpoint_next;
   pn_endpoint_t *endpoint_prev;
   pn_endpoint_t *transport_next;
@@ -115,6 +125,7 @@ struct pn_transport_t {
   pn_data_t *remote_desired_capabilities;
   uint32_t   local_max_frame;
   uint32_t   remote_max_frame;
+  pn_condition_t remote_condition;
 
   /* dead remote detection */
   pn_millis_t local_idle_timeout;
@@ -131,7 +142,6 @@ struct pn_transport_t {
   size_t session_capacity;
   pn_session_state_t **channels;
   size_t channel_capacity;
-  const char *condition;
   char scratch[SCRATCH];
 
   /* statistics */

Modified: qpid/proton/branches/kgiusti-proton-136/proton-c/src/engine/engine.c
URL: http://svn.apache.org/viewvc/qpid/proton/branches/kgiusti-proton-136/proton-c/src/engine/engine.c?rev=1419698&r1=1419697&r2=1419698&view=diff
==============================================================================
--- qpid/proton/branches/kgiusti-proton-136/proton-c/src/engine/engine.c (original)
+++ qpid/proton/branches/kgiusti-proton-136/proton-c/src/engine/engine.c Mon Dec 10 19:38:29 2012
@@ -26,6 +26,7 @@
 #include "protocol.h"
 #include <inttypes.h>
 
+#include <assert.h>
 #include <stdarg.h>
 #include <stdio.h>
 
@@ -180,6 +181,13 @@ void pn_free(pn_endpoint_t *endpoint)
   }
 }
 
+void pn_connection_reset(pn_connection_t *connection)
+{
+  assert(connection);
+  pn_endpoint_t *endpoint = &connection->endpoint;
+  endpoint->state = PN_LOCAL_UNINIT | PN_REMOTE_UNINIT;
+}
+
 void pn_connection_open(pn_connection_t *connection)
 {
   if (connection) pn_open((pn_endpoint_t *) connection);
@@ -228,6 +236,18 @@ void pn_transport_close(pn_transport_t *
   pn_close((pn_endpoint_t *) transport);
 }
 
+void pn_condition_init(pn_condition_t *condition)
+{
+  condition->name[0] = '\0';
+  condition->description[0] = '\0';
+  condition->info = pn_data(16);
+}
+
+void pn_condition_tini(pn_condition_t *condition)
+{
+  pn_data_free(condition->info);
+}
+
 void pn_transport_free(pn_transport_t *transport)
 {
   if (!transport) return;
@@ -246,6 +266,7 @@ void pn_transport_free(pn_transport_t *t
   pn_data_free(transport->remote_offered_capabilities);
   pn_data_free(transport->remote_desired_capabilities);
   pn_error_free(transport->error);
+  pn_condition_tini(&transport->remote_condition);
   free(transport->sessions);
   free(transport->channels);
   free(transport);
@@ -403,6 +424,7 @@ void pn_endpoint_init(pn_endpoint_t *end
   endpoint->type = type;
   endpoint->state = PN_LOCAL_UNINIT | PN_REMOTE_UNINIT;
   endpoint->error = pn_error();
+  pn_condition_init(&endpoint->condition);
   endpoint->endpoint_next = NULL;
   endpoint->endpoint_prev = NULL;
   endpoint->transport_next = NULL;
@@ -415,6 +437,7 @@ void pn_endpoint_init(pn_endpoint_t *end
 void pn_endpoint_tini(pn_endpoint_t *endpoint)
 {
   pn_error_free(endpoint->error);
+  pn_condition_tini(&endpoint->condition);
 }
 
 pn_connection_t *pn_connection()
@@ -774,6 +797,7 @@ void pn_transport_init(pn_transport_t *t
   transport->remote_offered_capabilities = pn_data(16);
   transport->remote_desired_capabilities = pn_data(16);
   transport->error = pn_error();
+  pn_condition_init(&transport->remote_condition);
 
   transport->sessions = NULL;
   transport->session_capacity = 0;
@@ -781,8 +805,6 @@ void pn_transport_init(pn_transport_t *t
   transport->channels = NULL;
   transport->channel_capacity = 0;
 
-  transport->condition = NULL;
-
   transport->bytes_input = 0;
   transport->bytes_output = 0;
 }
@@ -849,6 +871,41 @@ int pn_transport_bind(pn_transport_t *tr
   return 0;
 }
 
+int pn_transport_unbind(pn_transport_t *transport)
+{
+  assert(transport);
+  if (!transport->connection) return 0;
+
+  pn_connection_t *conn = transport->connection;
+  transport->connection = NULL;
+  conn->transport = NULL;
+
+  pn_link_t *link = pn_link_head(conn, 0);
+  while (link) {
+    pn_delivery_t *dlv = link->unsettled_head;
+    while (dlv) {
+      dlv->transport_context = NULL;
+      dlv = dlv->unsettled_next;
+    }
+
+    dlv = link->settled_head;
+    while (dlv) {
+      dlv->transport_context = NULL;
+      dlv = dlv->settled_next;
+    }
+
+    link = pn_link_next(link, 0);
+  }
+
+  pn_endpoint_t *endpoint = conn->endpoint_head;
+  while (endpoint) {
+    pn_modified(conn, endpoint);
+    endpoint = endpoint->endpoint_next;
+  }
+
+  return 0;
+}
+
 pn_error_t *pn_transport_error(pn_transport_t *transport)
 {
   return transport->error;
@@ -1309,16 +1366,24 @@ void pn_delivery_settle(pn_delivery_t *d
   pn_work_update(delivery->link->session->connection, delivery);
 }
 
-int pn_post_close(pn_transport_t *transport)
+int pn_post_close(pn_transport_t *transport, const char *condition)
 {
-  const char *condition = transport->condition;
-  return pn_post_frame(transport->disp, 0, "DL[?DL[s]]", CLOSE, (bool) condition, ERROR, condition);
+  pn_condition_t *cond = pn_connection_condition(transport->connection);
+  const char *description = NULL;
+  pn_data_t *info = NULL;
+  if (!condition && pn_condition_is_set(cond)) {
+    condition = pn_condition_get_name(cond);
+    description = pn_condition_get_description(cond);
+    info = pn_condition_info(cond);
+  }
+
+  return pn_post_frame(transport->disp, 0, "DL[?DL[sSC]]", CLOSE,
+                       (bool) condition, ERROR, condition, description, info);
 }
 
 int pn_do_error(pn_transport_t *transport, const char *condition, const char *fmt, ...)
 {
   va_list ap;
-  transport->condition = condition;
   va_start(ap, fmt);
   char buf[1024];
   // XXX: result
@@ -1326,7 +1391,7 @@ int pn_do_error(pn_transport_t *transpor
   va_end(ap);
   pn_error_set(transport->error, PN_ERR, buf);
   if (!transport->close_sent) {
-    pn_post_close(transport);
+    pn_post_close(transport, condition);
     transport->close_sent = true;
   }
   transport->disp->halt = true;
@@ -1732,11 +1797,27 @@ int pn_do_end(pn_dispatcher_t *disp)
   return 0;
 }
 
+static int pn_scan_error(pn_dispatcher_t *disp, pn_condition_t *condition)
+{
+  pn_bytes_t cond;
+  pn_bytes_t desc;
+  pn_condition_clear(condition);
+  int err = pn_scan_args(disp, "D.[D.[sSC]", &cond, &desc, condition->info);
+  if (err) return err;
+  strncat(condition->name, cond.start, cond.size);
+  strncat(condition->description, desc.start, desc.size);
+  pn_data_rewind(condition->info);
+  return 0;
+}
+
 int pn_do_close(pn_dispatcher_t *disp)
 {
   pn_transport_t *transport = (pn_transport_t *) disp->context;
+  pn_connection_t *conn = transport->connection;
+  int err = pn_scan_error(disp, &transport->remote_condition);
+  if (err) return err;
   transport->close_rcvd = true;
-  PN_SET_REMOTE(transport->connection->endpoint.state, PN_REMOTE_CLOSED);
+  PN_SET_REMOTE(conn->endpoint.state, PN_REMOTE_CLOSED);
   return 0;
 }
 
@@ -2295,8 +2376,8 @@ int pn_process_link_teardown(pn_transpor
 
 bool pn_pointful_buffering(pn_transport_t *transport, pn_session_t *session)
 {
-  if (!transport->open_rcvd) return true;
   if (transport->close_rcvd) return false;
+  if (!transport->open_rcvd) return true;
 
   pn_connection_t *conn = transport->connection;
   pn_link_t *link = pn_link_head(conn, 0);
@@ -2345,7 +2426,7 @@ int pn_process_conn_teardown(pn_transpor
   {
     if (endpoint->state & PN_LOCAL_CLOSED && !transport->close_sent) {
       if (pn_pointful_buffering(transport, NULL)) return 0;
-      int err = pn_post_close(transport);
+      int err = pn_post_close(transport, NULL);
       if (err) return err;
       transport->close_sent = true;
     }
@@ -2681,3 +2762,79 @@ bool pn_delivery_partial(pn_delivery_t *
 {
   return !delivery->done;
 }
+
+pn_condition_t *pn_connection_condition(pn_connection_t *connection)
+{
+  return &connection->endpoint.condition;
+}
+
+pn_condition_t *pn_connection_remote_condition(pn_connection_t *connection)
+{
+  pn_transport_t *transport = connection->transport;
+  return transport ? &transport->remote_condition : NULL;
+}
+
+bool pn_condition_is_set(pn_condition_t *condition)
+{
+  return condition && condition->name[0];
+}
+
+void pn_condition_clear(pn_condition_t *condition)
+{
+  assert(condition);
+  condition->name[0] = '\0';
+  condition->description[0] = '\0';
+  pn_data_clear(condition->info);
+}
+
+const char *pn_condition_get_name(pn_condition_t *condition)
+{
+  assert(condition);
+  return condition->name[0] ? condition->name : NULL;
+}
+
+static inline int pn_set_buf(char *dst, const char *src, size_t capacity)
+{
+  if (!src) {
+    dst[0] = '\0';
+    return 0;
+  } else {
+    int n = strlen(src) + 1;
+    if (n > capacity) {
+      return PN_ARG_ERR;
+    } else {
+      strncpy(dst, src, n);
+      return 0;
+    }
+  }
+}
+
+int pn_condition_set_name(pn_condition_t *condition, const char *name)
+{
+  assert(condition);
+  return pn_set_buf(condition->name, name, COND_NAME_MAX);
+}
+
+const char *pn_condition_get_description(pn_condition_t *condition)
+{
+  assert(condition);
+  return condition->description[0] ? condition->description : NULL;
+}
+
+int pn_condition_set_description(pn_condition_t *condition, const char *description)
+{
+  assert(condition);
+  return pn_set_buf(condition->description, description, COND_DESC_MAX);
+}
+
+pn_data_t *pn_condition_info(pn_condition_t *condition)
+{
+  assert(condition);
+  return condition->info;
+}
+
+bool pn_condition_is_redirect(pn_condition_t *condition)
+{
+  const char *name = pn_condition_get_name(condition);
+  return name && !strcmp(name, "amqp:connection:redirect");
+}

Modified: qpid/proton/branches/kgiusti-proton-136/proton-j/proton/src/main/scripts/proton.py
URL: http://svn.apache.org/viewvc/qpid/proton/branches/kgiusti-proton-136/proton-j/proton/src/main/scripts/proton.py?rev=1419698&r1=1419697&r2=1419698&view=diff
==============================================================================
--- qpid/proton/branches/kgiusti-proton-136/proton-j/proton/src/main/scripts/proton.py (original)
+++ qpid/proton/branches/kgiusti-proton-136/proton-j/proton/src/main/scripts/proton.py Mon Dec 10 19:38:29 2012
@@ -41,6 +41,13 @@ class Endpoint(object):
   REMOTE_ACTIVE = 16
   REMOTE_CLOSED = 32
 
+  def __init__(self):
+    self.condition = None
+
+  @property
+  def remote_condition(self):
+    raise Skipped()
+
   @property
   def state(self):
     local = self.impl.getLocalState()
@@ -90,6 +97,24 @@ class Endpoint(object):
   def close(self):
     self.impl.close()
 
+class Condition:
+
+  def __init__(self, name, description=None, info=None):
+    self.name = name
+    self.description = description
+    self.info = info
+
+  def __repr__(self):
+    return "Condition(%s)" % ", ".join([repr(x) for x in
+                                        (self.name, self.description, self.info)
+                                        if x])
+
+  def __eq__(self, o):
+    if not isinstance(o, Condition): return False
+    return self.name == o.name and \
+        self.description == o.description and \
+        self.info == o.info
+
 def wrap_connection(impl):
   if impl: return Connection(_impl = impl)
 
@@ -443,6 +468,11 @@ The idle timeout of the connection (in m
     #return pn_transport_get_frames_input(self._trans)
     raise Skipped()
 
+class symbol(unicode):
+
+  def __repr__(self):
+    return "symbol(%s)" % unicode.__repr__(self)
+
 class Data(object):
 
   SYMBOL = None
@@ -709,7 +739,7 @@ class SSL(object):
      self._ssl.allowUnsecuredClient(True)
 
 __all__ = ["Messenger", "Message", "ProtonException", "MessengerException",
-           "MessageException", "Timeout", "Data", "Endpoint", "Connection",
-           "Session", "Link", "Terminus", "Sender", "Receiver", "Delivery",
-           "Transport", "TransportException", "SASL", "SSL", "SSLException",
-           "SSLUnavailable", "PN_SESSION_WINDOW"]
+           "MessageException", "Timeout", "Condition", "Data", "Endpoint",
+           "Connection", "Session", "Link", "Terminus", "Sender", "Receiver",
+           "Delivery", "Transport", "TransportException", "SASL", "SSL",
+           "SSLException", "SSLUnavailable", "PN_SESSION_WINDOW", "symbol"]

Modified: qpid/proton/branches/kgiusti-proton-136/tests/proton_tests/engine.py
URL: http://svn.apache.org/viewvc/qpid/proton/branches/kgiusti-proton-136/tests/proton_tests/engine.py?rev=1419698&r1=1419697&r2=1419698&view=diff
==============================================================================
--- qpid/proton/branches/kgiusti-proton-136/tests/proton_tests/engine.py (original)
+++ qpid/proton/branches/kgiusti-proton-136/tests/proton_tests/engine.py Mon Dec 10 19:38:29 2012
@@ -183,6 +183,25 @@ class ConnectionTest(Test):
     assert self.c2.remote_offered_capabilities.format() == self.c1.offered_capabilities.format()
     assert self.c2.remote_desired_capabilities.format() == self.c1.desired_capabilities.format()
 
+  def test_condition(self):
+    self.c1.open()
+    self.c2.open()
+    self.pump()
+    assert self.c1.state == Endpoint.LOCAL_ACTIVE | Endpoint.REMOTE_ACTIVE
+    assert self.c2.state == Endpoint.LOCAL_ACTIVE | Endpoint.REMOTE_ACTIVE
+
+    cond = Condition("blah:bleh", "this is a description", {symbol("foo"): "bar"})
+    self.c1.condition = cond
+    self.c1.close()
+
+    self.pump()
+
+    assert self.c1.state == Endpoint.LOCAL_CLOSED | Endpoint.REMOTE_ACTIVE
+    assert self.c2.state == Endpoint.LOCAL_ACTIVE | Endpoint.REMOTE_CLOSED
+
+    rcond = self.c2.remote_condition
+    assert rcond == cond
+
 class SessionTest(Test):
 
   def setup(self):



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