Ejemplo n.º 1
0
  @Test
  public void testStringEquals() throws Exception {
    // First, simple test of string equality and inequality
    filter = FilterImpl.createFilter(new SimpleString("MyString='astring'"));

    doPutStringProperty("MyString", "astring");
    Assert.assertTrue(filter.match(message));

    doPutStringProperty("MyString", "NOTastring");
    Assert.assertTrue(!filter.match(message));

    // test empty string
    filter = FilterImpl.createFilter(new SimpleString("MyString=''"));

    doPutStringProperty("MyString", "");
    Assert.assertTrue("test 1", filter.match(message));

    doPutStringProperty("MyString", "NOTastring");
    Assert.assertTrue("test 2", !filter.match(message));

    // test literal apostrophes (which are escaped using two apostrophes
    // in selectors)
    filter = FilterImpl.createFilter(new SimpleString("MyString='test JBoss''s filter'"));

    // note: apostrophes are not escaped in string properties
    doPutStringProperty("MyString", "test JBoss's filter");
    // this test fails -- bug 530120
    // assertTrue("test 3", filter.match(message));

    doPutStringProperty("MyString", "NOTastring");
    Assert.assertTrue("test 4", !filter.match(message));
  }
Ejemplo n.º 2
0
  @Override
  public CompositeData[] browse(String filterStr) throws Exception {
    checkStarted();

    clearIO();
    try {
      int pageSize =
          addressSettingsRepository
              .getMatch(queue.getName().toString())
              .getManagementBrowsePageSize();
      int currentPageSize = 0;
      ArrayList<CompositeData> c = new ArrayList<>();
      Filter filter = FilterImpl.createFilter(filterStr);
      queue.flushExecutor();
      try (LinkedListIterator<MessageReference> iterator = queue.totalIterator()) {
        while (iterator.hasNext() && currentPageSize++ < pageSize) {
          MessageReference ref = iterator.next();
          if (filter == null || filter.match(ref.getMessage())) {
            c.add(OpenTypeSupport.convert(ref));
          }
        }
        CompositeData[] rc = new CompositeData[c.size()];
        c.toArray(rc);
        return rc;
      }
    } catch (ActiveMQException e) {
      throw new IllegalStateException(e.getMessage());
    } finally {
      blockOnIO();
    }
  }
Ejemplo n.º 3
0
  private void testBoolean(final String name, final boolean flag) throws Exception {
    message.putBooleanProperty(new SimpleString(name), flag);
    Assert.assertTrue(filter.match(message));

    message.putBooleanProperty(new SimpleString(name), !flag);
    Assert.assertTrue(!filter.match(message));
  }
Ejemplo n.º 4
0
  @Override
  public long countMessages(final String filterStr) throws Exception {
    checkStarted();

    clearIO();
    try {
      Filter filter = FilterImpl.createFilter(filterStr);
      if (filter == null) {
        return getMessageCount();
      } else {
        try (LinkedListIterator<MessageReference> iterator = queue.totalIterator()) {
          int count = 0;
          while (iterator.hasNext()) {
            MessageReference ref = iterator.next();
            if (filter.match(ref.getMessage())) {
              count++;
            }
          }
          return count;
        }
      }
    } finally {
      blockOnIO();
    }
  }
Ejemplo n.º 5
0
  @Override
  public Map<String, Object>[] listMessages(final String filterStr) throws Exception {
    checkStarted();

    clearIO();
    try {
      Filter filter = FilterImpl.createFilter(filterStr);
      List<Map<String, Object>> messages = new ArrayList<>();
      queue.flushExecutor();
      try (LinkedListIterator<MessageReference> iterator = queue.totalIterator()) {
        while (iterator.hasNext()) {
          MessageReference ref = iterator.next();
          if (filter == null || filter.match(ref.getMessage())) {
            Message message = ref.getMessage();
            messages.add(message.toMap());
          }
        }
        return messages.toArray(new Map[messages.size()]);
      }
    } catch (ActiveMQException e) {
      throw new IllegalStateException(e.getMessage());
    } finally {
      blockOnIO();
    }
  }
Ejemplo n.º 6
0
  @Test
  public void testNOT_LIKEWithNullProperty() throws Exception {
    filter = FilterImpl.createFilter(new SimpleString("myNullProp NOT LIKE '1_3'"));

    assertFalse(filter.match(message));

    message.putStringProperty("myNullProp", "JMS");
    assertTrue(filter.match(message));
  }
Ejemplo n.º 7
0
  @Test
  public void testFilterForgets() throws Exception {
    filter = FilterImpl.createFilter(new SimpleString("color = 'RED'"));

    message.putStringProperty(new SimpleString("color"), new SimpleString("RED"));
    Assert.assertTrue(filter.match(message));
    message = new ServerMessageImpl();
    Assert.assertFalse(filter.match(message));
  }
Ejemplo n.º 8
0
  @Test
  public void testIS_NOT_NULLWithNullProperty() throws Exception {
    filter = FilterImpl.createFilter(new SimpleString("myNullProp IS NOT NULL"));

    assertFalse(filter.match(message));

    message.putStringProperty("myNullProp", "JMS");
    assertTrue(filter.match(message));
  }
Ejemplo n.º 9
0
  @Test
  public void testNOT_INWithNullProperty() throws Exception {
    filter = FilterImpl.createFilter(new SimpleString("myNullProp NOT IN ('foo','jms','test')"));

    assertFalse(filter.match(message));

    message.putStringProperty("myNullProp", "JMS");
    assertTrue(filter.match(message));
  }
Ejemplo n.º 10
0
  @Test
  public void testAMQTimestamp() throws Exception {
    filter = FilterImpl.createFilter(new SimpleString("AMQTimestamp=12345678"));

    message.setTimestamp(87654321);

    Assert.assertFalse(filter.match(message));

    message.setTimestamp(12345678);

    Assert.assertTrue(filter.match(message));
  }
Ejemplo n.º 11
0
  @Override
  public String getFilter() {
    checkStarted();

    clearIO();
    try {
      Filter filter = queue.getFilter();

      return filter != null ? filter.getFilterString().toString() : null;
    } finally {
      blockOnIO();
    }
  }
Ejemplo n.º 12
0
  @Test
  public void testAMQPriority() throws Exception {
    filter = FilterImpl.createFilter(new SimpleString("AMQPriority=3"));

    for (int i = 0; i < 10; i++) {
      message.setPriority((byte) i);

      if (i == 3) {
        Assert.assertTrue(filter.match(message));
      } else {
        Assert.assertFalse(filter.match(message));
      }
    }
  }
Ejemplo n.º 13
0
  @Test
  public void testStringLike() throws Exception {
    // test LIKE operator with no wildcards
    filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'astring'"));
    Assert.assertFalse(filter.match(message));

    // test where LIKE operand matches
    doPutStringProperty("MyString", "astring");
    Assert.assertTrue(filter.match(message));

    // test one character string
    filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'a'"));
    doPutStringProperty("MyString", "a");
    Assert.assertTrue(filter.match(message));

    // test empty string
    filter = FilterImpl.createFilter(new SimpleString("MyString LIKE ''"));
    doPutStringProperty("MyString", "");
    Assert.assertTrue(filter.match(message));

    // tests where operand does not match
    filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'astring'"));

    // test with extra characters at beginning
    doPutStringProperty("MyString", "NOTastring");
    Assert.assertTrue(!filter.match(message));

    // test with extra characters at end
    doPutStringProperty("MyString", "astringNOT");
    Assert.assertTrue(!filter.match(message));

    // test with extra characters in the middle
    doPutStringProperty("MyString", "astNOTring");
    Assert.assertTrue(!filter.match(message));

    // test where operand is entirely different
    doPutStringProperty("MyString", "totally different");
    Assert.assertTrue(!filter.match(message));

    // test case sensitivity
    doPutStringProperty("MyString", "ASTRING");
    Assert.assertTrue(!filter.match(message));

    // test empty string
    doPutStringProperty("MyString", "");
    Assert.assertTrue(!filter.match(message));

    // test lower-case 'like' operator?
  }
Ejemplo n.º 14
0
  @Test
  public void testNotLikeExpression() throws Exception {
    // Should evaluate to false when the property MyString is not set
    filter = FilterImpl.createFilter(new SimpleString("NOT (MyString LIKE '%')"));

    Assert.assertFalse(filter.match(message));
  }
Ejemplo n.º 15
0
  @Test
  public void testDifferentNullString() throws Exception {
    filter = FilterImpl.createFilter(new SimpleString("prop <> 'foo'"));
    Assert.assertTrue(filter.match(message));

    filter = FilterImpl.createFilter(new SimpleString("NOT (prop = 'foo')"));
    Assert.assertTrue(filter.match(message));

    filter = FilterImpl.createFilter(new SimpleString("prop <> 'foo'"));
    doPutStringProperty("prop", "bar");
    Assert.assertTrue(filter.match(message));

    filter = FilterImpl.createFilter(new SimpleString("prop <> 'foo'"));
    doPutStringProperty("prop", "foo");
    Assert.assertFalse(filter.match(message));
  }
Ejemplo n.º 16
0
  @Test
  public void testNewlineMatch() throws Exception {
    filter = FilterImpl.createFilter(new SimpleString("fooprop LIKE '%1234%'"));

    message.putStringProperty(new SimpleString("fooprop"), new SimpleString("hello1234\n"));

    Assert.assertTrue(filter.match(message));
  }
Ejemplo n.º 17
0
  @Override
  public HandleStatus handle(final MessageReference ref) throws Exception {
    if (filter != null && !filter.match(ref.getMessage())) {
      return HandleStatus.NO_MATCH;
    }

    synchronized (this) {
      if (!active || !session.isWritable(this)) {
        if (logger.isDebugEnabled()) {
          logger.debug(this + "::Ignoring reference on bridge as it is set to inactive ref=" + ref);
        }
        return HandleStatus.BUSY;
      }

      if (deliveringLargeMessage) {
        return HandleStatus.BUSY;
      }

      if (logger.isTraceEnabled()) {
        logger.trace("Bridge " + this + " is handling reference=" + ref);
      }

      ref.handled();

      synchronized (refs) {
        refs.put(ref.getMessage().getMessageID(), ref);
      }

      final ServerMessage message = beforeForward(ref.getMessage());

      final SimpleString dest;

      if (forwardingAddress != null) {
        dest = forwardingAddress;
      } else {
        // Preserve the original address
        dest = message.getAddress();
      }

      pendingAcks.countUp();

      try {
        if (message.isLargeMessage()) {
          deliveringLargeMessage = true;
          deliverLargeMessage(dest, ref, (LargeServerMessage) message);
          return HandleStatus.HANDLED;
        } else {
          return deliverStandardMessage(dest, ref, message);
        }
      } catch (Exception e) {
        // If an exception happened, we must count down immediately
        pendingAcks.countDown();
        throw e;
      }
    }
  }
Ejemplo n.º 18
0
  @Test
  public void testAMQDurable() throws Exception {
    filter = FilterImpl.createFilter(new SimpleString("AMQDurable='DURABLE'"));

    message.setDurable(true);

    Assert.assertTrue(filter.match(message));

    message.setDurable(false);

    Assert.assertFalse(filter.match(message));

    filter = FilterImpl.createFilter(new SimpleString("AMQDurable='NON_DURABLE'"));

    message = new ServerMessageImpl();
    message.setDurable(true);

    Assert.assertFalse(filter.match(message));

    message.setDurable(false);

    Assert.assertTrue(filter.match(message));
  }
 private boolean checkBindingExists(DestinationAction command, String filter) {
   String bindingKey = command.getName();
   if (isJms(command)) {
     if (isTopic(command)) {
       bindingKey = "jms.topic." + bindingKey;
     } else {
       bindingKey = "jms.queue." + bindingKey;
     }
   }
   Map<SimpleString, Binding> bindings = server.getPostOffice().getAllBindings();
   System.out.println("bindings: " + bindings);
   Binding binding = bindings.get(new SimpleString(bindingKey));
   System.out.println("got binding: " + binding);
   if (binding == null) {
     System.out.println("No bindings for " + bindingKey);
     return false;
   }
   if (filter != null) {
     Filter bindingFilter = binding.getFilter();
     assertNotNull(bindingFilter);
     assertEquals(filter, bindingFilter.getFilterString().toString());
   }
   return true;
 }
Ejemplo n.º 20
0
  @Test
  public void testAMQSize() throws Exception {
    message.setAddress(RandomUtil.randomSimpleString());

    int encodeSize = message.getEncodeSize();

    Filter moreThanSmall =
        FilterImpl.createFilter(new SimpleString("AMQSize > " + (encodeSize - 1)));
    Filter lessThanLarge =
        FilterImpl.createFilter(new SimpleString("AMQSize < " + (encodeSize + 1)));

    Filter lessThanSmall = FilterImpl.createFilter(new SimpleString("AMQSize < " + encodeSize));
    Filter moreThanLarge = FilterImpl.createFilter(new SimpleString("AMQSize > " + encodeSize));

    Assert.assertTrue(moreThanSmall.match(message));
    Assert.assertTrue(lessThanLarge.match(message));

    Assert.assertFalse(lessThanSmall.match(message));
    Assert.assertFalse(moreThanLarge.match(message));
  }
  @Override
  public void initQueues(
      Map<Long, QueueBindingInfo> queueBindingInfosMap, List<QueueBindingInfo> queueBindingInfos)
      throws Exception {
    int duplicateID = 0;
    for (QueueBindingInfo queueBindingInfo : queueBindingInfos) {
      queueBindingInfosMap.put(queueBindingInfo.getId(), queueBindingInfo);

      Filter filter = FilterImpl.createFilter(queueBindingInfo.getFilterString());

      boolean isTopicIdentification =
          filter != null
              && filter.getFilterString() != null
              && filter
                  .getFilterString()
                  .toString()
                  .equals(ActiveMQServerImpl.GENERIC_IGNORED_FILTER);

      if (postOffice.getBinding(queueBindingInfo.getQueueName()) != null) {

        if (isTopicIdentification) {
          long tx = storageManager.generateID();
          storageManager.deleteQueueBinding(tx, queueBindingInfo.getId());
          storageManager.commitBindings(tx);
          continue;
        } else {

          SimpleString newName = queueBindingInfo.getQueueName().concat("-" + (duplicateID++));
          ActiveMQServerLogger.LOGGER.queueDuplicatedRenaming(
              queueBindingInfo.getQueueName().toString(), newName.toString());
          queueBindingInfo.replaceQueueName(newName);
        }
      }

      PageSubscription subscription = null;

      if (!isTopicIdentification) {
        subscription =
            pagingManager
                .getPageStore(queueBindingInfo.getAddress())
                .getCursorProvider()
                .createSubscription(queueBindingInfo.getId(), filter, true);
      }

      Queue queue =
          queueFactory.createQueue(
              queueBindingInfo.getId(),
              queueBindingInfo.getAddress(),
              queueBindingInfo.getQueueName(),
              filter,
              subscription,
              queueBindingInfo.getUser(),
              true,
              false,
              queueBindingInfo.isAutoCreated());

      if (queueBindingInfo.isAutoCreated()) {
        queue.setConsumersRefCount(
            new AutoCreatedQueueManagerImpl(
                ((PostOfficeImpl) postOffice).getServer().getJMSQueueDeleter(),
                queueBindingInfo.getQueueName()));
      }

      Binding binding =
          new LocalQueueBinding(queueBindingInfo.getAddress(), queue, nodeManager.getNodeId());

      queues.put(queueBindingInfo.getId(), queue);

      postOffice.addBinding(binding);

      managementService.registerAddress(queueBindingInfo.getAddress());
      managementService.registerQueue(queue, queueBindingInfo.getAddress(), storageManager);
    }
  }
Ejemplo n.º 22
0
  @Test
  public void testStringLikeUnderbarWildcard() throws Exception {
    // test LIKE operator with the _ wildcard, which
    // matches any single character

    // first, some tests with the wildcard by itself
    filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '_'"));
    Assert.assertFalse(filter.match(message));

    // test match against single character
    doPutStringProperty("MyString", "a");
    Assert.assertTrue(filter.match(message));

    // test match failure against multiple characters
    doPutStringProperty("MyString", "aaaaa");
    Assert.assertTrue(!filter.match(message));

    // test match failure against the empty string
    doPutStringProperty("MyString", "");
    Assert.assertTrue(!filter.match(message));

    // next, tests with wildcard at the beginning of the string
    filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '_bcdf'"));

    // test match at beginning of string
    doPutStringProperty("MyString", "abcdf");
    Assert.assertTrue(filter.match(message));

    // match failure in first character after wildcard
    doPutStringProperty("MyString", "aXcdf");
    Assert.assertTrue(!filter.match(message));

    // match failure in middle character
    doPutStringProperty("MyString", "abXdf");
    Assert.assertTrue(!filter.match(message));

    // match failure in last character
    doPutStringProperty("MyString", "abcdX");
    Assert.assertTrue(!filter.match(message));

    // match failure with empty string
    doPutStringProperty("MyString", "");
    Assert.assertTrue(!filter.match(message));

    // match failure due to extra characters at beginning
    doPutStringProperty("MyString", "XXXabcdf");
    Assert.assertTrue(!filter.match(message));

    // match failure due to extra characters at the end
    doPutStringProperty("MyString", "abcdfXXX");
    Assert.assertTrue(!filter.match(message));

    // test that the _ wildcard does not match the 'empty' character
    doPutStringProperty("MyString", "bcdf");
    Assert.assertTrue(!filter.match(message));

    // next, tests with wildcard at the end of the string
    filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'abcd_'"));

    // test match at end of string
    doPutStringProperty("MyString", "abcdf");
    Assert.assertTrue(filter.match(message));

    // match failure in first character before wildcard
    doPutStringProperty("MyString", "abcXf");
    Assert.assertTrue(!filter.match(message));

    // match failure in middle character
    doPutStringProperty("MyString", "abXdf");
    Assert.assertTrue(!filter.match(message));

    // match failure in first character
    doPutStringProperty("MyString", "Xbcdf");
    Assert.assertTrue(!filter.match(message));

    // match failure with empty string
    doPutStringProperty("MyString", "");
    Assert.assertTrue(!filter.match(message));

    // match failure due to extra characters at beginning
    doPutStringProperty("MyString", "XXXabcdf");
    Assert.assertTrue(!filter.match(message));

    // match failure due to extra characters at the end
    doPutStringProperty("MyString", "abcdfXXX");
    Assert.assertTrue(!filter.match(message));

    // test that the _ wildcard does not match the 'empty' character
    doPutStringProperty("MyString", "abcd");
    Assert.assertTrue(!filter.match(message));

    // test match in middle of string

    // next, tests with wildcard in the middle of the string
    filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'ab_df'"));

    // test match in the middle of string
    doPutStringProperty("MyString", "abcdf");
    Assert.assertTrue(filter.match(message));

    // match failure in first character before wildcard
    doPutStringProperty("MyString", "aXcdf");
    Assert.assertTrue(!filter.match(message));

    // match failure in first character after wildcard
    doPutStringProperty("MyString", "abcXf");
    Assert.assertTrue(!filter.match(message));

    // match failure in last character
    doPutStringProperty("MyString", "abcdX");
    Assert.assertTrue(!filter.match(message));

    // match failure with empty string
    doPutStringProperty("MyString", "");
    Assert.assertTrue(!filter.match(message));

    // match failure due to extra characters at beginning
    doPutStringProperty("MyString", "XXXabcdf");
    Assert.assertTrue(!filter.match(message));

    // match failure due to extra characters at the end
    doPutStringProperty("MyString", "abcdfXXX");
    Assert.assertTrue(!filter.match(message));

    // test that the _ wildcard does not match the 'empty' character
    doPutStringProperty("MyString", "abdf");
    Assert.assertTrue(!filter.match(message));

    // test match failures
  }
Ejemplo n.º 23
0
  @Test
  public void testStringLikePunctuation() throws Exception {
    // test proper handling of some punctuation characters.
    // non-trivial since the underlying implementation might
    // (and in fact currently does) use a general-purpose
    // RE library, which has a different notion of which
    // characters are wildcards

    // the particular tests here are motivated by the
    // wildcards of the current underlying RE engine,
    // GNU regexp.

    filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'a^$b'"));
    Assert.assertFalse(filter.match(message));

    doPutStringProperty("MyString", "a^$b");
    Assert.assertTrue(filter.match(message));

    // this one has a double backslash since backslash
    // is interpreted specially by Java
    filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'a\\dc'"));
    doPutStringProperty("MyString", "a\\dc");
    Assert.assertTrue(filter.match(message));

    filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'a.c'"));
    doPutStringProperty("MyString", "abc");
    Assert.assertTrue(!filter.match(message));

    filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '[abc]'"));
    doPutStringProperty("MyString", "[abc]");
    Assert.assertTrue(filter.match(message));

    filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '[^abc]'"));
    doPutStringProperty("MyString", "[^abc]");
    Assert.assertTrue(filter.match(message));

    filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '[a-c]'"));
    doPutStringProperty("MyString", "[a-c]");
    Assert.assertTrue(filter.match(message));

    filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '[:alpha]'"));
    doPutStringProperty("MyString", "[:alpha]");
    Assert.assertTrue(filter.match(message));

    filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '(abc)'"));
    doPutStringProperty("MyString", "(abc)");
    Assert.assertTrue(filter.match(message));

    filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'a|bc'"));
    doPutStringProperty("MyString", "a|bc");
    Assert.assertTrue(filter.match(message));

    filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '(abc)?'"));
    doPutStringProperty("MyString", "(abc)?");
    Assert.assertTrue(filter.match(message));

    filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '(abc)*'"));
    doPutStringProperty("MyString", "(abc)*");
    Assert.assertTrue(filter.match(message));

    filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '(abc)+'"));
    doPutStringProperty("MyString", "(abc)+");
    Assert.assertTrue(filter.match(message));

    filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '(abc){3}'"));
    doPutStringProperty("MyString", "(abc){3}");
    Assert.assertTrue(filter.match(message));

    filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '(abc){3,5}'"));
    doPutStringProperty("MyString", "(abc){3,5}");
    Assert.assertTrue(filter.match(message));

    filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '(abc){3,}'"));
    doPutStringProperty("MyString", "(abc){3,}");
    Assert.assertTrue(filter.match(message));

    filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '(?=abc)'"));
    doPutStringProperty("MyString", "(?=abc)");
    Assert.assertTrue(filter.match(message));

    filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '(?!abc)'"));
    doPutStringProperty("MyString", "(?!abc)");
    Assert.assertTrue(filter.match(message));
  }
Ejemplo n.º 24
0
  @Test
  public void testStringLikePercentWildcard() throws Exception {
    // test LIKE operator with the % wildcard, which
    // matches any sequence of characters
    // note many of the tests are similar to those for _

    // first, some tests with the wildcard by itself
    filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '%'"));
    Assert.assertFalse(filter.match(message));

    // test match against single character
    doPutStringProperty("MyString", "a");
    Assert.assertTrue(filter.match(message));

    // test match against multiple characters
    doPutStringProperty("MyString", "aaaaa");
    Assert.assertTrue(filter.match(message));

    doPutStringProperty("MyString", "abcdf");
    Assert.assertTrue(filter.match(message));

    // test match against the empty string
    doPutStringProperty("MyString", "");
    Assert.assertTrue(filter.match(message));

    // next, tests with wildcard at the beginning of the string
    filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '%bcdf'"));

    // test match with single character at beginning of string
    doPutStringProperty("MyString", "Xbcdf");
    Assert.assertTrue(filter.match(message));

    // match with multiple characters at beginning
    doPutStringProperty("MyString", "XXbcdf");
    Assert.assertTrue(filter.match(message));

    // match failure in middle character
    doPutStringProperty("MyString", "abXdf");
    Assert.assertTrue(!filter.match(message));

    // match failure in last character
    doPutStringProperty("MyString", "abcdX");
    Assert.assertTrue(!filter.match(message));

    // match failure with empty string
    doPutStringProperty("MyString", "");
    Assert.assertTrue(!filter.match(message));

    // match failure due to extra characters at the end
    doPutStringProperty("MyString", "abcdfXXX");
    Assert.assertTrue(!filter.match(message));

    // test that the % wildcard matches the empty string
    doPutStringProperty("MyString", "bcdf");
    Assert.assertTrue(filter.match(message));

    // next, tests with wildcard at the end of the string
    filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'abcd%'"));

    // test match of single character at end of string
    doPutStringProperty("MyString", "abcdf");
    Assert.assertTrue(filter.match(message));

    // test match of multiple characters at end of string
    doPutStringProperty("MyString", "abcdfgh");
    Assert.assertTrue(filter.match(message));

    // match failure in first character before wildcard
    doPutStringProperty("MyString", "abcXf");
    Assert.assertTrue(!filter.match(message));

    // match failure in middle character
    doPutStringProperty("MyString", "abXdf");
    Assert.assertTrue(!filter.match(message));

    // match failure in first character
    doPutStringProperty("MyString", "Xbcdf");
    Assert.assertTrue(!filter.match(message));

    // match failure with empty string
    doPutStringProperty("MyString", "");
    Assert.assertTrue(!filter.match(message));

    // match failure due to extra characters at beginning
    doPutStringProperty("MyString", "XXXabcdf");
    Assert.assertTrue(!filter.match(message));

    // test that the % wildcard matches the empty string
    doPutStringProperty("MyString", "abcd");
    Assert.assertTrue(filter.match(message));

    // next, tests with wildcard in the middle of the string
    filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'ab%df'"));

    // test match with single character in the middle of string
    doPutStringProperty("MyString", "abXdf");
    Assert.assertTrue(filter.match(message));

    // test match with multiple characters in the middle of string
    doPutStringProperty("MyString", "abXXXdf");
    Assert.assertTrue(filter.match(message));

    // match failure in first character before wildcard
    doPutStringProperty("MyString", "aXcdf");
    Assert.assertTrue(!filter.match(message));

    // match failure in first character after wildcard
    doPutStringProperty("MyString", "abcXf");
    Assert.assertTrue(!filter.match(message));

    // match failure in last character
    doPutStringProperty("MyString", "abcdX");
    Assert.assertTrue(!filter.match(message));

    // match failure with empty string
    doPutStringProperty("MyString", "");
    Assert.assertTrue(!filter.match(message));

    // match failure due to extra characters at beginning
    doPutStringProperty("MyString", "XXXabcdf");
    Assert.assertTrue(!filter.match(message));

    // match failure due to extra characters at the end
    doPutStringProperty("MyString", "abcdfXXX");
    Assert.assertTrue(!filter.match(message));

    // test that the % wildcard matches the empty string
    doPutStringProperty("MyString", "abdf");
    Assert.assertTrue(filter.match(message));
  }