Search in sources :

Example 1 with PipelineEventListener

use of org.guvnor.ala.pipeline.events.PipelineEventListener in project kie-wb-common by kiegroup.

the class BuildPipelineTest method doTestIncrementalBuildResourceExecution.

private void doTestIncrementalBuildResourceExecution(KieModule module, String resourceUri, LocalBuildConfig.BuildType buildType) {
    // prepare the pipeline input.
    Input input = createIncrementalBuildInput(ROOT_PATH_URI, resourceUri, buildType.name());
    // execute the pipeline and verify the result.
    pipelineInitializer.getExecutor().execute(input, pipe, (Consumer<LocalBinaryConfig>) localBinaryConfig -> {
        assertEquals(incrementalBuildResults, localBinaryConfig.getIncrementalBuildResults());
    }, pipelineEventListener);
    // verify that all stages were properly invoked.
    verifyLocalSourceConfigWasInvoked();
    verifyLocalProjectConfigWasInvoked();
    verifyLocalBuildConfigExecutorWasInvoked(module, resourceUri, buildType.name());
    verifyLocalBuildExecConfigExecutorWasInvoked(module, Paths.convert(getNioPath(resourceUri)), buildType);
    // verify the pipeline events where properly raised.
    verifyPipelineEvents();
}
Also used : Builder(org.kie.workbench.common.services.backend.builder.core.Builder) IncrementalBuildResults(org.guvnor.common.services.project.builder.model.IncrementalBuildResults) Stage(org.guvnor.ala.pipeline.Stage) Mock(org.mockito.Mock) ConfigExecutor(org.guvnor.ala.pipeline.ConfigExecutor) RunWith(org.junit.runner.RunWith) InMemoryPipelineRegistry(org.guvnor.ala.registry.inmemory.InMemoryPipelineRegistry) ArrayList(java.util.ArrayList) BeforePipelineExecutionEvent(org.guvnor.ala.pipeline.events.BeforePipelineExecutionEvent) Paths(org.uberfire.backend.server.util.Paths) Pipeline(org.guvnor.ala.pipeline.Pipeline) ArgumentCaptor(org.mockito.ArgumentCaptor) KieModuleService(org.kie.workbench.common.services.shared.project.KieModuleService) Map(java.util.Map) AfterPipelineExecutionEvent(org.guvnor.ala.pipeline.events.AfterPipelineExecutionEvent) ResourceChange(org.uberfire.workbench.events.ResourceChange) Source(org.guvnor.ala.source.Source) AfterStageExecutionEvent(org.guvnor.ala.pipeline.events.AfterStageExecutionEvent) Path(org.uberfire.backend.vfs.Path) Before(org.junit.Before) BuildResults(org.guvnor.common.services.project.builder.model.BuildResults) PipelineRegistry(org.guvnor.ala.registry.PipelineRegistry) Input(org.guvnor.ala.pipeline.Input) Collection(java.util.Collection) Test(org.junit.Test) BuildHelper(org.kie.workbench.common.services.backend.builder.core.BuildHelper) KieModule(org.kie.workbench.common.services.shared.project.KieModule) PipelineEventListener(org.guvnor.ala.pipeline.events.PipelineEventListener) Consumer(java.util.function.Consumer) BeforeStageExecutionEvent(org.guvnor.ala.pipeline.events.BeforeStageExecutionEvent) Mockito(org.mockito.Mockito) List(java.util.List) DeploymentMode(org.guvnor.common.services.project.service.DeploymentMode) MockitoJUnitRunner(org.mockito.runners.MockitoJUnitRunner) Assert(org.junit.Assert) Input(org.guvnor.ala.pipeline.Input)

Example 2 with PipelineEventListener

use of org.guvnor.ala.pipeline.events.PipelineEventListener in project kie-wb-common by kiegroup.

the class BuildPipelineTest method testIncrementalBuildResourceChangesExecution.

@Test
public void testIncrementalBuildResourceChangesExecution() {
    when(buildHelper.applyBatchResourceChanges(eq(module), any(Map.class))).thenReturn(incrementalBuildResults);
    // prepare the pipeline input.
    Input input = createBatchChangesInput(ROOT_PATH_URI, LocalBuildConfig.BuildType.INCREMENTAL_BATCH_CHANGES.name(), changes);
    // execute the pipeline and verify the result.
    pipelineInitializer.getExecutor().execute(input, pipe, (Consumer<LocalBinaryConfig>) localBinaryConfig -> {
        assertEquals(incrementalBuildResults, localBinaryConfig.getIncrementalBuildResults());
    }, pipelineEventListener);
    // verify that all stages were properly invoked.
    verifyLocalSourceConfigWasInvoked();
    verifyLocalProjectConfigWasInvoked();
    verifyLocalBuildConfigExecutorWasInvoked(module, changes);
    verifyLocalBuildExecConfigExecutorWasInvoked(module, changes);
    // verify the pipeline events where properly raised.
    verifyPipelineEvents();
}
Also used : Builder(org.kie.workbench.common.services.backend.builder.core.Builder) IncrementalBuildResults(org.guvnor.common.services.project.builder.model.IncrementalBuildResults) Stage(org.guvnor.ala.pipeline.Stage) Mock(org.mockito.Mock) ConfigExecutor(org.guvnor.ala.pipeline.ConfigExecutor) RunWith(org.junit.runner.RunWith) InMemoryPipelineRegistry(org.guvnor.ala.registry.inmemory.InMemoryPipelineRegistry) ArrayList(java.util.ArrayList) BeforePipelineExecutionEvent(org.guvnor.ala.pipeline.events.BeforePipelineExecutionEvent) Paths(org.uberfire.backend.server.util.Paths) Pipeline(org.guvnor.ala.pipeline.Pipeline) ArgumentCaptor(org.mockito.ArgumentCaptor) KieModuleService(org.kie.workbench.common.services.shared.project.KieModuleService) Map(java.util.Map) AfterPipelineExecutionEvent(org.guvnor.ala.pipeline.events.AfterPipelineExecutionEvent) ResourceChange(org.uberfire.workbench.events.ResourceChange) Source(org.guvnor.ala.source.Source) AfterStageExecutionEvent(org.guvnor.ala.pipeline.events.AfterStageExecutionEvent) Path(org.uberfire.backend.vfs.Path) Before(org.junit.Before) BuildResults(org.guvnor.common.services.project.builder.model.BuildResults) PipelineRegistry(org.guvnor.ala.registry.PipelineRegistry) Input(org.guvnor.ala.pipeline.Input) Collection(java.util.Collection) Test(org.junit.Test) BuildHelper(org.kie.workbench.common.services.backend.builder.core.BuildHelper) KieModule(org.kie.workbench.common.services.shared.project.KieModule) PipelineEventListener(org.guvnor.ala.pipeline.events.PipelineEventListener) Consumer(java.util.function.Consumer) BeforeStageExecutionEvent(org.guvnor.ala.pipeline.events.BeforeStageExecutionEvent) Mockito(org.mockito.Mockito) List(java.util.List) DeploymentMode(org.guvnor.common.services.project.service.DeploymentMode) MockitoJUnitRunner(org.mockito.runners.MockitoJUnitRunner) Assert(org.junit.Assert) Input(org.guvnor.ala.pipeline.Input) Map(java.util.Map) Test(org.junit.Test)

Example 3 with PipelineEventListener

use of org.guvnor.ala.pipeline.events.PipelineEventListener in project kie-wb-common by kiegroup.

the class PipelineExecutorTaskManagerImplTestBase method mockEventListeners.

public static List<PipelineEventListener> mockEventListeners(int count) {
    List<PipelineEventListener> result = new ArrayList<>();
    for (int i = 0; i < count; i++) {
        PipelineEventListener listener = mock(PipelineEventListener.class);
        result.add(listener);
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) PipelineEventListener(org.guvnor.ala.pipeline.events.PipelineEventListener)

Aggregations

ArrayList (java.util.ArrayList)3 PipelineEventListener (org.guvnor.ala.pipeline.events.PipelineEventListener)3 Collection (java.util.Collection)2 List (java.util.List)2 Map (java.util.Map)2 Consumer (java.util.function.Consumer)2 ConfigExecutor (org.guvnor.ala.pipeline.ConfigExecutor)2 Input (org.guvnor.ala.pipeline.Input)2 Pipeline (org.guvnor.ala.pipeline.Pipeline)2 Stage (org.guvnor.ala.pipeline.Stage)2 AfterPipelineExecutionEvent (org.guvnor.ala.pipeline.events.AfterPipelineExecutionEvent)2 AfterStageExecutionEvent (org.guvnor.ala.pipeline.events.AfterStageExecutionEvent)2 BeforePipelineExecutionEvent (org.guvnor.ala.pipeline.events.BeforePipelineExecutionEvent)2 BeforeStageExecutionEvent (org.guvnor.ala.pipeline.events.BeforeStageExecutionEvent)2 PipelineRegistry (org.guvnor.ala.registry.PipelineRegistry)2 InMemoryPipelineRegistry (org.guvnor.ala.registry.inmemory.InMemoryPipelineRegistry)2 Source (org.guvnor.ala.source.Source)2 BuildResults (org.guvnor.common.services.project.builder.model.BuildResults)2 IncrementalBuildResults (org.guvnor.common.services.project.builder.model.IncrementalBuildResults)2 DeploymentMode (org.guvnor.common.services.project.service.DeploymentMode)2