Exemple #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Deployment public void testForkSameSequenceLengthWithAsyncEndEvent()
        public virtual void testForkSameSequenceLengthWithAsyncEndEvent()
        {
            // given
            string processInstanceId = runtimeService.startProcessInstanceByKey("process").Id;

            JobQuery jobQuery = managementService.createJobQuery();

            // when (1)

            // then (1)
            IList <ActivitySequenceCounterMap> order = ExecutionOrderListener.ActivityExecutionOrder;

            assertEquals(5, order.Count);

            long lastSequenceCounter = 0;

            ActivitySequenceCounterMap theStartElement = order[0];

            assertEquals("theStart", theStartElement.ActivityId);
            assertTrue(theStartElement.SequenceCounter > lastSequenceCounter);
            lastSequenceCounter = theStartElement.SequenceCounter;

            ActivitySequenceCounterMap theForkElement = order[1];

            assertEquals("theService", theForkElement.ActivityId);
            assertTrue(theForkElement.SequenceCounter > lastSequenceCounter);
            lastSequenceCounter = theForkElement.SequenceCounter;

            ActivitySequenceCounterMap theServiceElement = order[2];

            assertEquals("fork", theServiceElement.ActivityId);
            assertTrue(theServiceElement.SequenceCounter > lastSequenceCounter);
            lastSequenceCounter = theServiceElement.SequenceCounter;

            ActivitySequenceCounterMap theService1Element = order[3];

            assertEquals("theService1", theService1Element.ActivityId);
            assertTrue(theService1Element.SequenceCounter > lastSequenceCounter);

            ActivitySequenceCounterMap theService2Element = order[4];

            assertEquals("theService2", theService2Element.ActivityId);
            assertTrue(theService2Element.SequenceCounter > lastSequenceCounter);

            // when (2)
            string jobId = jobQuery.activityId("theEnd1").singleResult().Id;

            managementService.executeJob(jobId);

            // then (2)
            order = ExecutionOrderListener.ActivityExecutionOrder;
            assertEquals(6, order.Count);

            ActivitySequenceCounterMap theEnd1Element = order[5];

            assertEquals("theEnd1", theEnd1Element.ActivityId);
            assertTrue(theEnd1Element.SequenceCounter > theService1Element.SequenceCounter);

            // when (3)
            jobId = jobQuery.activityId("theEnd2").singleResult().Id;
            managementService.executeJob(jobId);

            // then (3)
            assertProcessEnded(processInstanceId);

            order = ExecutionOrderListener.ActivityExecutionOrder;
            assertEquals(7, order.Count);

            ActivitySequenceCounterMap theEnd2Element = order[6];

            assertEquals("theEnd2", theEnd2Element.ActivityId);
            assertTrue(theEnd2Element.SequenceCounter > theService2Element.SequenceCounter);
        }
Exemple #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Deployment public void testForkReplaceByThreeBranches()
        public virtual void testForkReplaceByThreeBranches()
        {
            // given
            string   processInstanceId = runtimeService.startProcessInstanceByKey("process").Id;
            JobQuery jobQuery          = managementService.createJobQuery();

            // when (1)

            // then (1)
            IList <ActivitySequenceCounterMap> order = ExecutionOrderListener.ActivityExecutionOrder;

            assertEquals(3, order.Count);

            ActivitySequenceCounterMap theService1Element = order[0];

            assertEquals("theService1", theService1Element.ActivityId);

            ActivitySequenceCounterMap theService3Element = order[1];

            assertEquals("theService3", theService3Element.ActivityId);

            ActivitySequenceCounterMap theService6Element = order[2];

            assertEquals("theService6", theService6Element.ActivityId);

            assertTrue(theService1Element.SequenceCounter == theService3Element.SequenceCounter);
            assertTrue(theService3Element.SequenceCounter == theService6Element.SequenceCounter);

            // when (2)
            string jobId = jobQuery.activityId("theService2").singleResult().Id;

            managementService.executeJob(jobId);

            // then (2)
            order = ExecutionOrderListener.ActivityExecutionOrder;
            assertEquals(5, order.Count);

            ActivitySequenceCounterMap theService2Element = order[3];

            assertEquals("theService2", theService2Element.ActivityId);
            assertTrue(theService2Element.SequenceCounter > theService1Element.SequenceCounter);

            ActivitySequenceCounterMap theEnd1Element = order[4];

            assertEquals("theEnd1", theEnd1Element.ActivityId);
            assertTrue(theEnd1Element.SequenceCounter > theService2Element.SequenceCounter);

            // when (3)
            jobId = jobQuery.activityId("theService4").singleResult().Id;
            managementService.executeJob(jobId);

            // then (3)
            order = ExecutionOrderListener.ActivityExecutionOrder;
            assertEquals(8, order.Count);

            ActivitySequenceCounterMap theService4Element = order[5];

            assertEquals("theService4", theService4Element.ActivityId);
            assertTrue(theService4Element.SequenceCounter > theService3Element.SequenceCounter);

            ActivitySequenceCounterMap theService5Element = order[6];

            assertEquals("theService5", theService5Element.ActivityId);
            assertTrue(theService5Element.SequenceCounter > theService4Element.SequenceCounter);

            ActivitySequenceCounterMap theEnd2Element = order[7];

            assertEquals("theEnd2", theEnd2Element.ActivityId);
            assertTrue(theEnd2Element.SequenceCounter > theService5Element.SequenceCounter);

            // when (4)
            jobId = jobQuery.activityId("theService7").singleResult().Id;
            managementService.executeJob(jobId);

            // then (4)
            order = ExecutionOrderListener.ActivityExecutionOrder;
            assertEquals(12, order.Count);

            ActivitySequenceCounterMap theService7Element = order[8];

            assertEquals("theService7", theService7Element.ActivityId);
            assertTrue(theService7Element.SequenceCounter > theService6Element.SequenceCounter);
            assertTrue(theService7Element.SequenceCounter > theEnd2Element.SequenceCounter);

            ActivitySequenceCounterMap theService8Element = order[9];

            assertEquals("theService8", theService8Element.ActivityId);
            assertTrue(theService8Element.SequenceCounter > theService7Element.SequenceCounter);

            ActivitySequenceCounterMap theService9Element = order[10];

            assertEquals("theService9", theService9Element.ActivityId);
            assertTrue(theService9Element.SequenceCounter > theService8Element.SequenceCounter);

            ActivitySequenceCounterMap theEnd3Element = order[11];

            assertEquals("theEnd3", theEnd3Element.ActivityId);
            assertTrue(theEnd3Element.SequenceCounter > theService9Element.SequenceCounter);

            assertProcessEnded(processInstanceId);
        }