use of org.guvnor.ala.ui.model.ProviderTypeKey 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));
}
use of org.guvnor.ala.ui.model.ProviderTypeKey in project kie-wb-common by kiegroup.
the class RuntimeServiceImplTest method testCreateRuntimeWhenProviderExistsButRuntimeNameExitsts.
@Test
public void testCreateRuntimeWhenProviderExistsButRuntimeNameExitsts() {
Provider provider = mock(Provider.class);
ProviderTypeKey providerTypeKey = new ProviderTypeKey(PROVIDER_NAME, PROVIDER_VERSION);
ProviderKey providerKey = new ProviderKey(providerTypeKey, PROVIDER_ID);
List<RuntimeQueryResultItem> items = mock(List.class);
// the provider exists, so validation continues
when(providerService.getProvider(providerKey)).thenReturn(provider);
// but the runtime name already exists.
when(runtimeProvisioningService.executeQuery(RuntimeQueryBuilder.newInstance().withRuntimeName(RUNTIME_ID).build())).thenReturn(items);
when(items.isEmpty()).thenReturn(false);
expectedException.expectMessage("A runtime with the given name already exists: " + RUNTIME_ID);
service.createRuntime(providerKey, RUNTIME_ID, PIPELINE_KEY, mock(Map.class));
verify(pipelineService, never()).runPipeline(anyString(), any(Input.class), eq(true));
}
use of org.guvnor.ala.ui.model.ProviderTypeKey in project kie-wb-common by kiegroup.
the class ProviderConverterImplTest method setUp.
@Before
public void setUp() {
when(providerType.getProviderTypeName()).thenReturn(PROVIDER_TYPE_NAME);
when(providerType.getVersion()).thenReturn(PROVIDER_VERSION);
when(provider.getId()).thenReturn(PROVIDER_ID);
when(provider.getProviderType()).thenReturn(providerType);
when(provider.getConfig()).thenReturn(providerConfig);
providerTypeKey = new ProviderTypeKey(PROVIDER_TYPE_NAME, PROVIDER_VERSION);
providerKey = new ProviderKey(providerTypeKey, PROVIDER_ID);
converter = new ProviderConverterImpl(handlerRegistry);
}
use of org.guvnor.ala.ui.model.ProviderTypeKey in project kie-wb-common by kiegroup.
the class BackendProviderHandlerRegistryTest method testEnsureHandlerForNonRegisteredProviderType.
@Test
public void testEnsureHandlerForNonRegisteredProviderType() throws Exception {
// pick an arbitrary non registered provider type.
ProviderTypeKey providerTypeKey = mock(ProviderTypeKey.class);
expectedException.expectMessage("BackendProviderHandler was not found for providerTypeKey: " + providerTypeKey);
((BackendProviderHandlerRegistry) handlerRegistry).ensureHandler(providerTypeKey);
}
Aggregations