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