use of org.camunda.bpm.engine.history.UserOperationLogQuery in project camunda-bpm-platform by camunda.
the class UserOperationLogQueryTest method testQueryByCaseExecutionId.
@Deployment(resources = { ONE_TASK_CASE })
public void testQueryByCaseExecutionId() {
// given:
// a deployed case definition
String caseDefinitionId = repositoryService.createCaseDefinitionQuery().singleResult().getId();
// an active case instance
caseService.withCaseDefinition(caseDefinitionId).create();
String caseExecutionId = caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult().getId();
Task task = taskService.createTaskQuery().singleResult();
assertNotNull(task);
// when
taskService.setAssignee(task.getId(), "demo");
// then
UserOperationLogQuery query = historyService.createUserOperationLogQuery().caseExecutionId(caseExecutionId);
verifyQueryResults(query, 1);
}
use of org.camunda.bpm.engine.history.UserOperationLogQuery in project camunda-bpm-platform by camunda.
the class UserOperationLogTaskTest method testSetPriority.
@Deployment(resources = { "org/camunda/bpm/engine/test/history/oneTaskProcess.bpmn20.xml" })
public void testSetPriority() {
startTestProcess();
// then: set the priority of the task to 10
taskService.setPriority(task.getId(), 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.getProperty());
// note: 50 is the default task priority
assertEquals(50, Integer.parseInt(userOperationLogEntry.getOrgValue()));
assertEquals(10, Integer.parseInt(userOperationLogEntry.getNewValue()));
// move clock by 5 minutes
Date date = DateTimeUtil.now().plusMinutes(5).toDate();
ClockUtil.setCurrentTime(date);
// then: set priority again
taskService.setPriority(task.getId(), 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.getProperty());
assertEquals(10, Integer.parseInt(userOperationLogEntry.getOrgValue()));
assertEquals(75, Integer.parseInt(userOperationLogEntry.getNewValue()));
}
use of org.camunda.bpm.engine.history.UserOperationLogQuery in project camunda-bpm-platform by camunda.
the class UserOperationLogTaskTest method testSubmitTaskForm_Complete.
@Deployment(resources = { "org/camunda/bpm/engine/test/history/oneTaskProcess.bpmn20.xml" })
public void testSubmitTaskForm_Complete() {
startTestProcess();
formService.submitTaskForm(task.getId(), new HashMap<String, Object>());
// expect: two entries for the resolving (delegation and assignee changed)
UserOperationLogQuery query = queryOperationDetails(OPERATION_TYPE_COMPLETE);
assertEquals(1, query.count());
// assert: delete
assertFalse(Boolean.parseBoolean(query.property("delete").singleResult().getOrgValue()));
assertTrue(Boolean.parseBoolean(query.property("delete").singleResult().getNewValue()));
assertProcessEnded(process.getId());
}
use of org.camunda.bpm.engine.history.UserOperationLogQuery in project camunda-bpm-platform by camunda.
the class UserOperationLogTaskTest method testAssignTask.
@Deployment(resources = { "org/camunda/bpm/engine/test/history/oneTaskProcess.bpmn20.xml" })
public void testAssignTask() {
startTestProcess();
// then: assign the task
taskService.setAssignee(task.getId(), "icke");
// expect: one entry for the task assignment
UserOperationLogQuery query = queryOperationDetails(OPERATION_TYPE_ASSIGN);
assertEquals(1, query.count());
// assert: details
UserOperationLogEntry assign = query.singleResult();
assertEquals(ASSIGNEE, assign.getProperty());
assertEquals("icke", assign.getNewValue());
completeTestProcess();
}
use of org.camunda.bpm.engine.history.UserOperationLogQuery in project camunda-bpm-platform by camunda.
the class UserOperationLogTaskTest method testKeepOpLogEntriesOnUndeployment.
@Deployment(resources = { "org/camunda/bpm/engine/test/history/oneTaskProcess.bpmn20.xml" })
public void testKeepOpLogEntriesOnUndeployment() {
// given
startTestProcess();
// an op log entry directly related to the process instance is created
taskService.resolveTask(task.getId());
// and an op log entry with indirect reference to the process instance is created
runtimeService.suspendProcessInstanceByProcessDefinitionId(processDefinition.getId());
// when
// the deployment is deleted with cascade
repositoryService.deleteDeployment(deploymentId, true);
// then
UserOperationLogQuery query = historyService.createUserOperationLogQuery();
assertEquals(3, query.count());
assertEquals(1, query.operationType(UserOperationLogEntry.OPERATION_TYPE_SUSPEND).count());
assertEquals(1, query.operationType(UserOperationLogEntry.OPERATION_TYPE_RESOLVE).count());
assertEquals(1, query.operationType(UserOperationLogEntry.OPERATION_TYPE_DELETE).count());
}
Aggregations