Package org.hornetq.core.filter.impl

Examples of org.hornetq.core.filter.impl.Operator


   // Attributes ----------------------------------------------------

   // Static --------------------------------------------------------
   private static void assertSuccess(final int op, final Object arg1, final Object expectedResult) throws Exception
   {
      OperatorTest.assertOperationSuccess(new Operator(op, arg1), expectedResult);
   }
View Full Code Here


      OperatorTest.assertOperationSuccess(new Operator(op, arg1), expectedResult);
   }

   private static void assertSuccess(final int op, final Object arg1, final Object arg2, final Object expectedResult) throws Exception
   {
      OperatorTest.assertOperationSuccess(new Operator(op, arg1, arg2), expectedResult);
   }
View Full Code Here

                                     final Object arg1,
                                     final Object arg2,
                                     final Object arg3,
                                     final Object expectedResult) throws Exception
   {
      OperatorTest.assertOperationSuccess(new Operator(op, arg1, arg2, arg3), expectedResult);
   }
View Full Code Here

      Assert.assertEquals(expectedResult, operator.apply());
   }

   private static void assertFailure(final int op, final Object arg1) throws Exception
   {
      OperatorTest.assertOperationFailure(new Operator(op, arg1));
   }
View Full Code Here

      OperatorTest.assertOperationFailure(new Operator(op, arg1));
   }

   private static void assertFailure(final int op, final Object arg1, final Object arg2) throws Exception
   {
      OperatorTest.assertOperationFailure(new Operator(op, arg1, arg2));
   }
View Full Code Here

      OperatorTest.assertOperationFailure(new Operator(op, arg1, arg2));
   }

   private static void assertFailure(final int op, final Object arg1, final Object arg2, final Object arg3) throws Exception
   {
      OperatorTest.assertOperationFailure(new Operator(op, arg1, arg2, arg3));
   }
View Full Code Here

   public void testSimpleUnary() throws Exception
   {
      // Neg Long
      FilterParserTest.log.trace("parse(-12345 = -1 * 12345)");
      Operator result = (Operator)parser.parse(new SimpleString("-12345 = -1 * 12345"), identifierMap);
      FilterParserTest.log.trace("result -> " + result);
      Boolean b = (Boolean)result.apply();
      Assert.assertTrue("is true", b.booleanValue());

      // Neg Double
      FilterParserTest.log.trace("parse(-1 * 12345.67 = -12345.67)");
      result = (Operator)parser.parse(new SimpleString("-1 * 12345.67 = -12345.67"), identifierMap);
      FilterParserTest.log.trace("result -> " + result);
      b = (Boolean)result.apply();
      Assert.assertTrue("is true", b.booleanValue());

      FilterParserTest.log.trace("parse(-(1 * 12345.67) = -12345.67)");
      result = (Operator)parser.parse(new SimpleString("-(1 * 12345.67) = -12345.67"), identifierMap);
      FilterParserTest.log.trace("result -> " + result);
      b = (Boolean)result.apply();
      Assert.assertTrue("is true", b.booleanValue());
   }
View Full Code Here

   }

   public void testPrecedenceNAssoc() throws Exception
   {
      FilterParserTest.log.trace("parse(4 + 2 * 3 / 2 = 7)");
      Operator result = (Operator)parser.parse(new SimpleString("4 + 2 * 3 / 2 = 7"), identifierMap);
      FilterParserTest.log.trace("result -> " + result);
      Boolean b = (Boolean)result.apply();
      Assert.assertTrue("is true", b.booleanValue());

      FilterParserTest.log.trace("parse(4 + ((2 * 3) / 2) = 7)");
      result = (Operator)parser.parse(new SimpleString("4 + ((2 * 3) / 2) = 7"), identifierMap);
      FilterParserTest.log.trace("result -> " + result);
      b = (Boolean)result.apply();
      Assert.assertTrue("is true", b.booleanValue());

      FilterParserTest.log.trace("parse(4 * -2 / -1 - 4 = 4)");
      result = (Operator)parser.parse(new SimpleString("4 * -2 / -1 - 4 = 4"), identifierMap);
      FilterParserTest.log.trace("result -> " + result);
      b = (Boolean)result.apply();
      Assert.assertTrue("is true", b.booleanValue());

      FilterParserTest.log.trace("parse(4 * ((-2 / -1) - 4) = -8)");
      result = (Operator)parser.parse(new SimpleString("4 * ((-2 / -1) - 4) = -8"), identifierMap);
      FilterParserTest.log.trace("result -> " + result);
      b = (Boolean)result.apply();
      Assert.assertTrue("is true", b.booleanValue());
   }
View Full Code Here

   }

   public void testIds() throws Exception
   {
      FilterParserTest.log.trace("parse(a + b * c / d = e)");
      Operator result = (Operator)parser.parse(new SimpleString("a + b * c / d = e"), identifierMap);
      // 4 + 2 * 3 / 2 = 7
      Identifier a = identifierMap.get(new SimpleString("a"));
      a.setValue(new Long(4));
      Identifier b = identifierMap.get(new SimpleString("b"));
      b.setValue(new Long(2));
      Identifier c = identifierMap.get(new SimpleString("c"));
      c.setValue(new Long(3));
      Identifier d = identifierMap.get(new SimpleString("d"));
      d.setValue(new Long(2));
      Identifier e = identifierMap.get(new SimpleString("e"));
      e.setValue(new Long(7));
      FilterParserTest.log.trace("result -> " + result);
      Boolean bool = (Boolean)result.apply();
      Assert.assertTrue("is true", bool.booleanValue());

   }
View Full Code Here

   }

   public void testTrueINOperator() throws Exception
   {
      FilterParserTest.log.trace("parse(Status IN ('new', 'cleared', 'acknowledged'))");
      Operator result = (Operator)parser.parse(new SimpleString("Status IN ('new', 'cleared', 'acknowledged')"),
                                               identifierMap);
      Identifier a = identifierMap.get(new SimpleString("Status"));
      a.setValue(new SimpleString("new"));
      FilterParserTest.log.trace("result -> " + result);
      Boolean bool = (Boolean)result.apply();
      Assert.assertTrue("is true", bool.booleanValue());
   }
View Full Code Here

TOP

Related Classes of org.hornetq.core.filter.impl.Operator

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.