Package org.jboss.jms.selector

Examples of org.jboss.jms.selector.Selector


      int consumerID = connectionEndpoint.getServerPeer().getNextObjectID();
     
      Binding binding = null;
     
      // Always validate the selector first
      Selector selector = null;
      if (selectorString != null)
      {
         selector = new Selector(selectorString);
      }
     
      if (jmsDestination.isTopic())
      {
         JMSCondition topicCond = new JMSCondition(false, jmsDestination.getName());
View Full Code Here


      if (selector != null)
      {
         if (trace) { log.trace("creating selector:" + selector); }

         this.messageSelector = new Selector(selector);
         if (trace) { log.trace("created selector"); }
      }

      this.started = this.sessionEndpoint.getConnectionEndpoint().isStarted();
     
View Full Code Here

      if (binding == null)
      {
         throw new IllegalArgumentException("Cannot find subscription with id " + subId);
      }
     
      Selector sel = null;
     
      if (selector != null && "".equals(selector.trim()))
      {
         selector = null;
      }
        
      if (selector != null)
      { 
         sel = new Selector(selector);
      }
     
      List allMsgs = binding.getQueue().browse(sel);
     
      Iterator iter = allMsgs.iterator();
View Full Code Here

      return this.listMessages(NON_DURABLE, selector);
   }
  
   private List listMessages(int type, String selector) throws Exception
   {
      Selector sel = null;
                       
      if (selector != null && "".equals(selector.trim()))
      {
         selector = null;
      }
     
      if (selector != null)
      {       
         sel = new Selector(selector);
      }
     
      List msgs = new ArrayList();
     
      List allMsgs = queue.browse(sel);
View Full Code Here

      this.id = id;
      this.destination = destination;

    if (messageSelector != null)
    { 
      filter = new Selector(messageSelector);   
    }
   }
View Full Code Here

      message = new JBossMessage(0);
   }
  
   public void testBooleanTrue() throws Exception
   {
      selector = new Selector("MyBoolean=true");
      testBoolean("MyBoolean", true);
   }
View Full Code Here

      testBoolean("MyBoolean", true);
   }
  
   public void testBooleanFalse() throws Exception
   {
      selector = new Selector("MyBoolean=false");
      testBoolean("MyBoolean", false);
   }
View Full Code Here

   }
  
   public void testStringEquals() throws Exception
   {
      // First, simple test of string equality and inequality
      selector = new Selector("MyString='astring'");
     
      message.setStringProperty("MyString", "astring");
      assertTrue(selector.accept(message));
     
      message.setStringProperty("MyString", "NOTastring");
      assertTrue(!selector.accept(message));
     
      // test empty string
      selector = new Selector("MyString=''");
     
      message.setStringProperty("MyString", "");
      assertTrue("test 1", selector.accept(message));
     
      message.setStringProperty("MyString", "NOTastring");
      assertTrue("test 2", !selector.accept(message));
     
      // test literal apostrophes (which are escaped using two apostrophes
      // in selectors)
      selector = new Selector("MyString='test JBoss''s selector'");
     
      // note: apostrophes are not escaped in string properties
      message.setStringProperty("MyString", "test JBoss's selector");
      // this test fails -- bug 530120
      //assertTrue("test 3", selector.accept(message));
View Full Code Here

   }
  
   public void testStringLike() throws Exception
   {
      // test LIKE operator with no wildcards
      selector = new Selector("MyString LIKE 'astring'");
     
      // test where LIKE operand matches
      message.setStringProperty("MyString", "astring");
      assertTrue(selector.accept(message));
     
      // test one character string
      selector = new Selector("MyString LIKE 'a'");
      message.setStringProperty("MyString","a");
      assertTrue(selector.accept(message));
     
      // test empty string
      selector = new Selector("MyString LIKE ''");
      message.setStringProperty("MyString", "");
      assertTrue(selector.accept(message));
     
      // tests where operand does not match
      selector = new Selector("MyString LIKE 'astring'");
     
      // test with extra characters at beginning
      message.setStringProperty("MyString", "NOTastring");
      assertTrue(!selector.accept(message));
     
View Full Code Here

   {
      // test LIKE operator with the _ wildcard, which
      // matches any single character
     
      // first, some tests with the wildcard by itself
      selector = new Selector("MyString LIKE '_'");
     
      // test match against single character
      message.setStringProperty("MyString", "a");
      assertTrue(selector.accept(message));
     
      // test match failure against multiple characters
      message.setStringProperty("MyString", "aaaaa");
      assertTrue(!selector.accept(message));
     
      // test match failure against the empty string
      message.setStringProperty("MyString", "");
      assertTrue(!selector.accept(message));
     
     
      // next, tests with wildcard at the beginning of the string
      selector = new Selector("MyString LIKE '_bcdf'");
     
      // test match at beginning of string
      message.setStringProperty("MyString", "abcdf");
      assertTrue(selector.accept(message));
     
      // match failure in first character after wildcard
      message.setStringProperty("MyString", "aXcdf");
      assertTrue(!selector.accept(message));
     
      // match failure in middle character
      message.setStringProperty("MyString", "abXdf");
      assertTrue(!selector.accept(message));
     
      // match failure in last character
      message.setStringProperty("MyString", "abcdX");
      assertTrue(!selector.accept(message));
     
      // match failure with empty string
      message.setStringProperty("MyString", "");
      assertTrue(!selector.accept(message));
     
      // match failure due to extra characters at beginning
      message.setStringProperty("MyString", "XXXabcdf");
      assertTrue(!selector.accept(message));
     
      // match failure due to extra characters at the end
      message.setStringProperty("MyString", "abcdfXXX");
      assertTrue(!selector.accept(message));
     
      // test that the _ wildcard does not match the 'empty' character
      message.setStringProperty("MyString", "bcdf");
      assertTrue(!selector.accept(message));
     
      // next, tests with wildcard at the end of the string
      selector = new Selector("MyString LIKE 'abcd_'");
     
      // test match at end of string
      message.setStringProperty("MyString", "abcdf");
      assertTrue(selector.accept(message));
     
      // match failure in first character before wildcard
      message.setStringProperty("MyString", "abcXf");
      assertTrue(!selector.accept(message));
     
      // match failure in middle character
      message.setStringProperty("MyString", "abXdf");
      assertTrue(!selector.accept(message));
     
      // match failure in first character
      message.setStringProperty("MyString", "Xbcdf");
      assertTrue(!selector.accept(message));
     
      // match failure with empty string
      message.setStringProperty("MyString", "");
      assertTrue(!selector.accept(message));
     
      // match failure due to extra characters at beginning
      message.setStringProperty("MyString", "XXXabcdf");
      assertTrue(!selector.accept(message));
     
      // match failure due to extra characters at the end
      message.setStringProperty("MyString", "abcdfXXX");
      assertTrue(!selector.accept(message));
     
      // test that the _ wildcard does not match the 'empty' character
      message.setStringProperty("MyString", "abcd");
      assertTrue(!selector.accept(message));
     
      // test match in middle of string
     
      // next, tests with wildcard in the middle of the string
      selector = new Selector("MyString LIKE 'ab_df'");
     
      // test match in the middle of string
      message.setStringProperty("MyString", "abcdf");
      assertTrue(selector.accept(message));
     
View Full Code Here

TOP

Related Classes of org.jboss.jms.selector.Selector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.