use of org.apache.metron.stellar.dsl.functions.resolver.SimpleFunctionResolver in project metron by apache.
the class ProfilerFunctionsTest method testProfilerInitWithNoGlobalConfig.
@Test
public void testProfilerInitWithNoGlobalConfig() {
state.put("config", helloWorldProfilerDef);
String expression = "PROFILER_INIT(config)";
// use an executor with no GLOBAL_CONFIG defined in the context
StellarStatefulExecutor executor = new DefaultStellarStatefulExecutor(new SimpleFunctionResolver().withClass(ProfilerFunctions.ProfilerInit.class).withClass(ProfilerFunctions.ProfilerApply.class).withClass(ProfilerFunctions.ProfilerFlush.class), Context.EMPTY_CONTEXT());
StandAloneProfiler profiler = executor.execute(expression, state, StandAloneProfiler.class);
assertNotNull(profiler);
assertEquals(1, profiler.getProfileCount());
assertEquals(0, profiler.getMessageCount());
assertEquals(0, profiler.getRouteCount());
}
use of org.apache.metron.stellar.dsl.functions.resolver.SimpleFunctionResolver in project metron by apache.
the class DocCommandTest method setup.
@Before
public void setup() throws Exception {
// setup the command
command = new DocCommand();
// setup a function resolver - only 3 functions have been defined
SimpleFunctionResolver functionResolver = new SimpleFunctionResolver().withClass(StringFunctions.ToString.class).withClass(StringFunctions.ToLower.class).withClass(StringFunctions.ToUpper.class);
// setup the executor
Properties props = new Properties();
executor = new DefaultStellarShellExecutor(functionResolver, props, Optional.empty());
executor.init();
}
Aggregations