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