use of org.guvnor.ala.ui.model.ProviderType in project kie-wb-common by kiegroup.
the class ProviderServiceImplTest method setUp.
@Before
public void setUp() {
providerTypeSpi = mockProviderTypeSPI("0");
providersSpi = mockProviderListSPI(providerTypeSpi, PROVIDER_COUNT);
when(runtimeProvisioningService.getProviders(anyInt(), anyInt(), anyString(), anyBoolean())).thenReturn(providersSpi);
providerTypeKey = new ProviderTypeKey(providerTypeSpi.getProviderTypeName(), providerTypeSpi.getVersion());
providerType = new ProviderType(providerTypeKey, null);
when(providerConverterFactory.getProviderConverter()).thenReturn(providerConverter);
when(providerConverterFactory.getProviderConfigConverter(providerTypeKey)).thenReturn(providerConfigConverter);
providers = new ArrayList<>();
providerKeys = new ArrayList<>();
for (int i = 0; i < PROVIDER_COUNT; i++) {
Provider provider = mock(Provider.class);
ProviderTypeKey providerTypeKey = new ProviderTypeKey(providersSpi.get(i).getProviderType().getProviderTypeName(), providersSpi.get(i).getProviderType().getVersion());
ProviderKey providerKey = new ProviderKey(providerTypeKey, providersSpi.get(i).getId());
when(provider.getKey()).thenReturn(providerKey);
providers.add(provider);
providerKeys.add(providerKey);
when(providerConverter.toModel(providersSpi.get(i))).thenReturn(provider);
}
service = new ProviderServiceImpl(runtimeProvisioningService, providerConverterFactory);
}
use of org.guvnor.ala.ui.model.ProviderType 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.ProviderType in project kie-wb-common by kiegroup.
the class ProvisioningManagementBrowserPresenter method setupProviderTypes.
private void setupProviderTypes(final Collection<ProviderType> providerTypes, final ProviderTypeKey selectProviderTypeKey) {
if (providerTypes.isEmpty()) {
this.view.setEmptyView(providerTypeEmptyPresenter.getView());
providerTypeNavigationPresenter.clear();
} else {
ProviderType providerType2BeSelected = null;
if (selectProviderTypeKey != null) {
for (final ProviderType providerType : providerTypes) {
if (providerType.getKey().equals(selectProviderTypeKey)) {
providerType2BeSelected = providerType;
break;
}
}
}
if (providerType2BeSelected == null) {
providerType2BeSelected = providerTypes.iterator().next();
}
providerTypeNavigationPresenter.setup(providerType2BeSelected, providerTypes);
providerTypeSelectedEvent.fire(new ProviderTypeSelectedEvent(providerType2BeSelected.getKey()));
}
}
use of org.guvnor.ala.ui.model.ProviderType in project kie-wb-common by kiegroup.
the class ProviderTypeServiceImplTest method testGetProviderTypeNotExisting.
@Test
public void testGetProviderTypeNotExisting() {
// invent a non existing provider type key
ProviderTypeKey providerTypeKey = new ProviderTypeKey("NonExisting", "NonExisting");
ProviderType providerType = service.getProviderType(providerTypeKey);
assertNull(providerType);
}
use of org.guvnor.ala.ui.model.ProviderType in project kie-wb-common by kiegroup.
the class ProviderTypeServiceImplTest method testGetAvailableProviders.
@Test
public void testGetAvailableProviders() {
Collection<ProviderType> result = service.getAvailableProviderTypes();
assertEquals(PROVIDER_TYPES_COUNT, result.size());
int i = 0;
for (ProviderType providerType : result) {
assertNotNull(providerType.getKey());
assertEquals(providerTypesSpi.get(i).getProviderTypeName(), providerType.getKey().getId());
assertEquals(providerTypesSpi.get(i).getVersion(), providerType.getKey().getVersion());
i++;
}
}
Aggregations