use of com.dexels.navajo.parser.compiled.api.ExpressionCache in project navajo by Dexels.
the class TestCompiledExpression method testFunctionEvaluation.
@Test
public void testFunctionEvaluation() {
List<String> problems = new ArrayList<>();
ExpressionCache ce = ExpressionCache.getInstance();
String embeddedExpression = "StringFunction('matches','aaa', '.*[-]+7[0-9][A-z]*$' ))";
ContextExpression cemb = ce.parse(problems, embeddedExpression, name -> FunctionClassification.DEFAULT);
System.err.println("Problems: " + problems);
Assert.assertEquals(0, problems.size());
Operand result = cemb.apply(input, Optional.empty(), Optional.empty());
System.err.println("Result: " + result.type + " value: " + result.value);
}
use of com.dexels.navajo.parser.compiled.api.ExpressionCache in project navajo by Dexels.
the class TestCompiledExpression method testForall.
@Test
public void testForall() throws TMLExpressionException {
List<String> problems = new ArrayList<>();
ExpressionCache ce = ExpressionCache.getInstance();
// String extBackup ="FORALL( '/TestArrayMessageMessage', `! ?[Delete] OR ! [Delete] OR [/__globals__/ApplicationInstance] != 'TENANT' OR ! StringFunction( 'matches', [ChargeCodeId], '.*[-]+7[0-9][A-z]*$' )` )";
String ext = "FORALL( '/Msg', `!StringFunction( 'matches', [ChargeCodeId], '.*[-]+7[0-9][A-z]*$' )` )";
// String expression = "FORALL( '/Charges' , `! ?[Delete] OR ! [Delete] OR [/__globals__/ApplicationInstance] != 'SOMETENANT' OR [SomeProperty] == 'SOMESTRING' `)";
// ce.parse(problems, expression, mode, allowLiteralResolve)
ContextExpression cx = ce.parse(problems, ext, name -> FunctionClassification.DEFAULT);
System.err.println("Problems: " + problems);
Assert.assertEquals(0, problems.size());
Operand result = cx.apply(input, Optional.empty(), Optional.empty());
System.err.println("Result: " + result.type + " value: " + result.value);
// Operand result = Expression.evaluate(expression, testDoc,null,topMessage);
}
Aggregations