Search in sources :

Example 26 with ProviderTypeKey

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

Example 27 with ProviderTypeKey

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));
}
Also used : Input(org.guvnor.ala.pipeline.Input) ProviderKey(org.guvnor.ala.ui.model.ProviderKey) RuntimeQueryResultItem(org.guvnor.ala.services.api.RuntimeQueryResultItem) ProviderTypeKey(org.guvnor.ala.ui.model.ProviderTypeKey) Map(java.util.Map) Provider(org.guvnor.ala.ui.model.Provider) Test(org.junit.Test)

Example 28 with ProviderTypeKey

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);
}
Also used : ProviderKey(org.guvnor.ala.ui.model.ProviderKey) ProviderTypeKey(org.guvnor.ala.ui.model.ProviderTypeKey) Before(org.junit.Before)

Example 29 with ProviderTypeKey

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);
}
Also used : ProviderTypeKey(org.guvnor.ala.ui.model.ProviderTypeKey) AbstractProviderHandlerRegistryTest(org.guvnor.ala.ui.handler.AbstractProviderHandlerRegistryTest) 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