Search in sources :

Example 1 with WildcardConfiguration

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);
}
Also used : WildcardConfiguration(org.apache.activemq.artemis.core.config.WildcardConfiguration) Test(org.junit.Test)

Example 2 with WildcardConfiguration

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);
}
Also used : WildcardConfiguration(org.apache.activemq.artemis.core.config.WildcardConfiguration)

Example 3 with 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));
}
Also used : Configuration(org.apache.activemq.artemis.core.config.Configuration) WildcardConfiguration(org.apache.activemq.artemis.core.config.WildcardConfiguration) WildcardConfiguration(org.apache.activemq.artemis.core.config.WildcardConfiguration) Before(org.junit.Before)

Example 4 with WildcardConfiguration

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"));
}
Also used : WildcardConfiguration(org.apache.activemq.artemis.core.config.WildcardConfiguration) HierarchicalObjectRepository(org.apache.activemq.artemis.core.settings.impl.HierarchicalObjectRepository) Test(org.junit.Test)

Example 5 with WildcardConfiguration

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"));
}
Also used : WildcardConfiguration(org.apache.activemq.artemis.core.config.WildcardConfiguration) HierarchicalObjectRepository(org.apache.activemq.artemis.core.settings.impl.HierarchicalObjectRepository) Test(org.junit.Test)

Aggregations

WildcardConfiguration (org.apache.activemq.artemis.core.config.WildcardConfiguration)14 Test (org.junit.Test)8 Configuration (org.apache.activemq.artemis.core.config.Configuration)2 WildcardAddressManager (org.apache.activemq.artemis.core.postoffice.impl.WildcardAddressManager)2 AddressInfo (org.apache.activemq.artemis.core.server.impl.AddressInfo)2 HierarchicalObjectRepository (org.apache.activemq.artemis.core.settings.impl.HierarchicalObjectRepository)2 BlockingConnection (org.fusesource.mqtt.client.BlockingConnection)2 Message (org.fusesource.mqtt.client.Message)2 Topic (org.fusesource.mqtt.client.Topic)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ActiveMQDefaultConfiguration (org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration)1 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)1 BridgeConfiguration (org.apache.activemq.artemis.core.config.BridgeConfiguration)1 CoreAddressConfiguration (org.apache.activemq.artemis.core.config.CoreAddressConfiguration)1 HAPolicyConfiguration (org.apache.activemq.artemis.core.config.HAPolicyConfiguration)1 SharedStoreMasterPolicyConfiguration (org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration)1 FileConfigurationParser (org.apache.activemq.artemis.core.deployers.impl.FileConfigurationParser)1 AddressSettings (org.apache.activemq.artemis.core.settings.impl.AddressSettings)1 Before (org.junit.Before)1