use of org.apache.commons.jexl3.parser.ASTJexlScript in project datawave by NationalSecurityAgency.
the class RootNegationCheckVisitorTest method testEq.
@Test
public void testEq() throws ParseException {
ASTJexlScript script = JexlASTHelper.parseJexlQuery("FOO == 'bar'");
Assert.assertFalse(RootNegationCheckVisitor.hasTopLevelNegation(script));
}
use of org.apache.commons.jexl3.parser.ASTJexlScript in project datawave by NationalSecurityAgency.
the class RootNegationCheckVisitorTest method testNEq.
@Test
public void testNEq() throws ParseException {
ASTJexlScript script = JexlASTHelper.parseJexlQuery("FOO != 'bar'");
Assert.assertTrue(RootNegationCheckVisitor.hasTopLevelNegation(script));
}
use of org.apache.commons.jexl3.parser.ASTJexlScript in project datawave by NationalSecurityAgency.
the class RootNegationCheckVisitorTest method testWrappedNEq.
@Test
public void testWrappedNEq() throws ParseException {
ASTJexlScript script = JexlASTHelper.parseJexlQuery("!(FOO != 'bar')");
Assert.assertFalse(RootNegationCheckVisitor.hasTopLevelNegation(script));
}
use of org.apache.commons.jexl3.parser.ASTJexlScript in project datawave by NationalSecurityAgency.
the class UniqueExpressionTermsVisitorTest method visitAndValidate.
private void visitAndValidate(String original, String expected) throws ParseException {
ASTJexlScript originalScript = JexlASTHelper.parseJexlQuery(original);
// Remove duplicate terms from within expressions.
ASTJexlScript visitedScript = UniqueExpressionTermsVisitor.enforce(originalScript);
// Verify the script is as expected, and has a valid lineage.
JexlNodeAssert.assertThat(visitedScript).isEqualTo(expected).hasValidLineage();
// Verify the original script was not modified, and still has a valid lineage.
JexlNodeAssert.assertThat(originalScript).isEqualTo(original).hasValidLineage();
}
use of org.apache.commons.jexl3.parser.ASTJexlScript in project datawave by NationalSecurityAgency.
the class ValidComparisonVisitorTest method testMethodNode.
@Test
public void testMethodNode() throws ParseException {
String queryString = "AG.greaterThan(39).size() >= 1";
ASTJexlScript script = JexlASTHelper.parseJexlQuery(queryString);
ValidComparisonVisitor.check(script);
}
Aggregations