use of org.guvnor.ala.ui.model.ProviderTypeKey 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.ProviderTypeKey in project kie-wb-common by kiegroup.
the class BackendProviderHandlerRegistryTest method testEnsureHandlerForRegisteredProviderType.
@Test
public void testEnsureHandlerForRegisteredProviderType() throws Exception {
// pick an arbitrary registered provider type.
ProviderTypeKey providerTypeKey = expectedKeys.get(0);
BackendProviderHandler handler = ((BackendProviderHandlerRegistry) handlerRegistry).ensureHandler(providerTypeKey);
assertEquals(expectedHandlers.get(0), handler);
}
use of org.guvnor.ala.ui.model.ProviderTypeKey in project kie-wb-common by kiegroup.
the class ProvisioningManagementBrowserPresenterTest method testOnProviderTypeSelectedWithNOProviders.
@Test
public void testOnProviderTypeSelectedWithNOProviders() {
// pick an arbitrary element as the selected
ProviderType selectedProviderType = providerTypes.iterator().next();
ProviderTypeKey selectedProviderTypeKey = selectedProviderType.getKey();
// the selected provider type don't have providers.
List<ProviderKey> providerKeys = new ArrayList<>();
ProvidersInfo providersInfo = mock(ProvidersInfo.class);
when(providersInfo.getProviderType()).thenReturn(selectedProviderType);
when(providersInfo.getProvidersKey()).thenReturn(providerKeys);
when(providerTypeService.getProviderType(selectedProviderTypeKey)).thenReturn(selectedProviderType);
when(provisioningScreensService.getProvidersInfo(selectedProviderTypeKey)).thenReturn(providersInfo);
presenter.onProviderTypeSelected(new ProviderTypeSelectedEvent(selectedProviderType.getKey()));
verify(providerEmptyPresenter, times(1)).setProviderType(selectedProviderType);
verify(view, times(1)).setContent(providerEmptyPresenterView);
verify(providerTypePresenter, times(1)).setup(any(ProviderType.class), anyCollectionOf(ProviderKey.class), any(ProviderKey.class));
}
use of org.guvnor.ala.ui.model.ProviderTypeKey in project kie-wb-common by kiegroup.
the class ProviderPresenterTest method prepareRuntimesInfo.
private void prepareRuntimesInfo() {
ProviderTypeKey providerTypeKey = mockProviderTypeKey("1");
providerKey = mockProviderKey(providerTypeKey, "1");
ProviderConfiguration configuration = mock(ProviderConfiguration.class);
provider = new Provider(providerKey, configuration);
runtimesInfo = mock(RuntimesInfo.class);
when(runtimesInfo.getProvider()).thenReturn(provider);
when(runtimesInfo.getRuntimeItems()).thenReturn(runtimeItems);
when(providerService.getProvider(providerKey)).thenReturn(provider);
when(provisioningScreensService.getRuntimesInfo(providerKey)).thenReturn(runtimesInfo);
when(handlerRegistry.isProviderInstalled(providerTypeKey)).thenReturn(true);
when(handlerRegistry.getProviderHandler(providerTypeKey)).thenReturn(handler);
when(handler.getFormResolver()).thenReturn(formResolver);
when(formResolver.newProviderConfigurationForm()).thenReturn(configurationForm);
when(configurationForm.getView()).thenReturn(configurationFormView);
}
use of org.guvnor.ala.ui.model.ProviderTypeKey in project kie-wb-common by kiegroup.
the class AbstractProviderHandlerRegistryTest method testProviderNotInstalled.
@Test
public void testProviderNotInstalled() {
ProviderTypeKey providerTypeKey = mock(ProviderTypeKey.class);
assertFalse(handlerRegistry.isProviderInstalled(providerTypeKey));
}
Aggregations