use of org.guvnor.ala.ui.client.events.ProviderTypeSelectedEvent 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.client.events.ProviderTypeSelectedEvent in project kie-wb-common by kiegroup.
the class ProvisioningManagementBrowserPresenterTest method testOnRefreshProviderTypesWithEnabledProviderTypes.
@Test
public void testOnRefreshProviderTypesWithEnabledProviderTypes() {
when(providerTypeService.getEnabledProviderTypes()).thenReturn(providerTypes);
// pick an arbitrary element as the selected
ProviderType selectedProviderType = providerTypes.iterator().next();
presenter.onRefreshProviderTypes(new ProviderTypeListRefreshEvent(selectedProviderType.getKey()));
// the provider type navigation presenter must have been set properly.
verify(providerTypeNavigationPresenter, times(1)).setup(selectedProviderType, providerTypes);
verify(providerTypeSelectedEvent, times(1)).fire(new ProviderTypeSelectedEvent(selectedProviderType.getKey()));
}
use of org.guvnor.ala.ui.client.events.ProviderTypeSelectedEvent in project kie-wb-common by kiegroup.
the class ProviderPresenterTest method testRemoveProvider.
private void testRemoveProvider(boolean withErrors) {
// emulate that the provider was previously loaded.
prepareRuntimesInfo();
presenter.onProviderSelected(new ProviderSelectedEvent(providerKey));
when(view.getRemoveProviderSuccessMessage()).thenReturn(SUCCESS_MESSAGE);
when(view.getRemoveProviderErrorMessage()).thenReturn(ERROR_MESSAGE);
if (withErrors) {
// make the providerService fail.
prepareServiceCallerError(providerService, providerServiceCaller);
}
// the user confirms the delete operation at a later time from the ui.
presenter.removeProvider();
verify(providerService, times(1)).deleteProvider(providerKey);
verify(providerTypeSelectedEvent, times(1)).fire(new ProviderTypeSelectedEvent(providerKey.getProviderTypeKey()));
if (withErrors) {
verify(notification, times(1)).fire(new NotificationEvent(ERROR_MESSAGE, NotificationEvent.NotificationType.ERROR));
} else {
verify(notification, times(1)).fire(new NotificationEvent(SUCCESS_MESSAGE, NotificationEvent.NotificationType.SUCCESS));
}
}
use of org.guvnor.ala.ui.client.events.ProviderTypeSelectedEvent in project kie-wb-common by kiegroup.
the class NewProviderWizardTest method testCreateProviderSuccess.
@Test
public void testCreateProviderSuccess() {
// initialize and start the wizard.
wizard.start(providerType);
// emulate the user completing the wizard.
preCompleteWizard();
// emulate the user pressing the finish button.
wizard.complete();
// verify that the provider has been created and the proper notifications were fired.
verify(providerService, times(1)).createProvider(providerType, providerConfiguration);
verify(notification, times(1)).fire(new NotificationEvent(SUCCESS_MESSAGE, NotificationEvent.NotificationType.SUCCESS));
verify(providerTypeSelectedEvent, times(1)).fire(new ProviderTypeSelectedEvent(providerType.getKey(), providerConfiguration.getId()));
}
use of org.guvnor.ala.ui.client.events.ProviderTypeSelectedEvent in project kie-wb-common by kiegroup.
the class NewProviderWizard method onCreateProviderSuccess.
private void onCreateProviderSuccess(final ProviderConfiguration providerConfiguration) {
notification.fire(new NotificationEvent(translationService.getTranslation(NewProviderWizard_ProviderCreateSuccessMessage), NotificationEvent.NotificationType.SUCCESS));
NewProviderWizard.super.complete();
providerTypeSelectedEvent.fire(new ProviderTypeSelectedEvent(providerType.getKey(), providerConfiguration.getId()));
}
Aggregations