Search in sources :

Example 6 with ProviderTypeKey

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

the class ProviderServiceImplTest method testGetProviderExisting.

@Test
public void testGetProviderExisting() {
    // pick one of the existing providers.
    org.guvnor.ala.runtime.providers.Provider providerSpi = providersSpi.get(2);
    // create a key for finding it.
    ProviderTypeKey providerTypeKey = new ProviderTypeKey(providerSpi.getProviderType().getProviderTypeName(), providerSpi.getProviderType().getVersion());
    ProviderKey providerKey = new ProviderKey(providerTypeKey, providerSpi.getId());
    Provider provider = service.getProvider(providerKey);
    assertNotNull(provider);
    assertEquals(providers.get(2).getKey(), provider.getKey());
}
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 7 with ProviderTypeKey

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

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

the class RuntimeServiceImplTest method testGetRuntimeItems.

@Test
public void testGetRuntimeItems() {
    ProviderTypeKey providerTypeKey = new ProviderTypeKey(PROVIDER_NAME, PROVIDER_VERSION);
    ProviderKey providerKey = new ProviderKey(providerTypeKey, PROVIDER_ID);
    when(runtimeProvisioningService.executeQuery(any(RuntimeQuery.class))).thenReturn(queryItems);
    Collection<RuntimeListItem> result = service.getRuntimeItems(providerKey);
    Collection<RuntimeListItem> expectedResult = buildExpectedResult(queryItems);
    assertEquals(expectedResult, result);
}
Also used : ProviderKey(org.guvnor.ala.ui.model.ProviderKey) RuntimeListItem(org.guvnor.ala.ui.model.RuntimeListItem) RuntimeQuery(org.guvnor.ala.services.api.RuntimeQuery) ProviderTypeKey(org.guvnor.ala.ui.model.ProviderTypeKey) Test(org.junit.Test)

Example 9 with ProviderTypeKey

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

the class RuntimeServiceImplTest method testGetPipelines.

@Test
public void testGetPipelines() {
    ProviderTypeKey providerTypeKey = new ProviderTypeKey(PROVIDER_NAME, PROVIDER_VERSION);
    when(pipelineService.getPipelineNames(any(org.guvnor.ala.runtime.providers.ProviderType.class), anyInt(), anyInt(), anyString(), anyBoolean())).thenReturn(pipelineNames);
    Collection<PipelineKey> result = service.getPipelines(providerTypeKey);
    assertEquals(pipelineKeys, result);
}
Also used : PipelineKey(org.guvnor.ala.ui.model.PipelineKey) ProviderTypeKey(org.guvnor.ala.ui.model.ProviderTypeKey) Test(org.junit.Test)

Example 10 with ProviderTypeKey

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

the class RuntimeServiceImplTest method testCreateRuntimeWhenUnExpectedError.

@Test
public void testCreateRuntimeWhenUnExpectedError() {
    Provider provider = mock(Provider.class);
    ProviderTypeKey providerTypeKey = new ProviderTypeKey(PROVIDER_NAME, PROVIDER_VERSION);
    ProviderKey providerKey = new ProviderKey(providerTypeKey, PROVIDER_ID);
    when(providerService.getProvider(providerKey)).thenReturn(provider);
    when(pipelineService.runPipeline(anyString(), any(Input.class), eq(true))).thenThrow(new RuntimeException(ERROR_MESSAGE));
    expectedException.expectMessage(ERROR_MESSAGE);
    service.createRuntime(providerKey, "irrelevant for the test", mock(PipelineKey.class), mock(Map.class));
}
Also used : Input(org.guvnor.ala.pipeline.Input) ProviderKey(org.guvnor.ala.ui.model.ProviderKey) PipelineKey(org.guvnor.ala.ui.model.PipelineKey) ProviderTypeKey(org.guvnor.ala.ui.model.ProviderTypeKey) Map(java.util.Map) Provider(org.guvnor.ala.ui.model.Provider) Test(org.junit.Test)

Aggregations

ProviderTypeKey (org.guvnor.ala.ui.model.ProviderTypeKey)29 Test (org.junit.Test)18 ProviderKey (org.guvnor.ala.ui.model.ProviderKey)14 Provider (org.guvnor.ala.ui.model.Provider)8 ProviderType (org.guvnor.ala.ui.model.ProviderType)7 Input (org.guvnor.ala.pipeline.Input)4 Before (org.junit.Before)4 ArrayList (java.util.ArrayList)3 ProvisioningManagementTestCommons.mockProviderTypeKey (org.guvnor.ala.ui.ProvisioningManagementTestCommons.mockProviderTypeKey)3 PipelineKey (org.guvnor.ala.ui.model.PipelineKey)3 Map (java.util.Map)2 RuntimeQueryResultItem (org.guvnor.ala.services.api.RuntimeQueryResultItem)2 ProviderTypeSelectedEvent (org.guvnor.ala.ui.client.events.ProviderTypeSelectedEvent)2 AbstractProviderHandlerRegistryTest (org.guvnor.ala.ui.handler.AbstractProviderHandlerRegistryTest)2 ProviderConfiguration (org.guvnor.ala.ui.model.ProviderConfiguration)2 ProvidersInfo (org.guvnor.ala.ui.model.ProvidersInfo)2 Runtime (org.guvnor.ala.ui.model.Runtime)2 RuntimeKey (org.guvnor.ala.ui.model.RuntimeKey)2 RuntimeListItem (org.guvnor.ala.ui.model.RuntimeListItem)2 RuntimeQuery (org.guvnor.ala.services.api.RuntimeQuery)1