use of org.apache.metron.stellar.dsl.DefaultVariableResolver in project metron by apache.
the class GeoEnrichmentFunctionsTest method run.
public Object run(String rule, Map<String, Object> variables) throws Exception {
StellarProcessor processor = new StellarProcessor();
Assert.assertTrue(rule + " not valid.", processor.validate(rule, context));
return processor.parse(rule, new DefaultVariableResolver(x -> variables.get(x), x -> variables.containsKey(x)), StellarFunctions.FUNCTION_RESOLVER(), context);
}
use of org.apache.metron.stellar.dsl.DefaultVariableResolver in project metron by apache.
the class SimpleHBaseEnrichmentFunctionsTest method run.
public Object run(String rule, Map<String, Object> variables) throws Exception {
StellarProcessor processor = new StellarProcessor();
Assert.assertTrue(rule + " not valid.", processor.validate(rule, context));
return processor.parse(rule, new DefaultVariableResolver(x -> variables.get(x), x -> variables.containsKey(x)), StellarFunctions.FUNCTION_RESOLVER(), context);
}
use of org.apache.metron.stellar.dsl.DefaultVariableResolver in project metron by apache.
the class StellarComparisonExpressionWithOperatorTest method differentTypesShouldThrowErrorWhenUsingGTE.
@Test(expected = ParseException.class)
public void differentTypesShouldThrowErrorWhenUsingGTE() throws Exception {
final Map<String, Object> variableMap = new HashMap<>();
runPredicate("'1' >= 1", new DefaultVariableResolver(variableMap::get, variableMap::containsKey));
}
use of org.apache.metron.stellar.dsl.DefaultVariableResolver in project metron by apache.
the class StellarComparisonExpressionWithOperatorTest method differentTypesShouldThrowErrorWhenUsingLTE.
@Test(expected = ParseException.class)
public void differentTypesShouldThrowErrorWhenUsingLTE() throws Exception {
final Map<String, Object> variableMap = new HashMap<>();
runPredicate("'1' <= 1", new DefaultVariableResolver(variableMap::get, variableMap::containsKey));
}
use of org.apache.metron.stellar.dsl.DefaultVariableResolver in project metron by apache.
the class StellarComparisonExpressionWithOperatorTest method differentTypesShouldThrowErrorWhenUsingGT.
@Test(expected = ParseException.class)
public void differentTypesShouldThrowErrorWhenUsingGT() throws Exception {
final Map<String, Object> variableMap = new HashMap<>();
runPredicate("1 > '1'", new DefaultVariableResolver(variableMap::get, variableMap::containsKey));
}
Aggregations