Search in sources :

Example 1 with BeforePipelineExecutionEvent

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

the class PipelineExecutorTaskManagerImplEventsTest method testBeforePipelineExecutionEvent.

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

Example 2 with BeforePipelineExecutionEvent

use of org.guvnor.ala.pipeline.events.BeforePipelineExecutionEvent 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 3 with BeforePipelineExecutionEvent

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

the class PipelineExecutionListenerTest method testBeforePipelineExecution.

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

Example 4 with BeforePipelineExecutionEvent

use of org.guvnor.ala.pipeline.events.BeforePipelineExecutionEvent 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)

Aggregations

BeforePipelineExecutionEvent (org.guvnor.ala.pipeline.events.BeforePipelineExecutionEvent)4 AfterPipelineExecutionEvent (org.guvnor.ala.pipeline.events.AfterPipelineExecutionEvent)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