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()));
}
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);
}
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);
}
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));
}
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);
}
Aggregations