Search in sources :

Example 76 with ParseException

use of org.apache.commons.jexl2.parser.ParseException in project datawave by NationalSecurityAgency.

the class ValidComparisonVisitorTest method testInvalidRE.

@Test(expected = DatawaveFatalQueryException.class)
public void testInvalidRE() throws ParseException {
    String queryString = "'BAR' =~ 'foo'";
    ASTJexlScript script = JexlASTHelper.parseJexlQuery(queryString);
    ValidComparisonVisitor.check(script);
}
Also used : ASTJexlScript(org.apache.commons.jexl2.parser.ASTJexlScript) Test(org.junit.Test)

Example 77 with ParseException

use of org.apache.commons.jexl2.parser.ParseException in project datawave by NationalSecurityAgency.

the class ValidPatternVisitorTest method testValidNR.

@Test
public void testValidNR() throws ParseException {
    String queryString = "BAR == '1' && FOO !~ '1234.*\\d'";
    ASTJexlScript script = JexlASTHelper.parseJexlQuery(queryString);
    ValidPatternVisitor.check(script);
}
Also used : ASTJexlScript(org.apache.commons.jexl2.parser.ASTJexlScript) Test(org.junit.Test)

Example 78 with ParseException

use of org.apache.commons.jexl2.parser.ParseException in project datawave by NationalSecurityAgency.

the class ValidPatternVisitorTest method testValidERWithCacheHit.

@Test
public void testValidERWithCacheHit() throws ParseException {
    String queryString = "BAR == '1' && FOO =~ '1234.*\\d' && FOO2 =~ '1234.*\\d'";
    ASTJexlScript script = JexlASTHelper.parseJexlQuery(queryString);
    ValidPatternVisitor.check(script);
}
Also used : ASTJexlScript(org.apache.commons.jexl2.parser.ASTJexlScript) Test(org.junit.Test)

Example 79 with ParseException

use of org.apache.commons.jexl2.parser.ParseException in project datawave by NationalSecurityAgency.

the class ValidPatternVisitorTest method testValidDoubleSidedEr.

@Test
public void testValidDoubleSidedEr() throws ParseException {
    String queryString = "A =~ B";
    ASTJexlScript script = JexlASTHelper.parseJexlQuery(queryString);
    ValidPatternVisitor.check(script);
}
Also used : ASTJexlScript(org.apache.commons.jexl2.parser.ASTJexlScript) Test(org.junit.Test)

Example 80 with ParseException

use of org.apache.commons.jexl2.parser.ParseException in project datawave by NationalSecurityAgency.

the class ValidPatternVisitorTest method testFilterFunctionIncludeRegex.

@Test(expected = PatternSyntaxException.class)
public void testFilterFunctionIncludeRegex() throws ParseException {
    String queryString = "A == '1' && filter:includeRegex(B,'*2*')";
    ASTJexlScript script = JexlASTHelper.parseJexlQuery(queryString);
    ValidPatternVisitor.check(script);
}
Also used : ASTJexlScript(org.apache.commons.jexl2.parser.ASTJexlScript) Test(org.junit.Test)

Aggregations

ASTJexlScript (org.apache.commons.jexl2.parser.ASTJexlScript)258 Test (org.junit.Test)214 JexlNode (org.apache.commons.jexl2.parser.JexlNode)56 ShardQueryConfiguration (datawave.query.config.ShardQueryConfiguration)36 Date (java.util.Date)33 ParseException (org.apache.commons.jexl2.parser.ParseException)18 HashSet (java.util.HashSet)14 Key (org.apache.accumulo.core.data.Key)9 ArrayList (java.util.ArrayList)7 DatawaveFatalQueryException (datawave.query.exceptions.DatawaveFatalQueryException)6 IOException (java.io.IOException)5 ASTERNode (org.apache.commons.jexl2.parser.ASTERNode)5 MockMetadataHelper (datawave.query.util.MockMetadataHelper)4 PartialKey (org.apache.accumulo.core.data.PartialKey)4 Document (datawave.query.attributes.Document)3 JexlEvaluation (datawave.query.function.JexlEvaluation)3 DatawaveJexlContext (datawave.query.jexl.DatawaveJexlContext)3 DefaultArithmetic (datawave.query.jexl.DefaultArithmetic)3 StringReader (java.io.StringReader)3 AbstractMap (java.util.AbstractMap)3