Search in sources :

Example 6 with RecordedEvent

use of org.camunda.bpm.engine.test.bpmn.executionlistener.RecorderExecutionListener.RecordedEvent in project camunda-bpm-platform by camunda.

the class ExecutionListenerTest method testExecutionListenerOnTerminateEndEvent.

@Test
@Deployment
public void testExecutionListenerOnTerminateEndEvent() {
    RecorderExecutionListener.clear();
    runtimeService.startProcessInstanceByKey("oneTaskProcess");
    Task task = taskService.createTaskQuery().singleResult();
    taskService.complete(task.getId());
    List<RecordedEvent> recordedEvents = RecorderExecutionListener.getRecordedEvents();
    assertEquals(2, recordedEvents.size());
    assertEquals("start", recordedEvents.get(0).getEventName());
    assertEquals("end", recordedEvents.get(1).getEventName());
}
Also used : Task(org.camunda.bpm.engine.task.Task) RecordedEvent(org.camunda.bpm.engine.test.bpmn.executionlistener.RecorderExecutionListener.RecordedEvent) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 7 with RecordedEvent

use of org.camunda.bpm.engine.test.bpmn.executionlistener.RecorderExecutionListener.RecordedEvent in project camunda-bpm-platform by camunda.

the class ExecutionListenerTest method testOnBoundaryEvents.

@Test
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/executionlistener/ExecutionListenerTest.testOnBoundaryEvents.bpmn20.xml" })
public void testOnBoundaryEvents() {
    RecorderExecutionListener.clear();
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process");
    Job firstTimer = managementService.createJobQuery().timers().singleResult();
    managementService.executeJob(firstTimer.getId());
    Job secondTimer = managementService.createJobQuery().timers().singleResult();
    managementService.executeJob(secondTimer.getId());
    assertProcessEnded(processInstance.getId());
    List<RecordedEvent> recordedEvents = RecorderExecutionListener.getRecordedEvents();
    assertEquals(2, recordedEvents.size());
    assertEquals("timer1", recordedEvents.get(0).getActivityId());
    assertEquals("start boundary listener", recordedEvents.get(0).getParameter());
    assertEquals("start", recordedEvents.get(0).getEventName());
    assertThat(recordedEvents.get(0).isCanceled(), is(false));
    assertEquals("timer2", recordedEvents.get(1).getActivityId());
    assertEquals("end boundary listener", recordedEvents.get(1).getParameter());
    assertEquals("end", recordedEvents.get(1).getEventName());
    assertThat(recordedEvents.get(1).isCanceled(), is(false));
}
Also used : RecordedEvent(org.camunda.bpm.engine.test.bpmn.executionlistener.RecorderExecutionListener.RecordedEvent) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) Job(org.camunda.bpm.engine.runtime.Job) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 8 with RecordedEvent

use of org.camunda.bpm.engine.test.bpmn.executionlistener.RecorderExecutionListener.RecordedEvent in project camunda-bpm-platform by camunda.

the class ExecutionListenerTest method testServiceTaskExecutionListenerCall.

@Test
public void testServiceTaskExecutionListenerCall() {
    testHelper.deploy(PROCESS_SERVICE_TASK_WITH_EXECUTION_START_LISTENER);
    runtimeService.startProcessInstanceByKey("Process");
    Task task = taskService.createTaskQuery().taskDefinitionKey("userTask1").singleResult();
    taskService.complete(task.getId());
    assertEquals(0, taskService.createTaskQuery().list().size());
    List<RecordedEvent> recordedEvents = RecorderExecutionListener.getRecordedEvents();
    assertEquals(1, recordedEvents.size());
    assertEquals("endEvent", recordedEvents.get(0).getActivityId());
}
Also used : Task(org.camunda.bpm.engine.task.Task) RecordedEvent(org.camunda.bpm.engine.test.bpmn.executionlistener.RecorderExecutionListener.RecordedEvent) Test(org.junit.Test)

Example 9 with RecordedEvent

use of org.camunda.bpm.engine.test.bpmn.executionlistener.RecorderExecutionListener.RecordedEvent in project camunda-bpm-platform by camunda.

the class ExecutionListenerTest method testServiceTaskExecutionListenerCallAndSubProcess.

@Test
public void testServiceTaskExecutionListenerCallAndSubProcess() {
    testHelper.deploy(PROCESS_SERVICE_TASK_WITH_EXECUTION_START_LISTENER_AND_SUB_PROCESS);
    runtimeService.startProcessInstanceByKey("Process");
    Task task = taskService.createTaskQuery().taskDefinitionKey("userTask").singleResult();
    taskService.complete(task.getId());
    assertEquals(1, taskService.createTaskQuery().list().size());
    List<RecordedEvent> recordedEvents = RecorderExecutionListener.getRecordedEvents();
    assertEquals(4, recordedEvents.size());
    assertEquals("startSubProcess", recordedEvents.get(0).getActivityId());
    assertEquals("subProcessTask", recordedEvents.get(1).getActivityId());
    assertEquals("sendTask", recordedEvents.get(2).getActivityId());
    assertEquals("endEvent", recordedEvents.get(3).getActivityId());
}
Also used : Task(org.camunda.bpm.engine.task.Task) RecordedEvent(org.camunda.bpm.engine.test.bpmn.executionlistener.RecorderExecutionListener.RecordedEvent) Test(org.junit.Test)

Example 10 with RecordedEvent

use of org.camunda.bpm.engine.test.bpmn.executionlistener.RecorderExecutionListener.RecordedEvent in project camunda-bpm-platform by camunda.

the class ExecutionListenerTest method testServiceTaskTwoExecutionListenerCall.

@Test
public void testServiceTaskTwoExecutionListenerCall() {
    testHelper.deploy(PROCESS_SERVICE_TASK_WITH_TWO_EXECUTION_START_LISTENER);
    runtimeService.startProcessInstanceByKey("Process");
    Task task = taskService.createTaskQuery().taskDefinitionKey("userTask1").singleResult();
    taskService.complete(task.getId());
    assertEquals(0, taskService.createTaskQuery().list().size());
    List<RecordedEvent> recordedEvents = RecorderExecutionListener.getRecordedEvents();
    assertEquals(2, recordedEvents.size());
    assertEquals("sendTask", recordedEvents.get(0).getActivityId());
    assertEquals("endEvent", recordedEvents.get(1).getActivityId());
}
Also used : Task(org.camunda.bpm.engine.task.Task) RecordedEvent(org.camunda.bpm.engine.test.bpmn.executionlistener.RecorderExecutionListener.RecordedEvent) Test(org.junit.Test)

Aggregations

RecordedEvent (org.camunda.bpm.engine.test.bpmn.executionlistener.RecorderExecutionListener.RecordedEvent)17 Deployment (org.camunda.bpm.engine.test.Deployment)14 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)13 Test (org.junit.Test)8 ActivityInstance (org.camunda.bpm.engine.runtime.ActivityInstance)7 RecorderExecutionListener (org.camunda.bpm.engine.test.bpmn.executionlistener.RecorderExecutionListener)6 Task (org.camunda.bpm.engine.task.Task)4 Job (org.camunda.bpm.engine.runtime.Job)2 ExecutionAssert.describeExecutionTree (org.camunda.bpm.engine.test.util.ExecutionAssert.describeExecutionTree)2 ExecutionTree (org.camunda.bpm.engine.test.util.ExecutionTree)2 HashSet (java.util.HashSet)1 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1