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 2017/09/15 16:34:02 UTC

qpid-dispatch git commit: DISPATCH-821: actually delete the configured address

Repository: qpid-dispatch
Updated Branches:
  refs/heads/master 02ed034cd -> 355942a8a


DISPATCH-821: actually delete the configured address


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

Branch: refs/heads/master
Commit: 355942a8a0a4aa4c221d90272c1960542fe3b37d
Parents: 02ed034
Author: Kenneth Giusti <kg...@apache.org>
Authored: Fri Sep 15 12:00:20 2017 -0400
Committer: Kenneth Giusti <kg...@apache.org>
Committed: Fri Sep 15 12:00:20 2017 -0400

----------------------------------------------------------------------
 src/router_core/router_core.c    |  4 +---
 tests/system_tests_management.py | 36 +++++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/355942a8/src/router_core/router_core.c
----------------------------------------------------------------------
diff --git a/src/router_core/router_core.c b/src/router_core/router_core.c
index 010ad98..5c1d020 100644
--- a/src/router_core/router_core.c
+++ b/src/router_core/router_core.c
@@ -337,13 +337,11 @@ void qdr_core_remove_address(qdr_core_t *core, qdr_address_t *addr)
 
 void qdr_core_remove_address_config(qdr_core_t *core, qdr_address_config_t *addr)
 {
-    qdr_address_config_t *tmp;
     qd_iterator_t *pattern = qd_iterator_string(addr->pattern, ITER_VIEW_ALL);
 
     // Remove the address from the list and the parse tree
     DEQ_REMOVE(core->addr_config, addr);
-    qd_parse_tree_get_pattern(core->addr_parse_tree, pattern, (void **) &tmp);
-    assert(tmp == addr);
+    qd_parse_tree_remove_pattern(core->addr_parse_tree, pattern);
 
     // Free resources associated with this address.
     if (addr->name) {

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/355942a8/tests/system_tests_management.py
----------------------------------------------------------------------
diff --git a/tests/system_tests_management.py b/tests/system_tests_management.py
index c26741f..20bfacc 100644
--- a/tests/system_tests_management.py
+++ b/tests/system_tests_management.py
@@ -38,6 +38,7 @@ ROUTER = PREFIX + 'router'
 LINK = ROUTER + '.link'
 ADDRESS = ROUTER + '.address'
 NODE = ROUTER + '.node'
+CONFIG_ADDRESS = ROUTER + '.config.address'
 
 def short_name(name):
     if name.startswith(PREFIX):
@@ -161,6 +162,11 @@ class ManagementTest(system_test.TestCase):
         self.assertMapSubset(attributes, entity.attributes)
         return entity
 
+    def assert_read_ok(self, type, name, attributes):
+        entity = self.node.read(type, name)
+        self.assertMapSubset(attributes, entity.attributes)
+        return entity
+
     def test_create_listener(self):
         """Create a new listener on a running router"""
 
@@ -247,6 +253,36 @@ class ManagementTest(system_test.TestCase):
         msgr.put(message(address=address, body='hello'))
         self.assertEqual('hello', msgr.fetch().body)
 
+    def test_create_config_address(self):
+        self.assert_create_ok(CONFIG_ADDRESS, 'myConfigAddr', dict(prefix='prefixA'))
+        self.assert_read_ok(CONFIG_ADDRESS, 'myConfigAddr',
+                            dict(prefix='prefixA', pattern=None))
+        msgr = self.messenger()
+        address = self.router.addresses[0]+'/prefixA/other'
+        msgr.subscribe(address)
+        msgr.put(message(address=address, body='hello'))
+        self.assertEqual('hello', msgr.fetch().body)
+        msgr.stop()
+        del msgr
+        self.node.delete(CONFIG_ADDRESS, name='myConfigAddr')
+        self.assertRaises(NotFoundStatus, self.node.read,
+                          type=CONFIG_ADDRESS, name='myConfigAddr')
+
+    def test_create_config_address_pattern(self):
+        self.assert_create_ok(CONFIG_ADDRESS, 'patternAddr', dict(pattern='a.*.b'))
+        self.assert_read_ok(CONFIG_ADDRESS, 'patternAddr',
+                            dict(prefix=None, pattern='a.*.b'))
+        msgr = self.messenger()
+        address = self.router.addresses[0]+'/a.HITHERE.b'
+        msgr.subscribe(address)
+        msgr.put(message(address=address, body='hello'))
+        self.assertEqual('hello', msgr.fetch().body)
+        msgr.stop()
+        del msgr
+        self.node.delete(CONFIG_ADDRESS, name='patternAddr')
+        self.assertRaises(NotFoundStatus, self.node.read,
+                          type=CONFIG_ADDRESS, name='patternAddr')
+
     def test_dummy(self):
         """Test all operations on the dummy test entity"""
         entity = self.node.read(type=LISTENER, name='l0')


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