Search in sources :

Example 11 with ProviderKey

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

the class ProvisioningManagementBrowserPresenterTest method testOnProviderTypeSelectedWithNOProviders.

@Test
public void testOnProviderTypeSelectedWithNOProviders() {
    // pick an arbitrary element as the selected
    ProviderType selectedProviderType = providerTypes.iterator().next();
    ProviderTypeKey selectedProviderTypeKey = selectedProviderType.getKey();
    // the selected provider type don't have providers.
    List<ProviderKey> providerKeys = new ArrayList<>();
    ProvidersInfo providersInfo = mock(ProvidersInfo.class);
    when(providersInfo.getProviderType()).thenReturn(selectedProviderType);
    when(providersInfo.getProvidersKey()).thenReturn(providerKeys);
    when(providerTypeService.getProviderType(selectedProviderTypeKey)).thenReturn(selectedProviderType);
    when(provisioningScreensService.getProvidersInfo(selectedProviderTypeKey)).thenReturn(providersInfo);
    presenter.onProviderTypeSelected(new ProviderTypeSelectedEvent(selectedProviderType.getKey()));
    verify(providerEmptyPresenter, times(1)).setProviderType(selectedProviderType);
    verify(view, times(1)).setContent(providerEmptyPresenterView);
    verify(providerTypePresenter, times(1)).setup(any(ProviderType.class), anyCollectionOf(ProviderKey.class), any(ProviderKey.class));
}
Also used : ProviderKey(org.guvnor.ala.ui.model.ProviderKey) ProviderTypeSelectedEvent(org.guvnor.ala.ui.client.events.ProviderTypeSelectedEvent) ArrayList(java.util.ArrayList) ProviderType(org.guvnor.ala.ui.model.ProviderType) ProviderTypeKey(org.guvnor.ala.ui.model.ProviderTypeKey) ProvidersInfo(org.guvnor.ala.ui.model.ProvidersInfo) Test(org.junit.Test)

Example 12 with ProviderKey

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

the class ProvisioningScreensServiceImpl method getProvidersInfo.

@Override
public ProvidersInfo getProvidersInfo(final ProviderTypeKey providerTypeKey) {
    checkNotNull("providerTypeKey", providerTypeKey);
    final ProviderType providerType = providerTypeService.getProviderType(providerTypeKey);
    if (providerType == null) {
        return null;
    }
    final Collection<ProviderKey> providersKey = providerService.getProvidersKey(providerType);
    return new ProvidersInfo(providerType, providersKey);
}
Also used : ProviderKey(org.guvnor.ala.ui.model.ProviderKey) ProviderType(org.guvnor.ala.ui.model.ProviderType) ProvidersInfo(org.guvnor.ala.ui.model.ProvidersInfo)

Example 13 with ProviderKey

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

the class RuntimeListItemBuilder method build.

public RuntimeListItem build() {
    RuntimeListItem result;
    PipelineExecutionTrace pipelineTrace;
    String runtimeName;
    if (item.getRuntimeName() != null) {
        runtimeName = item.getRuntimeName();
    } else {
        runtimeName = item.getRuntimeId();
    }
    if (item.getPipelineExecutionId() != null) {
        final Pipeline pipeline = new Pipeline(new PipelineKey(item.getPipelineId()));
        pipelineTrace = new PipelineExecutionTrace(new PipelineExecutionTraceKey(item.getPipelineExecutionId()));
        pipelineTrace.setPipelineStatus(transformToPipelineStatus(item.getPipelineStatus()));
        pipelineTrace.setPipelineError(new PipelineError(item.getPipelineError(), item.getPipelineErrorDetail()));
        item.getPipelineStageItems().getItems().forEach(stage -> {
            pipeline.addStage(new Stage(pipeline.getKey(), stage.getName()));
            pipelineTrace.setStageStatus(stage.getName(), transformToPipelineStatus(stage.getStatus()));
            pipelineTrace.setStageError(stage.getName(), new PipelineError(stage.getStageError(), stage.getStageErrorDetail()));
        });
        pipelineTrace.setPipeline(pipeline);
    } else {
        pipelineTrace = null;
    }
    if (item.getRuntimeId() != null) {
        final Runtime runtime = new Runtime(new RuntimeKey(new ProviderKey(new ProviderTypeKey(item.getProviderTypeName(), item.getProviderVersion()), item.getProviderId()), item.getRuntimeId()), item.getRuntimeStatus(), item.getRuntimeEndpoint(), item.getStartedAt());
        runtime.setPipelineTrace(pipelineTrace);
        result = new RuntimeListItem(runtimeName, runtime);
    } else {
        result = new RuntimeListItem(runtimeName, pipelineTrace);
    }
    return result;
}
Also used : Runtime(org.guvnor.ala.ui.model.Runtime) RuntimeListItem(org.guvnor.ala.ui.model.RuntimeListItem) PipelineKey(org.guvnor.ala.ui.model.PipelineKey) ProviderKey(org.guvnor.ala.ui.model.ProviderKey) PipelineExecutionTrace(org.guvnor.ala.ui.model.PipelineExecutionTrace) Stage(org.guvnor.ala.ui.model.Stage) RuntimeKey(org.guvnor.ala.ui.model.RuntimeKey) PipelineExecutionTraceKey(org.guvnor.ala.ui.model.PipelineExecutionTraceKey) ProviderTypeKey(org.guvnor.ala.ui.model.ProviderTypeKey) Pipeline(org.guvnor.ala.ui.model.Pipeline) PipelineError(org.guvnor.ala.ui.model.PipelineError)

Example 14 with ProviderKey

use of org.guvnor.ala.ui.model.ProviderKey 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)

Example 15 with ProviderKey

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

the class ProviderServiceImplTest method testDeleteProvider.

@Test
public void testDeleteProvider() {
    ProviderKey providerKey = mock(ProviderKey.class);
    when(providerKey.getId()).thenReturn(PROVIDER_ID);
    service.deleteProvider(providerKey);
    verify(runtimeProvisioningService, times(1)).unregisterProvider(PROVIDER_ID);
}
Also used : ProviderKey(org.guvnor.ala.ui.model.ProviderKey) Test(org.junit.Test)

Aggregations

ProviderKey (org.guvnor.ala.ui.model.ProviderKey)24 Test (org.junit.Test)16 ProviderTypeKey (org.guvnor.ala.ui.model.ProviderTypeKey)14 Provider (org.guvnor.ala.ui.model.Provider)9 RuntimeKey (org.guvnor.ala.ui.model.RuntimeKey)7 Input (org.guvnor.ala.pipeline.Input)4 RuntimeQueryResultItem (org.guvnor.ala.services.api.RuntimeQueryResultItem)4 ProviderType (org.guvnor.ala.ui.model.ProviderType)4 RuntimeListItem (org.guvnor.ala.ui.model.RuntimeListItem)4 RuntimeQuery (org.guvnor.ala.services.api.RuntimeQuery)3 RuntimeChangeEvent (org.guvnor.ala.ui.events.RuntimeChangeEvent)3 ProviderConfiguration (org.guvnor.ala.ui.model.ProviderConfiguration)3 ProvidersInfo (org.guvnor.ala.ui.model.ProvidersInfo)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 ProviderTypeSelectedEvent (org.guvnor.ala.ui.client.events.ProviderTypeSelectedEvent)2 PipelineKey (org.guvnor.ala.ui.model.PipelineKey)2 Runtime (org.guvnor.ala.ui.model.Runtime)2 Before (org.junit.Before)2