diff options
| -rw-r--r-- | src/rabbit_exchange_type_topic.erl | 17 | ||||
| -rw-r--r-- | src/rabbit_tests.erl | 28 |
2 files changed, 23 insertions, 22 deletions
diff --git a/src/rabbit_exchange_type_topic.erl b/src/rabbit_exchange_type_topic.erl index 15ce487daf..2c2e589aa0 100644 --- a/src/rabbit_exchange_type_topic.erl +++ b/src/rabbit_exchange_type_topic.erl @@ -244,21 +244,20 @@ select_while_no_result(Other) -> Other. trie_remove_all_edges(X) -> - MatchHead = #topic_trie_edge{trie_edge = #trie_edge{exchange_name = X, - _='_'}, - _='_'}, + Pattern = #topic_trie_edge{trie_edge = #trie_edge{exchange_name = X, + _='_'}, + _='_'}, lists:foreach( fun(R) -> mnesia:delete_object(rabbit_topic_trie_edge, R, write) end, - mnesia:select(rabbit_topic_trie_edge, [{MatchHead, [], ['$_']}])). + mnesia:match_object(rabbit_topic_trie_edge, Pattern, write)). trie_remove_all_bindings(X) -> - MatchHead = #topic_trie_binding{trie_binding = - #trie_binding{exchange_name = X, - _='_'}, - _='_'}, + Pattern = #topic_trie_binding{trie_binding = #trie_binding{exchange_name =X, + _='_'}, + _='_'}, lists:foreach( fun(R) -> mnesia:delete_object(rabbit_topic_trie_binding, R, write) end, - mnesia:select(rabbit_topic_trie_binding, [{MatchHead, [], ['$_']}])). + mnesia:match_object(rabbit_topic_trie_binding, Pattern, write)). new_node_id() -> rabbit_guid:guid(). diff --git a/src/rabbit_tests.erl b/src/rabbit_tests.erl index cee728ea55..32c31bbfa1 100644 --- a/src/rabbit_tests.erl +++ b/src/rabbit_tests.erl @@ -622,32 +622,34 @@ test_topic_matching() -> {"#.*.#", "t22"}, {"*.#.#", "t23"}, {"#.#.#", "t24"}, - {"*", "t25"}]), + {"*", "t25"}, + {"#.b.#", "t26"}]), lists:foreach(fun(B) -> rabbit_exchange_type_topic:add_binding(X, B) end, Bindings), %% test some matches test_topic_expect_match(X, [{"a.b.c", ["t1", "t2", "t5", "t6", "t10", "t11", "t12", "t18", "t20", - "t21", "t22", "t23", "t24"]}, + "t21", "t22", "t23", "t24", "t26"]}, {"a.b", ["t3", "t5", "t6", "t7", "t8", "t9", "t11", "t12", "t15", - "t21", "t22", "t23", "t24"]}, + "t21", "t22", "t23", "t24", "t26"]}, {"a.b.b", ["t3", "t5", "t6", "t7", "t11", "t12", "t14", "t18", "t21", - "t22", "t23", "t24"]}, + "t22", "t23", "t24", "t26"]}, {"", ["t5", "t6", "t17", "t24"]}, - {"b.c.c", ["t5", "t6", "t18", "t21", "t22", "t23", "t24"]}, + {"b.c.c", ["t5", "t6", "t18", "t21", "t22", "t23", "t24", "t26"]}, {"a.a.a.a.a", ["t5", "t6", "t11", "t12", "t21", "t22", "t23", "t24"]}, {"vodka.gin", ["t5", "t6", "t8", "t21", "t22", "t23", "t24"]}, {"vodka.martini", ["t5", "t6", "t8", "t19", "t21", "t22", "t23", "t24"]}, {"b.b.c", ["t5", "t6", "t10", "t13", "t18", "t21", "t22", "t23", - "t24"]}, + "t24", "t26"]}, {"nothing.here.at.all", ["t5", "t6", "t21", "t22", "t23", "t24"]}, {"oneword", ["t5", "t6", "t21", "t22", "t23", "t24", "t25"]}]), %% remove some bindings RemovedBindings = [lists:nth(1, Bindings), lists:nth(5, Bindings), - lists:nth(11, Bindings), lists:nth(21, Bindings)], + lists:nth(11, Bindings), lists:nth(19, Bindings), + lists:nth(21, Bindings)], rabbit_exchange_type_topic:remove_bindings(X, RemovedBindings), RemainingBindings = ordsets:to_list( ordsets:subtract(ordsets:from_list(Bindings), @@ -656,17 +658,17 @@ test_topic_matching() -> %% test some matches test_topic_expect_match(X, [{"a.b.c", ["t2", "t6", "t10", "t12", "t18", "t20", "t22", "t23", - "t24"]}, + "t24", "t26"]}, {"a.b", ["t3", "t6", "t7", "t8", "t9", "t12", "t15", "t22", "t23", - "t24"]}, + "t24", "t26"]}, {"a.b.b", ["t3", "t6", "t7", "t12", "t14", "t18", "t22", "t23", - "t24"]}, + "t24", "t26"]}, {"", ["t6", "t17", "t24"]}, - {"b.c.c", ["t6", "t18", "t22", "t23", "t24"]}, + {"b.c.c", ["t6", "t18", "t22", "t23", "t24", "t26"]}, {"a.a.a.a.a", ["t6", "t12", "t22", "t23", "t24"]}, {"vodka.gin", ["t6", "t8", "t22", "t23", "t24"]}, - {"vodka.martini", ["t6", "t8", "t19", "t22", "t23", "t24"]}, - {"b.b.c", ["t6", "t10", "t13", "t18", "t22", "t23", "t24"]}, + {"vodka.martini", ["t6", "t8", "t22", "t23", "t24"]}, + {"b.b.c", ["t6", "t10", "t13", "t18", "t22", "t23", "t24", "t26"]}, {"nothing.here.at.all", ["t6", "t22", "t23", "t24"]}, {"oneword", ["t6", "t22", "t23", "t24", "t25"]}]), |
