Search in sources :

Example 6 with PipelineExecutionTraceKey

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

the class RuntimeServiceImplTest method getRuntimeItemByPipelineExecutionKeyExisting.

@Test
public void getRuntimeItemByPipelineExecutionKeyExisting() {
    PipelineExecutionTraceKey traceKey = new PipelineExecutionTraceKey(PIPELINE_EXECUTION_ID);
    List<RuntimeQueryResultItem> singleResult = mockRuntimeQueryResultItemList(1);
    when(runtimeProvisioningService.executeQuery(any(RuntimeQuery.class))).thenReturn(singleResult);
    RuntimeListItem expectedItem = buildExpectedResult(singleResult).iterator().next();
    RuntimeListItem result = service.getRuntimeItem(traceKey);
    assertEquals(expectedItem, result);
}
Also used : RuntimeListItem(org.guvnor.ala.ui.model.RuntimeListItem) RuntimeQuery(org.guvnor.ala.services.api.RuntimeQuery) RuntimeQueryResultItem(org.guvnor.ala.services.api.RuntimeQueryResultItem) PipelineExecutionTraceKey(org.guvnor.ala.ui.model.PipelineExecutionTraceKey) Test(org.junit.Test)

Example 7 with PipelineExecutionTraceKey

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

the class ProviderPresenterTest method testPipelineExecutionDeleted.

@Test
public void testPipelineExecutionDeleted() {
    // 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 provider status presenter is not empty after the removal.
    when(providerStatusPresenter.isEmpty()).thenReturn(false);
    presenter.onPipelineExecutionChange(new PipelineExecutionChangeEvent(PipelineExecutionChange.DELETED, pipelineExecutionTraceKey));
    verify(providerStatusPresenter, times(1)).removeItem(pipelineExecutionTraceKey);
}
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 8 with PipelineExecutionTraceKey

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

Example 9 with PipelineExecutionTraceKey

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

the class RuntimePresenterActionsTest method testStopPipelineConfirmYesAndSuccessful.

@Test
public void testStopPipelineConfirmYesAndSuccessful() {
    preparePipelineStop();
    PipelineExecutionTraceKey currentKey = trace.getKey();
    when(translationService.format(RuntimePresenter_PipelineExecutionStopSuccessMessage, currentKey.getId())).thenReturn(SUCCESS_MESSAGE);
    yesCommandCaptor.getValue().execute();
    verify(runtimeService, times(1)).stopPipelineExecution(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 10 with PipelineExecutionTraceKey

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

the class RuntimePresenterActionsTest method testStopPipelineConfirmYesAndFailed.

@Test
public void testStopPipelineConfirmYesAndFailed() {
    preparePipelineStop();
    PipelineExecutionTraceKey currentKey = trace.getKey();
    doThrow(new RuntimeException(ERROR_MESSAGE)).when(runtimeService).stopPipelineExecution(currentKey);
    yesCommandCaptor.getValue().execute();
    verify(runtimeService, times(1)).stopPipelineExecution(currentKey);
    verify(defaultErrorCallback, times(1)).error(any(Message.class), exceptionCaptor.capture());
    assertEquals(ERROR_MESSAGE, exceptionCaptor.getValue().getCause().getMessage());
}
Also used : RuntimePresenter_RuntimeDeletingForcedMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeDeletingForcedMessage) RuntimePresenter_RuntimeDeleteFailedMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeDeleteFailedMessage) RuntimePresenter_PipelineExecutionAlreadyStoppedMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_PipelineExecutionAlreadyStoppedMessage) RuntimePresenter_PipelineExecutionDeleteSuccessMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_PipelineExecutionDeleteSuccessMessage) RuntimePresenter_PipelineExecutionStopSuccessMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_PipelineExecutionStopSuccessMessage) RuntimePresenter_RuntimeDeleteSuccessMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeDeleteSuccessMessage) RuntimePresenter_RuntimeDeletingMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeDeletingMessage) RuntimePresenter_RuntimeConfirmForcedDeleteMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeConfirmForcedDeleteMessage) RuntimePresenter_RuntimeStopSuccessMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeStopSuccessMessage) RuntimePresenter_RuntimeConfirmDeleteMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeConfirmDeleteMessage) RuntimePresenter_PipelineExecutionConfirmDeleteMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_PipelineExecutionConfirmDeleteMessage) RuntimePresenter_PipelineExecutionConfirmStopMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_PipelineExecutionConfirmStopMessage) RuntimePresenter_RuntimeConfirmStopMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeConfirmStopMessage) Message(org.jboss.errai.bus.client.api.messaging.Message) RuntimePresenter_RuntimeStartingMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeStartingMessage) RuntimePresenter_RuntimeStoppingMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeStoppingMessage) RuntimePresenter_RuntimeStartSuccessMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeStartSuccessMessage) 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