Search in sources :

Example 1 with ProviderKey

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

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

the class RuntimeServiceImplTest method testStartRuntime.

@Test
public void testStartRuntime() {
    ProviderKey providerKey = mock(ProviderKey.class);
    RuntimeKey runtimeKey = new RuntimeKey(providerKey, RUNTIME_ID);
    service.startRuntime(runtimeKey);
    verify(runtimeProvisioningService, times(1)).startRuntime(RUNTIME_ID);
    verify(runtimeChangeEvent, times(1)).fire(new RuntimeChangeEvent(RuntimeChange.STARTED, runtimeKey));
}
Also used : ProviderKey(org.guvnor.ala.ui.model.ProviderKey) RuntimeKey(org.guvnor.ala.ui.model.RuntimeKey) RuntimeChangeEvent(org.guvnor.ala.ui.events.RuntimeChangeEvent) Test(org.junit.Test)

Example 3 with ProviderKey

use of org.guvnor.ala.ui.model.ProviderKey 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(Mockito.<String>any(), Mockito.<Input>any(), 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 : 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)

Example 4 with ProviderKey

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

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

the class RuntimeServiceImplTest method testStopRuntime.

@Test
public void testStopRuntime() {
    ProviderKey providerKey = mock(ProviderKey.class);
    RuntimeKey runtimeKey = new RuntimeKey(providerKey, RUNTIME_ID);
    service.stopRuntime(runtimeKey);
    verify(runtimeProvisioningService, times(1)).stopRuntime(RUNTIME_ID);
    verify(runtimeChangeEvent, times(1)).fire(new RuntimeChangeEvent(RuntimeChange.STOPPED, runtimeKey));
}
Also used : ProviderKey(org.guvnor.ala.ui.model.ProviderKey) RuntimeKey(org.guvnor.ala.ui.model.RuntimeKey) RuntimeChangeEvent(org.guvnor.ala.ui.events.RuntimeChangeEvent) 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 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 Input (org.guvnor.ala.pipeline.Input)1