Java Code Examples for org.apache.activemq.artemis.api.core.SimpleString#split()

The following examples show how to use org.apache.activemq.artemis.api.core.SimpleString#split() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: QueueInfo.java    From activemq-artemis with Apache License 2.0 6 votes vote down vote up
public boolean matchesAddress(SimpleString address) {
   boolean containsAddress = false;

   if (address != null) {
      SimpleString[] split = address.split(',');
      for (SimpleString addressPart : split) {
         containsAddress = address.startsWith(addressPart);

         if (containsAddress) {
            break;
         }
      }
   }

   return containsAddress;
}
 
Example 2
Source File: SimpleStringTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
@Test
public void testSplitNoDelimeter() throws Exception {
   SimpleString s = new SimpleString("abcdefghi");
   SimpleString[] strings = s.split('.');
   Assert.assertNotNull(strings);
   Assert.assertEquals(strings.length, 1);
   Assert.assertEquals(strings[0], s);
}
 
Example 3
Source File: SimpleStringTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
@Test
public void testSplit1Delimeter() throws Exception {
   SimpleString s = new SimpleString("abcd.efghi");
   SimpleString[] strings = s.split('.');
   Assert.assertNotNull(strings);
   Assert.assertEquals(strings.length, 2);
   Assert.assertEquals(strings[0], new SimpleString("abcd"));
   Assert.assertEquals(strings[1], new SimpleString("efghi"));
}
 
Example 4
Source File: SimpleStringTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
@Test
public void testSplitmanyDelimeters() throws Exception {
   SimpleString s = new SimpleString("abcd.efghi.jklmn.opqrs.tuvw.xyz");
   SimpleString[] strings = s.split('.');
   Assert.assertNotNull(strings);
   Assert.assertEquals(strings.length, 6);
   Assert.assertEquals(strings[0], new SimpleString("abcd"));
   Assert.assertEquals(strings[1], new SimpleString("efghi"));
   Assert.assertEquals(strings[2], new SimpleString("jklmn"));
   Assert.assertEquals(strings[3], new SimpleString("opqrs"));
   Assert.assertEquals(strings[4], new SimpleString("tuvw"));
   Assert.assertEquals(strings[5], new SimpleString("xyz"));
}
 
Example 5
Source File: AddressImpl.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
public AddressImpl(final SimpleString address, final WildcardConfiguration wildcardConfiguration) {
   this.address = address;
   this.wildcardConfiguration = wildcardConfiguration;
   addressParts = address.split(wildcardConfiguration.getDelimiter());
   containsWildCard = address.contains(wildcardConfiguration.getSingleWord()) || address.contains(wildcardConfiguration.getAnyWords());
}