Search in sources :

Example 26 with Context

use of org.apache.metron.stellar.dsl.Context in project metron by apache.

the class ShellFunctionsTest method testMap2TableInsufficientArgs.

@Test
public void testMap2TableInsufficientArgs() {
    Map<String, Object> variables = new HashMap<>();
    Context context = Context.EMPTY_CONTEXT();
    Object out = run("SHELL_MAP2TABLE()", variables, context);
    Assert.assertNull(out);
}
Also used : Context(org.apache.metron.stellar.dsl.Context) HashMap(java.util.HashMap) Test(org.junit.Test)

Example 27 with Context

use of org.apache.metron.stellar.dsl.Context in project metron by apache.

the class ShellFunctionsTest method testListVarsWithoutVars.

@Test
public void testListVarsWithoutVars() {
    Context context = new Context.Builder().with(Context.Capabilities.SHELL_VARIABLES, () -> new HashMap<>()).build();
    Object out = run("SHELL_LIST_VARS()", new HashMap<>(), context);
    Assert.assertEquals(expectedEmptyList, out);
}
Also used : Context(org.apache.metron.stellar.dsl.Context) HashMap(java.util.HashMap) SettingsBuilder(org.jboss.aesh.console.settings.SettingsBuilder) Test(org.junit.Test)

Aggregations

Context (org.apache.metron.stellar.dsl.Context)27 Test (org.junit.Test)15 HashMap (java.util.HashMap)14 Map (java.util.Map)12 StellarProcessor (org.apache.metron.stellar.common.StellarProcessor)9 List (java.util.List)8 ArrayList (java.util.ArrayList)6 DefaultVariableResolver (org.apache.metron.stellar.dsl.DefaultVariableResolver)6 ImmutableMap (com.google.common.collect.ImmutableMap)5 StellarFunctions (org.apache.metron.stellar.dsl.StellarFunctions)5 Assert (org.junit.Assert)5 ImmutableList (com.google.common.collect.ImmutableList)3 MapVariableResolver (org.apache.metron.stellar.dsl.MapVariableResolver)3 VariableResolver (org.apache.metron.stellar.dsl.VariableResolver)3 Before (org.junit.Before)3 Collectors (java.util.stream.Collectors)2 StellarPredicateProcessor (org.apache.metron.stellar.common.StellarPredicateProcessor)2 ConversionUtils (org.apache.metron.stellar.common.utils.ConversionUtils)2 ParseException (org.apache.metron.stellar.dsl.ParseException)2 FunctionResolver (org.apache.metron.stellar.dsl.functions.resolver.FunctionResolver)2