Esempio n. 1
0
        public virtual void testLogAllOperationWithAuthentication()
        {
            try
            {
                // given
                identityService.AuthenticatedUserId = USER_ID;
                string processInstanceId = runtimeService.startProcessInstanceByKey("process").Id;

                string taskId = taskService.createTaskQuery().singleResult().Id;

                // when
                taskService.complete(taskId);

                // then
                assertTrue((bool?)runtimeService.getVariable(processInstanceId, "taskListenerCalled"));
                assertTrue((bool?)runtimeService.getVariable(processInstanceId, "serviceTaskCalled"));

                UserOperationLogQuery query = userOperationLogQuery().userId(USER_ID);
                assertEquals(4, query.count());
                assertEquals(1, query.operationType(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_CREATE).count());
                assertEquals(1, query.operationType(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_COMPLETE).count());
                assertEquals(2, query.operationType(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_SET_VARIABLE).count());
            }
            finally
            {
                identityService.clearAuthentication();
            }
        }
Esempio n. 2
0
        public virtual void testUserOperationLogQueryByBatchId()
        {
            // given
            Batch batch1 = helper.migrateProcessInstancesAsync(1);
            Batch batch2 = helper.migrateProcessInstancesAsync(1);

            // when
            identityService.AuthenticatedUserId = USER_ID;
            managementService.suspendBatchById(batch1.Id);
            managementService.suspendBatchById(batch2.Id);
            managementService.activateBatchById(batch1.Id);
            identityService.clearAuthentication();

            // then
            UserOperationLogQuery query = historyService.createUserOperationLogQuery().batchId(batch1.Id);

            assertEquals(2, query.count());
            assertEquals(2, query.list().size());

            query = historyService.createUserOperationLogQuery().batchId(batch2.Id);
            assertEquals(1, query.count());
            assertEquals(1, query.list().size());
        }
Esempio n. 3
0
        protected internal virtual void verifyNoUserOperationLogged()
        {
            UserOperationLogQuery query = historyService.createUserOperationLogQuery();

            assertEquals(0, query.count());
        }
Esempio n. 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldLogUserCreation()
        public virtual void shouldLogUserCreation()
        {
            // given
            assertEquals(0, query.count());
            identityService.AuthenticatedUserId = "userId";

            // when
            identityService.saveUser(identityService.newUser(TEST_USER_ID));
            identityService.clearAuthentication();

            // then
            assertLog(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_CREATE, EntityTypes.USER, null, TEST_USER_ID);
        }