use of org.apache.commons.jexl2.parser.ParseException 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.jexl2.parser.ParseException 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);
}
use of org.apache.commons.jexl2.parser.ParseException in project datawave by NationalSecurityAgency.
the class ValidComparisonVisitorTest method testMulNode.
@Test
public void testMulNode() throws ParseException {
String queryString = "1*3*1 == 3";
ASTJexlScript script = JexlASTHelper.parseJexlQuery(queryString);
ValidComparisonVisitor.check(script);
}
use of org.apache.commons.jexl2.parser.ParseException in project datawave by NationalSecurityAgency.
the class ValidComparisonVisitorTest method testInvalidNR.
@Test(expected = DatawaveFatalQueryException.class)
public void testInvalidNR() throws ParseException {
String queryString = "'BAR' !~ 'foo'";
ASTJexlScript script = JexlASTHelper.parseJexlQuery(queryString);
ValidComparisonVisitor.check(script);
}
use of org.apache.commons.jexl2.parser.ParseException in project datawave by NationalSecurityAgency.
the class ValidComparisonVisitorTest method testInvalidEQ.
@Test(expected = DatawaveFatalQueryException.class)
public void testInvalidEQ() throws ParseException {
String queryString = "'BAR' == 1";
ASTJexlScript script = JexlASTHelper.parseJexlQuery(queryString);
ValidComparisonVisitor.check(script);
}
Aggregations