Exemple #1
0
        public virtual void testDeleteProcessInstanceKeepUserOperationLog()
        {
            // given
            string processInstanceId = runtimeService.startProcessInstanceByKey(PROCESS_KEY).Id;

            runtimeService.suspendProcessInstanceById(processInstanceId);
            runtimeService.activateProcessInstanceById(processInstanceId);

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

            taskService.complete(taskId);

            UserOperationLogQuery query = historyService.createUserOperationLogQuery().processInstanceId(processInstanceId);

            assertEquals(4, query.count());

            // when
            historyService.deleteHistoricProcessInstance(processInstanceId);

            // then
            assertEquals(4, query.count());

            UserOperationLogEntry entry = historyService.createUserOperationLogQuery().operationType(OPERATION_TYPE_DELETE_HISTORY).property("nrOfInstances").singleResult();

            assertNotNull(entry);
            assertEquals(CATEGORY_OPERATOR, entry.Category);
        }
Exemple #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testWithDeleteHistoryPermissionOnProcessDefinition()
        public virtual void testWithDeleteHistoryPermissionOnProcessDefinition()
        {
            // given
            UserOperationLogQuery query = historyService.createUserOperationLogQuery().processDefinitionKey("timerBoundaryProcess").beforeTimestamp(new DateTime(1549110000000l));

            // assume
            assertTrue(query.count() == 1 || query.count() == 2);

            string        logId             = query.list().get(0).Id;
            string        processInstanceId = query.list().get(0).ProcessInstanceId;
            Authorization auth = authorizationService.createNewAuthorization(org.camunda.bpm.engine.authorization.Authorization_Fields.AUTH_TYPE_GRANT);

            auth.UserId      = USER_ID;
            auth.Permissions = new Permissions[] { Permissions.DELETE_HISTORY };
            auth.Resource    = Resources.PROCESS_DEFINITION;
            auth.ResourceId  = "timerBoundaryProcess";

            authorizationService.saveAuthorization(auth);

            engineRule.ProcessEngineConfiguration.AuthorizationEnabled = true;

            // when
            historyService.deleteUserOperationLogEntry(logId);

            // then
            assertEquals(0, query.processInstanceId(processInstanceId).count());
        }
Exemple #3
0
        public virtual void testDeleteCaseInstanceKeepUserOperationLog()
        {
            // given
            string caseInstanceId = caseService.withCaseDefinitionByKey("oneTaskCase").create().Id;

            caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult().Id;

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

            taskService.complete(taskId);

            caseService.closeCaseInstance(caseInstanceId);

            UserOperationLogQuery query = historyService.createUserOperationLogQuery().caseInstanceId(caseInstanceId).entityType(EntityTypes.TASK);

            assertEquals(1, query.count());

            // when
            historyService.deleteHistoricCaseInstance(caseInstanceId);

            // then
            assertEquals(1, query.count());

            UserOperationLogEntry entry = historyService.createUserOperationLogQuery().operationType(OPERATION_TYPE_DELETE_HISTORY).singleResult();

            assertNotNull(entry);
            assertEquals(CATEGORY_OPERATOR, entry.Category);
        }
Exemple #4
0
        public virtual void testDeleteDeploymentWithoutCascadingShouldKeepCreateUserOperationLog()
        {
            // given
            Deployment deployment = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_NAME, createProcessWithServiceTask(PROCESS_KEY)).deploy();

            UserOperationLogQuery query = historyService.createUserOperationLogQuery().operationType(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_CREATE);

            assertEquals(1, query.count());

            // when
            repositoryService.deleteDeployment(deployment.Id, false);

            // then
            assertEquals(1, query.count());
        }
Exemple #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Deployment public void testOnlyTaskCompletionIsLogged()
        public virtual void testOnlyTaskCompletionIsLogged()
        {
            // given
            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"));

            // Filter only task entities, as the process start is also recorded
            UserOperationLogQuery query = historyService.createUserOperationLogQuery().entityType(EntityTypes.TASK);

            assertEquals(1, query.count());

            UserOperationLogEntry log = query.singleResult();

            assertEquals("process", log.ProcessDefinitionKey);
            assertEquals(processInstanceId, log.ProcessInstanceId);
            assertEquals(deploymentId, log.DeploymentId);
            assertEquals(taskId, log.TaskId);
            assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_COMPLETE, log.OperationType);
            assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_TASK_WORKER, log.Category);
        }
Exemple #6
0
        public virtual void testCompleteCaseExecution()
        {
            // given
            string caseDefinitionId = repositoryService.createCaseDefinitionQuery().singleResult().Id;

            string caseInstanceId = caseService.withCaseDefinition(caseDefinitionId).create().Id;

            string humanTaskId = caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult().Id;

            // when
            caseService.withCaseExecution(humanTaskId).complete();

            // then
            UserOperationLogQuery query = queryOperationDetails(OPERATION_TYPE_COMPLETE);

            assertEquals(1, query.count());

            UserOperationLogEntry entry = query.singleResult();

            assertNotNull(entry);

            assertEquals(caseDefinitionId, entry.CaseDefinitionId);
            assertEquals(caseInstanceId, entry.CaseInstanceId);
            assertEquals(humanTaskId, entry.CaseExecutionId);
            assertEquals(deploymentId, entry.DeploymentId);

            assertFalse(Convert.ToBoolean(entry.OrgValue));
            assertTrue(Convert.ToBoolean(entry.NewValue));
            assertEquals(DELETE, entry.Property);
            assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_TASK_WORKER, entry.Category);
        }
Exemple #7
0
        public virtual void testSubmitTaskForm_Resolve()
        {
            startTestProcess();

            taskService.delegateTask(task.Id, "demo");

            formService.submitTaskForm(task.Id, new Dictionary <string, object>());

            // expect: two entries for the resolving (delegation and assignee changed)
            UserOperationLogQuery query = queryOperationDetails(OPERATION_TYPE_RESOLVE);

            assertEquals(2, query.count());

            // assert: delegation
            UserOperationLogEntry log = query.property("delegation").singleResult();

            assertEquals(DelegationState.PENDING.ToString(), log.OrgValue);
            assertEquals(DelegationState.RESOLVED.ToString(), log.NewValue);
            assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_TASK_WORKER, log.Category);

            // assert: assignee
            log = query.property("assignee").singleResult();
            assertEquals("demo", log.OrgValue);
            assertEquals(null, log.NewValue);
            assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_TASK_WORKER, log.Category);

            completeTestProcess();
        }
Exemple #8
0
        public virtual void testSetJobDueDate()
        {
            // given a job
            runtimeService.startProcessInstanceByKey("asyncTaskProcess");
            Job job = managementService.createJobQuery().singleResult();

            // and set the job due date
            DateTime newDate = new DateTime(ClockUtil.CurrentTime.Ticks + 2 * 1000);

            managementService.setJobDuedate(job.Id, newDate);

            // then one op log entry is written
            UserOperationLogQuery query = historyService.createUserOperationLogQuery().operationType(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_SET_DUEDATE);

            assertEquals(1, query.count());

            // assert details
            UserOperationLogEntry entry = query.singleResult();

            assertEquals(job.Id, entry.JobId);
            assertEquals(job.DeploymentId, entry.DeploymentId);
            assertEquals(job.JobDefinitionId, entry.JobDefinitionId);
            assertEquals("duedate", entry.Property);
            assertNull(entry.OrgValue);
            assertEquals(newDate, new DateTime(Convert.ToInt64(entry.NewValue)));
        }
Exemple #9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testWithoutAuthorization()
        public virtual void testWithoutAuthorization()
        {
            // given
            UserOperationLogQuery query = historyService.createUserOperationLogQuery().processDefinitionKey("timerBoundaryProcess").afterTimestamp(new DateTime(1549110000000l));

            // assume
            assertEquals(1L, query.count());
            UserOperationLogEntry entry = query.singleResult();

            engineRule.ProcessEngineConfiguration.AuthorizationEnabled = true;

            try
            {
                // when
                historyService.deleteUserOperationLogEntry(entry.Id);
                fail("Exception expected: It should not be possible to delete the user operation log");
            }
            catch (AuthorizationException e)
            {
                // then
                string message = e.Message;
                assertTrue(message.Contains(USER_ID));
                assertTrue(message.Contains(DELETE_HISTORY.Name));
                assertTrue(message.Contains(PROCESS_DEFINITION.resourceName()));
                assertTrue(message.Contains("timerBoundaryProcess"));
            }
        }
Exemple #10
0
        public virtual CountResultDto queryUserOperationCount(UriInfo uriInfo)
        {
            UserOperationLogQueryDto queryDto = new UserOperationLogQueryDto(objectMapper, uriInfo.QueryParameters);
            UserOperationLogQuery    query    = queryDto.toQuery(processEngine);

            return(new CountResultDto(query.count()));
        }
Exemple #11
0
        protected internal virtual void verifyVariableOperationAsserts(int countAssertValue, string operationType, string category)
        {
            UserOperationLogQuery logQuery = query().entityType(EntityTypes.VARIABLE).operationType(operationType);

            assertEquals(countAssertValue, logQuery.count());

            if (countAssertValue > 1)
            {
                IList <UserOperationLogEntry> logEntryList = logQuery.list();

                foreach (UserOperationLogEntry logEntry in logEntryList)
                {
                    assertEquals(process.ProcessDefinitionId, logEntry.ProcessDefinitionId);
                    assertEquals(process.ProcessInstanceId, logEntry.ProcessInstanceId);
                    assertEquals(category, logEntry.Category);
                }
            }
            else
            {
                UserOperationLogEntry logEntry = logQuery.singleResult();
                assertEquals(process.ProcessDefinitionId, logEntry.ProcessDefinitionId);
                assertEquals(process.ProcessInstanceId, logEntry.ProcessInstanceId);
                assertEquals(category, logEntry.Category);
            }
        }
Exemple #12
0
        public virtual void testUserOperationLogDeletion()
        {
            // given
            process = runtimeService.startProcessInstanceByKey("oneTaskProcess");
            runtimeService.setVariable(process.Id, "testVariable1", "THIS IS TESTVARIABLE!!!");

            // assume
            verifyVariableOperationAsserts(1, org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_SET_VARIABLE, org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_OPERATOR);
            UserOperationLogQuery query = query().entityType(EntityTypes.VARIABLE).operationType(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_SET_VARIABLE);

            assertEquals(1, query.count());

            // when
            historyService.deleteUserOperationLogEntry(query.singleResult().Id);

            // then
            assertEquals(0, query.count());
        }
Exemple #13
0
        public virtual void testCaseInstanceId()
        {
            // create new task
            task = taskService.newTask();
            taskService.saveTask(task);

            UserOperationLogQuery query = queryOperationDetails(OPERATION_TYPE_UPDATE);

            assertEquals(0, query.count());

            // set case instance id and save task
            task.CaseInstanceId = "aCaseInstanceId";
            taskService.saveTask(task);

            assertEquals(1, query.count());

            UserOperationLogEntry entry = query.singleResult();

            assertNotNull(entry);

            assertNull(entry.OrgValue);
            assertEquals("aCaseInstanceId", entry.NewValue);
            assertEquals(CASE_INSTANCE_ID, entry.Property);

            // change case instance id and save task
            task.CaseInstanceId = "anotherCaseInstanceId";
            taskService.saveTask(task);

            assertEquals(2, query.count());

            IList <UserOperationLogEntry> entries = query.list();

            assertEquals(2, entries.Count);

            foreach (UserOperationLogEntry currentEntry in entries)
            {
                if (!currentEntry.Id.Equals(entry.Id))
                {
                    assertEquals("aCaseInstanceId", currentEntry.OrgValue);
                    assertEquals("anotherCaseInstanceId", currentEntry.NewValue);
                    assertEquals(CASE_INSTANCE_ID, currentEntry.Property);
                }
            }
        }
Exemple #14
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUpMock()
        public virtual void setUpMock()
        {
            IList <UserOperationLogEntry> entries = MockProvider.createUserOperationLogEntries();

            queryMock = mock(typeof(UserOperationLogQuery));
            when(queryMock.list()).thenReturn(entries);
            when(queryMock.listPage(anyInt(), anyInt())).thenReturn(entries);
            when(queryMock.count()).thenReturn((long)entries.Count);
            when(processEngine.HistoryService.createUserOperationLogQuery()).thenReturn(queryMock);
        }
Exemple #15
0
        public virtual void testDeleteDeploymentKeepUserOperationLog()
        {
            // given
            string deploymentId = repositoryService.createDeploymentQuery().singleResult().Id;

            string processDefinitionId = repositoryService.createProcessDefinitionQuery().singleResult().Id;

            repositoryService.suspendProcessDefinitionById(processDefinitionId);

            UserOperationLogQuery query = historyService.createUserOperationLogQuery().processDefinitionId(processDefinitionId);

            assertEquals(1, query.count());

            // when
            repositoryService.deleteDeployment(deploymentId, true);

            // then
            assertEquals(1, query.count());
        }
Exemple #16
0
        public virtual void testDeleteProcessDefinitionKeepUserOperationLog()
        {
            // given
            string processDefinitionId = repositoryService.createProcessDefinitionQuery().singleResult().Id;

            string processInstanceId = runtimeService.startProcessInstanceByKey(PROCESS_KEY).Id;

            runtimeService.suspendProcessInstanceById(processInstanceId);

            UserOperationLogQuery query = historyService.createUserOperationLogQuery().processInstanceId(processInstanceId);

            assertEquals(2, query.count());

            // when
            repositoryService.deleteProcessDefinition(processDefinitionId, true);

            // then new log is created and old stays
            assertEquals(2, query.count());
        }
Exemple #17
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testWithoutAuthorization()
        public virtual void testWithoutAuthorization()
        {
            // given
            engineRule.ProcessEngineConfiguration.AuthorizationEnabled = true;

            // when
            UserOperationLogQuery query = historyService.createUserOperationLogQuery().processDefinitionKey("oneTaskProcess_userOpLog");

            // then
            assertEquals(0, query.count());
        }
Exemple #18
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testWithoutAuthorization()
        public virtual void testWithoutAuthorization()
        {
            // given
            engineRule.ProcessEngineConfiguration.AuthorizationEnabled = true;

            // when
            UserOperationLogQuery query = historyService.createUserOperationLogQuery().taskId("myTaskForUserOperationLog");

            // then
            assertEquals(1, query.count());
        }
Exemple #19
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);
        }
Exemple #20
0
        public virtual void testDeleteStandaloneTaskKeepUserOperationLog()
        {
            // given
            string taskId = "my-task";
            Task   task   = taskService.newTask(taskId);

            taskService.saveTask(task);

            taskService.setAssignee(taskId, "demo");
            taskService.complete(taskId);

            UserOperationLogQuery query = historyService.createUserOperationLogQuery().taskId(taskId);

            assertEquals(3, query.count());

            // when
            historyService.deleteHistoricTaskInstance(taskId);

            // then
            assertEquals(5, query.count());
        }
Exemple #21
0
        public virtual void testCreateAndCompleteTask()
        {
            startTestProcess();

            // expect: one entry for process instance creation,
            //         no entry for the task creation by process engine
            UserOperationLogQuery query = historyService.createUserOperationLogQuery();

            assertEquals(1, query.count());

            completeTestProcess();

            // expect: one entry for the task completion
            query = queryOperationDetails(OPERATION_TYPE_COMPLETE);
            assertEquals(1, query.count());
            UserOperationLogEntry complete = query.singleResult();

            assertEquals(DELETE, complete.Property);
            assertTrue(bool.Parse(complete.NewValue));
            assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_TASK_WORKER, complete.Category);
        }
Exemple #22
0
        public virtual void testDeleteCaseTaskKeepUserOperationLog()
        {
            // given
            caseService.withCaseDefinitionByKey("oneTaskCase").create();

            caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult().Id;

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

            taskService.setAssignee(taskId, "demo");
            taskService.complete(taskId);

            UserOperationLogQuery query = historyService.createUserOperationLogQuery().taskId(taskId);

            assertEquals(2, query.count());

            // when
            historyService.deleteHistoricTaskInstance(taskId);

            // then
            assertEquals(4, query.count());
        }
Exemple #23
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testQueryByDeploymentId()
        public virtual void testQueryByDeploymentId()
        {
            // given
            string deploymentId = repositoryService.createDeployment().addClasspathResource(ONE_TASK_PROCESS).deploy().Id;

            // when
            UserOperationLogQuery query = historyService.createUserOperationLogQuery().deploymentId(deploymentId);

            // then
            assertEquals(0, query.count());

            repositoryService.deleteDeployment(deploymentId, true);
        }
Exemple #24
0
        public virtual void testQueryProcessInstanceModificationOperation()
        {
            ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess");

            processInstance.Id;

            repositoryService.createProcessDefinitionQuery().singleResult();

            runtimeService.createProcessInstanceModification(processInstance.Id).startBeforeActivity("theTask").execute();

            UserOperationLogQuery logQuery = query().entityType(EntityTypes.PROCESS_INSTANCE).operationType(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_MODIFY_PROCESS_INSTANCE);

            assertEquals(0, logQuery.count());
        }
Exemple #25
0
        public virtual void testPropertyDuplicateFiltering()
        {
            // given
            BpmnModelInstance model = createProcessWithServiceTask(PROCESS_KEY);

            // when
            Deployment deployment = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_NAME, model).enableDuplicateFiltering(false).deploy();

            // then
            UserOperationLogQuery query = historyService.createUserOperationLogQuery();

            assertEquals(2, query.count());

            // (1): duplicate filter enabled property
            UserOperationLogEntry logDuplicateFilterEnabledProperty = query.property("duplicateFilterEnabled").singleResult();

            assertNotNull(logDuplicateFilterEnabledProperty);

            assertEquals(EntityTypes.DEPLOYMENT, logDuplicateFilterEnabledProperty.EntityType);
            assertEquals(deployment.Id, logDuplicateFilterEnabledProperty.DeploymentId);
            assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_CREATE, logDuplicateFilterEnabledProperty.OperationType);

            assertEquals(USER_ID, logDuplicateFilterEnabledProperty.UserId);

            assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_OPERATOR, logDuplicateFilterEnabledProperty.Category);

            assertEquals("duplicateFilterEnabled", logDuplicateFilterEnabledProperty.Property);
            assertNull(logDuplicateFilterEnabledProperty.OrgValue);
            assertTrue(Convert.ToBoolean(logDuplicateFilterEnabledProperty.NewValue));

            // (2): deploy changed only
            UserOperationLogEntry logDeployChangedOnlyProperty = query.property("deployChangedOnly").singleResult();

            assertNotNull(logDeployChangedOnlyProperty);

            assertEquals(EntityTypes.DEPLOYMENT, logDeployChangedOnlyProperty.EntityType);
            assertEquals(deployment.Id, logDeployChangedOnlyProperty.DeploymentId);
            assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_CREATE, logDeployChangedOnlyProperty.OperationType);
            assertEquals(USER_ID, logDeployChangedOnlyProperty.UserId);

            assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_OPERATOR, logDeployChangedOnlyProperty.Category);

            assertEquals("deployChangedOnly", logDeployChangedOnlyProperty.Property);
            assertNull(logDeployChangedOnlyProperty.OrgValue);
            assertFalse(Convert.ToBoolean(logDeployChangedOnlyProperty.NewValue));

            // (3): operation id
            assertEquals(logDuplicateFilterEnabledProperty.OperationId, logDeployChangedOnlyProperty.OperationId);
        }
Exemple #26
0
        public virtual void testDeleteProcessTaskKeepTaskOperationLog()
        {
            // given
            runtimeService.startProcessInstanceByKey(PROCESS_KEY);

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

            taskService.setAssignee(taskId, "demo");
            taskService.complete(taskId);

            UserOperationLogQuery query = historyService.createUserOperationLogQuery().taskId(taskId);

            assertEquals(2, query.count());

            // when
            historyService.deleteHistoricTaskInstance(taskId);

            // then
            assertEquals(4, query.count());

            UserOperationLogEntry entry = historyService.createUserOperationLogQuery().operationType(OPERATION_TYPE_DELETE_HISTORY).taskId(taskId).property("nrOfInstances").singleResult();

            assertEquals(CATEGORY_OPERATOR, entry.Category);
        }
Exemple #27
0
        public virtual void testQueryByEntityTypes()
        {
            // given
            process       = runtimeService.startProcessInstanceByKey("oneTaskProcess");
            processTaskId = taskService.createTaskQuery().singleResult().Id;

            // when
            taskService.setAssignee(processTaskId, "foo");
            taskService.setVariable(processTaskId, "foo", "bar");

            // then
            UserOperationLogQuery query = historyService.createUserOperationLogQuery().entityTypeIn(EntityTypes.TASK, EntityTypes.VARIABLE);

            assertEquals(0, query.count());
        }
Exemple #28
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testWithReadHistoryPermissionOnAnyProcessDefinition()
        public virtual void testWithReadHistoryPermissionOnAnyProcessDefinition()
        {
            // given
            Authorization auth = authorizationService.createNewAuthorization(org.camunda.bpm.engine.authorization.Authorization_Fields.AUTH_TYPE_GRANT);

            auth.UserId      = USER_ID;
            auth.Permissions = new Permissions[] { Permissions.READ_HISTORY };
            auth.Resource    = Resources.PROCESS_DEFINITION;
            auth.ResourceId  = "*";

            authorizationService.saveAuthorization(auth);
            engineRule.ProcessEngineConfiguration.AuthorizationEnabled = true;
            // when
            UserOperationLogQuery query = historyService.createUserOperationLogQuery().processDefinitionKey("oneTaskProcess_userOpLog");

            // then
            assertEquals(1, query.count());
        }
Exemple #29
0
        protected internal virtual void verifyQueryResults(UserOperationLogQuery query, int countExpected)
        {
            assertEquals(countExpected, query.list().size());
            assertEquals(countExpected, query.count());

            if (countExpected == 1)
            {
                assertNotNull(query.singleResult());
            }
            else if (countExpected > 1)
            {
                verifySingleResultFails(query);
            }
            else if (countExpected == 0)
            {
                assertNull(query.singleResult());
            }
        }
Exemple #30
0
        public virtual void testSubmitTaskForm_Complete()
        {
            startTestProcess();

            formService.submitTaskForm(task.Id, new Dictionary <string, object>());

            // expect: one entry for the completion
            UserOperationLogQuery query = queryOperationDetails(OPERATION_TYPE_COMPLETE);

            assertEquals(1, query.count());

            // assert: delete
            UserOperationLogEntry log = query.property("delete").singleResult();

            assertFalse(bool.Parse(log.OrgValue));
            assertTrue(bool.Parse(log.NewValue));
            assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_TASK_WORKER, log.Category);

            assertProcessEnded(process.Id);
        }