use of org.apache.activemq.artemis.core.config.WildcardConfiguration in project activemq-artemis by apache.
the class OpenWireUtilTest method testWildcardConversion.
@Test
public void testWildcardConversion() throws Exception {
String amqTarget = "TEST.ONE.>";
String coreTarget = OpenWireUtil.OPENWIRE_WILDCARD.convert(amqTarget, new WildcardConfiguration());
assertEquals("TEST.ONE.#", coreTarget);
amqTarget = "TEST.*.ONE";
coreTarget = OpenWireUtil.OPENWIRE_WILDCARD.convert(amqTarget, new WildcardConfiguration());
assertEquals("TEST.*.ONE", coreTarget);
amqTarget = "a.*.>.>";
coreTarget = OpenWireUtil.OPENWIRE_WILDCARD.convert(amqTarget, new WildcardConfiguration());
assertEquals("a.*.#.#", coreTarget);
}
use of org.apache.activemq.artemis.core.config.WildcardConfiguration in project activemq-artemis by apache.
the class MQTTOpenwireTest method configureBroker.
@Override
public void configureBroker() throws Exception {
super.configureBroker();
WildcardConfiguration wildcardConfiguration = new WildcardConfiguration();
wildcardConfiguration.setDelimiter('.');
wildcardConfiguration.setSingleWord('*');
wildcardConfiguration.setAnyWords('>');
server.getConfiguration().setWildCardConfiguration(wildcardConfiguration);
}
use of org.apache.activemq.artemis.core.config.WildcardConfiguration in project activemq-artemis by apache.
the class WildcardConfigurationTest method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
WildcardConfiguration wildcardConfiguration = new WildcardConfiguration();
wildcardConfiguration.setDelimiter('/');
Configuration configuration = createDefaultInVMConfig().setWildcardRoutingEnabled(true).setTransactionTimeoutScanPeriod(500).setWildCardConfiguration(wildcardConfiguration);
server = addServer(ActiveMQServers.newActiveMQServer(configuration, false));
server.start();
server.getManagementService().enableNotifications(false);
locator = createInVMNonHALocator();
sf = createSessionFactory(locator);
clientSession = addClientSession(sf.createSession(false, true, true));
}
use of org.apache.activemq.artemis.core.config.WildcardConfiguration in project activemq-artemis by apache.
the class RepositoryTest method testMatchingDocsCustomUnderscorDelimiter.
@Test
public void testMatchingDocsCustomUnderscorDelimiter() throws Throwable {
WildcardConfiguration wildcardConfiguration = new WildcardConfiguration();
wildcardConfiguration.setDelimiter('_');
HierarchicalObjectRepository<String> repo = new HierarchicalObjectRepository<>(wildcardConfiguration);
repo.addMatch("a_b_#", "ab#");
repo.addMatch("a_b_d_#", "abd#");
repo.addMatch("#", "root");
Assert.assertEquals("ab#", repo.getMatch("a_b"));
Assert.assertEquals("ab#", repo.getMatch("a_b_c"));
Assert.assertEquals("abd#", repo.getMatch("a_b_d_lll"));
Assert.assertEquals("root", repo.getMatch("z_z_z_z_z"));
Assert.assertEquals("root", repo.getMatch("a_babc"));
Assert.assertEquals("ab#", repo.getMatch("a_b_dabc"));
Assert.assertEquals("abd#", repo.getMatch("a_b_d"));
}
use of org.apache.activemq.artemis.core.config.WildcardConfiguration in project activemq-artemis by apache.
the class RepositoryTest method testMatchingDocsCustomForwardSlashDelimiter.
@Test
public void testMatchingDocsCustomForwardSlashDelimiter() throws Throwable {
WildcardConfiguration wildcardConfiguration = new WildcardConfiguration();
wildcardConfiguration.setDelimiter('/');
HierarchicalObjectRepository<String> repo = new HierarchicalObjectRepository<>(wildcardConfiguration);
repo.addMatch("a/b/#", "ab#");
repo.addMatch("a/b/d/#", "abd#");
repo.addMatch("#", "root");
Assert.assertEquals("ab#", repo.getMatch("a/b"));
Assert.assertEquals("ab#", repo.getMatch("a/b/c"));
Assert.assertEquals("abd#", repo.getMatch("a/b/d/lll"));
Assert.assertEquals("root", repo.getMatch("z/z/z/z/z"));
Assert.assertEquals("root", repo.getMatch("a/babc"));
Assert.assertEquals("ab#", repo.getMatch("a/b/dabc"));
Assert.assertEquals("abd#", repo.getMatch("a/b/d"));
}
Aggregations