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);
}
use of org.guvnor.ala.services.api.RuntimeQueryResultItem 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);
}
use of org.guvnor.ala.services.api.RuntimeQueryResultItem in project kie-wb-common by kiegroup.
the class RuntimeServiceImplTest method testCreateRuntimeWhenProviderExistsButRuntimeNameExitsts.
@Test
public void testCreateRuntimeWhenProviderExistsButRuntimeNameExitsts() {
Provider provider = mock(Provider.class);
ProviderTypeKey providerTypeKey = new ProviderTypeKey(PROVIDER_NAME, PROVIDER_VERSION);
ProviderKey providerKey = new ProviderKey(providerTypeKey, PROVIDER_ID);
List<RuntimeQueryResultItem> items = mock(List.class);
// the provider exists, so validation continues
when(providerService.getProvider(providerKey)).thenReturn(provider);
// but the runtime name already exists.
when(runtimeProvisioningService.executeQuery(RuntimeQueryBuilder.newInstance().withRuntimeName(RUNTIME_ID).build())).thenReturn(items);
when(items.isEmpty()).thenReturn(false);
expectedException.expectMessage("A runtime with the given name already exists: " + RUNTIME_ID);
service.createRuntime(providerKey, RUNTIME_ID, PIPELINE_KEY, mock(Map.class));
verify(pipelineService, never()).runPipeline(anyString(), any(Input.class), eq(true));
}
use of org.guvnor.ala.services.api.RuntimeQueryResultItem in project kie-wb-common by kiegroup.
the class RuntimeServiceImplTest method getRuntimeItemByPipelineExecutionKeyNotExisting.
@Test
public void getRuntimeItemByPipelineExecutionKeyNotExisting() {
PipelineExecutionTraceKey traceKey = new PipelineExecutionTraceKey(PIPELINE_EXECUTION_ID);
List<RuntimeQueryResultItem> singleResult = new ArrayList<>();
when(runtimeProvisioningService.executeQuery(any(RuntimeQuery.class))).thenReturn(singleResult);
RuntimeListItem result = service.getRuntimeItem(traceKey);
assertNull(result);
}
Aggregations