use of org.camunda.bpm.engine.history.UserOperationLogQuery 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.UserOperationLogQuery in project camunda-bpm-platform by camunda.
the class UserOperationLogTaskServiceAndBeanTest method testCompositeBeanInteraction.
public 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(ENTITY_TYPE_TASK, create.getEntityType());
assertNull(create.getOrgValue());
assertNull(create.getNewValue());
assertNull(create.getProperty());
task.setAssignee("icke");
task.setName("to do");
// then: save the task again
taskService.saveTask(task);
// expect: two update entries with the same operation id
List<UserOperationLogEntry> entries = queryOperationDetails(OPERATION_TYPE_UPDATE).list();
assertEquals(2, entries.size());
assertEquals(entries.get(0).getOperationId(), entries.get(1).getOperationId());
}
use of org.camunda.bpm.engine.history.UserOperationLogQuery in project camunda-bpm-platform by camunda.
the class UserOperationLogWithoutUserTest method verifyNoUserOperationLogged.
protected void verifyNoUserOperationLogged() {
UserOperationLogQuery query = historyService.createUserOperationLogQuery();
assertEquals(0, query.count());
}
use of org.camunda.bpm.engine.history.UserOperationLogQuery in project camunda-bpm-platform by camunda.
the class UserOperationLogDeletionTest method testDeleteCaseTaskKeepUserOperationLog.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testDeleteCaseTaskKeepUserOperationLog() {
// given
caseService.withCaseDefinitionByKey("oneTaskCase").create();
String caseExecutionId = caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult().getId();
String taskId = taskService.createTaskQuery().singleResult().getId();
taskService.setAssignee(taskId, "demo");
taskService.complete(taskId);
UserOperationLogQuery query = historyService.createUserOperationLogQuery().taskId(taskId);
assertEquals(2, query.count());
// when
historyService.deleteHistoricTaskInstance(taskId);
// then
assertEquals(2, query.count());
}
use of org.camunda.bpm.engine.history.UserOperationLogQuery in project camunda-bpm-platform by camunda.
the class UserOperationLogDeletionTest method testDeleteStandaloneTaskKeepUserOperationLog.
public void testDeleteStandaloneTaskKeepUserOperationLog() {
// given
String taskId = "my-task";
Task task = taskService.newTask(taskId);
taskService.saveTask(task);
taskService.setAssignee(taskId, "demo");
taskService.complete(taskId);
UserOperationLogQuery query = historyService.createUserOperationLogQuery().taskId(taskId);
assertEquals(3, query.count());
// when
historyService.deleteHistoricTaskInstance(taskId);
// then
assertEquals(3, query.count());
}
Aggregations