use of com.sequenceiq.flow.core.chain.FlowEventChainFactory in project cloudbreak by hortonworks.
the class Flow2InitializerTest method testInitialize.
@Test
public void testInitialize() {
List<FlowConfiguration<?>> flowConfigs = new ArrayList<>();
flowConfigs.add(new HelloWorldFlowConfig());
given(this.flowConfigs.stream()).willReturn(flowConfigs.stream());
given(flowEventChainFactory.initEvent()).willReturn("OTHER_SELECTOR");
List<FlowEventChainFactory<?>> flowChainFactories = new ArrayList<>();
flowChainFactories.add(flowEventChainFactory);
given(this.flowChainFactories.stream()).willReturn(flowChainFactories.stream());
underTest.init();
verify(reactor, times(1)).on(any(Selector.class), any(Consumer.class));
}
use of com.sequenceiq.flow.core.chain.FlowEventChainFactory in project cloudbreak by hortonworks.
the class Flow2InitializerTest method testInitializeFailsWithFlowSelectorIsFlowChainSelector.
@Test
public void testInitializeFailsWithFlowSelectorIsFlowChainSelector() {
List<FlowConfiguration<?>> flowConfigs = new ArrayList<>();
flowConfigs.add(new HelloWorldFlowConfig());
given(this.flowConfigs.stream()).willReturn(flowConfigs.stream());
given(flowEventChainFactory.initEvent()).willReturn(HelloWorldEvent.HELLOWORLD_TRIGGER_EVENT.name());
List<FlowEventChainFactory<?>> flowChainFactories = new ArrayList<>();
flowChainFactories.add(flowEventChainFactory);
given(this.flowChainFactories.stream()).willReturn(flowChainFactories.stream());
RuntimeException runtimeException = Assertions.assertThrows(RuntimeException.class, () -> underTest.init());
assertEquals("HELLOWORLD_TRIGGER_EVENT is a flow selector and a flow chain selector. It should be only in one category.", runtimeException.getMessage());
verify(reactor, times(0)).on(any(Selector.class), any(Consumer.class));
}
Aggregations