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