Search in sources :

Example 6 with ProviderType

use of org.guvnor.ala.runtime.providers.ProviderType in project kie-wb-common by kiegroup.

the class InMemoryPipelineRegistryTest method getPipelinesForProvider.

@Test
public void getPipelinesForProvider() {
    ProviderType providerType1 = mockProviderTypeSPI("providerType1");
    ProviderType providerType2 = mockProviderTypeSPI("providerType2");
    List<Pipeline> result = pipelineRegistry.getPipelines(0, 1000, PipelineRegistry.PIPELINE_NAME_SORT, true);
    assertTrue(result.isEmpty());
    // register pipelines for providerType, providerType1, and providerType2
    List<Pipeline> pipelines = mockPipelineList("providerType", ELEMENTS_COUNT);
    registerPipelinesForProviderType(pipelines, providerType);
    registerPipelinesForProviderType(mockPipelineList("providerType1", ELEMENTS_COUNT), providerType1);
    registerPipelinesForProviderType(mockPipelineList("providerType2", ELEMENTS_COUNT), providerType2);
    result = pipelineRegistry.getPipelines(0, 1000, PipelineRegistry.PIPELINE_NAME_SORT, true);
    assertEquals(3 * ELEMENTS_COUNT, result.size());
    result = pipelineRegistry.getPipelines(providerType.getProviderTypeName(), providerType.getVersion(), 0, 1000, PipelineRegistry.PIPELINE_NAME_SORT, true);
    assertEquals(pipelines.size(), result.size());
    for (Pipeline pipeline : result) {
        assertTrue(result.contains(pipeline));
    }
}
Also used : ProviderType(org.guvnor.ala.runtime.providers.ProviderType) Pipeline(org.guvnor.ala.pipeline.Pipeline) Test(org.junit.Test)

Example 7 with ProviderType

use of org.guvnor.ala.runtime.providers.ProviderType in project kie-wb-common by kiegroup.

the class InMemoryRuntimeRegistryTest method testGetProvidersByType.

@Test
public void testGetProvidersByType() {
    ProviderType providerType1 = mockProviderTypeSPI("ProviderType1");
    ProviderType providerType2 = mockProviderTypeSPI("ProviderType2");
    List<Provider> providers = mockProviderListSPI(providerType, "1", ELEMENTS_COUNT);
    List<Provider> providersForType1 = mockProviderListSPI(providerType1, "2", ELEMENTS_COUNT);
    List<Provider> providersForType2 = mockProviderListSPI(providerType2, ELEMENTS_COUNT);
    List<Provider> allProviders = new ArrayList<>();
    allProviders.addAll(providers);
    allProviders.addAll(providersForType1);
    allProviders.addAll(providersForType2);
    allProviders.forEach(provider -> runtimeRegistry.registerProvider(provider));
    List<Provider> result = runtimeRegistry.getProvidersByType(providerType);
    assertEquals(providers.size(), result.size());
    for (Provider provider : providers) {
        assertTrue(result.contains(provider));
    }
}
Also used : ArrayList(java.util.ArrayList) ProviderType(org.guvnor.ala.runtime.providers.ProviderType) Provider(org.guvnor.ala.runtime.providers.Provider) Test(org.junit.Test)

Example 8 with ProviderType

use of org.guvnor.ala.runtime.providers.ProviderType in project kie-wb-common by kiegroup.

the class InMemoryRuntimeRegistryTest method testGetProviderTypes.

@Test
public void testGetProviderTypes() {
    List<ProviderType> result = runtimeRegistry.getProviderTypes(0, 1000, RuntimeRegistry.PROVIDER_TYPE_NAME_SORT, true);
    assertTrue(result.isEmpty());
    List<ProviderType> providerTypes = mockProviderTypeListSPI(ELEMENTS_COUNT);
    providerTypes.forEach(providerType -> runtimeRegistry.registerProviderType(providerType));
    result = runtimeRegistry.getProviderTypes(0, 1000, RuntimeRegistry.PROVIDER_TYPE_NAME_SORT, true);
    for (ProviderType providerType : providerTypes) {
        assertTrue(result.contains(providerType));
    }
}
Also used : ProviderType(org.guvnor.ala.runtime.providers.ProviderType) Test(org.junit.Test)

Aggregations

ProviderType (org.guvnor.ala.runtime.providers.ProviderType)8 Test (org.junit.Test)5 Pipeline (org.guvnor.ala.pipeline.Pipeline)3 ArrayList (java.util.ArrayList)2 Provider (org.guvnor.ala.runtime.providers.Provider)2 Properties (java.util.Properties)1 PostConstruct (javax.annotation.PostConstruct)1 Any (javax.enterprise.inject.Any)1 Produces (javax.enterprise.inject.Produces)1 Bean (javax.enterprise.inject.spi.Bean)1 MavenBuildConfig (org.guvnor.ala.build.maven.config.MavenBuildConfig)1 MavenBuildExecConfig (org.guvnor.ala.build.maven.config.MavenBuildExecConfig)1 MavenProjectConfig (org.guvnor.ala.build.maven.config.MavenProjectConfig)1 ConfigBasedPipeline (org.guvnor.ala.pipeline.ConfigBasedPipeline)1 SystemPipelineDescriptor (org.guvnor.ala.pipeline.SystemPipelineDescriptor)1 PipelineExecutorTaskDef (org.guvnor.ala.pipeline.execution.PipelineExecutorTaskDef)1 PipelineExecutorTaskDefImpl (org.guvnor.ala.pipeline.execution.impl.PipelineExecutorTaskDefImpl)1 ProviderTypeList (org.guvnor.ala.services.api.itemlist.ProviderTypeList)1 BusinessException (org.guvnor.ala.services.exceptions.BusinessException)1 GitConfig (org.guvnor.ala.source.git.config.GitConfig)1