Search in sources :

Example 1 with PipelineExecutionTrace

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());
}
Also used : PipelineExecutionTrace(org.guvnor.ala.ui.model.PipelineExecutionTrace)

Example 2 with PipelineExecutionTrace

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());
    }
}
Also used : TransitionPresenter(org.guvnor.ala.ui.client.widget.pipeline.transition.TransitionPresenter) PipelineStatus(org.guvnor.ala.ui.model.PipelineStatus) PipelineExecutionTrace(org.guvnor.ala.ui.model.PipelineExecutionTrace) StagePresenter(org.guvnor.ala.ui.client.widget.pipeline.stage.StagePresenter) Stage(org.guvnor.ala.ui.model.Stage)

Example 3 with PipelineExecutionTrace

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;
}
Also used : PipelineExecutionTrace(org.guvnor.ala.ui.model.PipelineExecutionTrace) PipelineExecutionTraceKey(org.guvnor.ala.ui.model.PipelineExecutionTraceKey)

Example 4 with PipelineExecutionTrace

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);
}
Also used : Runtime(org.guvnor.ala.ui.model.Runtime) PipelineExecutionTrace(org.guvnor.ala.ui.model.PipelineExecutionTrace)

Example 5 with PipelineExecutionTrace

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());
}
Also used : RuntimeListItem(org.guvnor.ala.ui.model.RuntimeListItem) PipelineExecutionTrace(org.guvnor.ala.ui.model.PipelineExecutionTrace) PipelineExecutionTraceKey(org.guvnor.ala.ui.model.PipelineExecutionTraceKey) Test(org.junit.Test)

Aggregations

PipelineExecutionTrace (org.guvnor.ala.ui.model.PipelineExecutionTrace)6 PipelineExecutionTraceKey (org.guvnor.ala.ui.model.PipelineExecutionTraceKey)3 Runtime (org.guvnor.ala.ui.model.Runtime)2 RuntimeListItem (org.guvnor.ala.ui.model.RuntimeListItem)2 Stage (org.guvnor.ala.ui.model.Stage)2 StagePresenter (org.guvnor.ala.ui.client.widget.pipeline.stage.StagePresenter)1 TransitionPresenter (org.guvnor.ala.ui.client.widget.pipeline.transition.TransitionPresenter)1 Pipeline (org.guvnor.ala.ui.model.Pipeline)1 PipelineError (org.guvnor.ala.ui.model.PipelineError)1 PipelineKey (org.guvnor.ala.ui.model.PipelineKey)1 PipelineStatus (org.guvnor.ala.ui.model.PipelineStatus)1 ProviderKey (org.guvnor.ala.ui.model.ProviderKey)1 ProviderTypeKey (org.guvnor.ala.ui.model.ProviderTypeKey)1 RuntimeKey (org.guvnor.ala.ui.model.RuntimeKey)1 Test (org.junit.Test)1