use of com.sequenceiq.flow.api.model.operation.OperationFlowsView in project cloudbreak by hortonworks.
the class OperationService method getOperationProgressByResourceCrn.
public OperationView getOperationProgressByResourceCrn(String resourceCrn, boolean detailed) {
OperationView stackOperationView = new OperationView();
try {
OperationResource operationResource = OperationResource.fromCrn(Crn.safeFromString(resourceCrn));
Optional<OperationFlowsView> operationFlowsViewOpt = flowService.getLastFlowOperationByResourceCrn(resourceCrn);
if (operationFlowsViewOpt.isPresent()) {
OperationFlowsView operationFlowsView = operationFlowsViewOpt.get();
OperationType operationType = operationFlowsView.getOperationType();
if (OperationType.PROVISION.equals(operationType)) {
stackOperationView = handleProvisionOperation(resourceCrn, operationResource, operationFlowsView, detailed);
} else {
stackOperationView = operationDetailsPopulator.createOperationView(operationFlowsView, operationResource);
}
}
} catch (Exception e) {
LOGGER.debug(String.format("Could not fetch remote database details for stack with crn %s", resourceCrn), e);
}
return stackOperationView;
}
use of com.sequenceiq.flow.api.model.operation.OperationFlowsView in project cloudbreak by hortonworks.
the class OperationService method getOperationProgressByResourceCrn.
public OperationView getOperationProgressByResourceCrn(String resourceCrn, boolean detailed) {
OperationView response = new OperationView();
Optional<OperationFlowsView> operationFlowsViewOpt = flowService.getLastFlowOperationByResourceCrn(resourceCrn);
if (operationFlowsViewOpt.isPresent()) {
return operationDetailsPopulator.createOperationView(operationFlowsViewOpt.get(), OperationResource.REMOTEDB);
}
return response;
}
use of com.sequenceiq.flow.api.model.operation.OperationFlowsView in project cloudbreak by hortonworks.
the class OperationDetailsPopulatorTest method testCreateOperationViewWithFailedState.
@Test
public void testCreateOperationViewWithFailedState() {
// GIVEN
Map<String, FlowProgressResponse> flowProgressResponseMap = new HashMap<>();
flowProgressResponseMap.put(DUMMY_CLASS, createFlowProgressResponse("FAILED", true).get());
OperationFlowsView operationFlowsView = createOperationFlowsView(flowProgressResponseMap);
// WHEN
OperationView operationView = underTest.createOperationView(operationFlowsView, OperationResource.ENVIRONMENT);
// THEN
assertEquals(MAX_PROGRESS, operationView.getProgress());
assertEquals(OperationProgressStatus.FAILED, operationView.getProgressStatus());
}
use of com.sequenceiq.flow.api.model.operation.OperationFlowsView in project cloudbreak by hortonworks.
the class OperationDetailsPopulatorTest method testCreateOperationViewWithPendingState.
@Test
public void testCreateOperationViewWithPendingState() {
// GIVEN
Map<String, FlowProgressResponse> flowProgressResponseMap = new HashMap<>();
flowProgressResponseMap.put(DUMMY_CLASS, createFlowProgressResponse("SUCCESSFUL", false).get());
OperationFlowsView operationFlowsView = createOperationFlowsView(flowProgressResponseMap);
// WHEN
OperationView operationView = underTest.createOperationView(operationFlowsView, OperationResource.ENVIRONMENT);
// THEN
assertEquals(IN_PROGRESS_FROM_HISTORY, operationView.getProgress());
assertEquals(OperationProgressStatus.RUNNING, operationView.getProgressStatus());
}
use of com.sequenceiq.flow.api.model.operation.OperationFlowsView in project cloudbreak by hortonworks.
the class FlowOperationService method getOperationProgressByEnvironmentCrn.
public OperationView getOperationProgressByEnvironmentCrn(String environmentCrn, boolean detailed) {
OperationView operationView = new OperationView();
Optional<OperationFlowsView> operationFlowsViewOpt = flowService.getLastFlowOperationByResourceCrn(environmentCrn);
if (operationFlowsViewOpt.isPresent()) {
OperationFlowsView operationFlowsView = operationFlowsViewOpt.get();
OperationResource operationResource = OperationResource.FREEIPA;
com.sequenceiq.flow.api.model.operation.OperationType operationType = operationFlowsView.getOperationType();
if (com.sequenceiq.flow.api.model.operation.OperationType.PROVISION.equals(operationType)) {
operationView = operationDetailsPopulator.createOperationView(operationFlowsView, operationResource, List.of(StackProvisionFlowConfig.class, FreeIpaProvisionFlowConfig.class));
} else {
operationView = operationDetailsPopulator.createOperationView(operationFlowsView, operationResource);
}
}
return operationView;
}
Aggregations