use of org.camunda.bpm.engine.history.UserOperationLogQuery in project camunda-bpm-platform by camunda.
the class UserOperationLogQueryTest method verifyVariableOperationAsserts.
private void verifyVariableOperationAsserts(int countAssertValue, String operationType) {
UserOperationLogQuery logQuery = query().entityType(EntityTypes.VARIABLE).operationType(operationType);
assertEquals(countAssertValue, logQuery.count());
if (countAssertValue > 1) {
List<UserOperationLogEntry> logEntryList = logQuery.list();
for (UserOperationLogEntry logEntry : logEntryList) {
assertEquals(process.getProcessDefinitionId(), logEntry.getProcessDefinitionId());
assertEquals(process.getProcessInstanceId(), logEntry.getProcessInstanceId());
assertEquals(deploymentId, logEntry.getDeploymentId());
}
} else {
UserOperationLogEntry logEntry = logQuery.singleResult();
assertEquals(process.getProcessDefinitionId(), logEntry.getProcessDefinitionId());
assertEquals(process.getProcessInstanceId(), logEntry.getProcessInstanceId());
assertEquals(deploymentId, logEntry.getDeploymentId());
}
}
use of org.camunda.bpm.engine.history.UserOperationLogQuery in project camunda-bpm-platform by camunda.
the class UserOperationLogQueryTest method testQueryByInvalidDeploymentId.
public void testQueryByInvalidDeploymentId() {
UserOperationLogQuery query = historyService.createUserOperationLogQuery().deploymentId("invalid");
verifyQueryResults(query, 0);
try {
query.deploymentId(null);
fail();
} catch (ProcessEngineException e) {
// expected
}
}
use of org.camunda.bpm.engine.history.UserOperationLogQuery in project camunda-bpm-platform by camunda.
the class UserOperationLogQueryTest method testQueryByCaseDefinitionId.
// --------------- CMMN --------------------
@Deployment(resources = { ONE_TASK_CASE })
public void testQueryByCaseDefinitionId() {
// given:
// a deployed case definition
String caseDefinitionId = repositoryService.createCaseDefinitionQuery().singleResult().getId();
// an active case instance
caseService.withCaseDefinition(caseDefinitionId).create();
Task task = taskService.createTaskQuery().singleResult();
assertNotNull(task);
// when
taskService.setAssignee(task.getId(), "demo");
// then
UserOperationLogQuery query = historyService.createUserOperationLogQuery().caseDefinitionId(caseDefinitionId);
verifyQueryResults(query, 1);
}
use of org.camunda.bpm.engine.history.UserOperationLogQuery in project camunda-bpm-platform by camunda.
the class UserOperationLogTaskTest method testCompleteCaseExecution.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testCompleteCaseExecution() {
// given
String caseDefinitionId = repositoryService.createCaseDefinitionQuery().singleResult().getId();
String caseInstanceId = caseService.withCaseDefinition(caseDefinitionId).create().getId();
String humanTaskId = caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult().getId();
// when
caseService.withCaseExecution(humanTaskId).complete();
// then
UserOperationLogQuery query = queryOperationDetails(OPERATION_TYPE_COMPLETE);
assertEquals(1, query.count());
UserOperationLogEntry entry = query.singleResult();
assertNotNull(entry);
assertEquals(caseDefinitionId, entry.getCaseDefinitionId());
assertEquals(caseInstanceId, entry.getCaseInstanceId());
assertEquals(humanTaskId, entry.getCaseExecutionId());
assertEquals(deploymentId, entry.getDeploymentId());
assertFalse(Boolean.valueOf(entry.getOrgValue()));
assertTrue(Boolean.valueOf(entry.getNewValue()));
assertEquals(DELETE, entry.getProperty());
}
use of org.camunda.bpm.engine.history.UserOperationLogQuery in project camunda-bpm-platform by camunda.
the class UserOperationLogTaskTest method testCreateAndCompleteTask.
@Deployment(resources = { "org/camunda/bpm/engine/test/history/oneTaskProcess.bpmn20.xml" })
public void testCreateAndCompleteTask() {
startTestProcess();
// expect: no entry for the task creation by process engine
UserOperationLogQuery query = historyService.createUserOperationLogQuery();
assertEquals(0, query.count());
completeTestProcess();
// expect: one entry for the task completion
query = queryOperationDetails(OPERATION_TYPE_COMPLETE);
assertEquals(1, query.count());
UserOperationLogEntry complete = query.singleResult();
assertEquals(DELETE, complete.getProperty());
assertTrue(Boolean.parseBoolean(complete.getNewValue()));
}
Aggregations