use of org.guvnor.ala.ui.model.ProviderKey in project kie-wb-common by kiegroup.
the class ProviderServiceImplTest method setUp.
@Before
public void setUp() {
providerTypeSpi = mockProviderTypeSPI("0");
providersSpi = mockProviderListSPI(providerTypeSpi, PROVIDER_COUNT);
when(runtimeProvisioningService.getProviders(anyInt(), anyInt(), anyString(), anyBoolean())).thenReturn(providersSpi);
providerTypeKey = new ProviderTypeKey(providerTypeSpi.getProviderTypeName(), providerTypeSpi.getVersion());
providerType = new ProviderType(providerTypeKey, null);
when(providerConverterFactory.getProviderConverter()).thenReturn(providerConverter);
when(providerConverterFactory.getProviderConfigConverter(providerTypeKey)).thenReturn(providerConfigConverter);
providers = new ArrayList<>();
providerKeys = new ArrayList<>();
for (int i = 0; i < PROVIDER_COUNT; i++) {
Provider provider = mock(Provider.class);
ProviderTypeKey providerTypeKey = new ProviderTypeKey(providersSpi.get(i).getProviderType().getProviderTypeName(), providersSpi.get(i).getProviderType().getVersion());
ProviderKey providerKey = new ProviderKey(providerTypeKey, providersSpi.get(i).getId());
when(provider.getKey()).thenReturn(providerKey);
providers.add(provider);
providerKeys.add(providerKey);
when(providerConverter.toModel(providersSpi.get(i))).thenReturn(provider);
}
service = new ProviderServiceImpl(runtimeProvisioningService, providerConverterFactory);
}
use of org.guvnor.ala.ui.model.ProviderKey in project kie-wb-common by kiegroup.
the class ProviderServiceImplTest method testGetProviderNotExisting.
@Test
public void testGetProviderNotExisting() {
// create an arbitrary not existing key.
ProviderTypeKey providerTypeKey = new ProviderTypeKey("not exist", "not exist");
ProviderKey providerKey = new ProviderKey(providerTypeKey, "not exist");
Provider provider = service.getProvider(providerKey);
assertNull(provider);
}
use of org.guvnor.ala.ui.model.ProviderKey in project kie-wb-common by kiegroup.
the class RuntimeServiceImplTest method testDeleteRuntime.
private void testDeleteRuntime(boolean forced) {
ProviderKey providerKey = mock(ProviderKey.class);
RuntimeKey runtimeKey = new RuntimeKey(providerKey, RUNTIME_ID);
service.deleteRuntime(runtimeKey, forced);
verify(runtimeProvisioningService, times(1)).destroyRuntime(RUNTIME_ID, forced);
verify(runtimeChangeEvent, times(1)).fire(new RuntimeChangeEvent(RuntimeChange.DELETED, runtimeKey));
}
use of org.guvnor.ala.ui.model.ProviderKey in project kie-wb-common by kiegroup.
the class RuntimeServiceImplTest method getRuntimeItemByRuntimeKeyNotExisting.
@Test
public void getRuntimeItemByRuntimeKeyNotExisting() {
ProviderKey providerKey = mock(ProviderKey.class);
RuntimeKey runtimeKey = new RuntimeKey(providerKey, RUNTIME_ID);
List<RuntimeQueryResultItem> singleResult = new ArrayList<>();
when(runtimeProvisioningService.executeQuery(any(RuntimeQuery.class))).thenReturn(singleResult);
RuntimeListItem result = service.getRuntimeItem(runtimeKey);
assertNull(result);
}
use of org.guvnor.ala.ui.model.ProviderKey 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));
}
Aggregations