mirror of https://github.com/apache/activemq.git
AMQ-5933 - add test and fix
This commit is contained in:
parent
3ee84a17fb
commit
3c2ed9352b
|
@ -76,6 +76,7 @@ public class SelectorAwareVirtualTopicInterceptor extends VirtualTopicIntercepto
|
||||||
|
|
||||||
if (cache != null) {
|
if (cache != null) {
|
||||||
final Set<String> selectors = cache.getSelector(dest.getActiveMQDestination().getQualifiedName());
|
final Set<String> selectors = cache.getSelector(dest.getActiveMQDestination().getQualifiedName());
|
||||||
|
if (selectors != null) {
|
||||||
for (String selector : selectors) {
|
for (String selector : selectors) {
|
||||||
try {
|
try {
|
||||||
final BooleanExpression expression = getExpression(selector);
|
final BooleanExpression expression = getExpression(selector);
|
||||||
|
@ -88,6 +89,7 @@ public class SelectorAwareVirtualTopicInterceptor extends VirtualTopicIntercepto
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return matches;
|
return matches;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -578,6 +578,23 @@ public class TwoBrokerVirtualTopicSelectorAwareForwardingTest extends
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testSelectorNoMatchInCache() throws Exception {
|
||||||
|
clearSelectorCacheFiles();
|
||||||
|
|
||||||
|
// have the cache ignoreWildcardSelectors
|
||||||
|
final BrokerService brokerA = brokers.get("BrokerA").broker;
|
||||||
|
((SubQueueSelectorCacheBrokerPlugin)brokerA.getPlugins()[0]).setIgnoreWildcardSelectors(true);
|
||||||
|
|
||||||
|
startAllBrokers();
|
||||||
|
|
||||||
|
ActiveMQDestination consumerBQueue = createDestination("Consumer.B.VirtualTopic.tempTopic", false);
|
||||||
|
|
||||||
|
MessageConsumer nonMatchingConsumer = createConsumer("BrokerA", consumerBQueue, "foo = 'bar%'");
|
||||||
|
|
||||||
|
ActiveMQTopic virtualTopic = new ActiveMQTopic("VirtualTopic.tempTopic");
|
||||||
|
sendMessages("BrokerA", virtualTopic, 1, asMap("foo", "notBar"));
|
||||||
|
}
|
||||||
|
|
||||||
private HashMap<String, Object> asMap(String key, Object value) {
|
private HashMap<String, Object> asMap(String key, Object value) {
|
||||||
HashMap<String, Object> rc = new HashMap<String, Object>(1);
|
HashMap<String, Object> rc = new HashMap<String, Object>(1);
|
||||||
rc.put(key, value);
|
rc.put(key, value);
|
||||||
|
|
Loading…
Reference in New Issue