Search in sources :

Example 1 with ActivitySequenceCounterMap

use of org.camunda.bpm.engine.test.standalone.entity.ExecutionOrderListener.ActivitySequenceCounterMap in project camunda-bpm-platform by camunda.

the class ExecutionSequenceCounterTest method testForkSameSequenceLengthWithAsyncEndEvent.

@Deployment
public void testForkSameSequenceLengthWithAsyncEndEvent() {
    // given
    String processInstanceId = runtimeService.startProcessInstanceByKey("process").getId();
    JobQuery jobQuery = managementService.createJobQuery();
    // when (1)
    // then (1)
    List<ActivitySequenceCounterMap> order = ExecutionOrderListener.getActivityExecutionOrder();
    assertEquals(5, order.size());
    long lastSequenceCounter = 0;
    ActivitySequenceCounterMap theStartElement = order.get(0);
    assertEquals("theStart", theStartElement.getActivityId());
    assertTrue(theStartElement.getSequenceCounter() > lastSequenceCounter);
    lastSequenceCounter = theStartElement.getSequenceCounter();
    ActivitySequenceCounterMap theForkElement = order.get(1);
    assertEquals("theService", theForkElement.getActivityId());
    assertTrue(theForkElement.getSequenceCounter() > lastSequenceCounter);
    lastSequenceCounter = theForkElement.getSequenceCounter();
    ActivitySequenceCounterMap theServiceElement = order.get(2);
    assertEquals("fork", theServiceElement.getActivityId());
    assertTrue(theServiceElement.getSequenceCounter() > lastSequenceCounter);
    lastSequenceCounter = theServiceElement.getSequenceCounter();
    ActivitySequenceCounterMap theService1Element = order.get(3);
    assertEquals("theService1", theService1Element.getActivityId());
    assertTrue(theService1Element.getSequenceCounter() > lastSequenceCounter);
    ActivitySequenceCounterMap theService2Element = order.get(4);
    assertEquals("theService2", theService2Element.getActivityId());
    assertTrue(theService2Element.getSequenceCounter() > lastSequenceCounter);
    // when (2)
    String jobId = jobQuery.activityId("theEnd1").singleResult().getId();
    managementService.executeJob(jobId);
    // then (2)
    order = ExecutionOrderListener.getActivityExecutionOrder();
    assertEquals(6, order.size());
    ActivitySequenceCounterMap theEnd1Element = order.get(5);
    assertEquals("theEnd1", theEnd1Element.getActivityId());
    assertTrue(theEnd1Element.getSequenceCounter() > theService1Element.getSequenceCounter());
    // when (3)
    jobId = jobQuery.activityId("theEnd2").singleResult().getId();
    managementService.executeJob(jobId);
    // then (3)
    assertProcessEnded(processInstanceId);
    order = ExecutionOrderListener.getActivityExecutionOrder();
    assertEquals(7, order.size());
    ActivitySequenceCounterMap theEnd2Element = order.get(6);
    assertEquals("theEnd2", theEnd2Element.getActivityId());
    assertTrue(theEnd2Element.getSequenceCounter() > theService2Element.getSequenceCounter());
}
Also used : JobQuery(org.camunda.bpm.engine.runtime.JobQuery) ActivitySequenceCounterMap(org.camunda.bpm.engine.test.standalone.entity.ExecutionOrderListener.ActivitySequenceCounterMap) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 2 with ActivitySequenceCounterMap

use of org.camunda.bpm.engine.test.standalone.entity.ExecutionOrderListener.ActivitySequenceCounterMap in project camunda-bpm-platform by camunda.

the class ExecutionSequenceCounterTest method testForkReplaceByAnotherExecutionOrder.

@Deployment(resources = { "org/camunda/bpm/engine/test/standalone/entity/ExecutionSequenceCounterTest.testForkReplaceBy.bpmn20.xml" })
public void testForkReplaceByAnotherExecutionOrder() {
    // given
    String processInstanceId = runtimeService.startProcessInstanceByKey("process").getId();
    JobQuery jobQuery = managementService.createJobQuery();
    // when (1)
    // then (1)
    List<ActivitySequenceCounterMap> order = ExecutionOrderListener.getActivityExecutionOrder();
    assertEquals(2, order.size());
    ActivitySequenceCounterMap theService1Element = order.get(0);
    assertEquals("theService1", theService1Element.getActivityId());
    ActivitySequenceCounterMap theService3Element = order.get(1);
    assertEquals("theService3", theService3Element.getActivityId());
    assertTrue(theService1Element.getSequenceCounter() == theService3Element.getSequenceCounter());
    // when (2)
    String jobId = jobQuery.activityId("theService2").singleResult().getId();
    managementService.executeJob(jobId);
    // then (2)
    order = ExecutionOrderListener.getActivityExecutionOrder();
    assertEquals(4, order.size());
    ActivitySequenceCounterMap theService2Element = order.get(2);
    assertEquals("theService2", theService2Element.getActivityId());
    assertTrue(theService2Element.getSequenceCounter() > theService1Element.getSequenceCounter());
    ActivitySequenceCounterMap theEnd1Element = order.get(3);
    assertEquals("theEnd1", theEnd1Element.getActivityId());
    assertTrue(theEnd1Element.getSequenceCounter() > theService2Element.getSequenceCounter());
    // when (3)
    jobId = jobQuery.activityId("theService4").singleResult().getId();
    managementService.executeJob(jobId);
    // then (3)
    order = ExecutionOrderListener.getActivityExecutionOrder();
    assertEquals(7, order.size());
    ActivitySequenceCounterMap theService4Element = order.get(4);
    assertEquals("theService4", theService4Element.getActivityId());
    assertTrue(theService4Element.getSequenceCounter() > theService3Element.getSequenceCounter());
    assertTrue(theService4Element.getSequenceCounter() > theEnd1Element.getSequenceCounter());
    ActivitySequenceCounterMap theService5Element = order.get(5);
    assertEquals("theService5", theService5Element.getActivityId());
    assertTrue(theService5Element.getSequenceCounter() > theService4Element.getSequenceCounter());
    ActivitySequenceCounterMap theEnd2Element = order.get(6);
    assertEquals("theEnd2", theEnd2Element.getActivityId());
    assertTrue(theEnd2Element.getSequenceCounter() > theService5Element.getSequenceCounter());
    assertProcessEnded(processInstanceId);
}
Also used : JobQuery(org.camunda.bpm.engine.runtime.JobQuery) ActivitySequenceCounterMap(org.camunda.bpm.engine.test.standalone.entity.ExecutionOrderListener.ActivitySequenceCounterMap) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 3 with ActivitySequenceCounterMap

use of org.camunda.bpm.engine.test.standalone.entity.ExecutionOrderListener.ActivitySequenceCounterMap in project camunda-bpm-platform by camunda.

the class ExecutionSequenceCounterTest method testForkDifferentSequenceLengthInsideSubProcess.

@Deployment
public void testForkDifferentSequenceLengthInsideSubProcess() {
    // given
    String processInstanceId = runtimeService.startProcessInstanceByKey("process").getId();
    // when
    // then
    assertProcessEnded(processInstanceId);
    List<ActivitySequenceCounterMap> order = ExecutionOrderListener.getActivityExecutionOrder();
    assertEquals(3, order.size());
    ActivitySequenceCounterMap innerEnd1Element = order.get(0);
    assertEquals("innerEnd1", innerEnd1Element.getActivityId());
    ActivitySequenceCounterMap innerEnd2Element = order.get(1);
    assertEquals("innerEnd2", innerEnd2Element.getActivityId());
    ActivitySequenceCounterMap theService1Element = order.get(2);
    assertEquals("theService1", theService1Element.getActivityId());
    assertTrue(theService1Element.getSequenceCounter() > innerEnd1Element.getSequenceCounter());
    assertTrue(theService1Element.getSequenceCounter() > innerEnd2Element.getSequenceCounter());
}
Also used : ActivitySequenceCounterMap(org.camunda.bpm.engine.test.standalone.entity.ExecutionOrderListener.ActivitySequenceCounterMap) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 4 with ActivitySequenceCounterMap

use of org.camunda.bpm.engine.test.standalone.entity.ExecutionOrderListener.ActivitySequenceCounterMap in project camunda-bpm-platform by camunda.

the class ExecutionSequenceCounterTest method testForkDifferentSequenceLengthWithAsyncEndEvent.

@Deployment
public void testForkDifferentSequenceLengthWithAsyncEndEvent() {
    // given
    String processInstanceId = runtimeService.startProcessInstanceByKey("process").getId();
    JobQuery jobQuery = managementService.createJobQuery();
    // when (1)
    // then (1)
    List<ActivitySequenceCounterMap> order = ExecutionOrderListener.getActivityExecutionOrder();
    assertEquals(6, order.size());
    long lastSequenceCounter = 0;
    ActivitySequenceCounterMap theStartElement = order.get(0);
    assertEquals("theStart", theStartElement.getActivityId());
    assertTrue(theStartElement.getSequenceCounter() > lastSequenceCounter);
    lastSequenceCounter = theStartElement.getSequenceCounter();
    ActivitySequenceCounterMap theForkElement = order.get(1);
    assertEquals("theService", theForkElement.getActivityId());
    assertTrue(theForkElement.getSequenceCounter() > lastSequenceCounter);
    lastSequenceCounter = theForkElement.getSequenceCounter();
    ActivitySequenceCounterMap theServiceElement = order.get(2);
    assertEquals("fork", theServiceElement.getActivityId());
    assertTrue(theServiceElement.getSequenceCounter() > lastSequenceCounter);
    lastSequenceCounter = theServiceElement.getSequenceCounter();
    ActivitySequenceCounterMap theService1Element = order.get(3);
    assertEquals("theService1", theService1Element.getActivityId());
    assertTrue(theService1Element.getSequenceCounter() > lastSequenceCounter);
    ActivitySequenceCounterMap theService2Element = order.get(4);
    assertEquals("theService2", theService2Element.getActivityId());
    assertTrue(theService2Element.getSequenceCounter() > lastSequenceCounter);
    ActivitySequenceCounterMap theService3Element = order.get(5);
    assertEquals("theService3", theService3Element.getActivityId());
    assertTrue(theService3Element.getSequenceCounter() > theService2Element.getSequenceCounter());
    // when (2)
    String jobId = jobQuery.activityId("theEnd1").singleResult().getId();
    managementService.executeJob(jobId);
    // then (2)
    order = ExecutionOrderListener.getActivityExecutionOrder();
    assertEquals(7, order.size());
    ActivitySequenceCounterMap theEnd1Element = order.get(6);
    assertEquals("theEnd1", theEnd1Element.getActivityId());
    assertTrue(theEnd1Element.getSequenceCounter() > theService1Element.getSequenceCounter());
    // when (3)
    jobId = jobQuery.activityId("theEnd2").singleResult().getId();
    managementService.executeJob(jobId);
    // then (3)
    assertProcessEnded(processInstanceId);
    order = ExecutionOrderListener.getActivityExecutionOrder();
    assertEquals(8, order.size());
    ActivitySequenceCounterMap theEnd2Element = order.get(7);
    assertEquals("theEnd2", theEnd2Element.getActivityId());
    assertTrue(theEnd2Element.getSequenceCounter() > theService3Element.getSequenceCounter());
}
Also used : JobQuery(org.camunda.bpm.engine.runtime.JobQuery) ActivitySequenceCounterMap(org.camunda.bpm.engine.test.standalone.entity.ExecutionOrderListener.ActivitySequenceCounterMap) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 5 with ActivitySequenceCounterMap

use of org.camunda.bpm.engine.test.standalone.entity.ExecutionOrderListener.ActivitySequenceCounterMap in project camunda-bpm-platform by camunda.

the class ExecutionSequenceCounterTest method testForkAndJoinSameSequenceLength.

@Deployment
public void testForkAndJoinSameSequenceLength() {
    // given
    String processInstanceId = runtimeService.startProcessInstanceByKey("process").getId();
    // when
    // then
    assertProcessEnded(processInstanceId);
    List<ActivitySequenceCounterMap> order = ExecutionOrderListener.getActivityExecutionOrder();
    assertEquals(9, order.size());
    long lastSequenceCounter = 0;
    ActivitySequenceCounterMap theStartElement = order.get(0);
    assertEquals("theStart", theStartElement.getActivityId());
    assertTrue(theStartElement.getSequenceCounter() > lastSequenceCounter);
    lastSequenceCounter = theStartElement.getSequenceCounter();
    ActivitySequenceCounterMap theForkElement = order.get(1);
    assertEquals("theService", theForkElement.getActivityId());
    assertTrue(theForkElement.getSequenceCounter() > lastSequenceCounter);
    lastSequenceCounter = theForkElement.getSequenceCounter();
    ActivitySequenceCounterMap theServiceElement = order.get(2);
    assertEquals("fork", theServiceElement.getActivityId());
    assertTrue(theServiceElement.getSequenceCounter() > lastSequenceCounter);
    lastSequenceCounter = theServiceElement.getSequenceCounter();
    ActivitySequenceCounterMap theService1Element = order.get(3);
    assertEquals("theService1", theService1Element.getActivityId());
    assertTrue(theService1Element.getSequenceCounter() > lastSequenceCounter);
    lastSequenceCounter = theService1Element.getSequenceCounter();
    ActivitySequenceCounterMap theJoin1Element = order.get(4);
    assertEquals("join", theJoin1Element.getActivityId());
    assertTrue(theJoin1Element.getSequenceCounter() > lastSequenceCounter);
    lastSequenceCounter = theForkElement.getSequenceCounter();
    ActivitySequenceCounterMap theService2Element = order.get(5);
    assertEquals("theService2", theService2Element.getActivityId());
    assertTrue(theService2Element.getSequenceCounter() > lastSequenceCounter);
    lastSequenceCounter = theService2Element.getSequenceCounter();
    ActivitySequenceCounterMap theJoin2Element = order.get(6);
    assertEquals("join", theJoin2Element.getActivityId());
    assertTrue(theJoin2Element.getSequenceCounter() > lastSequenceCounter);
    ActivitySequenceCounterMap theService3Element = order.get(7);
    assertEquals("theService3", theService3Element.getActivityId());
    assertTrue(theService3Element.getSequenceCounter() > theJoin1Element.getSequenceCounter());
    assertTrue(theService3Element.getSequenceCounter() > theJoin2Element.getSequenceCounter());
    lastSequenceCounter = theService3Element.getSequenceCounter();
    ActivitySequenceCounterMap theEndElement = order.get(8);
    assertEquals("theEnd", theEndElement.getActivityId());
    assertTrue(theEndElement.getSequenceCounter() > lastSequenceCounter);
}
Also used : ActivitySequenceCounterMap(org.camunda.bpm.engine.test.standalone.entity.ExecutionOrderListener.ActivitySequenceCounterMap) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

ActivitySequenceCounterMap (org.camunda.bpm.engine.test.standalone.entity.ExecutionOrderListener.ActivitySequenceCounterMap)13 Deployment (org.camunda.bpm.engine.test.Deployment)12 JobQuery (org.camunda.bpm.engine.runtime.JobQuery)5