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

svn commit: r1536961 - in /qpid/dispatch/trunk: include/qpid/dispatch/compose.h src/agent.c src/compose.c src/container.c tests/system_tests_one_router.py

Author: tross
Date: Wed Oct 30 03:59:38 2013
New Revision: 1536961

URL: http://svn.apache.org/r1536961
Log:
QPID-5238
  - Switched the DISCOVER-TYPES to return an empty list of superclasses instead of null.
  - Added a facility in the field-composer to create efficient empty lists.
  - Added a test for the management agent.
  - Changed the system tests to all run against the same execution of the router (much faster).
  - Added a system test to verify the back-flow of dispositions into closed connections.
  - Fixed the stability bug that was exposed by the above test.

Modified:
    qpid/dispatch/trunk/include/qpid/dispatch/compose.h
    qpid/dispatch/trunk/src/agent.c
    qpid/dispatch/trunk/src/compose.c
    qpid/dispatch/trunk/src/container.c
    qpid/dispatch/trunk/tests/system_tests_one_router.py

Modified: qpid/dispatch/trunk/include/qpid/dispatch/compose.h
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/include/qpid/dispatch/compose.h?rev=1536961&r1=1536960&r2=1536961&view=diff
==============================================================================
--- qpid/dispatch/trunk/include/qpid/dispatch/compose.h (original)
+++ qpid/dispatch/trunk/include/qpid/dispatch/compose.h Wed Oct 30 03:59:38 2013
@@ -59,6 +59,13 @@ void dx_compose_start_list(dx_composed_f
 void dx_compose_end_list(dx_composed_field_t *field);
 
 /**
+ * Insert an empty list into the field.
+ *
+ * @param field A field created by dx_compose.
+ */
+void dx_compose_empty_list(dx_composed_field_t *field);
+
+/**
  * Begin to compose the elements os a map in the field.  This is called before
  * inserting the first element-pair into the map.
  *

Modified: qpid/dispatch/trunk/src/agent.c
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/src/agent.c?rev=1536961&r1=1536960&r2=1536961&view=diff
==============================================================================
--- qpid/dispatch/trunk/src/agent.c (original)
+++ qpid/dispatch/trunk/src/agent.c Wed Oct 30 03:59:38 2013
@@ -176,7 +176,7 @@ static void dx_agent_process_discover_ty
     dx_agent_class_t *cls = DEQ_HEAD(agent->class_list);
     while (cls) {
         dx_compose_insert_string(field, (const char*) dx_hash_key_by_handle(cls->hash_handle));
-        dx_compose_insert_null(field); // TODO - https://tools.oasis-open.org/issues/browse/AMQP-87
+        dx_compose_empty_list(field);
         cls = DEQ_NEXT(cls);
     }
     sys_mutex_unlock(agent->lock);

Modified: qpid/dispatch/trunk/src/compose.c
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/src/compose.c?rev=1536961&r1=1536960&r2=1536961&view=diff
==============================================================================
--- qpid/dispatch/trunk/src/compose.c (original)
+++ qpid/dispatch/trunk/src/compose.c Wed Oct 30 03:59:38 2013
@@ -239,6 +239,13 @@ void dx_compose_end_list(dx_composed_fie
 }
 
 
+void dx_compose_empty_list(dx_composed_field_t *field)
+{
+    dx_insert_8(field, DX_AMQP_LIST0);
+    bump_count(field);
+}
+
+
 void dx_compose_start_map(dx_composed_field_t *field)
 {
     dx_compose_start_composite(field, 1);

Modified: qpid/dispatch/trunk/src/container.c
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/src/container.c?rev=1536961&r1=1536960&r2=1536961&view=diff
==============================================================================
--- qpid/dispatch/trunk/src/container.c (original)
+++ qpid/dispatch/trunk/src/container.c Wed Oct 30 03:59:38 2013
@@ -734,15 +734,15 @@ pn_terminus_t *dx_link_remote_target(dx_
 
 void dx_link_activate(dx_link_t *link)
 {
-    if (!link || !link->pn_link)
+    if (!link || !link->pn_link || pn_link_state(link->pn_link) != (PN_LOCAL_ACTIVE|PN_REMOTE_ACTIVE))
         return;
 
     pn_session_t *sess = pn_link_session(link->pn_link);
-    if (!sess)
+    if (!sess || pn_session_state(sess) != (PN_LOCAL_ACTIVE|PN_REMOTE_ACTIVE))
         return;
 
     pn_connection_t *conn = pn_session_connection(sess);
-    if (!conn)
+    if (!conn || pn_connection_state(conn) != (PN_LOCAL_ACTIVE|PN_REMOTE_ACTIVE))
         return;
 
     dx_connection_t *ctx = pn_connection_get_context(conn);

Modified: qpid/dispatch/trunk/tests/system_tests_one_router.py
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/tests/system_tests_one_router.py?rev=1536961&r1=1536960&r2=1536961&view=diff
==============================================================================
--- qpid/dispatch/trunk/tests/system_tests_one_router.py (original)
+++ qpid/dispatch/trunk/tests/system_tests_one_router.py Wed Oct 30 03:59:38 2013
@@ -25,17 +25,19 @@ from proton import Messenger, Message, P
 
 class RouterTest(unittest.TestCase):
 
-  def setUp(self):
+  @classmethod
+  def setUpClass(cls):
       if 'CTEST_SOURCE_DIR' not in os.environ:
         raise Exception("Environment variable 'CTEST_SOURCE_DIR' not set")
       srcdir = os.environ['CTEST_SOURCE_DIR']
-      self.router = subprocess.Popen(['../router/qpid-dxrouterd', '-c', '%s/config-1/A.conf' % srcdir],
-                                     stderr=subprocess.PIPE, stdout=subprocess.PIPE)
+      cls.router = subprocess.Popen(['../router/qpid-dxrouterd', '-c', '%s/config-1/A.conf' % srcdir],
+                                    stderr=subprocess.PIPE, stdout=subprocess.PIPE)
       time.sleep(1)
 
-  def tearDown(self):
-    self.router.terminate()
-    self.router.wait()
+  @classmethod
+  def tearDownClass(cls):
+    cls.router.terminate()
+    cls.router.wait()
 
   def flush(self, messenger):
     while messenger.work(0.1):
@@ -191,12 +193,52 @@ class RouterTest(unittest.TestCase):
       M4.settle(trk)
       self.assertEqual(i, rm.body['number'])
 
+    self.flush(M1)
+    self.flush(M2)
+    self.flush(M3)
+    self.flush(M4)
+
     M1.stop()
     M2.stop()
     M3.stop()
     M4.stop()
 
 
+  def test_2b_disp_to_closed_connection(self):
+    addr = "amqp://0.0.0.0:20000/pre_settled/multicast/1"
+    M1 = Messenger()
+    M2 = Messenger()
+
+    M1.timeout = 1.0
+    M2.timeout = 1.0
+
+    M1.outgoing_window = 5
+    M2.incoming_window = 5
+
+    M1.start()
+    M2.start()
+    self.subscribe(M2, addr)
+
+    tm = Message()
+    rm = Message()
+
+    tm.address = addr
+    for i in range(2):
+      tm.body = {'number': i}
+      M1.put(tm)
+    M1.send(0)
+    M1.stop()
+
+    for i in range(2):
+      M2.recv(1)
+      trk = M2.get(rm)
+      M2.accept(trk)
+      M2.settle(trk)
+      self.assertEqual(i, rm.body['number'])
+
+    M2.stop()
+
+
   def test_3_propagated_disposition(self):
     addr = "amqp://0.0.0.0:20000/unsettled/1"
     M1 = Messenger()
@@ -448,5 +490,32 @@ class RouterTest(unittest.TestCase):
     M2.stop()
 
 
+  def test_9_management(self):
+    addr  = "amqp:/_local/$management"
+    reply = "amqp:/temp.reply"
+
+    M = Messenger()
+    M.start()
+    M.route("amqp:/*", "amqp://0.0.0.0:20000/$1")
+    M.subscribe(reply)
+
+    request  = Message()
+    response = Message()
+
+    request.address        = addr
+    request.reply_to       = reply
+    request.correlation_id = 1
+    request.properties     = {u'type':u'org.amqp.management', u'name':u'self', u'operation':u'DISCOVER-MGMT-NODES'}
+
+    M.put(request)
+    M.send()
+    M.recv()
+    M.get(response)
+
+    self.assertEqual(response.properties['status-code'], 200)
+    self.assertEqual(response.body, ['amqp:/_local/$management'])
+
+    M.stop()
+
 if __name__ == '__main__':
   unittest.main()



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