Search in sources :

Example 1 with RuntimesInfo

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

the class ProvisioningScreensServiceImpl method getRuntimesInfo.

@Override
public RuntimesInfo getRuntimesInfo(final ProviderKey providerKey) {
    checkNotNull("providerKey", providerKey);
    final Provider provider = providerService.getProvider(providerKey);
    if (provider == null) {
        return null;
    }
    final Collection<RuntimeListItem> items = runtimeService.getRuntimeItems(providerKey);
    return new RuntimesInfo(provider, items);
}
Also used : RuntimeListItem(org.guvnor.ala.ui.model.RuntimeListItem) RuntimesInfo(org.guvnor.ala.ui.model.RuntimesInfo) Provider(org.guvnor.ala.ui.model.Provider)

Example 2 with RuntimesInfo

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

the class ProvisioningScreensServiceImplTest method testGetRuntimesInfoProviderNotExisting.

@Test
public void testGetRuntimesInfoProviderNotExisting() {
    // the provider not exists.
    when(providerService.getProvider(providerKey)).thenReturn(null);
    RuntimesInfo info = service.getRuntimesInfo(providerKey);
    assertNull(info);
    verify(providerService, times(1)).getProvider(providerKey);
    verify(runtimeService, never()).getRuntimeItems(providerKey);
}
Also used : RuntimesInfo(org.guvnor.ala.ui.model.RuntimesInfo) Test(org.junit.Test)

Example 3 with RuntimesInfo

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

the class ProviderPresenterTest method prepareRuntimesInfo.

private void prepareRuntimesInfo() {
    ProviderTypeKey providerTypeKey = mockProviderTypeKey("1");
    providerKey = mockProviderKey(providerTypeKey, "1");
    ProviderConfiguration configuration = mock(ProviderConfiguration.class);
    provider = new Provider(providerKey, configuration);
    runtimesInfo = mock(RuntimesInfo.class);
    when(runtimesInfo.getProvider()).thenReturn(provider);
    when(runtimesInfo.getRuntimeItems()).thenReturn(runtimeItems);
    when(providerService.getProvider(providerKey)).thenReturn(provider);
    when(provisioningScreensService.getRuntimesInfo(providerKey)).thenReturn(runtimesInfo);
    when(handlerRegistry.isProviderInstalled(providerTypeKey)).thenReturn(true);
    when(handlerRegistry.getProviderHandler(providerTypeKey)).thenReturn(handler);
    when(handler.getFormResolver()).thenReturn(formResolver);
    when(formResolver.newProviderConfigurationForm()).thenReturn(configurationForm);
    when(configurationForm.getView()).thenReturn(configurationFormView);
}
Also used : RuntimesInfo(org.guvnor.ala.ui.model.RuntimesInfo) ProviderTypeKey(org.guvnor.ala.ui.model.ProviderTypeKey) ProvisioningManagementTestCommons.mockProviderTypeKey(org.guvnor.ala.ui.ProvisioningManagementTestCommons.mockProviderTypeKey) ProviderConfiguration(org.guvnor.ala.ui.model.ProviderConfiguration) Provider(org.guvnor.ala.ui.model.Provider)

Example 4 with RuntimesInfo

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

the class ProvisioningScreensServiceImplTest method testGetRuntimesInfoProviderExisting.

@Test
public void testGetRuntimesInfoProviderExisting() {
    // the provider exists.
    when(providerService.getProvider(providerKey)).thenReturn(provider);
    when(runtimeService.getRuntimeItems(providerKey)).thenReturn(runtimeListItems);
    RuntimesInfo info = service.getRuntimesInfo(providerKey);
    assertNotNull(info);
    assertEquals(provider, info.getProvider());
    assertEquals(runtimeListItems, info.getRuntimeItems());
    verify(providerService, times(1)).getProvider(providerKey);
    verify(runtimeService, times(1)).getRuntimeItems(providerKey);
}
Also used : RuntimesInfo(org.guvnor.ala.ui.model.RuntimesInfo) Test(org.junit.Test)

Aggregations

RuntimesInfo (org.guvnor.ala.ui.model.RuntimesInfo)4 Provider (org.guvnor.ala.ui.model.Provider)2 Test (org.junit.Test)2 ProvisioningManagementTestCommons.mockProviderTypeKey (org.guvnor.ala.ui.ProvisioningManagementTestCommons.mockProviderTypeKey)1 ProviderConfiguration (org.guvnor.ala.ui.model.ProviderConfiguration)1 ProviderTypeKey (org.guvnor.ala.ui.model.ProviderTypeKey)1 RuntimeListItem (org.guvnor.ala.ui.model.RuntimeListItem)1