use of org.guvnor.ala.ui.model.ProviderKey in project kie-wb-common by kiegroup.
the class RuntimeServiceImplTest method getRuntimeItemByRuntimeKeyExisting.
@Test
public void getRuntimeItemByRuntimeKeyExisting() {
ProviderKey providerKey = mock(ProviderKey.class);
RuntimeKey runtimeKey = new RuntimeKey(providerKey, RUNTIME_ID);
List<RuntimeQueryResultItem> singleResult = mockRuntimeQueryResultItemList(1);
when(runtimeProvisioningService.executeQuery(any(RuntimeQuery.class))).thenReturn(singleResult);
RuntimeListItem expectedItem = buildExpectedResult(singleResult).iterator().next();
RuntimeListItem result = service.getRuntimeItem(runtimeKey);
assertEquals(expectedItem, result);
}
use of org.guvnor.ala.ui.model.ProviderKey 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.ProviderKey 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.ProviderKey in project kie-wb-common by kiegroup.
the class ProvisioningManagementBrowserPresenter method setupProviderType.
private void setupProviderType(final ProviderType providerType, final Collection<ProviderKey> providerKeys, final String selectProviderId) {
ProviderKey provider2BeSelected = null;
this.view.setProviderType(providerTypePresenter.getView());
if (providerKeys.isEmpty()) {
providerEmptyPresenter.setProviderType(providerType);
this.view.setContent(providerEmptyPresenter.getView());
} else {
if (selectProviderId != null) {
for (ProviderKey provider : providerKeys) {
if (provider.getId().equals(selectProviderId)) {
provider2BeSelected = provider;
break;
}
}
}
if (provider2BeSelected == null) {
provider2BeSelected = providerKeys.iterator().next();
}
}
providerTypePresenter.setup(providerType, providerKeys, provider2BeSelected);
}
Aggregations