use of org.apache.commons.jexl2.parser.ASTJexlScript in project datawave by NationalSecurityAgency.
the class PushdownNegationVisitorTest method testNestedAnd.
@Test
public void testNestedAnd() throws ParseException {
ASTJexlScript query = JexlASTHelper.parseJexlQuery("!(F1 == 'v1' && F2 == 'v2' && (F3 == 'v3' || F4 == 'v4'))");
JexlNode result = PushdownNegationVisitor.pushdownNegations(query);
Assert.assertEquals("((!(F1 == 'v1') || !(F2 == 'v2') || (((!(F3 == 'v3') && !(F4 == 'v4'))))))", JexlStringBuildingVisitor.buildQuery(result));
}
use of org.apache.commons.jexl2.parser.ASTJexlScript in project datawave by NationalSecurityAgency.
the class PushdownNegationVisitorTest method testNestedAndMixedCancels.
@Test
public void testNestedAndMixedCancels() throws ParseException {
ASTJexlScript query = JexlASTHelper.parseJexlQuery("!(F1 != 'v1' && !F2 == 'v2' && (F3 == 'v3' || F4 == 'v4'))");
JexlNode result = PushdownNegationVisitor.pushdownNegations(query);
Assert.assertEquals("(((F1 == 'v1') || (F2 == 'v2') || (((!(F3 == 'v3') && !(F4 == 'v4'))))))", JexlStringBuildingVisitor.buildQuery(result));
}
use of org.apache.commons.jexl2.parser.ASTJexlScript in project datawave by NationalSecurityAgency.
the class PushdownNegationVisitorTest method testAnd.
@Test
public void testAnd() throws ParseException {
ASTJexlScript query = JexlASTHelper.parseJexlQuery("!(F1 == 'v1' && F2 == 'v2')");
visitor.visit(query, null);
Assert.assertEquals("((!(F1 == 'v1') || !(F2 == 'v2')))", JexlStringBuildingVisitor.buildQuery(query));
}
use of org.apache.commons.jexl2.parser.ASTJexlScript in project datawave by NationalSecurityAgency.
the class PushdownNegationVisitorTest method testExceededTermPropertyMarkerPropagate.
@Test
public void testExceededTermPropertyMarkerPropagate() throws ParseException {
ASTJexlScript query = JexlASTHelper.parseJexlQuery("!((_Term_ = true) && (F1 == 'v1' || F2 == 'v2'))");
JexlNode result = PushdownNegationVisitor.pushdownNegations(query);
Assert.assertEquals("!((_Term_ = true) && (F1 == 'v1' || F2 == 'v2'))", JexlStringBuildingVisitor.buildQuery(result));
}
use of org.apache.commons.jexl2.parser.ASTJexlScript in project datawave by NationalSecurityAgency.
the class PushdownNegationVisitorTest method testNENotNegated.
@Test
public void testNENotNegated() throws ParseException {
ASTJexlScript query = JexlASTHelper.parseJexlQuery("!(F1 == 'v1') && F2 != 'v2'");
JexlNode result = PushdownNegationVisitor.pushdownNegations(query);
Assert.assertEquals("!(F1 == 'v1') && F2 != 'v2'", JexlStringBuildingVisitor.buildQuery(result));
}
Aggregations