Search in sources :

Example 76 with ASTJexlScript

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));
}
Also used : ASTJexlScript(org.apache.commons.jexl2.parser.ASTJexlScript) Test(org.junit.Test)

Example 77 with ASTJexlScript

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));
}
Also used : ASTJexlScript(org.apache.commons.jexl2.parser.ASTJexlScript) Test(org.junit.Test)

Example 78 with ASTJexlScript

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));
}
Also used : ASTJexlScript(org.apache.commons.jexl2.parser.ASTJexlScript) Test(org.junit.Test)

Example 79 with ASTJexlScript

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();
}
Also used : ASTJexlScript(org.apache.commons.jexl2.parser.ASTJexlScript)

Example 80 with ASTJexlScript

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);
}
Also used : ASTJexlScript(org.apache.commons.jexl2.parser.ASTJexlScript) Test(org.junit.Test)

Aggregations

ASTJexlScript (org.apache.commons.jexl2.parser.ASTJexlScript)457 Test (org.junit.Test)385 Key (org.apache.accumulo.core.data.Key)69 JexlNode (org.apache.commons.jexl2.parser.JexlNode)61 HashSet (java.util.HashSet)50 ShardQueryConfiguration (datawave.query.config.ShardQueryConfiguration)48 MockMetadataHelper (datawave.query.util.MockMetadataHelper)40 Type (datawave.data.type.Type)38 LcNoDiacriticsType (datawave.data.type.LcNoDiacriticsType)37 ArrayList (java.util.ArrayList)37 ExpressionFilter (datawave.query.jexl.visitors.EventDataQueryExpressionVisitor.ExpressionFilter)36 ScannerFactory (datawave.query.tables.ScannerFactory)35 Date (java.util.Date)35 NoOpType (datawave.data.type.NoOpType)34 NumberType (datawave.data.type.NumberType)34 AbstractMap (java.util.AbstractMap)32 Range (org.apache.accumulo.core.data.Range)30 Value (org.apache.accumulo.core.data.Value)29 RangeFactoryForTests.makeTestRange (datawave.common.test.utils.query.RangeFactoryForTests.makeTestRange)26 QueryPlan (datawave.query.planner.QueryPlan)26