Search in sources :

Example 16 with ProviderKey

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

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

the class ProviderServiceImplTest method testGetProviderNotExisting.

@Test
public void testGetProviderNotExisting() {
    // create an arbitrary not existing key.
    ProviderTypeKey providerTypeKey = new ProviderTypeKey("not exist", "not exist");
    ProviderKey providerKey = new ProviderKey(providerTypeKey, "not exist");
    Provider provider = service.getProvider(providerKey);
    assertNull(provider);
}
Also used : ProviderKey(org.guvnor.ala.ui.model.ProviderKey) ProviderTypeKey(org.guvnor.ala.ui.model.ProviderTypeKey) Provider(org.guvnor.ala.ui.model.Provider) Test(org.junit.Test)

Example 18 with ProviderKey

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

the class RuntimeServiceImplTest method testDeleteRuntime.

private void testDeleteRuntime(boolean forced) {
    ProviderKey providerKey = mock(ProviderKey.class);
    RuntimeKey runtimeKey = new RuntimeKey(providerKey, RUNTIME_ID);
    service.deleteRuntime(runtimeKey, forced);
    verify(runtimeProvisioningService, times(1)).destroyRuntime(RUNTIME_ID, forced);
    verify(runtimeChangeEvent, times(1)).fire(new RuntimeChangeEvent(RuntimeChange.DELETED, runtimeKey));
}
Also used : ProviderKey(org.guvnor.ala.ui.model.ProviderKey) RuntimeKey(org.guvnor.ala.ui.model.RuntimeKey) RuntimeChangeEvent(org.guvnor.ala.ui.events.RuntimeChangeEvent)

Example 19 with ProviderKey

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

the class RuntimeServiceImplTest method getRuntimeItemByRuntimeKeyNotExisting.

@Test
public void getRuntimeItemByRuntimeKeyNotExisting() {
    ProviderKey providerKey = mock(ProviderKey.class);
    RuntimeKey runtimeKey = new RuntimeKey(providerKey, RUNTIME_ID);
    List<RuntimeQueryResultItem> singleResult = new ArrayList<>();
    when(runtimeProvisioningService.executeQuery(any(RuntimeQuery.class))).thenReturn(singleResult);
    RuntimeListItem result = service.getRuntimeItem(runtimeKey);
    assertNull(result);
}
Also used : ProviderKey(org.guvnor.ala.ui.model.ProviderKey) RuntimeListItem(org.guvnor.ala.ui.model.RuntimeListItem) RuntimeQuery(org.guvnor.ala.services.api.RuntimeQuery) RuntimeQueryResultItem(org.guvnor.ala.services.api.RuntimeQueryResultItem) ArrayList(java.util.ArrayList) RuntimeKey(org.guvnor.ala.ui.model.RuntimeKey) Test(org.junit.Test)

Example 20 with ProviderKey

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

the class RuntimeServiceImplTest method testCreateRuntimeWhenProviderNotExists.

@Test
public void testCreateRuntimeWhenProviderNotExists() {
    ProviderTypeKey providerTypeKey = new ProviderTypeKey(PROVIDER_NAME, PROVIDER_VERSION);
    ProviderKey providerKey = new ProviderKey(providerTypeKey, PROVIDER_ID);
    expectedException.expectMessage("No provider was found for providerKey: " + providerKey);
    service.createRuntime(providerKey, RUNTIME_ID, PIPELINE_KEY, null);
    verify(pipelineService, never()).runPipeline(anyString(), any(Input.class), eq(true));
}
Also used : Input(org.guvnor.ala.pipeline.Input) ProviderKey(org.guvnor.ala.ui.model.ProviderKey) ProviderTypeKey(org.guvnor.ala.ui.model.ProviderTypeKey) Test(org.junit.Test)

Aggregations

ProviderKey (org.guvnor.ala.ui.model.ProviderKey)24 Test (org.junit.Test)16 ProviderTypeKey (org.guvnor.ala.ui.model.ProviderTypeKey)14 Provider (org.guvnor.ala.ui.model.Provider)9 RuntimeKey (org.guvnor.ala.ui.model.RuntimeKey)7 Input (org.guvnor.ala.pipeline.Input)4 RuntimeQueryResultItem (org.guvnor.ala.services.api.RuntimeQueryResultItem)4 ProviderType (org.guvnor.ala.ui.model.ProviderType)4 RuntimeListItem (org.guvnor.ala.ui.model.RuntimeListItem)4 RuntimeQuery (org.guvnor.ala.services.api.RuntimeQuery)3 RuntimeChangeEvent (org.guvnor.ala.ui.events.RuntimeChangeEvent)3 ProviderConfiguration (org.guvnor.ala.ui.model.ProviderConfiguration)3 ProvidersInfo (org.guvnor.ala.ui.model.ProvidersInfo)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 ProviderTypeSelectedEvent (org.guvnor.ala.ui.client.events.ProviderTypeSelectedEvent)2 PipelineKey (org.guvnor.ala.ui.model.PipelineKey)2 Runtime (org.guvnor.ala.ui.model.Runtime)2 Before (org.junit.Before)2