Search in sources :

Example 6 with JoinAction

use of com.hortonworks.streamline.streams.layout.component.impl.splitjoin.JoinAction in project streamline by hortonworks.

the class SplitJoinTest method runSplitJoin.

private void runSplitJoin(SplitJoinRule splitRule, SplitJoinRule joinRule, Map<String, Object> config) {
    final SplitAction splitAction = (SplitAction) splitRule.getAction();
    SplitActionRuntime splitActionRuntime = new SplitActionRuntime(splitAction);
    splitActionRuntime.setActionRuntimeContext(new ActionRuntimeContext(splitRule, splitAction));
    splitActionRuntime.initialize(config);
    StreamlineEvent streamlineEvent = createRootEvent();
    final List<Result> results = splitActionRuntime.execute(streamlineEvent);
    JoinAction joinAction = (JoinAction) joinRule.getAction();
    JoinActionRuntime joinActionRuntime = new JoinActionRuntime(joinAction);
    joinActionRuntime.setActionRuntimeContext(new ActionRuntimeContext(joinRule, joinAction));
    joinActionRuntime.initialize(config);
    List<Result> effectiveResult = null;
    for (Result result : results) {
        for (StreamlineEvent event : result.events) {
            List<Result> processedResult = joinActionRuntime.execute(event);
            if (processedResult != null) {
                effectiveResult = processedResult;
            }
        }
    }
    Assert.assertNotNull(effectiveResult);
}
Also used : JoinAction(com.hortonworks.streamline.streams.layout.component.impl.splitjoin.JoinAction) StreamlineEvent(com.hortonworks.streamline.streams.StreamlineEvent) SplitAction(com.hortonworks.streamline.streams.layout.component.impl.splitjoin.SplitAction) ActionRuntimeContext(com.hortonworks.streamline.streams.runtime.rule.action.ActionRuntimeContext) Result(com.hortonworks.streamline.streams.Result)

Aggregations

JoinAction (com.hortonworks.streamline.streams.layout.component.impl.splitjoin.JoinAction)6 SplitAction (com.hortonworks.streamline.streams.layout.component.impl.splitjoin.SplitAction)6 Test (org.junit.Test)4 Result (com.hortonworks.streamline.streams.Result)1 StreamlineEvent (com.hortonworks.streamline.streams.StreamlineEvent)1 ActionRuntimeContext (com.hortonworks.streamline.streams.runtime.rule.action.ActionRuntimeContext)1 Path (java.nio.file.Path)1 HashMap (java.util.HashMap)1 Expectations (mockit.Expectations)1