use of org.camunda.bpm.engine.history.UserOperationLogEntry in project camunda-bpm-platform by camunda.
the class UserOperationLogQueryTest method testQueryJobRetryOperationsById.
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/async/FoxJobRetryCmdTest.testFailedServiceTask.bpmn20.xml" })
public void testQueryJobRetryOperationsById() {
// given
process = runtimeService.startProcessInstanceByKey("failedServiceTask");
Job job = managementService.createJobQuery().processInstanceId(process.getProcessInstanceId()).singleResult();
managementService.setJobRetries(job.getId(), 10);
// then
assertEquals(1, query().entityType(JOB).operationType(OPERATION_TYPE_SET_JOB_RETRIES).count());
UserOperationLogEntry jobRetryEntry = query().entityType(JOB).jobId(job.getId()).operationType(OPERATION_TYPE_SET_JOB_RETRIES).singleResult();
assertNotNull(jobRetryEntry);
assertEquals(job.getId(), jobRetryEntry.getJobId());
assertEquals("3", jobRetryEntry.getOrgValue());
assertEquals("10", jobRetryEntry.getNewValue());
assertEquals("retries", jobRetryEntry.getProperty());
assertEquals(job.getJobDefinitionId(), jobRetryEntry.getJobDefinitionId());
assertEquals(job.getProcessInstanceId(), jobRetryEntry.getProcessInstanceId());
assertEquals(job.getProcessDefinitionKey(), jobRetryEntry.getProcessDefinitionKey());
assertEquals(job.getProcessDefinitionId(), jobRetryEntry.getProcessDefinitionId());
assertEquals(deploymentId, jobRetryEntry.getDeploymentId());
}
use of org.camunda.bpm.engine.history.UserOperationLogEntry in project camunda-bpm-platform by camunda.
the class UserOperationLogTaskTest method testDeleteOpLogEntry.
@Deployment(resources = { "org/camunda/bpm/engine/test/history/oneTaskProcess.bpmn20.xml" })
public void testDeleteOpLogEntry() {
// given
startTestProcess();
// an op log instance is created
taskService.resolveTask(task.getId());
UserOperationLogEntry opLogEntry = historyService.createUserOperationLogQuery().singleResult();
// when the op log instance is deleted
historyService.deleteUserOperationLogEntry(opLogEntry.getId());
// then it should be removed from the database
assertEquals(0, historyService.createUserOperationLogQuery().count());
}
use of org.camunda.bpm.engine.history.UserOperationLogEntry 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.UserOperationLogEntry 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.UserOperationLogEntry in project camunda-bpm-platform by camunda.
the class UserOperationLogTaskTest method testOnlyTaskCompletionIsLogged.
@Deployment
public void testOnlyTaskCompletionIsLogged() {
// given
String processInstanceId = runtimeService.startProcessInstanceByKey("process").getId();
String taskId = taskService.createTaskQuery().singleResult().getId();
// when
taskService.complete(taskId);
// then
assertTrue((Boolean) runtimeService.getVariable(processInstanceId, "taskListenerCalled"));
assertTrue((Boolean) runtimeService.getVariable(processInstanceId, "serviceTaskCalled"));
UserOperationLogQuery query = historyService.createUserOperationLogQuery();
assertEquals(1, query.count());
UserOperationLogEntry log = query.singleResult();
assertEquals("process", log.getProcessDefinitionKey());
assertEquals(processInstanceId, log.getProcessInstanceId());
assertEquals(deploymentId, log.getDeploymentId());
assertEquals(taskId, log.getTaskId());
assertEquals(UserOperationLogEntry.OPERATION_TYPE_COMPLETE, log.getOperationType());
}
Aggregations