private Criteria getSimpliedCriteria(Criteria crit, Expression a, boolean outcome, boolean nullPossible) { if (nullPossible) { if (outcome) { if (processing) { return crit; } IsNullCriteria inc = new IsNullCriteria(a); inc.setNegated(true); return inc; } } else if (outcome) { return TRUE_CRITERIA; } return FALSE_CRITERIA; }
private Criteria getSimpliedCriteria(Criteria crit, Expression a, boolean outcome, boolean nullPossible) { if (nullPossible) { if (outcome) { if (processing) { return crit; } IsNullCriteria inc = new IsNullCriteria(a); inc.setNegated(true); return inc; } } else if (outcome) { return TRUE_CRITERIA; } return FALSE_CRITERIA; }
/** * Deep copy of object * @return Deep copy of object */ public Object clone() { Expression copy = null; if(getExpression() != null) { copy = (Expression) getExpression().clone(); } IsNullCriteria criteriaCopy = new IsNullCriteria(copy); criteriaCopy.setNegated(isNegated()); return criteriaCopy; }
public static IsNullCriteria helpExample(boolean negated) { IsNullCriteria crit = new IsNullCriteria(TestElementImpl.helpExample("vm1.g1", "e1")); //$NON-NLS-1$ //$NON-NLS-2$ crit.setNegated(negated); return crit; }
@Test public void testIsNullCriteria3() { IsNullCriteria inc = new IsNullCriteria(); helpTest(inc, "<undefined> IS NULL"); //$NON-NLS-1$ }
/** * Deep copy of object * @return Deep copy of object */ public Object clone() { Expression copy = null; if(getExpression() != null) { copy = (Expression) getExpression().clone(); } IsNullCriteria criteriaCopy = new IsNullCriteria(copy); criteriaCopy.setNegated(isNegated()); return criteriaCopy; }
/** * Deep copy of object * @return Deep copy of object */ public Object clone() { Expression copy = null; if(getExpression() != null) { copy = (Expression) getExpression().clone(); } IsNullCriteria criteriaCopy = new IsNullCriteria(copy); criteriaCopy.setNegated(isNegated()); return criteriaCopy; }
public static IsNullCriteria example(String element, boolean negated) { IsNullCriteria crit = new IsNullCriteria(); crit.setNegated(negated); crit.setExpression(new ElementSymbol(element)); return crit; }
public void testVisitIsNullCriteria() { IsNullCriteria inc = new IsNullCriteria(exampleElement(true, 0)); helpTest(inc, getSymbolMap()); }
@Test public void testNotCriteria1() { NotCriteria not = new NotCriteria(new IsNullCriteria(new ElementSymbol("m.g.e1"))); //$NON-NLS-1$ helpTest(not, "NOT (m.g.e1 IS NULL)"); //$NON-NLS-1$ }
@Test public void testIsNullCriteria1() { IsNullCriteria inc = new IsNullCriteria(); inc.setExpression(new Constant("abc")); //$NON-NLS-1$ helpTest(inc, "'abc' IS NULL"); //$NON-NLS-1$ }
public void testSelfEquivalence(){ IsNullCriteria c1 = new IsNullCriteria(); c1.setNegated(true); c1.setExpression(new Constant("abc")); //$NON-NLS-1$ int equals = 0; UnitTestUtil.helpTestEquivalence(equals, c1, c1); }
@Test public void testIsNullCriteria2() { IsNullCriteria inc = new IsNullCriteria(); inc.setExpression(new ElementSymbol("m.g.e1")); //$NON-NLS-1$ helpTest(inc, "m.g.e1 IS NULL"); //$NON-NLS-1$ }
@Test public void testCompoundNonJoinCriteriaInFromWithIsNull() { helpTestCompoundNonJoinCriteria("e2 IS NULL", new IsNullCriteria(new ElementSymbol("e2"))); //$NON-NLS-1$ //$NON-NLS-2$ }
private void helpTestIsNull(String value, boolean negated, boolean expectedMatch) throws ExpressionEvaluationException, BlockedException, TeiidComponentException { IsNullCriteria criteria = new IsNullCriteria(new Constant(value)); criteria.setNegated(negated); boolean result = Evaluator.evaluate(criteria); assertEquals("Result did not match expected value", expectedMatch, result); //$NON-NLS-1$ }
@Test public void testIsNullCriteria4() { IsNullCriteria inc = new IsNullCriteria(); inc.setExpression(new ElementSymbol("m.g.e1")); //$NON-NLS-1$ inc.setNegated(true); helpTest(inc, "m.g.e1 IS NOT NULL"); //$NON-NLS-1$ }
@Test public void testIsNull1() throws Exception { assertEquals(Boolean.FALSE, Evaluator.evaluate(new IsNullCriteria(new Constant(Boolean.TRUE, DataTypeManager.DefaultDataClasses.BOOLEAN)))); }
@Test public void testIsNull() throws Exception { assertEquals(Boolean.TRUE, Evaluator.evaluate(new IsNullCriteria(new Constant(null, DataTypeManager.DefaultDataClasses.BOOLEAN)))); }
@Test public void testIsNull4() throws Exception { IsNullCriteria inc = new IsNullCriteria(new Constant(Boolean.TRUE, DataTypeManager.DefaultDataClasses.BOOLEAN)); inc.setNegated(true); assertEquals(Boolean.TRUE, Evaluator.evaluate(inc)); }
@Test public void testIsNull3() throws Exception { IsNullCriteria inc = new IsNullCriteria(new Constant(null, DataTypeManager.DefaultDataClasses.BOOLEAN)); inc.setNegated(true); assertEquals(Boolean.FALSE, Evaluator.evaluate(inc)); }