Search in sources :

Example 11 with ProviderConfiguration

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

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

the class ProviderConverterImpl method toModel.

/**
 * @param provider A provider representation in the guvnor-ala core domain.
 * @return the converted version of the provider in the format managed by the UI related modules.
 */
@Override
public Provider toModel(org.guvnor.ala.runtime.providers.Provider provider) {
    Provider result = null;
    if (provider != null) {
        ProviderTypeKey providerTypeKey = new ProviderTypeKey(provider.getProviderType().getProviderTypeName(), provider.getProviderType().getVersion());
        ProviderKey providerKey = new ProviderKey(providerTypeKey, provider.getId());
        final BackendProviderHandler handler = handlerRegistry.ensureHandler(providerTypeKey);
        @SuppressWarnings("unchecked") final ProviderConfiguration providerConfiguration = (ProviderConfiguration) handler.getProviderConfigConverter().toModel(provider.getConfig());
        result = new Provider(providerKey, providerConfiguration);
    }
    return result;
}
Also used : ProviderKey(org.guvnor.ala.ui.model.ProviderKey) BackendProviderHandler(org.guvnor.ala.ui.backend.service.handler.BackendProviderHandler) ProviderTypeKey(org.guvnor.ala.ui.model.ProviderTypeKey) Provider(org.guvnor.ala.ui.model.Provider) 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