use of org.guvnor.ala.services.api.RuntimeQueryResultItem 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.services.api.RuntimeQueryResultItem in project kie-wb-common by kiegroup.
the class RuntimeServiceImplTest method mockRuntimeQueryResultItem.
private RuntimeQueryResultItem mockRuntimeQueryResultItem(String suffix, int stageItemsCount) {
RuntimeQueryResultItem item = new RuntimeQueryResultItem();
item.setProviderId("RuntimeQueryResultItem.providerId." + suffix);
item.setProviderTypeName("RuntimeQueryResultItem.providerTypeName." + suffix);
item.setProviderVersion("RuntimeQueryResultItem.providerVersion." + suffix);
item.setPipelineId("RuntimeQueryResultItem.pipelineId." + suffix);
item.setPipelineExecutionId("RuntimeQueryResultItem.pipelineExecutionId." + suffix);
item.setPipelineStatus("RUNNING");
item.setPipelineError("RuntimeQueryResultItem.pipelineError." + suffix);
item.setPipelineStageItems(mockPipelineStageItemList(stageItemsCount));
item.setRuntimeId("RuntimeQueryResultItem.runtimeId." + suffix);
item.setRuntimeName("RuntimeQueryResultItem.runtimeName." + suffix);
item.setRuntimeStatus("RUNNING");
item.setStartedAt("RuntimeQueryResultItem.startedAt." + suffix);
item.setRuntimeEndpoint("RuntimeQueryResultItem.runtimeEndpoint." + suffix);
return item;
}
use of org.guvnor.ala.services.api.RuntimeQueryResultItem in project kie-wb-common by kiegroup.
the class RuntimeServiceImplTest method testCreateRuntimeSuccessful.
@Test
public void testCreateRuntimeSuccessful() {
Provider provider = mock(Provider.class);
ProviderTypeKey providerTypeKey = new ProviderTypeKey(PROVIDER_NAME, PROVIDER_VERSION);
ProviderKey providerKey = new ProviderKey(providerTypeKey, PROVIDER_ID);
Map<String, String> params = PipelineInputBuilderTest.mockParams(PARAMS_COUNT);
List<RuntimeQueryResultItem> items = mock(List.class);
when(providerService.getProvider(providerKey)).thenReturn(provider);
when(runtimeProvisioningService.executeQuery(RuntimeQueryBuilder.newInstance().withRuntimeName(RUNTIME_ID).build())).thenReturn(items);
when(items.isEmpty()).thenReturn(true);
Input expectedInput = PipelineInputBuilder.newInstance().withProvider(providerKey).withRuntimeName(RUNTIME_ID).withParams(params).build();
service.createRuntime(providerKey, RUNTIME_ID, PIPELINE_KEY, params);
verify(pipelineService, times(1)).runPipeline(PIPELINE, expectedInput, true);
}
use of org.guvnor.ala.services.api.RuntimeQueryResultItem in project kie-wb-common by kiegroup.
the class RuntimeProvisioningServiceBackendImplTest method testExecuteQuery.
@Test
public void testExecuteQuery() {
RuntimeQuery query = mock(RuntimeQuery.class);
List<RuntimeQueryResultItem> values = mockList(RuntimeQueryResultItem.class, ELEMENTS_COUNT);
RuntimeQueryResultItemList list = new RuntimeQueryResultItemList(values);
when(runtimeProvisioningService.executeQuery(query)).thenReturn(list);
List<RuntimeQueryResultItem> result = runtimeProvisioningServiceBackend.executeQuery(query);
verify(runtimeProvisioningService, times(1)).executeQuery(query);
assertEquals(values, result);
}
use of org.guvnor.ala.services.api.RuntimeQueryResultItem 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);
}
Aggregations