Example #1
0
        public virtual void testSetPriority()
        {
            startTestProcess();

            // then: set the priority of the task to 10
            taskService.setPriority(task.Id, 10);

            // expect: one entry for the priority update
            UserOperationLogQuery query = queryOperationDetails(OPERATION_TYPE_SET_PRIORITY);

            assertEquals(1, query.count());

            // assert: correct priority set
            UserOperationLogEntry userOperationLogEntry = query.singleResult();

            assertEquals(PRIORITY, userOperationLogEntry.Property);
            // note: 50 is the default task priority
            assertEquals(50, int.Parse(userOperationLogEntry.OrgValue));
            assertEquals(10, int.Parse(userOperationLogEntry.NewValue));
            // assert: correct category set
            assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_TASK_WORKER, userOperationLogEntry.Category);

            // move clock by 5 minutes
            DateTime date = DateTimeUtil.now().plusMinutes(5).toDate();

            ClockUtil.CurrentTime = date;

            // then: set priority again
            taskService.setPriority(task.Id, 75);

            // expect: one entry for the priority update
            query = queryOperationDetails(OPERATION_TYPE_SET_PRIORITY);
            assertEquals(2, query.count());

            // assert: correct priority set
            userOperationLogEntry = query.orderByTimestamp().asc().list().get(1);
            assertEquals(PRIORITY, userOperationLogEntry.Property);
            assertEquals(10, int.Parse(userOperationLogEntry.OrgValue));
            assertEquals(75, int.Parse(userOperationLogEntry.NewValue));
            assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_TASK_WORKER, userOperationLogEntry.Category);
        }