Search in sources :

Example 11 with PipelineExecutionTraceKey

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

the class RuntimePresenterActionsTest method testOnCurrentPipelineExecutionStopped.

@Test
public void testOnCurrentPipelineExecutionStopped() {
    preparePipelineExecutionTraceSetup();
    PipelineExecutionTraceKey currentKey = trace.getKey();
    RuntimeListItem item = new RuntimeListItem(RUNTIME_NAME, trace);
    presenter.setup(item);
    presenter.onPipelineExecutionChange(new PipelineExecutionChangeEvent(PipelineExecutionChange.STOPPED, currentKey));
    verify(presenter, times(1)).refresh(currentKey);
}
Also used : RuntimeListItem(org.guvnor.ala.ui.model.RuntimeListItem) PipelineExecutionChangeEvent(org.guvnor.ala.ui.events.PipelineExecutionChangeEvent) PipelineExecutionTraceKey(org.guvnor.ala.ui.model.PipelineExecutionTraceKey) Test(org.junit.Test)

Example 12 with PipelineExecutionTraceKey

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

the class RuntimePresenterActionsTest method testDeletePipelineConfirmYesAndFailed.

@Test
public void testDeletePipelineConfirmYesAndFailed() {
    preparePipelineDelete();
    PipelineExecutionTraceKey currentKey = trace.getKey();
    doThrow(new RuntimeException(ERROR_MESSAGE)).when(runtimeService).deletePipelineExecution(currentKey);
    yesCommandCaptor.getValue().execute();
    verify(runtimeService, times(1)).deletePipelineExecution(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)

Example 13 with PipelineExecutionTraceKey

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

the class RuntimePresenterActionsTest method testOnOtherPipelineExecutionStopped.

@Test
public void testOnOtherPipelineExecutionStopped() {
    preparePipelineExecutionTraceSetup();
    PipelineExecutionTraceKey otherKey = mock(PipelineExecutionTraceKey.class);
    RuntimeListItem item = new RuntimeListItem(RUNTIME_NAME, trace);
    presenter.setup(item);
    presenter.onPipelineExecutionChange(new PipelineExecutionChangeEvent(PipelineExecutionChange.STOPPED, otherKey));
    verify(presenter, never()).refresh(any(PipelineExecutionTraceKey.class));
}
Also used : RuntimeListItem(org.guvnor.ala.ui.model.RuntimeListItem) PipelineExecutionChangeEvent(org.guvnor.ala.ui.events.PipelineExecutionChangeEvent) PipelineExecutionTraceKey(org.guvnor.ala.ui.model.PipelineExecutionTraceKey) Test(org.junit.Test)

Example 14 with PipelineExecutionTraceKey

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

the class RuntimeListItemBuilder method build.

public RuntimeListItem build() {
    RuntimeListItem result;
    PipelineExecutionTrace pipelineTrace;
    String runtimeName;
    if (item.getRuntimeName() != null) {
        runtimeName = item.getRuntimeName();
    } else {
        runtimeName = item.getRuntimeId();
    }
    if (item.getPipelineExecutionId() != null) {
        final Pipeline pipeline = new Pipeline(new PipelineKey(item.getPipelineId()));
        pipelineTrace = new PipelineExecutionTrace(new PipelineExecutionTraceKey(item.getPipelineExecutionId()));
        pipelineTrace.setPipelineStatus(transformToPipelineStatus(item.getPipelineStatus()));
        pipelineTrace.setPipelineError(new PipelineError(item.getPipelineError(), item.getPipelineErrorDetail()));
        item.getPipelineStageItems().getItems().forEach(stage -> {
            pipeline.addStage(new Stage(pipeline.getKey(), stage.getName()));
            pipelineTrace.setStageStatus(stage.getName(), transformToPipelineStatus(stage.getStatus()));
            pipelineTrace.setStageError(stage.getName(), new PipelineError(stage.getStageError(), stage.getStageErrorDetail()));
        });
        pipelineTrace.setPipeline(pipeline);
    } else {
        pipelineTrace = null;
    }
    if (item.getRuntimeId() != null) {
        final Runtime runtime = new Runtime(new RuntimeKey(new ProviderKey(new ProviderTypeKey(item.getProviderTypeName(), item.getProviderVersion()), item.getProviderId()), item.getRuntimeId()), item.getRuntimeStatus(), item.getRuntimeEndpoint(), item.getStartedAt());
        runtime.setPipelineTrace(pipelineTrace);
        result = new RuntimeListItem(runtimeName, runtime);
    } else {
        result = new RuntimeListItem(runtimeName, pipelineTrace);
    }
    return result;
}
Also used : Runtime(org.guvnor.ala.ui.model.Runtime) RuntimeListItem(org.guvnor.ala.ui.model.RuntimeListItem) PipelineKey(org.guvnor.ala.ui.model.PipelineKey) ProviderKey(org.guvnor.ala.ui.model.ProviderKey) PipelineExecutionTrace(org.guvnor.ala.ui.model.PipelineExecutionTrace) Stage(org.guvnor.ala.ui.model.Stage) RuntimeKey(org.guvnor.ala.ui.model.RuntimeKey) PipelineExecutionTraceKey(org.guvnor.ala.ui.model.PipelineExecutionTraceKey) ProviderTypeKey(org.guvnor.ala.ui.model.ProviderTypeKey) Pipeline(org.guvnor.ala.ui.model.Pipeline) PipelineError(org.guvnor.ala.ui.model.PipelineError)

Example 15 with PipelineExecutionTraceKey

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

the class RuntimeServiceImpl method createRuntime.

@Override
public PipelineExecutionTraceKey createRuntime(final ProviderKey providerKey, final String runtimeName, final PipelineKey pipelineKey, final Map<String, String> params) {
    checkNotNull("providerKey", providerKey);
    checkNotNull("runtimeName", runtimeName);
    checkNotNull("pipelineKey", pipelineKey);
    validateForCreateRuntime(providerKey, runtimeName);
    try {
        final Input input = PipelineInputBuilder.newInstance().withRuntimeName(runtimeName).withProvider(providerKey).withParams(params).build();
        return new PipelineExecutionTraceKey(pipelineService.runPipeline(pipelineKey.getId(), input, true));
    } catch (Exception e) {
        logger.error("Runtime creation failed.", e);
        throw ExceptionUtilities.handleException(e);
    }
}
Also used : Input(org.guvnor.ala.pipeline.Input) PipelineExecutionTraceKey(org.guvnor.ala.ui.model.PipelineExecutionTraceKey) ServiceException(org.guvnor.ala.ui.exceptions.ServiceException)

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