Search in sources :

Example 6 with ProviderConfiguration

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

the class OpenShiftProviderConfigConverterTest method testToModel.

@Test
public void testToModel() {
    OpenShiftProviderConfig config = mock(OpenShiftProviderConfig.class);
    when(config.getName()).thenReturn(PROVIDER_NAME_VALUE);
    when(config.getKubernetesMaster()).thenReturn(MASTER_URL_VALUE);
    when(config.getKubernetesAuthBasicUsername()).thenReturn(USER_VALUE);
    when(config.getKubernetesAuthBasicPassword()).thenReturn(PASSWORD_VALUE);
    ProviderConfiguration result = converter.toModel(config);
    assertNotNull(result);
    assertEquals(PROVIDER_NAME_VALUE, result.getId());
    assertEquals(MASTER_URL_VALUE, result.getValues().get(KUBERNETES_MASTER.inputKey()));
    assertEquals(USER_VALUE, result.getValues().get(KUBERNETES_AUTH_BASIC_USERNAME.inputKey()));
    assertEquals(PASSWORD_VALUE, result.getValues().get(KUBERNETES_AUTH_BASIC_PASSWORD.inputKey()));
}
Also used : OpenShiftProviderConfig(org.guvnor.ala.openshift.config.OpenShiftProviderConfig) ProviderConfiguration(org.guvnor.ala.ui.model.ProviderConfiguration) Test(org.junit.Test)

Example 7 with ProviderConfiguration

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

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

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

the class WF10ProviderConfigPresenterTest method testBuildProviderConfiguration.

@Test
public void testBuildProviderConfiguration() {
    when(view.getProviderName()).thenReturn(PROVIDER_NAME_VALUE);
    when(view.getHost()).thenReturn(HOST_VALUE);
    when(view.getPort()).thenReturn(PORT_VALUE);
    when(view.getManagementPort()).thenReturn(MANAGEMENT_PORT_VALUE);
    when(view.getUsername()).thenReturn(USER_VALUE);
    when(view.getPassword()).thenReturn(PASSWORD_VALUE);
    ProviderConfiguration configuration = presenter.buildProviderConfiguration();
    assertEquals(PROVIDER_NAME_VALUE, presenter.getProviderName());
    assertEquals(HOST_VALUE, configuration.getValues().get(HOST));
    assertEquals(PORT_VALUE, configuration.getValues().get(PORT));
    assertEquals(MANAGEMENT_PORT_VALUE, configuration.getValues().get(MANAGEMENT_PORT));
    assertEquals(USER_VALUE, configuration.getValues().get(USER));
    assertEquals(PASSWORD_VALUE, configuration.getValues().get(PASSWORD));
}
Also used : ProviderConfiguration(org.guvnor.ala.ui.model.ProviderConfiguration) Test(org.junit.Test)

Example 10 with ProviderConfiguration

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

the class NewProviderWizard method complete.

@Override
public void complete() {
    final ProviderConfiguration providerConfiguration = providerConfigurationPage.buildProviderConfiguration();
    providerService.call((Void aVoid) -> onCreateProviderSuccess(providerConfiguration), popupHelper.getPopupErrorCallback()).createProvider(providerType, providerConfiguration);
}
Also used : ProviderConfiguration(org.guvnor.ala.ui.model.ProviderConfiguration)

Aggregations

ProviderConfiguration (org.guvnor.ala.ui.model.ProviderConfiguration)12 Test (org.junit.Test)8 HashMap (java.util.HashMap)4 Provider (org.guvnor.ala.ui.model.Provider)4 ProviderKey (org.guvnor.ala.ui.model.ProviderKey)3 OpenShiftProviderConfig (org.guvnor.ala.openshift.config.OpenShiftProviderConfig)2 ProviderTypeKey (org.guvnor.ala.ui.model.ProviderTypeKey)2 WildflyProviderConfig (org.guvnor.ala.wildfly.config.WildflyProviderConfig)2 Map (java.util.Map)1 ProviderConfig (org.guvnor.ala.config.ProviderConfig)1 ProvisioningManagementTestCommons.mockProviderTypeKey (org.guvnor.ala.ui.ProvisioningManagementTestCommons.mockProviderTypeKey)1 BackendProviderHandler (org.guvnor.ala.ui.backend.service.handler.BackendProviderHandler)1 RuntimesInfo (org.guvnor.ala.ui.model.RuntimesInfo)1