Search in sources :

Example 1 with AfterPipelineExecutionEvent

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

the class PipelineExecutor method execute.

public <T> void execute(final Input input, final Pipeline pipeline, final Consumer<T> callback, final PipelineEventListener... eventListeners) {
    final PipelineContext context = new PipelineContext(pipeline);
    context.start(input);
    context.pushCallback(callback);
    propagateEvent(new BeforePipelineExecutionEvent(context.getExecutionId(), pipeline), eventListeners);
    continuePipeline(context, eventListeners);
    propagateEvent(new AfterPipelineExecutionEvent(context.getExecutionId(), pipeline), eventListeners);
}
Also used : BeforePipelineExecutionEvent(org.guvnor.ala.pipeline.events.BeforePipelineExecutionEvent) AfterPipelineExecutionEvent(org.guvnor.ala.pipeline.events.AfterPipelineExecutionEvent)

Example 2 with AfterPipelineExecutionEvent

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

the class PipelineExecutionListenerTest method testAfterPipelineExecution.

@Test
public void testAfterPipelineExecution() {
    listener.afterPipelineExecution(new AfterPipelineExecutionEvent(EXECUTION_ID, pipeline));
    verify(pipelineStatusChangeEvent, times(1)).fire(new PipelineStatusChangeEvent(traceKey, PipelineStatus.FINISHED));
}
Also used : AfterPipelineExecutionEvent(org.guvnor.ala.pipeline.events.AfterPipelineExecutionEvent) PipelineStatusChangeEvent(org.guvnor.ala.ui.events.PipelineStatusChangeEvent) Test(org.junit.Test)

Example 3 with AfterPipelineExecutionEvent

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

the class RestPipelineEventsTest method testEventsPropagation.

@Test
public void testEventsPropagation() {
    List<PipelineConfigStage> configs = new ArrayList<>();
    configs.add(new PipelineConfigStage("GitConfig", new GitConfigImpl()));
    configs.add(new PipelineConfigStage("MavenProjectConfig", new MavenProjectConfigImpl()));
    pipelineService.newPipeline(new PipelineConfigImpl("mypipe", configs));
    Input input = new Input();
    input.put("repo-name", "drools-workshop-events");
    input.put("create-repo", "true");
    input.put("branch", "master");
    input.put("out-dir", tempPath.getAbsolutePath());
    input.put("origin", gitUrl);
    pipelineService.runPipeline("mypipe", input, false);
    assertEquals(6, listener.getEvents().size());
    assertTrue(listener.getEvents().get(0) instanceof BeforePipelineExecutionEvent);
    assertTrue(listener.getEvents().get(1) instanceof BeforeStageExecutionEvent);
    assertTrue(listener.getEvents().get(2) instanceof AfterStageExecutionEvent);
    assertTrue(listener.getEvents().get(3) instanceof BeforeStageExecutionEvent);
    assertTrue(listener.getEvents().get(4) instanceof AfterStageExecutionEvent);
    assertTrue(listener.getEvents().get(5) instanceof AfterPipelineExecutionEvent);
}
Also used : BeforePipelineExecutionEvent(org.guvnor.ala.pipeline.events.BeforePipelineExecutionEvent) Input(org.guvnor.ala.pipeline.Input) AfterStageExecutionEvent(org.guvnor.ala.pipeline.events.AfterStageExecutionEvent) PipelineConfigStage(org.guvnor.ala.pipeline.PipelineConfigStage) MavenProjectConfigImpl(org.guvnor.ala.build.maven.config.impl.MavenProjectConfigImpl) BeforeStageExecutionEvent(org.guvnor.ala.pipeline.events.BeforeStageExecutionEvent) GitConfigImpl(org.guvnor.ala.source.git.config.impl.GitConfigImpl) ArrayList(java.util.ArrayList) AfterPipelineExecutionEvent(org.guvnor.ala.pipeline.events.AfterPipelineExecutionEvent) PipelineConfigImpl(org.guvnor.ala.pipeline.impl.PipelineConfigImpl) Test(org.junit.Test)

Example 4 with AfterPipelineExecutionEvent

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

the class PipelineExecutorTaskManagerImplEventsTest method testAfterPipelineExecutionEvent.

private void testAfterPipelineExecutionEvent(boolean async) {
    when(taskEntry.isAsync()).thenReturn(async);
    AfterPipelineExecutionEvent event = new AfterPipelineExecutionEvent(TASK_ID, pipeline);
    taskManager.localListener.afterPipelineExecution(event);
    verify(task, times(1)).setPipelineStatus(PipelineExecutorTask.Status.FINISHED);
    verifyExecutorRegistryUpdated(async);
    verifyExternalListenersNotified(event);
}
Also used : AfterPipelineExecutionEvent(org.guvnor.ala.pipeline.events.AfterPipelineExecutionEvent)

Aggregations

AfterPipelineExecutionEvent (org.guvnor.ala.pipeline.events.AfterPipelineExecutionEvent)4 BeforePipelineExecutionEvent (org.guvnor.ala.pipeline.events.BeforePipelineExecutionEvent)2 Test (org.junit.Test)2 ArrayList (java.util.ArrayList)1 MavenProjectConfigImpl (org.guvnor.ala.build.maven.config.impl.MavenProjectConfigImpl)1 Input (org.guvnor.ala.pipeline.Input)1 PipelineConfigStage (org.guvnor.ala.pipeline.PipelineConfigStage)1 AfterStageExecutionEvent (org.guvnor.ala.pipeline.events.AfterStageExecutionEvent)1 BeforeStageExecutionEvent (org.guvnor.ala.pipeline.events.BeforeStageExecutionEvent)1 PipelineConfigImpl (org.guvnor.ala.pipeline.impl.PipelineConfigImpl)1 GitConfigImpl (org.guvnor.ala.source.git.config.impl.GitConfigImpl)1 PipelineStatusChangeEvent (org.guvnor.ala.ui.events.PipelineStatusChangeEvent)1