Search in sources :

Example 11 with ProviderType

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

Example 12 with ProviderType

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;
}
Also used : ArrayList(java.util.ArrayList) ProviderType(org.guvnor.ala.ui.model.ProviderType) ProviderTypeKey(org.guvnor.ala.ui.model.ProviderTypeKey)

Example 13 with ProviderType

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());
}
Also used : ProviderKey(org.guvnor.ala.ui.model.ProviderKey) ProviderTypeSelectedEvent(org.guvnor.ala.ui.client.events.ProviderTypeSelectedEvent) ArrayList(java.util.ArrayList) 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 14 with ProviderType

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

Example 15 with ProviderType

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();
}
Also used : ProviderTypeItemPresenter(org.guvnor.ala.ui.client.wizard.providertype.item.ProviderTypeItemPresenter) ProviderTypeStatus(org.guvnor.ala.ui.model.ProviderTypeStatus) ContentChangeHandler(org.guvnor.ala.ui.client.util.ContentChangeHandler) ProviderType(org.guvnor.ala.ui.model.ProviderType) Test(org.junit.Test)

Aggregations

ProviderType (org.guvnor.ala.ui.model.ProviderType)15 Test (org.junit.Test)10 ProviderTypeKey (org.guvnor.ala.ui.model.ProviderTypeKey)7 ProviderTypeSelectedEvent (org.guvnor.ala.ui.client.events.ProviderTypeSelectedEvent)4 ProviderKey (org.guvnor.ala.ui.model.ProviderKey)4 ProvidersInfo (org.guvnor.ala.ui.model.ProvidersInfo)3 ArrayList (java.util.ArrayList)2 ProviderTypeListRefreshEvent (org.guvnor.ala.ui.client.events.ProviderTypeListRefreshEvent)2 Before (org.junit.Before)2 ProvisioningManagementTestCommons.mockProviderType (org.guvnor.ala.ui.ProvisioningManagementTestCommons.mockProviderType)1 AddNewProviderEvent (org.guvnor.ala.ui.client.events.AddNewProviderEvent)1 ContentChangeHandler (org.guvnor.ala.ui.client.util.ContentChangeHandler)1 ProviderTypeItemPresenter (org.guvnor.ala.ui.client.wizard.providertype.item.ProviderTypeItemPresenter)1 Provider (org.guvnor.ala.ui.model.Provider)1 ProviderTypeStatus (org.guvnor.ala.ui.model.ProviderTypeStatus)1