use of org.guvnor.ala.ui.model.ProviderType in project kie-wb-common by kiegroup.
the class ProviderTypeServiceImplTest method testDisableProviderType.
@Test
public void testDisableProviderType() {
pickSomeProviders();
// pick some providers an emulate that they are currently enabled in the preferences.
pickSomeProviders();
pickedProviderTypes.forEach(providerType -> provisioningPreferences.getProviderTypeEnablements().put(providerType, Boolean.TRUE));
// pick a provider type to disable and disable it
ProviderType providerTypeToDisable = pickedProviderTypes.get(0);
service.disableProviderType(providerTypeToDisable);
// it must be now enabled.
assertFalse(provisioningPreferences.getProviderTypeEnablements().get(providerTypeToDisable));
verify(provisioningPreferences, times(1)).save(preferenceScope);
}
use of org.guvnor.ala.ui.model.ProviderType in project kie-wb-common by kiegroup.
the class ProviderTypeServiceImpl method getAvailableProviderTypes.
@Override
public Collection<ProviderType> getAvailableProviderTypes() {
List<ProviderType> result = new ArrayList<>();
List<org.guvnor.ala.runtime.providers.ProviderType> providers = runtimeProvisioningService.getProviderTypes(0, 100, PROVIDER_TYPE_NAME_SORT, true);
if (providers != null) {
providers.forEach(providerType -> result.add(new ProviderType(new ProviderTypeKey(providerType.getProviderTypeName(), providerType.getVersion()), providerType.getProviderTypeName())));
}
return result;
}
use of org.guvnor.ala.ui.model.ProviderType 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(Mockito.<ProviderType>any(), anyCollectionOf(ProviderKey.class), Mockito.<ProviderKey>any());
}
use of org.guvnor.ala.ui.model.ProviderType in project kie-wb-common by kiegroup.
the class ProvisioningManagementBrowserPresenterTest method testOnRefreshProviderTypesWithNOEnabledProviderTypes.
@Test
public void testOnRefreshProviderTypesWithNOEnabledProviderTypes() {
providerTypes.clear();
when(providerTypeService.getEnabledProviderTypes()).thenReturn(providerTypes);
presenter.onRefreshProviderTypes(new ProviderTypeListRefreshEvent());
verify(view, times(1)).setEmptyView(providerTypeEmptyPresenterView);
verify(providerTypeNavigationPresenter, times(1)).clear();
verify(providerTypeNavigationPresenter, times(0)).setup(Mockito.<ProviderType>any(), anyCollectionOf(ProviderType.class));
}
use of org.guvnor.ala.ui.model.ProviderType in project kie-wb-common by kiegroup.
the class EnableProviderTypePagePresenterTest method testSetup.
@Test
public void testSetup() {
presenter.setup(providerTypeStatus);
verify(view, times(1)).clear();
assertEquals(providerTypeStatus.size(), presenter.getItemPresenters().size());
for (int i = 0; i < presenter.getItemPresenters().size(); i++) {
ProviderTypeItemPresenter itemPresenter = presenter.getItemPresenters().get(i);
Pair<ProviderType, ProviderTypeStatus> pair = providerTypeStatus.get(i);
verify(itemPresenter, times(1)).setup(pair.getK1(), pair.getK2());
verify(itemPresenter, times(1)).addContentChangeHandler(any(ContentChangeHandler.class));
verify(view, times(1)).addProviderType(itemPresenter.getView());
}
verify(providerTypeItemPresenterInstance, times(providerTypeStatus.size())).get();
}
Aggregations