use of org.guvnor.ala.ui.model.Provider in project kie-wb-common by kiegroup.
the class ProvisioningScreensServiceImpl method getRuntimesInfo.
@Override
public RuntimesInfo getRuntimesInfo(final ProviderKey providerKey) {
checkNotNull("providerKey", providerKey);
final Provider provider = providerService.getProvider(providerKey);
if (provider == null) {
return null;
}
final Collection<RuntimeListItem> items = runtimeService.getRuntimeItems(providerKey);
return new RuntimesInfo(provider, items);
}
use of org.guvnor.ala.ui.model.Provider in project kie-wb-common by kiegroup.
the class ProviderServiceImplTest method testGetProviderExisting.
@Test
public void testGetProviderExisting() {
// pick one of the existing providers.
org.guvnor.ala.runtime.providers.Provider providerSpi = providersSpi.get(2);
// create a key for finding it.
ProviderTypeKey providerTypeKey = new ProviderTypeKey(providerSpi.getProviderType().getProviderTypeName(), providerSpi.getProviderType().getVersion());
ProviderKey providerKey = new ProviderKey(providerTypeKey, providerSpi.getId());
Provider provider = service.getProvider(providerKey);
assertNotNull(provider);
assertEquals(providers.get(2).getKey(), provider.getKey());
}
use of org.guvnor.ala.ui.model.Provider in project kie-wb-common by kiegroup.
the class RuntimeServiceImplTest method testCreateRuntimeWhenUnExpectedError.
@Test
public void testCreateRuntimeWhenUnExpectedError() {
Provider provider = mock(Provider.class);
ProviderTypeKey providerTypeKey = new ProviderTypeKey(PROVIDER_NAME, PROVIDER_VERSION);
ProviderKey providerKey = new ProviderKey(providerTypeKey, PROVIDER_ID);
when(providerService.getProvider(providerKey)).thenReturn(provider);
when(pipelineService.runPipeline(anyString(), any(Input.class), eq(true))).thenThrow(new RuntimeException(ERROR_MESSAGE));
expectedException.expectMessage(ERROR_MESSAGE);
service.createRuntime(providerKey, "irrelevant for the test", mock(PipelineKey.class), mock(Map.class));
}
use of org.guvnor.ala.ui.model.Provider 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.ui.model.Provider in project kie-wb-common by kiegroup.
the class ProviderConverterImplTest method testToModelWhenHandlerIsConfigured.
@Test
public void testToModelWhenHandlerIsConfigured() {
when(handlerRegistry.ensureHandler(providerTypeKey)).thenReturn(providerHandler);
when(providerHandler.getProviderConfigConverter()).thenReturn(providerConfigConverter);
when(providerConfigConverter.toModel(providerConfig)).thenReturn(providerConfiguration);
Provider result = converter.toModel(provider);
assertNotNull(result);
assertEquals(PROVIDER_ID, result.getKey().getId());
assertEquals(PROVIDER_TYPE_NAME, result.getKey().getProviderTypeKey().getId());
assertEquals(PROVIDER_VERSION, result.getKey().getProviderTypeKey().getVersion());
assertEquals(result.getConfiguration(), providerConfiguration);
}
Aggregations