Search in sources :

Example 11 with ActivitySequenceCounterMap

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

the class ExecutionSequenceCounterTest method testForkReplaceBy.

@Deployment
public void testForkReplaceBy() {
    // 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("theService4").singleResult().getId();
    managementService.executeJob(jobId);
    // then (2)
    order = ExecutionOrderListener.getActivityExecutionOrder();
    assertEquals(5, order.size());
    ActivitySequenceCounterMap theService4Element = order.get(2);
    assertEquals("theService4", theService4Element.getActivityId());
    assertTrue(theService4Element.getSequenceCounter() > theService3Element.getSequenceCounter());
    ActivitySequenceCounterMap theService5Element = order.get(3);
    assertEquals("theService5", theService5Element.getActivityId());
    assertTrue(theService5Element.getSequenceCounter() > theService4Element.getSequenceCounter());
    ActivitySequenceCounterMap theEnd2Element = order.get(4);
    assertEquals("theEnd2", theEnd2Element.getActivityId());
    assertTrue(theEnd2Element.getSequenceCounter() > theService5Element.getSequenceCounter());
    // when (3)
    jobId = jobQuery.activityId("theService2").singleResult().getId();
    managementService.executeJob(jobId);
    // then (3)
    order = ExecutionOrderListener.getActivityExecutionOrder();
    assertEquals(7, order.size());
    ActivitySequenceCounterMap theService2Element = order.get(5);
    assertEquals("theService2", theService2Element.getActivityId());
    assertTrue(theService2Element.getSequenceCounter() > theService1Element.getSequenceCounter());
    assertTrue(theService2Element.getSequenceCounter() > theEnd2Element.getSequenceCounter());
    ActivitySequenceCounterMap theEnd1Element = order.get(6);
    assertEquals("theEnd1", theEnd1Element.getActivityId());
    assertTrue(theEnd1Element.getSequenceCounter() > theService2Element.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 12 with ActivitySequenceCounterMap

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

the class ExecutionSequenceCounterTest method testParallelMultiInstance.

@Deployment
public void testParallelMultiInstance() {
    // given
    String processInstanceId = runtimeService.startProcessInstanceByKey("process").getId();
    // when
    // then
    assertProcessEnded(processInstanceId);
    List<ActivitySequenceCounterMap> order = ExecutionOrderListener.getActivityExecutionOrder();
    assertEquals(6, order.size());
    ActivitySequenceCounterMap theStartElement = order.get(0);
    assertEquals("theStart", theStartElement.getActivityId());
    ActivitySequenceCounterMap theService1Element = order.get(1);
    assertEquals("theService1", theService1Element.getActivityId());
    assertTrue(theService1Element.getSequenceCounter() > theStartElement.getSequenceCounter());
    ActivitySequenceCounterMap theService21Element = order.get(2);
    assertEquals("theService2", theService21Element.getActivityId());
    assertTrue(theService21Element.getSequenceCounter() > theService1Element.getSequenceCounter());
    ActivitySequenceCounterMap theService22Element = order.get(3);
    assertEquals("theService2", theService22Element.getActivityId());
    assertTrue(theService22Element.getSequenceCounter() > theService1Element.getSequenceCounter());
    ActivitySequenceCounterMap theService3Element = order.get(4);
    assertEquals("theService3", theService3Element.getActivityId());
    assertTrue(theService3Element.getSequenceCounter() > theService21Element.getSequenceCounter());
    assertTrue(theService3Element.getSequenceCounter() > theService22Element.getSequenceCounter());
    ActivitySequenceCounterMap theEndElement = order.get(5);
    assertEquals("theEnd", theEndElement.getActivityId());
    assertTrue(theEndElement.getSequenceCounter() > theService3Element.getSequenceCounter());
}
Also used : ActivitySequenceCounterMap(org.camunda.bpm.engine.test.standalone.entity.ExecutionOrderListener.ActivitySequenceCounterMap) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 13 with ActivitySequenceCounterMap

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

the class ExecutionSequenceCounterTest method testForkAndJoinDifferentSequenceLength.

@Deployment
public void testForkAndJoinDifferentSequenceLength() {
    // given
    String processInstanceId = runtimeService.startProcessInstanceByKey("process").getId();
    // when
    // then
    assertProcessEnded(processInstanceId);
    List<ActivitySequenceCounterMap> order = ExecutionOrderListener.getActivityExecutionOrder();
    assertEquals(10, 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 theService3Element = order.get(6);
    assertEquals("theService3", theService3Element.getActivityId());
    assertTrue(theService3Element.getSequenceCounter() > lastSequenceCounter);
    lastSequenceCounter = theService3Element.getSequenceCounter();
    ActivitySequenceCounterMap theJoin2Element = order.get(7);
    assertEquals("join", theJoin2Element.getActivityId());
    assertTrue(theJoin2Element.getSequenceCounter() > lastSequenceCounter);
    assertFalse(theJoin1Element.getSequenceCounter() == theJoin2Element.getSequenceCounter());
    ActivitySequenceCounterMap theService4Element = order.get(8);
    assertEquals("theService4", theService4Element.getActivityId());
    assertTrue(theService4Element.getSequenceCounter() > theJoin1Element.getSequenceCounter());
    assertTrue(theService4Element.getSequenceCounter() > theJoin2Element.getSequenceCounter());
    lastSequenceCounter = theService4Element.getSequenceCounter();
    ActivitySequenceCounterMap theEndElement = order.get(9);
    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