Search in sources :

Example 21 with RuntimeKey

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

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

the class RuntimeServiceImplTest method testDeleteRuntime.

private void testDeleteRuntime(boolean forced) {
    ProviderKey providerKey = mock(ProviderKey.class);
    RuntimeKey runtimeKey = new RuntimeKey(providerKey, RUNTIME_ID);
    service.deleteRuntime(runtimeKey, forced);
    verify(runtimeProvisioningService, times(1)).destroyRuntime(RUNTIME_ID, forced);
    verify(runtimeChangeEvent, times(1)).fire(new RuntimeChangeEvent(RuntimeChange.DELETED, runtimeKey));
}
Also used : ProviderKey(org.guvnor.ala.ui.model.ProviderKey) RuntimeKey(org.guvnor.ala.ui.model.RuntimeKey) RuntimeChangeEvent(org.guvnor.ala.ui.events.RuntimeChangeEvent)

Example 23 with RuntimeKey

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

the class RuntimeServiceImplTest method getRuntimeItemByRuntimeKeyNotExisting.

@Test
public void getRuntimeItemByRuntimeKeyNotExisting() {
    ProviderKey providerKey = mock(ProviderKey.class);
    RuntimeKey runtimeKey = new RuntimeKey(providerKey, RUNTIME_ID);
    List<RuntimeQueryResultItem> singleResult = new ArrayList<>();
    when(runtimeProvisioningService.executeQuery(any(RuntimeQuery.class))).thenReturn(singleResult);
    RuntimeListItem result = service.getRuntimeItem(runtimeKey);
    assertNull(result);
}
Also used : ProviderKey(org.guvnor.ala.ui.model.ProviderKey) RuntimeListItem(org.guvnor.ala.ui.model.RuntimeListItem) RuntimeQuery(org.guvnor.ala.services.api.RuntimeQuery) RuntimeQueryResultItem(org.guvnor.ala.services.api.RuntimeQueryResultItem) ArrayList(java.util.ArrayList) RuntimeKey(org.guvnor.ala.ui.model.RuntimeKey) Test(org.junit.Test)

Example 24 with RuntimeKey

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

the class RuntimeServiceImplTest method getRuntimeItemByRuntimeKeyExisting.

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

Aggregations

RuntimeKey (org.guvnor.ala.ui.model.RuntimeKey)24 Test (org.junit.Test)21 RuntimeChangeEvent (org.guvnor.ala.ui.events.RuntimeChangeEvent)9 ProviderKey (org.guvnor.ala.ui.model.ProviderKey)7 RuntimeListItem (org.guvnor.ala.ui.model.RuntimeListItem)5 NotificationEvent (org.uberfire.workbench.events.NotificationEvent)5 RuntimePresenter_PipelineExecutionAlreadyStoppedMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_PipelineExecutionAlreadyStoppedMessage)3 RuntimePresenter_PipelineExecutionConfirmDeleteMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_PipelineExecutionConfirmDeleteMessage)3 RuntimePresenter_PipelineExecutionConfirmStopMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_PipelineExecutionConfirmStopMessage)3 RuntimePresenter_PipelineExecutionDeleteSuccessMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_PipelineExecutionDeleteSuccessMessage)3 RuntimePresenter_PipelineExecutionStopSuccessMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_PipelineExecutionStopSuccessMessage)3 RuntimePresenter_RuntimeConfirmDeleteMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeConfirmDeleteMessage)3 RuntimePresenter_RuntimeConfirmForcedDeleteMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeConfirmForcedDeleteMessage)3 RuntimePresenter_RuntimeConfirmStopMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeConfirmStopMessage)3 RuntimePresenter_RuntimeDeleteFailedMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeDeleteFailedMessage)3 RuntimePresenter_RuntimeDeleteSuccessMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeDeleteSuccessMessage)3 RuntimePresenter_RuntimeDeletingForcedMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeDeletingForcedMessage)3 RuntimePresenter_RuntimeDeletingMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeDeletingMessage)3 RuntimePresenter_RuntimeStartSuccessMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeStartSuccessMessage)3 RuntimePresenter_RuntimeStartingMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeStartingMessage)3