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