Search in sources :

Example 1 with ProviderTypeListRefreshEvent

use of org.guvnor.ala.ui.client.events.ProviderTypeListRefreshEvent 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 2 with ProviderTypeListRefreshEvent

use of org.guvnor.ala.ui.client.events.ProviderTypeListRefreshEvent in project kie-wb-common by kiegroup.

the class ProviderTypePresenterTest method onRemoveProviderTypeTest.

@Test
public void onRemoveProviderTypeTest() {
    presenter.setup(providerType, providers, provider);
    presenter.onRemoveProviderType();
    // emulate user confirmation on screen
    verify(view, times(1)).confirmRemove(any(Command.class));
    presenter.removeProviderType();
    verify(providerTypeService, times(1)).disableProviderType(providerType);
    verify(providerTypeListRefreshEvent, times(1)).fire(new ProviderTypeListRefreshEvent());
}
Also used : Command(org.uberfire.mvp.Command) ProviderTypeListRefreshEvent(org.guvnor.ala.ui.client.events.ProviderTypeListRefreshEvent) Test(org.junit.Test)

Example 3 with ProviderTypeListRefreshEvent

use of org.guvnor.ala.ui.client.events.ProviderTypeListRefreshEvent in project kie-wb-common by kiegroup.

the class EnableProviderTypeWizardTest method testEnableProviderSuccess.

@Test
public void testEnableProviderSuccess() {
    // initialize and start the wizard.
    wizard.start(providerTypeStatus);
    // emulate the user completing the wizard.
    preCompleteWizard();
    // emulates the user pressing the finish button
    wizard.complete();
    // verify the provider types has been enabled and the proper notifications were fired.
    verify(providerTypeService, times(1)).enableProviderTypes(selectedProviders);
    verify(notification, times(1)).fire(new NotificationEvent(SUCCESS_MESSAGE, NotificationEvent.NotificationType.SUCCESS));
    verify(providerTypeListRefreshEvent, times(1)).fire(new ProviderTypeListRefreshEvent(selectedProviders.get(0).getKey()));
}
Also used : ProviderTypeListRefreshEvent(org.guvnor.ala.ui.client.events.ProviderTypeListRefreshEvent) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) Test(org.junit.Test)

Example 4 with ProviderTypeListRefreshEvent

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

Example 5 with ProviderTypeListRefreshEvent

use of org.guvnor.ala.ui.client.events.ProviderTypeListRefreshEvent in project kie-wb-common by kiegroup.

the class ProviderTypeNavigationPresenterTest method testOnRefresh.

@Test
public void testOnRefresh() {
    presenter.onRefresh();
    verify(providerTypeListRefreshEvent, times(1)).fire(new ProviderTypeListRefreshEvent());
}
Also used : ProviderTypeListRefreshEvent(org.guvnor.ala.ui.client.events.ProviderTypeListRefreshEvent) Test(org.junit.Test)

Aggregations

ProviderTypeListRefreshEvent (org.guvnor.ala.ui.client.events.ProviderTypeListRefreshEvent)6 Test (org.junit.Test)5 ProviderType (org.guvnor.ala.ui.model.ProviderType)2 NotificationEvent (org.uberfire.workbench.events.NotificationEvent)2 ProviderTypeSelectedEvent (org.guvnor.ala.ui.client.events.ProviderTypeSelectedEvent)1 Command (org.uberfire.mvp.Command)1