use of org.apache.commons.jexl3.parser.ASTJexlScript in project datawave by NationalSecurityAgency.
the class PushdownNegationVisitorTest method testNestedOrMixedCancels.
@Test
public void testNestedOrMixedCancels() 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.jexl3.parser.ASTJexlScript in project datawave by NationalSecurityAgency.
the class PushdownNegationVisitorTest method testBoundedRangeNoPropagation.
@Test
public void testBoundedRangeNoPropagation() throws ParseException {
ASTJexlScript query = JexlASTHelper.parseJexlQuery("F3 == 'v3' || !((_Bounded_ = true) && (F1 >= 'v1' && F1 <= 'v2'))");
JexlNode result = PushdownNegationVisitor.pushdownNegations(query);
Assert.assertEquals("F3 == 'v3' || !((_Bounded_ = true) && (F1 >= 'v1' && F1 <= 'v2'))", JexlStringBuildingVisitor.buildQuery(result));
}
use of org.apache.commons.jexl3.parser.ASTJexlScript in project datawave by NationalSecurityAgency.
the class PushdownNegationVisitorTest method testEvaluationOnlyPropertyMarkerPropagate.
@Test
public void testEvaluationOnlyPropertyMarkerPropagate() throws ParseException {
ASTJexlScript query = JexlASTHelper.parseJexlQuery("!((_Eval_ = true) && (F1 == 'v1' || F2 == 'v2'))");
JexlNode result = PushdownNegationVisitor.pushdownNegations(query);
Assert.assertEquals("((_Eval_ = true) && ((!(F1 == 'v1') && !(F2 == 'v2'))))", JexlStringBuildingVisitor.buildQuery(result));
}
use of org.apache.commons.jexl3.parser.ASTJexlScript in project datawave by NationalSecurityAgency.
the class PushdownNegationVisitorTest method testMixedBoundedRanges.
@Test
public void testMixedBoundedRanges() throws ParseException {
ASTJexlScript query = JexlASTHelper.parseJexlQuery("(F3 == 'v3' || !(((_Bounded_ = true) && (F1 >= 'v1' && F2 <= 'v2')) || !((_Bounded_ = true) && (F1 >= 'v1' && F1 <= 'v2'))))");
JexlNode result = PushdownNegationVisitor.pushdownNegations(query);
Assert.assertEquals("(F3 == 'v3' || ((!(((_Bounded_ = true) && (F1 >= 'v1' && F2 <= 'v2'))) && (((_Bounded_ = true) && (F1 >= 'v1' && F1 <= 'v2'))))))", JexlStringBuildingVisitor.buildQuery(result));
}
use of org.apache.commons.jexl3.parser.ASTJexlScript in project datawave by NationalSecurityAgency.
the class PushdownNegationVisitorTest method testER.
@Test
public void testER() throws ParseException {
ASTJexlScript query = JexlASTHelper.parseJexlQuery("!(F1 =~ 'v1')");
visitor.visit(query, null);
Assert.assertEquals("!(F1 =~ 'v1')", JexlStringBuildingVisitor.buildQuery(query));
}
Aggregations