use of org.camunda.bpm.engine.history.UserOperationLogEntry in project camunda-bpm-platform by camunda.
the class UserOperationLogJobTest method testSetJobPriority.
@Deployment(resources = { "org/camunda/bpm/engine/test/history/asyncTaskProcess.bpmn20.xml" })
public void testSetJobPriority() {
// given a job
runtimeService.startProcessInstanceByKey("asyncTaskProcess");
Job job = managementService.createJobQuery().singleResult();
// when I set a job priority
managementService.setJobPriority(job.getId(), 42);
// then an op log entry is written
UserOperationLogEntry userOperationLogEntry = historyService.createUserOperationLogQuery().singleResult();
assertNotNull(userOperationLogEntry);
assertEquals(EntityTypes.JOB, userOperationLogEntry.getEntityType());
assertEquals(job.getId(), userOperationLogEntry.getJobId());
assertEquals(UserOperationLogEntry.OPERATION_TYPE_SET_PRIORITY, userOperationLogEntry.getOperationType());
assertEquals("priority", userOperationLogEntry.getProperty());
assertEquals("42", userOperationLogEntry.getNewValue());
assertEquals("0", userOperationLogEntry.getOrgValue());
assertEquals(USER_ID, userOperationLogEntry.getUserId());
assertEquals(job.getJobDefinitionId(), userOperationLogEntry.getJobDefinitionId());
assertEquals(job.getProcessInstanceId(), userOperationLogEntry.getProcessInstanceId());
assertEquals(job.getProcessDefinitionId(), userOperationLogEntry.getProcessDefinitionId());
assertEquals(job.getProcessDefinitionKey(), userOperationLogEntry.getProcessDefinitionKey());
assertEquals(deploymentId, userOperationLogEntry.getDeploymentId());
}
use of org.camunda.bpm.engine.history.UserOperationLogEntry in project camunda-bpm-platform by camunda.
the class UserOperationLogTaskServiceAndBeanTest method testDeleteTask.
public void testDeleteTask() {
// given: a single task
task = taskService.newTask();
taskService.saveTask(task);
// then: delete the task
taskService.deleteTask(task.getId(), "duplicated");
// expect: one entry for the deletion
UserOperationLogQuery query = queryOperationDetails(OPERATION_TYPE_DELETE);
assertEquals(1, query.count());
// assert: details
UserOperationLogEntry delete = query.singleResult();
assertEquals(DELETE, delete.getProperty());
assertFalse(Boolean.parseBoolean(delete.getOrgValue()));
assertTrue(Boolean.parseBoolean(delete.getNewValue()));
}
use of org.camunda.bpm.engine.history.UserOperationLogEntry in project camunda-bpm-platform by camunda.
the class UserOperationLogTaskServiceAndBeanTest method testResetChange.
public void testResetChange() {
// given: a single task
task = taskService.newTask();
taskService.saveTask(task);
// then: change the name
String name = "a task";
task.setName(name);
taskService.saveTask(task);
UserOperationLogEntry update = queryOperationDetails(OPERATION_TYPE_UPDATE).singleResult();
assertNull(update.getOrgValue());
assertEquals(name, update.getNewValue());
// then: change the name some times and set it back to the original value
task.setName("to do 1");
task.setName("to do 2");
task.setName(name);
taskService.saveTask(task);
// expect: there is no additional change tracked
update = queryOperationDetails(OPERATION_TYPE_UPDATE).singleResult();
assertNull(update.getOrgValue());
assertEquals(name, update.getNewValue());
}
use of org.camunda.bpm.engine.history.UserOperationLogEntry in project camunda-bpm-platform by camunda.
the class UserOperationLogTaskServiceAndBeanTest method testCaseInstanceId.
public 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.setCaseInstanceId("aCaseInstanceId");
taskService.saveTask(task);
assertEquals(1, query.count());
UserOperationLogEntry entry = query.singleResult();
assertNotNull(entry);
assertNull(entry.getOrgValue());
assertEquals("aCaseInstanceId", entry.getNewValue());
assertEquals(CASE_INSTANCE_ID, entry.getProperty());
// change case instance id and save task
task.setCaseInstanceId("anotherCaseInstanceId");
taskService.saveTask(task);
assertEquals(2, query.count());
List<UserOperationLogEntry> entries = query.list();
assertEquals(2, entries.size());
for (UserOperationLogEntry currentEntry : entries) {
if (!currentEntry.getId().equals(entry.getId())) {
assertEquals("aCaseInstanceId", currentEntry.getOrgValue());
assertEquals("anotherCaseInstanceId", currentEntry.getNewValue());
assertEquals(CASE_INSTANCE_ID, currentEntry.getProperty());
}
}
}
use of org.camunda.bpm.engine.history.UserOperationLogEntry in project camunda-bpm-platform by camunda.
the class UserOperationLogTaskServiceAndBeanTest method testSetDateProperty.
public void testSetDateProperty() {
// given: a single task
task = taskService.newTask();
Date now = ClockUtil.getCurrentTime();
task.setDueDate(now);
taskService.saveTask(task);
UserOperationLogEntry logEntry = historyService.createUserOperationLogQuery().singleResult();
assertEquals(String.valueOf(now.getTime()), logEntry.getNewValue());
}
Aggregations