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());
}
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));
}
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));
}
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);
}
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));
}
Aggregations