Search in sources :

Example 11 with ProviderTypeKey

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);
}
Also used : Input(org.guvnor.ala.pipeline.Input) ProviderKey(org.guvnor.ala.ui.model.ProviderKey) RuntimeQueryResultItem(org.guvnor.ala.services.api.RuntimeQueryResultItem) ProviderTypeKey(org.guvnor.ala.ui.model.ProviderTypeKey) Provider(org.guvnor.ala.ui.model.Provider) Test(org.junit.Test)

Example 12 with ProviderTypeKey

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);
}
Also used : ProviderTypeKey(org.guvnor.ala.ui.model.ProviderTypeKey) AbstractProviderHandlerRegistryTest(org.guvnor.ala.ui.handler.AbstractProviderHandlerRegistryTest) Test(org.junit.Test)

Example 13 with ProviderTypeKey

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));
}
Also used : ProviderKey(org.guvnor.ala.ui.model.ProviderKey) ProviderTypeSelectedEvent(org.guvnor.ala.ui.client.events.ProviderTypeSelectedEvent) ArrayList(java.util.ArrayList) ProviderType(org.guvnor.ala.ui.model.ProviderType) ProviderTypeKey(org.guvnor.ala.ui.model.ProviderTypeKey) ProvidersInfo(org.guvnor.ala.ui.model.ProvidersInfo) Test(org.junit.Test)

Example 14 with ProviderTypeKey

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);
}
Also used : RuntimesInfo(org.guvnor.ala.ui.model.RuntimesInfo) ProviderTypeKey(org.guvnor.ala.ui.model.ProviderTypeKey) ProvisioningManagementTestCommons.mockProviderTypeKey(org.guvnor.ala.ui.ProvisioningManagementTestCommons.mockProviderTypeKey) ProviderConfiguration(org.guvnor.ala.ui.model.ProviderConfiguration) Provider(org.guvnor.ala.ui.model.Provider)

Example 15 with ProviderTypeKey

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));
}
Also used : ProviderTypeKey(org.guvnor.ala.ui.model.ProviderTypeKey) Test(org.junit.Test)

Aggregations

ProviderTypeKey (org.guvnor.ala.ui.model.ProviderTypeKey)29 Test (org.junit.Test)18 ProviderKey (org.guvnor.ala.ui.model.ProviderKey)14 Provider (org.guvnor.ala.ui.model.Provider)8 ProviderType (org.guvnor.ala.ui.model.ProviderType)7 Input (org.guvnor.ala.pipeline.Input)4 Before (org.junit.Before)4 ArrayList (java.util.ArrayList)3 ProvisioningManagementTestCommons.mockProviderTypeKey (org.guvnor.ala.ui.ProvisioningManagementTestCommons.mockProviderTypeKey)3 PipelineKey (org.guvnor.ala.ui.model.PipelineKey)3 Map (java.util.Map)2 RuntimeQueryResultItem (org.guvnor.ala.services.api.RuntimeQueryResultItem)2 ProviderTypeSelectedEvent (org.guvnor.ala.ui.client.events.ProviderTypeSelectedEvent)2 AbstractProviderHandlerRegistryTest (org.guvnor.ala.ui.handler.AbstractProviderHandlerRegistryTest)2 ProviderConfiguration (org.guvnor.ala.ui.model.ProviderConfiguration)2 ProvidersInfo (org.guvnor.ala.ui.model.ProvidersInfo)2 Runtime (org.guvnor.ala.ui.model.Runtime)2 RuntimeKey (org.guvnor.ala.ui.model.RuntimeKey)2 RuntimeListItem (org.guvnor.ala.ui.model.RuntimeListItem)2 RuntimeQuery (org.guvnor.ala.services.api.RuntimeQuery)1