use of org.guvnor.ala.ui.model.ProvidersInfo in project kie-wb-common by kiegroup.
the class ProvisioningManagementBrowserPresenterTest method testOnProviderTypeSelectedWithProviders.
@Test
public void testOnProviderTypeSelectedWithProviders() {
// pick an arbitrary element as the selected
ProviderType selectedProviderType = providerTypes.iterator().next();
ProviderTypeKey selectedProviderTypeKey = selectedProviderType.getKey();
List<ProviderKey> providerKeys = mockProviderKeyList(selectedProviderType.getKey(), PROVIDER_TYPES_SIZE);
// pick an arbitrary element as the selected.
ProviderKey selectedProviderKey = providerKeys.iterator().next();
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(), selectedProviderKey.getId()));
verify(providerTypePresenter, times(1)).setup(selectedProviderType, providerKeys, selectedProviderKey);
}
use of org.guvnor.ala.ui.model.ProvidersInfo in project kie-wb-common by kiegroup.
the class ProvisioningScreensServiceImplTest method testGetProvidersInfoProviderTypeNotExisting.
@Test
public void testGetProvidersInfoProviderTypeNotExisting() {
// the provider type not exists.
when(providerTypeService.getProviderType(providerTypeKey)).thenReturn(null);
ProvidersInfo providersInfo = service.getProvidersInfo(providerTypeKey);
assertNull(providersInfo);
verify(providerTypeService, times(1)).getProviderType(providerTypeKey);
verify(providerService, never()).getProvidersKey(providerType);
}
use of org.guvnor.ala.ui.model.ProvidersInfo 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.ProvidersInfo 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.ProvidersInfo in project kie-wb-common by kiegroup.
the class ProvisioningScreensServiceImplTest method testGetProvidersInfoProviderTypeExisting.
@Test
public void testGetProvidersInfoProviderTypeExisting() {
// the provider type exists.
when(providerTypeService.getProviderType(providerTypeKey)).thenReturn(providerType);
when(providerService.getProvidersKey(providerType)).thenReturn(providerKeys);
ProvidersInfo providersInfo = service.getProvidersInfo(providerTypeKey);
assertNotNull(providersInfo);
assertEquals(providerType, providersInfo.getProviderType());
assertEquals(providerKeys, providersInfo.getProvidersKey());
verify(providerTypeService, times(1)).getProviderType(providerTypeKey);
verify(providerService, times(1)).getProvidersKey(providerType);
}
Aggregations