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(); }
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); }
public virtual void testRecalculateJobDueDate() { // given a job Dictionary <string, object> variables1 = new Dictionary <string, object>(); DateTime duedate = ClockUtil.CurrentTime; variables1["dueDate"] = duedate; runtimeService.startProcessInstanceByKey("intermediateTimerEventExample", variables1); Job job = managementService.createJobQuery().singleResult(); // when I recalculate the job due date managementService.recalculateJobDuedate(job.Id, false); // then one op log entry is written UserOperationLogQuery query = historyService.createUserOperationLogQuery().operationType(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_RECALC_DUEDATE); assertEquals(2, query.count()); // assert details UserOperationLogEntry entry = query.property("duedate").singleResult(); assertEquals(job.Id, entry.JobId); assertEquals(job.DeploymentId, entry.DeploymentId); assertEquals(job.JobDefinitionId, entry.JobDefinitionId); assertEquals("duedate", entry.Property); assertTrue(DateUtils.truncatedEquals(duedate, new DateTime(Convert.ToInt64(entry.OrgValue)), DateTime.SECOND)); assertTrue(DateUtils.truncatedEquals(duedate, new DateTime(Convert.ToInt64(entry.NewValue)), DateTime.SECOND)); entry = query.property("creationDateBased").singleResult(); assertEquals(job.Id, entry.JobId); assertEquals(job.DeploymentId, entry.DeploymentId); assertEquals(job.JobDefinitionId, entry.JobDefinitionId); assertEquals("creationDateBased", entry.Property); assertNull(entry.OrgValue); assertFalse(Convert.ToBoolean(entry.NewValue)); }
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); }
public virtual void testSetRetriesAsyncProcessInstanceId() { // given a job ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("asyncTaskProcess"); Job job = managementService.createJobQuery().singleResult(); // when I set the job retries Batch batch = managementService.setJobRetriesAsync(Arrays.asList(processInstance.Id), (ProcessInstanceQuery)null, 4); // then three op log entries are written UserOperationLogQuery query = historyService.createUserOperationLogQuery().operationType(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_SET_JOB_RETRIES); assertEquals(3, query.count()); // check 'retries' entry UserOperationLogEntry userOperationLogEntry = query.property("retries").singleResult(); assertEquals(EntityTypes.JOB, userOperationLogEntry.EntityType); assertNull(userOperationLogEntry.JobId); assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_SET_JOB_RETRIES, userOperationLogEntry.OperationType); assertEquals("retries", userOperationLogEntry.Property); assertEquals("4", userOperationLogEntry.NewValue); assertNull(userOperationLogEntry.OrgValue); assertEquals(USER_ID, userOperationLogEntry.UserId); assertNull(job.JobDefinitionId, userOperationLogEntry.JobDefinitionId); assertNull(job.ProcessInstanceId, userOperationLogEntry.ProcessInstanceId); assertNull(job.ProcessDefinitionId, userOperationLogEntry.ProcessDefinitionId); assertNull(job.ProcessDefinitionKey, userOperationLogEntry.ProcessDefinitionKey); assertNull(deploymentId, userOperationLogEntry.DeploymentId); assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_OPERATOR, userOperationLogEntry.Category); // check 'nrOfInstances' entry userOperationLogEntry = query.property("nrOfInstances").singleResult(); assertEquals(EntityTypes.JOB, userOperationLogEntry.EntityType); assertNull(userOperationLogEntry.JobId); assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_SET_JOB_RETRIES, userOperationLogEntry.OperationType); assertEquals("nrOfInstances", userOperationLogEntry.Property); assertEquals("1", userOperationLogEntry.NewValue); assertNull(userOperationLogEntry.OrgValue); assertEquals(USER_ID, userOperationLogEntry.UserId); assertNull(job.JobDefinitionId, userOperationLogEntry.JobDefinitionId); assertNull(job.ProcessInstanceId, userOperationLogEntry.ProcessInstanceId); assertNull(job.ProcessDefinitionId, userOperationLogEntry.ProcessDefinitionId); assertNull(job.ProcessDefinitionKey, userOperationLogEntry.ProcessDefinitionKey); assertNull(deploymentId, userOperationLogEntry.DeploymentId); assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_OPERATOR, userOperationLogEntry.Category); // check 'async' entry userOperationLogEntry = query.property("async").singleResult(); assertEquals(EntityTypes.JOB, userOperationLogEntry.EntityType); assertNull(userOperationLogEntry.JobId); assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_SET_JOB_RETRIES, userOperationLogEntry.OperationType); assertEquals("async", userOperationLogEntry.Property); assertEquals("true", userOperationLogEntry.NewValue); assertNull(userOperationLogEntry.OrgValue); assertEquals(USER_ID, userOperationLogEntry.UserId); assertNull(job.JobDefinitionId, userOperationLogEntry.JobDefinitionId); assertNull(job.ProcessInstanceId, userOperationLogEntry.ProcessInstanceId); assertNull(job.ProcessDefinitionId, userOperationLogEntry.ProcessDefinitionId); assertNull(job.ProcessDefinitionKey, userOperationLogEntry.ProcessDefinitionKey); assertNull(deploymentId, userOperationLogEntry.DeploymentId); assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_OPERATOR, userOperationLogEntry.Category); managementService.deleteBatch(batch.Id, true); }