Search in sources :

Example 21 with ProviderKey

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);
}
Also used : ProviderKey(org.guvnor.ala.ui.model.ProviderKey) RuntimeListItem(org.guvnor.ala.ui.model.RuntimeListItem) RuntimeQuery(org.guvnor.ala.services.api.RuntimeQuery) RuntimeQueryResultItem(org.guvnor.ala.services.api.RuntimeQueryResultItem) RuntimeKey(org.guvnor.ala.ui.model.RuntimeKey) Test(org.junit.Test)

Example 22 with ProviderKey

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));
}
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 23 with ProviderKey

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

Example 24 with ProviderKey

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

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