Search in sources :

Example 6 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(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)

Example 7 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 8 with ProviderKey

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

the class RuntimeServiceImplTest method testCreateRuntimeSuccessful.

@Test
public void testCreateRuntimeSuccessful() {
    Provider provider = mock(Provider.class);
    ProviderTypeKey providerTypeKey = new ProviderTypeKey(PROVIDER_NAME, PROVIDER_VERSION);
    ProviderKey providerKey = new ProviderKey(providerTypeKey, PROVIDER_ID);
    Map<String, String> params = PipelineInputBuilderTest.mockParams(PARAMS_COUNT);
    List<RuntimeQueryResultItem> items = mock(List.class);
    when(providerService.getProvider(providerKey)).thenReturn(provider);
    when(runtimeProvisioningService.executeQuery(RuntimeQueryBuilder.newInstance().withRuntimeName(RUNTIME_ID).build())).thenReturn(items);
    when(items.isEmpty()).thenReturn(true);
    Input expectedInput = PipelineInputBuilder.newInstance().withProvider(providerKey).withRuntimeName(RUNTIME_ID).withParams(params).build();
    service.createRuntime(providerKey, RUNTIME_ID, PIPELINE_KEY, params);
    verify(pipelineService, times(1)).runPipeline(PIPELINE, expectedInput, 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) Provider(org.guvnor.ala.ui.model.Provider) Test(org.junit.Test)

Example 9 with ProviderKey

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

the class OpenShiftProviderConfigPresenterTest method testLoad.

@Test
public void testLoad() {
    Map<String, Object> values = new HashMap<>();
    values.put(MASTER_URL, MASTER_URL_VALUE);
    values.put(USER, USER_VALUE);
    values.put(PASSWORD, PASSWORD_VALUE);
    Provider provider = mock(Provider.class);
    ProviderKey providerKey = mock(ProviderKey.class);
    ProviderConfiguration configuration = mock(ProviderConfiguration.class);
    when(provider.getKey()).thenReturn(providerKey);
    when(providerKey.getId()).thenReturn(PROVIDER_NAME_VALUE);
    when(provider.getConfiguration()).thenReturn(configuration);
    when(configuration.getValues()).thenReturn(values);
    presenter.load(provider);
    verify(view, times(1)).clear();
    verify(view, times(1)).setProviderName(PROVIDER_NAME_VALUE);
    verify(view, times(1)).setMasterURL(MASTER_URL_VALUE);
    verify(view, times(1)).setUsername(USER_VALUE);
    verify(view, times(1)).setPassword(PASSWORD_VALUE);
}
Also used : ProviderKey(org.guvnor.ala.ui.model.ProviderKey) HashMap(java.util.HashMap) Provider(org.guvnor.ala.ui.model.Provider) ProviderConfiguration(org.guvnor.ala.ui.model.ProviderConfiguration) Test(org.junit.Test)

Example 10 with ProviderKey

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

the class WF10ProviderConfigPresenterTest method testLoad.

@Test
public void testLoad() {
    Map<String, Object> values = new HashMap<>();
    values.put(HOST, HOST_VALUE);
    values.put(PORT, PORT_VALUE);
    values.put(MANAGEMENT_PORT, MANAGEMENT_PORT_VALUE);
    values.put(USER, USER_VALUE);
    values.put(PASSWORD, PASSWORD_VALUE);
    Provider provider = mock(Provider.class);
    ProviderKey providerKey = mock(ProviderKey.class);
    ProviderConfiguration configuration = mock(ProviderConfiguration.class);
    when(provider.getKey()).thenReturn(providerKey);
    when(providerKey.getId()).thenReturn(PROVIDER_NAME_VALUE);
    when(provider.getConfiguration()).thenReturn(configuration);
    when(configuration.getValues()).thenReturn(values);
    presenter.load(provider);
    verify(view, times(1)).setProviderName(PROVIDER_NAME_VALUE);
    verify(view, times(1)).setHost(HOST_VALUE);
    verify(view, times(1)).setPort(PORT_VALUE);
    verify(view, times(1)).setManagementPort(MANAGEMENT_PORT_VALUE);
    verify(view, times(1)).setUsername(USER_VALUE);
    verify(view, times(1)).setPassword(PASSWORD_MASK);
}
Also used : ProviderKey(org.guvnor.ala.ui.model.ProviderKey) HashMap(java.util.HashMap) Provider(org.guvnor.ala.ui.model.Provider) ProviderConfiguration(org.guvnor.ala.ui.model.ProviderConfiguration) 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 Input (org.guvnor.ala.pipeline.Input)4 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