Search in sources :

Example 1 with PipelineExecutionTraceKey

use of org.guvnor.ala.ui.model.PipelineExecutionTraceKey in project kie-wb-common by kiegroup.

the class ProviderPresenterTest method testPipelineExecutionDeletedRefreshRequired.

@Test
public void testPipelineExecutionDeletedRefreshRequired() {
    // load the presenter.
    prepareRuntimesInfo();
    when(runtimeItems.isEmpty()).thenReturn(true);
    presenter.onProviderSelected(new ProviderSelectedEvent(providerKey));
    PipelineExecutionTraceKey pipelineExecutionTraceKey = mock(PipelineExecutionTraceKey.class);
    when(providerStatusPresenter.removeItem(pipelineExecutionTraceKey)).thenReturn(true);
    // the status presenter is empty after the removal.
    when(providerStatusPresenter.isEmpty()).thenReturn(true);
    presenter.onPipelineExecutionChange(new PipelineExecutionChangeEvent(PipelineExecutionChange.DELETED, pipelineExecutionTraceKey));
    verify(providerStatusPresenter, times(1)).removeItem(pipelineExecutionTraceKey);
    verify(presenter, times(1)).refresh();
}
Also used : ProviderSelectedEvent(org.guvnor.ala.ui.client.events.ProviderSelectedEvent) PipelineExecutionChangeEvent(org.guvnor.ala.ui.events.PipelineExecutionChangeEvent) PipelineExecutionTraceKey(org.guvnor.ala.ui.model.PipelineExecutionTraceKey) Test(org.junit.Test)

Example 2 with PipelineExecutionTraceKey

use of org.guvnor.ala.ui.model.PipelineExecutionTraceKey in project kie-wb-common by kiegroup.

the class ProviderStatusPresenterTest method testRemoveNonExistingPipelineExecution.

@Test
public void testRemoveNonExistingPipelineExecution() {
    PipelineExecutionTraceKey keyToRemove = mock(PipelineExecutionTraceKey.class);
    List<RuntimeListItem> items = mockItems(ITEMS_COUNT);
    presenter.setupItems(items);
    for (int i = 0; i < ITEMS_COUNT; i++) {
        when(runtimePresenters.get(i).getItem()).thenReturn(items.get(i));
    }
    assertFalse(presenter.removeItem(keyToRemove));
    verify(runtimePresenterInstance, never()).destroy(anyObject());
    verify(view, never()).removeListItem(anyObject());
}
Also used : RuntimeListItem(org.guvnor.ala.ui.model.RuntimeListItem) PipelineExecutionTraceKey(org.guvnor.ala.ui.model.PipelineExecutionTraceKey) Test(org.junit.Test)

Example 3 with PipelineExecutionTraceKey

use of org.guvnor.ala.ui.model.PipelineExecutionTraceKey in project kie-wb-common by kiegroup.

the class RuntimePresenterActionsTest method testDeletePipelineConfirmYesAndSuccessful.

@Test
public void testDeletePipelineConfirmYesAndSuccessful() {
    preparePipelineDelete();
    PipelineExecutionTraceKey currentKey = trace.getKey();
    when(translationService.format(RuntimePresenter_PipelineExecutionDeleteSuccessMessage, currentKey.getId())).thenReturn(SUCCESS_MESSAGE);
    yesCommandCaptor.getValue().execute();
    verify(runtimeService, times(1)).deletePipelineExecution(currentKey);
    verify(notificationEvent, times(1)).fire(new NotificationEvent(SUCCESS_MESSAGE, NotificationEvent.NotificationType.SUCCESS));
}
Also used : NotificationEvent(org.uberfire.workbench.events.NotificationEvent) PipelineExecutionTraceKey(org.guvnor.ala.ui.model.PipelineExecutionTraceKey) Test(org.junit.Test)

Example 4 with PipelineExecutionTraceKey

use of org.guvnor.ala.ui.model.PipelineExecutionTraceKey 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 5 with PipelineExecutionTraceKey

use of org.guvnor.ala.ui.model.PipelineExecutionTraceKey in project kie-wb-common by kiegroup.

the class RuntimeServiceImplTest method testStopPipelineExecution.

@Test
public void testStopPipelineExecution() {
    PipelineExecutionTraceKey pipelineExecutionTraceKey = new PipelineExecutionTraceKey(PIPELINE_EXECUTION_ID);
    service.stopPipelineExecution(pipelineExecutionTraceKey);
    verify(pipelineService, times(1)).stopPipelineExecution(PIPELINE_EXECUTION_ID);
    verify(pipelineExecutionChangeEvent, times(1)).fire(new PipelineExecutionChangeEvent(PipelineExecutionChange.STOPPED, pipelineExecutionTraceKey));
}
Also used : PipelineExecutionChangeEvent(org.guvnor.ala.ui.events.PipelineExecutionChangeEvent) PipelineExecutionTraceKey(org.guvnor.ala.ui.model.PipelineExecutionTraceKey) Test(org.junit.Test)

Aggregations

PipelineExecutionTraceKey (org.guvnor.ala.ui.model.PipelineExecutionTraceKey)18 Test (org.junit.Test)14 RuntimeListItem (org.guvnor.ala.ui.model.RuntimeListItem)7 PipelineExecutionChangeEvent (org.guvnor.ala.ui.events.PipelineExecutionChangeEvent)6 PipelineExecutionTrace (org.guvnor.ala.ui.model.PipelineExecutionTrace)3 RuntimeQuery (org.guvnor.ala.services.api.RuntimeQuery)2 RuntimeQueryResultItem (org.guvnor.ala.services.api.RuntimeQueryResultItem)2 ProviderSelectedEvent (org.guvnor.ala.ui.client.events.ProviderSelectedEvent)2 RuntimePresenter_PipelineExecutionAlreadyStoppedMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_PipelineExecutionAlreadyStoppedMessage)2 RuntimePresenter_PipelineExecutionConfirmDeleteMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_PipelineExecutionConfirmDeleteMessage)2 RuntimePresenter_PipelineExecutionConfirmStopMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_PipelineExecutionConfirmStopMessage)2 RuntimePresenter_PipelineExecutionDeleteSuccessMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_PipelineExecutionDeleteSuccessMessage)2 RuntimePresenter_PipelineExecutionStopSuccessMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_PipelineExecutionStopSuccessMessage)2 RuntimePresenter_RuntimeConfirmDeleteMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeConfirmDeleteMessage)2 RuntimePresenter_RuntimeConfirmForcedDeleteMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeConfirmForcedDeleteMessage)2 RuntimePresenter_RuntimeConfirmStopMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeConfirmStopMessage)2 RuntimePresenter_RuntimeDeleteFailedMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeDeleteFailedMessage)2 RuntimePresenter_RuntimeDeleteSuccessMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeDeleteSuccessMessage)2 RuntimePresenter_RuntimeDeletingForcedMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeDeletingForcedMessage)2 RuntimePresenter_RuntimeDeletingMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeDeletingMessage)2