use of com.sequenceiq.flow.core.helloworld.config.HelloWorldFlowConfig in project cloudbreak by hortonworks.
the class Flow2ConfigTest method testFlowConfigurationMapInit.
@Test
public void testFlowConfigurationMapInit() {
List<FlowConfiguration<?>> flowConfigs = new ArrayList<>();
flowConfigs.add(new HelloWorldFlowConfig());
flowConfigs.add(new TestFlowConfig());
Map<String, FlowConfiguration<?>> flowConfigMap = underTest.flowConfigurationMap(flowConfigs);
assertEquals("Not all flow type appeared in map!", countEvents(flowConfigs), flowConfigMap.size());
}
use of com.sequenceiq.flow.core.helloworld.config.HelloWorldFlowConfig in project cloudbreak by hortonworks.
the class Flow2ConfigTest method testRetryableEvents.
@Test
public void testRetryableEvents() {
HelloWorldFlowConfig helloWorldFlowConfig = new HelloWorldFlowConfig();
TestFlowConfig testFlowConfig = new TestFlowConfig();
List<RetryableFlowConfiguration<?>> retryableFlowConfigurations = List.of(helloWorldFlowConfig, testFlowConfig);
Set<String> retryableEvents = underTest.retryableEvents(retryableFlowConfigurations);
Set<String> expected = Set.of(helloWorldFlowConfig.getRetryableEvent().event(), testFlowConfig.getRetryableEvent().event());
assertEquals(expected, retryableEvents);
}
use of com.sequenceiq.flow.core.helloworld.config.HelloWorldFlowConfig 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.helloworld.config.HelloWorldFlowConfig 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