use of org.guvnor.ala.ui.client.events.ProviderTypeSelectedEvent 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.client.events.ProviderTypeSelectedEvent in project kie-wb-common by kiegroup.
the class ProviderTypeNavigationPresenterTest method testOnSelect.
@Test
public void testOnSelect() {
presenter.setup(providerType, providerTypes);
// test the selection of whatever of the elements.
providerTypes.forEach(currentProviderType -> {
presenter.onSelect(new ProviderTypeSelectedEvent(currentProviderType.getKey()));
if (!currentProviderType.equals(providerType)) {
verify(view, times(1)).select(currentProviderType.getKey());
}
});
verify(view, times(2)).select(providerType.getKey());
}
use of org.guvnor.ala.ui.client.events.ProviderTypeSelectedEvent 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()));
}
}
Aggregations