Пример #1
0
 @Test
 public void testIntegerEq() throws Exception {
   ConstantExpression lt = GenPhyOp.exprConst();
   lt.setValue(new Integer(1));
   ConstantExpression rt = GenPhyOp.exprConst();
   rt.setValue(new Integer(1));
   NotEqualToExpr g = GenPhyOp.compNotEqualToExpr();
   g.setLhs(lt);
   g.setRhs(rt);
   g.setOperandType(DataType.INTEGER);
   Result r = g.getNextBoolean();
   assertEquals(POStatus.STATUS_OK, r.returnStatus);
   assertFalse((Boolean) r.result);
 }
Пример #2
0
 @Test
 public void testBooleanNe() throws Exception {
   ConstantExpression lt = GenPhyOp.exprConst();
   lt.setValue(Boolean.TRUE);
   ConstantExpression rt = GenPhyOp.exprConst();
   rt.setValue(Boolean.FALSE);
   NotEqualToExpr g = GenPhyOp.compNotEqualToExpr();
   g.setLhs(lt);
   g.setRhs(rt);
   g.setOperandType(DataType.BOOLEAN);
   Result r = g.getNextBoolean();
   assertEquals(POStatus.STATUS_OK, r.returnStatus);
   assertTrue((Boolean) r.result);
 }
Пример #3
0
 @Test
 public void testDataByteArrayNe() throws Exception {
   ConstantExpression lt = GenPhyOp.exprConst();
   lt.setValue(new DataByteArray("a"));
   ConstantExpression rt = GenPhyOp.exprConst();
   rt.setValue(new DataByteArray("b"));
   NotEqualToExpr g = GenPhyOp.compNotEqualToExpr();
   g.setLhs(lt);
   g.setRhs(rt);
   g.setOperandType(DataType.BYTEARRAY);
   Result r = g.getNextBoolean();
   assertEquals(POStatus.STATUS_OK, r.returnStatus);
   assertTrue((Boolean) r.result);
 }
Пример #4
0
 @Test
 public void testTupleNe() throws ExecException {
   Tuple tuple_1 = TupleFactory.getInstance().newTuple("item_1");
   Tuple tuple_2 = TupleFactory.getInstance().newTuple("item_2");
   ConstantExpression lt = GenPhyOp.exprConst();
   lt.setValue(tuple_1);
   ConstantExpression rt = GenPhyOp.exprConst();
   rt.setValue(tuple_2);
   NotEqualToExpr g = GenPhyOp.compNotEqualToExpr();
   g.setLhs(lt);
   g.setRhs(rt);
   g.setOperandType(DataType.TUPLE);
   Result r = g.getNextBoolean();
   assertEquals(POStatus.STATUS_OK, r.returnStatus);
   assertTrue((Boolean) r.result);
 }
Пример #5
0
  @Test
  public void testMapEq() throws ExecException {
    Map map_1 = new HashMap();
    map_1.put("key_1", "value_1");
    Map map_2 = new HashMap();
    map_2.put("key_1", "value_1");

    ConstantExpression lt = GenPhyOp.exprConst();
    lt.setValue(map_1);
    ConstantExpression rt = GenPhyOp.exprConst();
    rt.setValue(map_2);
    NotEqualToExpr g = GenPhyOp.compNotEqualToExpr();
    g.setLhs(lt);
    g.setRhs(rt);
    g.setOperandType(DataType.MAP);
    Result r = g.getNextBoolean();
    assertEquals(POStatus.STATUS_OK, r.returnStatus);
    assertFalse((Boolean) r.result);
  }
Пример #6
0
  public <U> void checkNullValues(byte operandType, U value) throws Exception {

    ConstantExpression lt = GenPhyOp.exprConst();
    ConstantExpression rt = GenPhyOp.exprConst();
    NotEqualToExpr g = GenPhyOp.compNotEqualToExpr();

    // test with null in lhs
    g.setOperandType(operandType);
    lt.setValue(null);
    rt.setValue(value);
    g.setLhs(lt);
    g.setRhs(rt);

    Result r = g.getNextBoolean();
    assertEquals(POStatus.STATUS_NULL, r.returnStatus);
    assertNull(r.result);

    // test with null in rhs
    g.setOperandType(operandType);
    lt.setValue(value);
    rt.setValue(null);
    g.setLhs(lt);
    g.setRhs(rt);

    r = g.getNextBoolean();
    assertEquals(POStatus.STATUS_NULL, r.returnStatus);
    assertNull(r.result);

    // test with null in lhs and rhs
    g.setOperandType(operandType);
    lt.setValue(null);
    rt.setValue(null);
    g.setLhs(lt);
    g.setRhs(rt);

    r = g.getNextBoolean();
    assertEquals(POStatus.STATUS_NULL, r.returnStatus);
    assertNull(r.result);
  }