Exemplo n.º 1
0
        public virtual void testForkAndJoin()
        {
            // given
            HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery().orderPartiallyByOccurrence().asc();

            // when
            string processInstanceId = runtimeService.startProcessInstanceByKey("process").Id;

            // then
            query.executionId(processInstanceId);
            verifyOrder(query, "theStart", "theService", "fork", "join", "theService4", "theEnd");

            string firstExecutionId = historyService.createHistoricActivityInstanceQuery().activityId("theService1").singleResult().ExecutionId;

            string secondExecutionId = historyService.createHistoricActivityInstanceQuery().activityId("theService2").singleResult().ExecutionId;

            query.executionId(firstExecutionId);
            verifyOrder(query, "theService1", "join");

            query.executionId(secondExecutionId);
            verifyOrder(query, "theService2", "theService3");

            query = historyService.createHistoricActivityInstanceQuery().orderPartiallyByOccurrence().asc().orderByActivityId().asc();
            verifyOrder(query, "theStart", "theService", "fork", "theService1", "theService2", "join", "theService3", "join", "theService4", "theEnd");
        }
Exemplo n.º 2
0
        public virtual void testNonInterruptingBoundaryEvent()
        {
            // given
            HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery().orderPartiallyByOccurrence().asc();

            // when
            string processInstanceId = runtimeService.startProcessInstanceByKey("process").Id;

            runtimeService.correlateMessage("newMessage");
            runtimeService.correlateMessage("newMessage");
            string taskId = taskService.createTaskQuery().singleResult().Id;

            taskService.complete(taskId);

            // then
            query.executionId(processInstanceId);
            verifyOrder(query, "theStart", "theService1", "theEnd1");

            string taskExecutionId = historyService.createHistoricActivityInstanceQuery().activityId("theTask").singleResult().ExecutionId;

            query.executionId(taskExecutionId);
            verifyOrder(query, "theTask");

            IList <HistoricActivityInstance> activityInstances = historyService.createHistoricActivityInstanceQuery().activityId("messageBoundary").list();

            foreach (HistoricActivityInstance historicActivityInstance in activityInstances)
            {
                query.executionId(historicActivityInstance.ExecutionId);
                verifyOrder(query, "messageBoundary", "theServiceAfterMessage", "theEnd2");
            }

            query = historyService.createHistoricActivityInstanceQuery().orderPartiallyByOccurrence().asc().orderByActivityId().asc();

            verifyOrder(query, "theStart", "theService1", "messageBoundary", "theTask", "theServiceAfterMessage", "theEnd2", "messageBoundary", "theServiceAfterMessage", "theEnd2", "theEnd1");
        }
Exemplo n.º 3
0
        public virtual void testSequenceInsideSubProcess()
        {
            // given
            HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery().orderPartiallyByOccurrence().asc();

            // when
            string processInstanceId = runtimeService.startProcessInstanceByKey("process").Id;

            // then
            query.executionId(processInstanceId);
            verifyOrder(query, "theStart", "theService1", "theService2", "theEnd");

            string subProcessExecutionId = historyService.createHistoricActivityInstanceQuery().activityId("subProcess").singleResult().ExecutionId;

            query.executionId(subProcessExecutionId);
            verifyOrder(query, "subProcess", "innerStart", "innerService", "innerEnd");

            query = historyService.createHistoricActivityInstanceQuery().orderPartiallyByOccurrence().asc();
            verifyOrder(query, "theStart", "theService1", "subProcess", "innerStart", "innerService", "innerEnd", "theService2", "theEnd");
        }
Exemplo n.º 4
0
        public virtual void testSequentialMultiInstance()
        {
            // given
            HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery().orderPartiallyByOccurrence().asc();

            // when
            string processInstanceId = runtimeService.startProcessInstanceByKey("process").Id;

            // then
            query.executionId(processInstanceId);
            verifyOrder(query, "theStart", "theService1", "theService3", "theEnd");

            string taskExecutionId = historyService.createHistoricActivityInstanceQuery().activityId("theService2").list().get(0).ExecutionId;

            query.executionId(taskExecutionId);
            verifyOrder(query, "theService2#multiInstanceBody", "theService2", "theService2");

            query = historyService.createHistoricActivityInstanceQuery().orderPartiallyByOccurrence().asc();
            verifyOrder(query, "theStart", "theService1", "theService2#multiInstanceBody", "theService2", "theService2", "theService3", "theEnd");
        }
Exemplo n.º 5
0
        public virtual void testInterruptingBoundaryEvent()
        {
            // given
            HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery().orderPartiallyByOccurrence().asc();

            // when
            string processInstanceId = runtimeService.startProcessInstanceByKey("process").Id;

            runtimeService.correlateMessage("newMessage");

            // then
            verifyOrder(query, "theStart", "theService1", "theTask", "messageBoundary", "theServiceAfterMessage", "theEnd2");

            query.executionId(processInstanceId);
            verifyOrder(query, "theStart", "theService1", "messageBoundary", "theServiceAfterMessage", "theEnd2");

            string taskExecutionId = historyService.createHistoricActivityInstanceQuery().activityId("theTask").singleResult().ExecutionId;

            query.executionId(taskExecutionId);
            verifyOrder(query, "theTask");
        }
Exemplo n.º 6
0
        public virtual void testLoop()
        {
            // given
            HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery().orderPartiallyByOccurrence().asc();

            // when
            string processInstanceId = runtimeService.startProcessInstanceByKey("process").Id;

            // then
            query.executionId(processInstanceId);
            verifyOrder(query, "theStart", "theService1", "join", "theScript", "fork", "join", "theScript", "fork", "theService2", "theEnd");
        }
Exemplo n.º 7
0
        public virtual void testParallelMultiInstance()
        {
            // given
            HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery().orderPartiallyByOccurrence().asc();

            // when
            string processInstanceId = runtimeService.startProcessInstanceByKey("process").Id;

            // then
            query.executionId(processInstanceId);
            verifyOrder(query, "theStart", "theService1", "theService3", "theEnd");

            IList <HistoricActivityInstance> taskActivityInstances = historyService.createHistoricActivityInstanceQuery().activityId("theService2").list();

            foreach (HistoricActivityInstance activityInstance in taskActivityInstances)
            {
                query.executionId(activityInstance.ExecutionId);
                verifyOrder(query, "theService2");
            }

            query = historyService.createHistoricActivityInstanceQuery().orderPartiallyByOccurrence().asc();
            verifyOrder(query, "theStart", "theService1", "theService2#multiInstanceBody", "theService2", "theService2", "theService3", "theEnd");
        }