use of org.guvnor.ala.ui.model.PipelineExecutionTrace in project kie-wb-common by kiegroup.
the class RuntimePresenter method setupPipelineTrace.
private void setupPipelineTrace(RuntimeListItem item) {
PipelineExecutionTrace trace = item.getPipelineTrace();
String itemLabel = item.getItemLabel();
String pipelineName = trace.getPipeline().getKey().getId();
String createdDate = "";
view.setup(itemLabel, createdDate, pipelineName);
setupPipeline(trace);
processPipelineStatus(trace.getPipelineStatus());
}
use of org.guvnor.ala.ui.model.PipelineExecutionTrace in project kie-wb-common by kiegroup.
the class RuntimePresenter method onStageStatusChange.
public void onStageStatusChange(@Observes final StageStatusChangeEvent event) {
if (isFromCurrentPipeline(event.getPipelineExecutionTraceKey())) {
PipelineExecutionTrace trace = item.getPipelineTrace();
Stage currentStage = currentStages.stream().filter(step -> event.getStage().equals(step.getName())).findFirst().orElse(null);
if (currentStage != null) {
StagePresenter stagePresenter = stagePresenters.get(currentStage);
stagePresenter.setState(buildStageState(event.getStatus()));
} else {
Stage stage = new Stage(item.getPipelineTrace().getPipeline().getKey(), event.getStage());
PipelineStatus stageStatus = event.getStatus();
StagePresenter stagePresenter = newStagePresenter();
stagePresenter.setup(stage);
stagePresenter.setState(buildStageState(stageStatus));
if (!currentStages.isEmpty()) {
TransitionPresenter transitionPresenter = newTransitionPresenter();
currentTransitions.add(transitionPresenter);
pipelinePresenter.addStage(transitionPresenter.getView());
}
pipelinePresenter.addStage(stagePresenter.getView());
currentStages.add(stage);
stagePresenters.put(stage, stagePresenter);
}
trace.setStageStatus(event.getStage(), event.getStatus());
}
}
use of org.guvnor.ala.ui.model.PipelineExecutionTrace in project kie-wb-common by kiegroup.
the class RuntimePresenterTest method mockPipelineExecutionTrace.
protected PipelineExecutionTrace mockPipelineExecutionTrace(String executionId, Pipeline pipeline, PipelineStatus initialPipelineStatus, PipelineStatus initialStagesStatus) {
PipelineExecutionTrace trace = new PipelineExecutionTrace(new PipelineExecutionTraceKey(executionId));
trace.setPipeline(pipeline);
trace.setPipelineStatus(initialPipelineStatus);
pipeline.getStages().forEach(stage -> trace.setStageStatus(stage.getName(), initialStagesStatus));
return trace;
}
use of org.guvnor.ala.ui.model.PipelineExecutionTrace in project kie-wb-common by kiegroup.
the class RuntimePresenter method setupRuntime.
private void setupRuntime(RuntimeListItem item) {
String itemLabel = item.getItemLabel();
String pipelineName = SYSTEM_PIPELINE_NAME;
String createdDate = item.getRuntime().getCreatedDate();
String endpoint = "";
Runtime runtime = item.getRuntime();
PipelineExecutionTrace trace = runtime.getPipelineTrace();
if (trace != null) {
pipelineName = trace.getPipeline().getKey().getId();
setupPipeline(trace);
}
view.setup(itemLabel, createdDate, pipelineName);
if (runtime.getEndpoint() != null) {
endpoint = runtime.getEndpoint();
}
view.setEndpoint(endpoint);
processRuntimeStatus(runtime);
}
use of org.guvnor.ala.ui.model.PipelineExecutionTrace in project kie-wb-common by kiegroup.
the class ProviderStatusPresenterTest method testRemoveExistingPipelineExecution.
@Test
public void testRemoveExistingPipelineExecution() {
PipelineExecutionTraceKey keyToRemove = mock(PipelineExecutionTraceKey.class);
List<RuntimeListItem> items = mockItems(ITEMS_COUNT);
// pick an arbitrary element as the existing pipeline execution.
int index = 2;
RuntimeListItem item = items.get(index);
PipelineExecutionTrace pipelineExecutionTrace = mock(PipelineExecutionTrace.class);
when(pipelineExecutionTrace.getKey()).thenReturn(keyToRemove);
when(item.isRuntime()).thenReturn(false);
when(item.getPipelineTrace()).thenReturn(pipelineExecutionTrace);
presenter.setupItems(items);
for (int i = 0; i < ITEMS_COUNT; i++) {
when(runtimePresenters.get(i).getItem()).thenReturn(items.get(i));
}
assertTrue(presenter.removeItem(keyToRemove));
verify(runtimePresenterInstance, times(1)).destroy(runtimePresenters.get(index));
verify(view, times(1)).removeListItem(runtimePresenters.get(index).getView());
}
Aggregations