Search in sources :

Example 6 with ProviderType

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

the class ProviderServiceImplTest method setUp.

@Before
public void setUp() {
    providerTypeSpi = mockProviderTypeSPI("0");
    providersSpi = mockProviderListSPI(providerTypeSpi, PROVIDER_COUNT);
    when(runtimeProvisioningService.getProviders(anyInt(), anyInt(), anyString(), anyBoolean())).thenReturn(providersSpi);
    providerTypeKey = new ProviderTypeKey(providerTypeSpi.getProviderTypeName(), providerTypeSpi.getVersion());
    providerType = new ProviderType(providerTypeKey, null);
    when(providerConverterFactory.getProviderConverter()).thenReturn(providerConverter);
    when(providerConverterFactory.getProviderConfigConverter(providerTypeKey)).thenReturn(providerConfigConverter);
    providers = new ArrayList<>();
    providerKeys = new ArrayList<>();
    for (int i = 0; i < PROVIDER_COUNT; i++) {
        Provider provider = mock(Provider.class);
        ProviderTypeKey providerTypeKey = new ProviderTypeKey(providersSpi.get(i).getProviderType().getProviderTypeName(), providersSpi.get(i).getProviderType().getVersion());
        ProviderKey providerKey = new ProviderKey(providerTypeKey, providersSpi.get(i).getId());
        when(provider.getKey()).thenReturn(providerKey);
        providers.add(provider);
        providerKeys.add(providerKey);
        when(providerConverter.toModel(providersSpi.get(i))).thenReturn(provider);
    }
    service = new ProviderServiceImpl(runtimeProvisioningService, providerConverterFactory);
}
Also used : ProviderKey(org.guvnor.ala.ui.model.ProviderKey) ProviderType(org.guvnor.ala.ui.model.ProviderType) ProviderTypeKey(org.guvnor.ala.ui.model.ProviderTypeKey) Provider(org.guvnor.ala.ui.model.Provider) Before(org.junit.Before)

Example 7 with ProviderType

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

the class ProvisioningScreensServiceImpl method getProvidersInfo.

@Override
public ProvidersInfo getProvidersInfo(final ProviderTypeKey providerTypeKey) {
    checkNotNull("providerTypeKey", providerTypeKey);
    final ProviderType providerType = providerTypeService.getProviderType(providerTypeKey);
    if (providerType == null) {
        return null;
    }
    final Collection<ProviderKey> providersKey = providerService.getProvidersKey(providerType);
    return new ProvidersInfo(providerType, providersKey);
}
Also used : ProviderKey(org.guvnor.ala.ui.model.ProviderKey) ProviderType(org.guvnor.ala.ui.model.ProviderType) ProvidersInfo(org.guvnor.ala.ui.model.ProvidersInfo)

Example 8 with ProviderType

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

the class ProvisioningManagementBrowserPresenter method setupProviderTypes.

private void setupProviderTypes(final Collection<ProviderType> providerTypes, final ProviderTypeKey selectProviderTypeKey) {
    if (providerTypes.isEmpty()) {
        this.view.setEmptyView(providerTypeEmptyPresenter.getView());
        providerTypeNavigationPresenter.clear();
    } else {
        ProviderType providerType2BeSelected = null;
        if (selectProviderTypeKey != null) {
            for (final ProviderType providerType : providerTypes) {
                if (providerType.getKey().equals(selectProviderTypeKey)) {
                    providerType2BeSelected = providerType;
                    break;
                }
            }
        }
        if (providerType2BeSelected == null) {
            providerType2BeSelected = providerTypes.iterator().next();
        }
        providerTypeNavigationPresenter.setup(providerType2BeSelected, providerTypes);
        providerTypeSelectedEvent.fire(new ProviderTypeSelectedEvent(providerType2BeSelected.getKey()));
    }
}
Also used : ProviderTypeSelectedEvent(org.guvnor.ala.ui.client.events.ProviderTypeSelectedEvent) ProviderType(org.guvnor.ala.ui.model.ProviderType)

Example 9 with ProviderType

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

the class ProviderTypeServiceImplTest method testGetProviderTypeNotExisting.

@Test
public void testGetProviderTypeNotExisting() {
    // invent a non existing provider type key
    ProviderTypeKey providerTypeKey = new ProviderTypeKey("NonExisting", "NonExisting");
    ProviderType providerType = service.getProviderType(providerTypeKey);
    assertNull(providerType);
}
Also used : ProviderType(org.guvnor.ala.ui.model.ProviderType) ProviderTypeKey(org.guvnor.ala.ui.model.ProviderTypeKey) Test(org.junit.Test)

Example 10 with ProviderType

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

the class ProviderTypeServiceImplTest method testGetAvailableProviders.

@Test
public void testGetAvailableProviders() {
    Collection<ProviderType> result = service.getAvailableProviderTypes();
    assertEquals(PROVIDER_TYPES_COUNT, result.size());
    int i = 0;
    for (ProviderType providerType : result) {
        assertNotNull(providerType.getKey());
        assertEquals(providerTypesSpi.get(i).getProviderTypeName(), providerType.getKey().getId());
        assertEquals(providerTypesSpi.get(i).getVersion(), providerType.getKey().getVersion());
        i++;
    }
}
Also used : 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