use of com.sequenceiq.flow.api.model.FlowLogResponse in project cloudbreak by hortonworks.
the class SdxUpgradeValidationResultProviderTest method createLastFlowLog.
private FlowLogResponse createLastFlowLog() {
FlowLogResponse flowLogResponse = new FlowLogResponse();
flowLogResponse.setFlowId(FLOW_ID);
return flowLogResponse;
}
use of com.sequenceiq.flow.api.model.FlowLogResponse in project cloudbreak by hortonworks.
the class CloudbreakFlowServiceTest method testSaveFlowIdWhenNoFlowIdentifierIsPresent.
@Test
public void testSaveFlowIdWhenNoFlowIdentifierIsPresent() {
SdxCluster cluster = new SdxCluster();
cluster.setLastCbFlowChainId(FLOW_CHAIN_ID);
cluster.setInitiatorUserCrn(USER_CRN);
cluster.setClusterName(CLUSTER_NAME);
FlowLogResponse response = new FlowLogResponse();
response.setStateStatus(StateStatus.SUCCESSFUL);
response.setFinalized(true);
response.setFlowId(FLOW_ID);
when(flowEndpoint.getLastFlowByResourceName(any(), anyString())).thenReturn(response);
when(sdxClusterRepository.save(any())).thenReturn(cluster);
when(regionAwareInternalCrnGenerator.getInternalCrnForServiceAsString()).thenReturn("crn:cdp:freeipa:us-west-1:altus:user:__internal__actor__");
when(regionAwareInternalCrnGeneratorFactory.iam()).thenReturn(regionAwareInternalCrnGenerator);
underTest.saveLastCloudbreakFlowChainId(cluster, null);
verify(flowEndpoint).getLastFlowByResourceName(any(), anyString());
verify(sdxClusterRepository).save(clusterCaptor.capture());
assertEquals(FLOW_ID, clusterCaptor.getValue().getLastCbFlowId());
assertNull(clusterCaptor.getValue().getLastCbFlowChainId());
}
use of com.sequenceiq.flow.api.model.FlowLogResponse in project cloudbreak by hortonworks.
the class LoadBalancerPollerServiceTest method setupSuccessFlowLogResponse.
private FlowLogResponse setupSuccessFlowLogResponse() {
FlowLogResponse flowLogResponse = new FlowLogResponse();
flowLogResponse.setCurrentState(LOAD_BALANCER_UPDATE_FINISHED_STATE);
return flowLogResponse;
}
use of com.sequenceiq.flow.api.model.FlowLogResponse in project cloudbreak by hortonworks.
the class CloudbreakFlowService method trySaveLastCbFlowIdOrFlowChainId.
private void trySaveLastCbFlowIdOrFlowChainId(SdxCluster sdxCluster) {
try {
FlowLogResponse lastFlowByResourceName = ThreadBasedUserCrnProvider.doAsInternalActor(regionAwareInternalCrnGeneratorFactory.iam().getInternalCrnForServiceAsString(), () -> flowEndpoint.getLastFlowByResourceName(sdxCluster.getAccountId(), sdxCluster.getClusterName()));
logFlowLogResponse(lastFlowByResourceName);
if (StringUtils.isNotBlank(lastFlowByResourceName.getFlowChainId())) {
setFlowChainIdAndResetFlowId(sdxCluster, lastFlowByResourceName.getFlowChainId());
} else if (StringUtils.isNotBlank(lastFlowByResourceName.getFlowId())) {
setFlowIdAndResetFlowChainId(sdxCluster, lastFlowByResourceName.getFlowId());
} else {
resetFlowIdAndFlowChainId(sdxCluster);
}
} catch (Exception ex) {
LOGGER.info("Not found flow id for cluster: {}. Reset laast flow id to null.", sdxCluster.getClusterName());
resetFlowIdAndFlowChainId(sdxCluster);
}
sdxClusterRepository.save(sdxCluster);
}
use of com.sequenceiq.flow.api.model.FlowLogResponse in project cloudbreak by hortonworks.
the class FlowLogConverter method convert.
public FlowLogResponse convert(FlowLog source) {
FlowLogResponse flowLogResponse = new FlowLogResponse();
flowLogResponse.setCreated(source.getCreated());
flowLogResponse.setCurrentState(source.getCurrentState());
flowLogResponse.setFinalized(source.getFinalized());
flowLogResponse.setFlowChainId(source.getFlowChainId());
flowLogResponse.setFlowId(source.getFlowId());
flowLogResponse.setFlowTriggerUserCrn(source.getFlowTriggerUserCrn());
flowLogResponse.setResourceId(source.getResourceId());
flowLogResponse.setNextEvent(source.getNextEvent());
flowLogResponse.setNodeId(source.getCloudbreakNodeId());
if (source.getStateStatus() != null) {
flowLogResponse.setStateStatus(StateStatus.valueOf(source.getStateStatus().name()));
}
return flowLogResponse;
}
Aggregations