use of com.sequenceiq.flow.domain.FlowLog in project cloudbreak by hortonworks.
the class Flow2HandlerTest method testRestartFlowNotRestartable.
@Test
public void testRestartFlowNotRestartable() throws TransactionExecutionException {
FlowLog flowLog = new FlowLog(STACK_ID, FLOW_ID, "START_STATE", true, StateStatus.SUCCESSFUL, OperationType.UNKNOWN);
flowLog.setFlowType(ClassValue.of(String.class));
flowLog.setPayloadType(ClassValue.of(TestPayload.class));
when(flowLogService.findFirstByFlowIdOrderByCreatedDesc(FLOW_ID)).thenReturn(Optional.of(flowLog));
underTest.restartFlow(FLOW_ID);
verify(flowLogService, times(1)).terminate(STACK_ID, FLOW_ID);
}
use of com.sequenceiq.flow.domain.FlowLog in project cloudbreak by hortonworks.
the class Flow2HandlerTest method createFlowLog.
private FlowLog createFlowLog(String flowChainId) {
FlowLog flowLog = new FlowLog(STACK_ID, FLOW_ID, "START_STATE", true, StateStatus.SUCCESSFUL, OperationType.UNKNOWN);
flowLog.setFlowType(ClassValue.of(HelloWorldFlowConfig.class));
flowLog.setVariables(JsonWriter.objectToJson(new HashMap<>()));
flowLog.setFlowChainId(flowChainId);
flowLog.setNextEvent(NEXT_EVENT);
flowLog.setFlowTriggerUserCrn(FLOW_TRIGGER_USERCRN);
return flowLog;
}
use of com.sequenceiq.flow.domain.FlowLog in project cloudbreak by hortonworks.
the class Flow2HandlerTest method testRestartFlowNoRestartActionNoFlowChainId.
@Test
public void testRestartFlowNoRestartActionNoFlowChainId() throws TransactionExecutionException {
FlowLog flowLog = createFlowLog(null);
Payload payload = new TestPayload(STACK_ID);
flowLog.setPayloadType(ClassValue.of(TestPayload.class));
flowLog.setPayload(JsonWriter.objectToJson(payload));
when(flowLogService.findFirstByFlowIdOrderByCreatedDesc(FLOW_ID)).thenReturn(Optional.of(flowLog));
HelloWorldFlowConfig helloWorldFlowConfig = new HelloWorldFlowConfig();
setUpFlowConfigCreateFlow(helloWorldFlowConfig);
List<FlowConfiguration<?>> flowConfigs = Lists.newArrayList(helloWorldFlowConfig);
ReflectionTestUtils.setField(underTest, "flowConfigs", flowConfigs);
underTest.restartFlow(FLOW_ID);
verify(flowChainHandler, never()).restoreFlowChain(FLOW_CHAIN_ID);
verify(flowLogService, times(1)).terminate(STACK_ID, FLOW_ID);
verify(defaultRestartAction, never()).restart(any(), any(), any(), any());
}
use of com.sequenceiq.flow.domain.FlowLog in project cloudbreak by hortonworks.
the class FlowServiceTest method flowLog.
private FlowLog flowLog(String currentState, String nextEvent, long created) {
FlowLog flowLog = new FlowLog();
flowLog.setCurrentState(currentState);
flowLog.setNextEvent(nextEvent);
flowLog.setCreated(created);
flowLog.setStateStatus(StateStatus.SUCCESSFUL);
flowLog.setFinalized(true);
return flowLog;
}
use of com.sequenceiq.flow.domain.FlowLog in project cloudbreak by hortonworks.
the class FlowLogDBServiceTest method getLastFlowLog.
@Test
public void getLastFlowLog() {
FlowLog flowLog = new FlowLog();
flowLog.setId(ID);
Optional<FlowLog> flowLogOptional = Optional.of(flowLog);
when(flowLogRepository.findFirstByFlowIdOrderByCreatedDesc(FLOW_ID)).thenReturn(flowLogOptional);
Optional<FlowLog> lastFlowLog = underTest.getLastFlowLog(FLOW_ID);
assertEquals(flowLogOptional, lastFlowLog);
}
Aggregations