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