Search in sources :

Example 1 with ProviderType

use of org.guvnor.ala.ui.model.ProviderType in project kie-wb-common by kiegroup.

the class ProviderTypeServiceImplTest method testGetProviderTypeExisting.

@Test
public void testGetProviderTypeExisting() {
    // pick an arbitrary existing provider type
    org.guvnor.ala.runtime.providers.ProviderType providerTypeSpi = providerTypesSpi.get(2);
    ProviderTypeKey providerTypeKey = new ProviderTypeKey(providerTypeSpi.getProviderTypeName(), providerTypeSpi.getVersion());
    ProviderType providerType = service.getProviderType(providerTypeKey);
    assertNotNull(providerType);
    assertEquals(providerTypeSpi.getProviderTypeName(), providerType.getKey().getId());
    assertEquals(providerTypeSpi.getVersion(), providerType.getKey().getVersion());
}
Also used : ProviderType(org.guvnor.ala.ui.model.ProviderType) ProviderTypeKey(org.guvnor.ala.ui.model.ProviderTypeKey) Test(org.junit.Test)

Example 2 with ProviderType

use of org.guvnor.ala.ui.model.ProviderType 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 ProviderType

use of org.guvnor.ala.ui.model.ProviderType 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 4 with ProviderType

use of org.guvnor.ala.ui.model.ProviderType in project kie-wb-common by kiegroup.

the class ProviderTypeItemPresenterTest method setUp.

@Before
public void setUp() {
    providerType = new ProviderType(new ProviderTypeKey(PROVIDER_ID, PROVIDER_VERSION), PROVIDER_NAME);
    when(handlerRegistry.getProviderHandler(providerType.getKey())).thenReturn(providerHandler);
    when(providerHandler.getProviderTypeImageURL()).thenReturn(IMAGE_URL);
    presenter = new ProviderTypeItemPresenter(view, handlerRegistry);
    presenter.init();
    verify(view, times(1)).init(presenter);
}
Also used : ProviderType(org.guvnor.ala.ui.model.ProviderType) ProviderTypeKey(org.guvnor.ala.ui.model.ProviderTypeKey) Before(org.junit.Before)

Example 5 with ProviderType

use of org.guvnor.ala.ui.model.ProviderType in project kie-wb-common by kiegroup.

the class ProvisioningManagementPerspectiveTest method testAddNewProvider.

@Test
public void testAddNewProvider() {
    ProviderType providerType = mockProviderType("");
    perspective.onAddNewProvider(new AddNewProviderEvent(providerType));
    verify(newProviderWizard, times(1)).start(providerType);
}
Also used : AddNewProviderEvent(org.guvnor.ala.ui.client.events.AddNewProviderEvent) ProviderType(org.guvnor.ala.ui.model.ProviderType) ProvisioningManagementTestCommons.mockProviderType(org.guvnor.ala.ui.ProvisioningManagementTestCommons.mockProviderType) 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