Search in sources :

Example 6 with Provider

use of org.guvnor.ala.ui.model.Provider in project kie-wb-common by kiegroup.

the class OpenShiftProviderConfigPresenterTest method testLoad.

@Test
public void testLoad() {
    Map<String, Object> values = new HashMap<>();
    values.put(MASTER_URL, MASTER_URL_VALUE);
    values.put(USER, USER_VALUE);
    values.put(PASSWORD, PASSWORD_VALUE);
    Provider provider = mock(Provider.class);
    ProviderKey providerKey = mock(ProviderKey.class);
    ProviderConfiguration configuration = mock(ProviderConfiguration.class);
    when(provider.getKey()).thenReturn(providerKey);
    when(providerKey.getId()).thenReturn(PROVIDER_NAME_VALUE);
    when(provider.getConfiguration()).thenReturn(configuration);
    when(configuration.getValues()).thenReturn(values);
    presenter.load(provider);
    verify(view, times(1)).clear();
    verify(view, times(1)).setProviderName(PROVIDER_NAME_VALUE);
    verify(view, times(1)).setMasterURL(MASTER_URL_VALUE);
    verify(view, times(1)).setUsername(USER_VALUE);
    verify(view, times(1)).setPassword(PASSWORD_VALUE);
}
Also used : ProviderKey(org.guvnor.ala.ui.model.ProviderKey) HashMap(java.util.HashMap) Provider(org.guvnor.ala.ui.model.Provider) ProviderConfiguration(org.guvnor.ala.ui.model.ProviderConfiguration) Test(org.junit.Test)

Example 7 with Provider

use of org.guvnor.ala.ui.model.Provider in project kie-wb-common by kiegroup.

the class WF10ProviderConfigPresenterTest method testLoad.

@Test
public void testLoad() {
    Map<String, Object> values = new HashMap<>();
    values.put(HOST, HOST_VALUE);
    values.put(PORT, PORT_VALUE);
    values.put(MANAGEMENT_PORT, MANAGEMENT_PORT_VALUE);
    values.put(USER, USER_VALUE);
    values.put(PASSWORD, PASSWORD_VALUE);
    Provider provider = mock(Provider.class);
    ProviderKey providerKey = mock(ProviderKey.class);
    ProviderConfiguration configuration = mock(ProviderConfiguration.class);
    when(provider.getKey()).thenReturn(providerKey);
    when(providerKey.getId()).thenReturn(PROVIDER_NAME_VALUE);
    when(provider.getConfiguration()).thenReturn(configuration);
    when(configuration.getValues()).thenReturn(values);
    presenter.load(provider);
    verify(view, times(1)).setProviderName(PROVIDER_NAME_VALUE);
    verify(view, times(1)).setHost(HOST_VALUE);
    verify(view, times(1)).setPort(PORT_VALUE);
    verify(view, times(1)).setManagementPort(MANAGEMENT_PORT_VALUE);
    verify(view, times(1)).setUsername(USER_VALUE);
    verify(view, times(1)).setPassword(PASSWORD_MASK);
}
Also used : ProviderKey(org.guvnor.ala.ui.model.ProviderKey) HashMap(java.util.HashMap) Provider(org.guvnor.ala.ui.model.Provider) ProviderConfiguration(org.guvnor.ala.ui.model.ProviderConfiguration) Test(org.junit.Test)

Example 8 with Provider

use of org.guvnor.ala.ui.model.Provider in project kie-wb-common by kiegroup.

the class ProvisioningManagementPerspectiveTest method testAddNewRuntime.

@Test
public void testAddNewRuntime() {
    Provider provider = new Provider(mockProviderKey(mockProviderTypeKey(""), ""), mock(ProviderConfiguration.class));
    @SuppressWarnings("unchecked") List<PipelineKey> pipelines = mock(List.class);
    when(runtimeService.getPipelines(provider.getKey().getProviderTypeKey())).thenReturn(pipelines);
    perspective.onAddNewRuntime(new AddNewRuntimeEvent(provider));
    verify(newDeployWizard, times(1)).start(provider, pipelines);
}
Also used : PipelineKey(org.guvnor.ala.ui.model.PipelineKey) AddNewRuntimeEvent(org.guvnor.ala.ui.client.events.AddNewRuntimeEvent) Provider(org.guvnor.ala.ui.model.Provider) ProviderConfiguration(org.guvnor.ala.ui.model.ProviderConfiguration) Test(org.junit.Test)

Example 9 with Provider

use of org.guvnor.ala.ui.model.Provider 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 10 with Provider

use of org.guvnor.ala.ui.model.Provider in project kie-wb-common by kiegroup.

the class RuntimeServiceImpl method validateForCreateRuntime.

private void validateForCreateRuntime(final ProviderKey providerKey, final String runtimeName) {
    final Provider provider = providerService.getProvider(providerKey);
    if (provider == null) {
        // uncommon case
        logger.error("No provider was found for providerKey: " + providerKey);
        throw new ServiceException("No provider was found for providerKey: " + providerKey);
    }
    final Collection<RuntimeQueryResultItem> items = runtimeProvisioningService.executeQuery(RuntimeQueryBuilder.newInstance().withRuntimeName(runtimeName).build());
    if (!items.isEmpty()) {
        throw new ServiceException("A runtime with the given name already exists: " + runtimeName);
    }
}
Also used : ServiceException(org.guvnor.ala.ui.exceptions.ServiceException) RuntimeQueryResultItem(org.guvnor.ala.services.api.RuntimeQueryResultItem) Provider(org.guvnor.ala.ui.model.Provider)

Aggregations

Provider (org.guvnor.ala.ui.model.Provider)14 ProviderKey (org.guvnor.ala.ui.model.ProviderKey)9 Test (org.junit.Test)9 ProviderTypeKey (org.guvnor.ala.ui.model.ProviderTypeKey)8 ProviderConfiguration (org.guvnor.ala.ui.model.ProviderConfiguration)5 Input (org.guvnor.ala.pipeline.Input)3 RuntimeQueryResultItem (org.guvnor.ala.services.api.RuntimeQueryResultItem)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2 PipelineKey (org.guvnor.ala.ui.model.PipelineKey)2 RuntimesInfo (org.guvnor.ala.ui.model.RuntimesInfo)2 ProvisioningManagementTestCommons.mockProviderTypeKey (org.guvnor.ala.ui.ProvisioningManagementTestCommons.mockProviderTypeKey)1 BackendProviderHandler (org.guvnor.ala.ui.backend.service.handler.BackendProviderHandler)1 AddNewRuntimeEvent (org.guvnor.ala.ui.client.events.AddNewRuntimeEvent)1 ServiceException (org.guvnor.ala.ui.exceptions.ServiceException)1 ProviderType (org.guvnor.ala.ui.model.ProviderType)1 RuntimeListItem (org.guvnor.ala.ui.model.RuntimeListItem)1 Before (org.junit.Before)1