Ejemplo n.º 1
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"));
            }
        }
Ejemplo n.º 2
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)));
        }
Ejemplo n.º 3
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();
        }
Ejemplo n.º 4
0
        public virtual CountResultDto queryUserOperationCount(UriInfo uriInfo)
        {
            UserOperationLogQueryDto queryDto = new UserOperationLogQueryDto(objectMapper, uriInfo.QueryParameters);
            UserOperationLogQuery    query    = queryDto.toQuery(processEngine);

            return(new CountResultDto(query.count()));
        }
Ejemplo n.º 5
0
        public virtual void testCompositeBeanInteraction()
        {
            // given: a manually created task
            task = taskService.newTask();

            // then: save the task without any property change
            taskService.saveTask(task);

            // expect: no entry
            UserOperationLogQuery query  = queryOperationDetails(OPERATION_TYPE_CREATE);
            UserOperationLogEntry create = query.singleResult();

            assertNotNull(create);
            assertEquals(EntityTypes.TASK, create.EntityType);
            assertNull(create.OrgValue);
            assertNull(create.NewValue);
            assertNull(create.Property);
            assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_TASK_WORKER, create.Category);

            task.Assignee = "icke";
            task.Name     = "to do";

            // then: save the task again
            taskService.saveTask(task);

            // expect: two update entries with the same operation id
            IList <UserOperationLogEntry> entries = queryOperationDetails(OPERATION_TYPE_UPDATE).list();

            assertEquals(2, entries.Count);
            assertEquals(entries[0].OperationId, entries[1].OperationId);
            assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_TASK_WORKER, entries[0].Category);
            assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_TASK_WORKER, entries[1].Category);
        }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
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);
            }
        }
Ejemplo n.º 8
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);
        }
Ejemplo n.º 9
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);
        }
Ejemplo n.º 10
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);
        }
Ejemplo n.º 11
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());
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Requires no additional DELETE_HISTORY authorization => consistent with deleteDeployment
        /// </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testDeleteBatchCascade()
        public virtual void testDeleteBatchCascade()
        {
            // given
            ProcessInstance processInstance = engineRule.RuntimeService.startProcessInstanceById(migrationPlan.SourceProcessDefinitionId);

            batch = engineRule.RuntimeService.newMigration(migrationPlan).processInstanceIds(Arrays.asList(processInstance.Id)).executeAsync();

            // when
            authRule.init(scenario).withUser("userId").bindResource("batchId", batch.Id).start();

            cascade = true;
            engineRule.ManagementService.deleteBatch(batch.Id, cascade);

            // then
            if (authRule.assertScenario(scenario))
            {
                Assert.assertEquals(0, engineRule.ManagementService.createBatchQuery().count());
                Assert.assertEquals(0, engineRule.HistoryService.createHistoricBatchQuery().count());

                UserOperationLogQuery query = engineRule.HistoryService.createUserOperationLogQuery();

                IList <UserOperationLogEntry> userOperationLogEntries = query.operationType(OPERATION_TYPE_DELETE).batchId(batch.Id).list();
                assertEquals(1, userOperationLogEntries.Count);

                UserOperationLogEntry entry = userOperationLogEntries[0];
                assertEquals("cascadeToHistory", entry.Property);
                assertEquals("true", entry.NewValue);
                assertEquals(CATEGORY_OPERATOR, entry.Category);

                // Ensure that HistoricBatch deletion is not logged
                IList <UserOperationLogEntry> userOperationLogHistoricEntries = query.operationType(OPERATION_TYPE_DELETE_HISTORY).batchId(batch.Id).list();
                assertEquals(0, userOperationLogHistoricEntries.Count);
            }
        }
Ejemplo n.º 13
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);
        }
Ejemplo n.º 14
0
 protected internal virtual void verifySingleResultFails(UserOperationLogQuery query)
 {
     try
     {
         query.singleResult();
         fail();
     }
     catch (ProcessEngineException)
     {
     }
 }
Ejemplo n.º 15
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());
        }
Ejemplo n.º 16
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());
        }
Ejemplo n.º 17
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);
        }
Ejemplo n.º 18
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());
        }
Ejemplo n.º 19
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);
        }
Ejemplo n.º 20
0
        public virtual void testQueryByCategories()
        {
            // 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().categoryIn(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_TASK_WORKER);

            verifyQueryResults(query, 2);
        }
Ejemplo n.º 21
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());
        }
Ejemplo n.º 22
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());
        }
Ejemplo n.º 23
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());
        }
Ejemplo n.º 24
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());
            }
        }
Ejemplo n.º 25
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());
        }
Ejemplo n.º 26
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);
                }
            }
        }
Ejemplo n.º 27
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());
        }
Ejemplo n.º 28
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());
        }
Ejemplo n.º 29
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);
        }
Ejemplo n.º 30
0
        public virtual void testResolveTask()
        {
            startTestProcess();

            // then: resolve the task
            taskService.resolveTask(task.Id);

            // expect: one entry for the resolving
            UserOperationLogQuery query = queryOperationDetails(OPERATION_TYPE_RESOLVE);

            assertEquals(1, query.count());

            // assert: details
            UserOperationLogEntry log = query.singleResult();

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

            completeTestProcess();
        }