Search in sources :

Example 1 with StageStatusChangeEvent

use of org.guvnor.ala.ui.events.StageStatusChangeEvent in project kie-wb-common by kiegroup.

the class PipelineExecutionListenerTest method testOnStageError.

@Test
public void testOnStageError() {
    listener.onStageError(new OnErrorStageExecutionEvent(EXECUTION_ID, pipeline, stage, throwable));
    verify(stageStatusChangeEvent, times(1)).fire(new StageStatusChangeEvent(traceKey, STAGE_NAME, PipelineStatus.ERROR));
}
Also used : OnErrorStageExecutionEvent(org.guvnor.ala.pipeline.events.OnErrorStageExecutionEvent) StageStatusChangeEvent(org.guvnor.ala.ui.events.StageStatusChangeEvent) Test(org.junit.Test)

Example 2 with StageStatusChangeEvent

use of org.guvnor.ala.ui.events.StageStatusChangeEvent in project kie-wb-common by kiegroup.

the class PipelineExecutionListenerTest method testBeforeStageExecution.

@Test
public void testBeforeStageExecution() {
    listener.beforeStageExecution(new BeforeStageExecutionEvent(EXECUTION_ID, pipeline, stage));
    verify(stageStatusChangeEvent, times(1)).fire(new StageStatusChangeEvent(traceKey, STAGE_NAME, PipelineStatus.RUNNING));
}
Also used : BeforeStageExecutionEvent(org.guvnor.ala.pipeline.events.BeforeStageExecutionEvent) StageStatusChangeEvent(org.guvnor.ala.ui.events.StageStatusChangeEvent) Test(org.junit.Test)

Example 3 with StageStatusChangeEvent

use of org.guvnor.ala.ui.events.StageStatusChangeEvent in project kie-wb-common by kiegroup.

the class RuntimePresenterSetupsTest method testOnStageStatusChangeNewStageChanged.

/**
 * an item with a pipeline execution trace was initially set and a new stage status not yet drawn has changed.
 */
@Test
public void testOnStageStatusChangeNewStageChanged() {
    preparePipelineExecutionTraceSetup();
    RuntimeListItem item = new RuntimeListItem(RUNTIME_NAME, trace);
    // setup the presenter.
    presenter.setup(item);
    int initialStagePresentersSize = stagePresenters.size();
    // emulate the next stage consecutive stage finishing.
    Stage stage = item.getPipelineTrace().getPipeline().getStages().get(displayableStages.size());
    presenter.onStageStatusChange(new StageStatusChangeEvent(trace.getKey(), stage.getName(), PipelineStatus.RUNNING));
    // an additional stage was added.
    verify(stagePresenterInstance, times(initialStagePresentersSize + 1)).get();
    // the newly stage is set to EXECUTING in the UI
    StagePresenter stagePresenter = stagePresenters.get(stagePresenters.size() - 1);
    verify(stagePresenter, times(1)).setup(stage);
    verify(stagePresenter, times(1)).setState(State.EXECUTING);
}
Also used : RuntimeListItem(org.guvnor.ala.ui.model.RuntimeListItem) StagePresenter(org.guvnor.ala.ui.client.widget.pipeline.stage.StagePresenter) Stage(org.guvnor.ala.ui.model.Stage) StageStatusChangeEvent(org.guvnor.ala.ui.events.StageStatusChangeEvent) Test(org.junit.Test)

Example 4 with StageStatusChangeEvent

use of org.guvnor.ala.ui.events.StageStatusChangeEvent in project kie-wb-common by kiegroup.

the class RuntimePresenterSetupsTest method testOnStageStatusChangeLastVisibleStageChanged.

/**
 * an item with a pipeline execution trace was initially set and the last stage status has changed.
 */
@Test
public void testOnStageStatusChangeLastVisibleStageChanged() {
    preparePipelineExecutionTraceSetup();
    RuntimeListItem item = new RuntimeListItem(RUNTIME_NAME, trace);
    // setup the presenter.
    presenter.setup(item);
    int initialStagePresentersSize = stagePresenters.size();
    // emulate the last stage finishing.
    Stage stage = displayableStages.get(displayableStages.size() - 1);
    presenter.onStageStatusChange(new StageStatusChangeEvent(trace.getKey(), stage.getName(), PipelineStatus.FINISHED));
    // the last stage status was changed form EXECUTING to to DONE
    StagePresenter stagePresenter = stagePresenters.get(stagePresenters.size() - 1);
    verify(stagePresenter, times(1)).setState(State.EXECUTING);
    verify(stagePresenter, times(1)).setState(State.DONE);
    // no additional stages were added.
    verify(stagePresenterInstance, times(initialStagePresentersSize)).get();
}
Also used : RuntimeListItem(org.guvnor.ala.ui.model.RuntimeListItem) StagePresenter(org.guvnor.ala.ui.client.widget.pipeline.stage.StagePresenter) Stage(org.guvnor.ala.ui.model.Stage) StageStatusChangeEvent(org.guvnor.ala.ui.events.StageStatusChangeEvent) Test(org.junit.Test)

Example 5 with StageStatusChangeEvent

use of org.guvnor.ala.ui.events.StageStatusChangeEvent in project kie-wb-common by kiegroup.

the class PipelineExecutionListenerTest method testAfterStageExecution.

@Test
public void testAfterStageExecution() {
    listener.afterStageExecution(new AfterStageExecutionEvent(EXECUTION_ID, pipeline, stage));
    verify(stageStatusChangeEvent, times(1)).fire(new StageStatusChangeEvent(traceKey, STAGE_NAME, PipelineStatus.FINISHED));
}
Also used : AfterStageExecutionEvent(org.guvnor.ala.pipeline.events.AfterStageExecutionEvent) StageStatusChangeEvent(org.guvnor.ala.ui.events.StageStatusChangeEvent) Test(org.junit.Test)

Aggregations

StageStatusChangeEvent (org.guvnor.ala.ui.events.StageStatusChangeEvent)5 Test (org.junit.Test)5 StagePresenter (org.guvnor.ala.ui.client.widget.pipeline.stage.StagePresenter)2 RuntimeListItem (org.guvnor.ala.ui.model.RuntimeListItem)2 Stage (org.guvnor.ala.ui.model.Stage)2 AfterStageExecutionEvent (org.guvnor.ala.pipeline.events.AfterStageExecutionEvent)1 BeforeStageExecutionEvent (org.guvnor.ala.pipeline.events.BeforeStageExecutionEvent)1 OnErrorStageExecutionEvent (org.guvnor.ala.pipeline.events.OnErrorStageExecutionEvent)1