Search in sources :

Example 1 with ProviderConfiguration

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

the class WildflyProviderConfigConverterTest method testToModel.

@Test
public void testToModel() {
    WildflyProviderConfig config = mock(WildflyProviderConfig.class);
    when(config.getName()).thenReturn(PROVIDER_NAME_VALUE);
    when(config.getHost()).thenReturn(HOST_VALUE);
    when(config.getPort()).thenReturn(PORT_VALUE);
    when(config.getManagementPort()).thenReturn(MANAGEMENT_PORT_VALUE);
    when(config.getUser()).thenReturn(WILDFLY_USER_VALUE);
    when(config.getPassword()).thenReturn(WILDFLY_PASSWORD_VALUE);
    ProviderConfiguration result = converter.toModel(config);
    assertNotNull(result);
    assertEquals(PROVIDER_NAME_VALUE, result.getId());
    assertEquals(HOST_VALUE, result.getValues().get(HOST));
    assertEquals(PORT_VALUE, result.getValues().get(PORT));
    assertEquals(MANAGEMENT_PORT_VALUE, result.getValues().get(MANAGEMENT_PORT));
    assertEquals(WILDFLY_USER_VALUE, result.getValues().get(WILDFLY_USER));
    assertEquals(WILDFLY_PASSWORD_VALUE, result.getValues().get(WILDFLY_PASSWORD));
}
Also used : WildflyProviderConfig(org.guvnor.ala.wildfly.config.WildflyProviderConfig) ProviderConfiguration(org.guvnor.ala.ui.model.ProviderConfiguration) Test(org.junit.Test)

Example 2 with ProviderConfiguration

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

the class WildflyProviderConfigConverterTest method testToDomain.

@Test
public void testToDomain() {
    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(WILDFLY_USER, WILDFLY_USER_VALUE);
    values.put(WILDFLY_PASSWORD, WILDFLY_PASSWORD_VALUE);
    ProviderConfiguration configuration = new ProviderConfiguration(PROVIDER_NAME_VALUE, values);
    WildflyProviderConfig result = converter.toDomain(configuration);
    assertNotNull(result);
    assertEquals(PROVIDER_NAME_VALUE, result.getName());
    assertEquals(HOST_VALUE, result.getHost());
    assertEquals(PORT_VALUE, result.getPort());
    assertEquals(MANAGEMENT_PORT_VALUE, result.getManagementPort());
    assertEquals(WILDFLY_USER_VALUE, result.getUser());
    assertEquals(WILDFLY_PASSWORD_VALUE, result.getPassword());
}
Also used : WildflyProviderConfig(org.guvnor.ala.wildfly.config.WildflyProviderConfig) HashMap(java.util.HashMap) ProviderConfiguration(org.guvnor.ala.ui.model.ProviderConfiguration) Test(org.junit.Test)

Example 3 with ProviderConfiguration

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

the class OpenShiftProviderConfigConverterTest method testToDomain.

@Test
public void testToDomain() {
    Map<String, Object> values = new HashMap<>();
    values.put(KUBERNETES_MASTER.inputKey(), MASTER_URL_VALUE);
    values.put(KUBERNETES_AUTH_BASIC_USERNAME.inputKey(), USER_VALUE);
    values.put(KUBERNETES_AUTH_BASIC_PASSWORD.inputKey(), PASSWORD_VALUE);
    ProviderConfiguration configuration = new ProviderConfiguration(PROVIDER_NAME_VALUE, values);
    OpenShiftProviderConfig result = converter.toDomain(configuration);
    assertNotNull(result);
    assertEquals(PROVIDER_NAME_VALUE, result.getName());
    assertEquals(MASTER_URL_VALUE, result.getKubernetesMaster());
    assertEquals(USER_VALUE, result.getKubernetesAuthBasicUsername());
    assertEquals(PASSWORD_VALUE, result.getKubernetesAuthBasicPassword());
}
Also used : HashMap(java.util.HashMap) OpenShiftProviderConfig(org.guvnor.ala.openshift.config.OpenShiftProviderConfig) ProviderConfiguration(org.guvnor.ala.ui.model.ProviderConfiguration) Test(org.junit.Test)

Example 4 with ProviderConfiguration

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

the class OpenShiftProviderConfigPresenterTest method testBuildProviderConfiguration.

@Test
public void testBuildProviderConfiguration() {
    when(view.getProviderName()).thenReturn(PROVIDER_NAME_VALUE);
    when(view.getMasterURL()).thenReturn(MASTER_URL_VALUE);
    when(view.getUsername()).thenReturn(USER_VALUE);
    when(view.getPassword()).thenReturn(PASSWORD_VALUE);
    ProviderConfiguration configuration = presenter.buildProviderConfiguration();
    assertEquals(PROVIDER_NAME_VALUE, presenter.getProviderName());
    assertEquals(MASTER_URL_VALUE, configuration.getValues().get(MASTER_URL));
    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 5 with ProviderConfiguration

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

the class ProviderServiceImplTest method prepareConfigurationForCreate.

private void prepareConfigurationForCreate() {
    providerConfiguration = mock(ProviderConfiguration.class);
    Map values = mock(Map.class);
    when(values.size()).thenReturn(5);
    when(providerConfiguration.getValues()).thenReturn(values);
    providerConfig = mock(ProviderConfig.class);
    when(providerConfigConverter.toDomain(providerConfiguration)).thenReturn(providerConfig);
}
Also used : ProviderConfig(org.guvnor.ala.config.ProviderConfig) Map(java.util.Map) 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