Search in sources :

Example 1 with ProviderTypeSelectedEvent

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);
}
Also used : ProviderKey(org.guvnor.ala.ui.model.ProviderKey) ProviderTypeSelectedEvent(org.guvnor.ala.ui.client.events.ProviderTypeSelectedEvent) ProviderType(org.guvnor.ala.ui.model.ProviderType) ProviderTypeKey(org.guvnor.ala.ui.model.ProviderTypeKey) ProvidersInfo(org.guvnor.ala.ui.model.ProvidersInfo) Test(org.junit.Test)

Example 2 with ProviderTypeSelectedEvent

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()));
}
Also used : ProviderTypeSelectedEvent(org.guvnor.ala.ui.client.events.ProviderTypeSelectedEvent) ProviderTypeListRefreshEvent(org.guvnor.ala.ui.client.events.ProviderTypeListRefreshEvent) ProviderType(org.guvnor.ala.ui.model.ProviderType) Test(org.junit.Test)

Example 3 with ProviderTypeSelectedEvent

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));
    }
}
Also used : ProviderSelectedEvent(org.guvnor.ala.ui.client.events.ProviderSelectedEvent) ProviderTypeSelectedEvent(org.guvnor.ala.ui.client.events.ProviderTypeSelectedEvent) NotificationEvent(org.uberfire.workbench.events.NotificationEvent)

Example 4 with ProviderTypeSelectedEvent

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()));
}
Also used : ProviderTypeSelectedEvent(org.guvnor.ala.ui.client.events.ProviderTypeSelectedEvent) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) Test(org.junit.Test)

Example 5 with ProviderTypeSelectedEvent

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()));
}
Also used : ProviderTypeSelectedEvent(org.guvnor.ala.ui.client.events.ProviderTypeSelectedEvent) NotificationEvent(org.uberfire.workbench.events.NotificationEvent)

Aggregations

ProviderTypeSelectedEvent (org.guvnor.ala.ui.client.events.ProviderTypeSelectedEvent)8 Test (org.junit.Test)5 ProviderType (org.guvnor.ala.ui.model.ProviderType)4 NotificationEvent (org.uberfire.workbench.events.NotificationEvent)3 ProviderKey (org.guvnor.ala.ui.model.ProviderKey)2 ProviderTypeKey (org.guvnor.ala.ui.model.ProviderTypeKey)2 ProvidersInfo (org.guvnor.ala.ui.model.ProvidersInfo)2 ArrayList (java.util.ArrayList)1 ProviderSelectedEvent (org.guvnor.ala.ui.client.events.ProviderSelectedEvent)1 ProviderTypeListRefreshEvent (org.guvnor.ala.ui.client.events.ProviderTypeListRefreshEvent)1