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);
}
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);
}
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());
}
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));
}
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());
}
Aggregations