use of org.camunda.bpm.engine.history.UserOperationLogQuery in project camunda-bpm-platform by camunda.
the class UserOperationLogQueryTest method testQueryProcessInstanceModificationOperation.
// ----- PROCESS INSTANCE MODIFICATION -----
@Deployment(resources = { ONE_TASK_PROCESS })
public void testQueryProcessInstanceModificationOperation() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess");
String processInstanceId = processInstance.getId();
ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().singleResult();
runtimeService.createProcessInstanceModification(processInstance.getId()).startBeforeActivity("theTask").execute();
UserOperationLogQuery logQuery = query().entityType(EntityTypes.PROCESS_INSTANCE).operationType(UserOperationLogEntry.OPERATION_TYPE_MODIFY_PROCESS_INSTANCE);
assertEquals(1, logQuery.count());
UserOperationLogEntry logEntry = logQuery.singleResult();
assertEquals(processInstanceId, logEntry.getProcessInstanceId());
assertEquals(processInstance.getProcessDefinitionId(), logEntry.getProcessDefinitionId());
assertEquals(definition.getKey(), logEntry.getProcessDefinitionKey());
assertEquals(deploymentId, logEntry.getDeploymentId());
assertEquals(UserOperationLogEntry.OPERATION_TYPE_MODIFY_PROCESS_INSTANCE, logEntry.getOperationType());
assertEquals(EntityTypes.PROCESS_INSTANCE, logEntry.getEntityType());
assertNull(logEntry.getProperty());
assertNull(logEntry.getOrgValue());
assertNull(logEntry.getNewValue());
}
use of org.camunda.bpm.engine.history.UserOperationLogQuery in project camunda-bpm-platform by camunda.
the class UserOperationLogQueryTest method testQueryByEntityTypes.
@Deployment(resources = { ONE_TASK_PROCESS })
public void testQueryByEntityTypes() {
// given
process = runtimeService.startProcessInstanceByKey("oneTaskProcess");
processTaskId = taskService.createTaskQuery().singleResult().getId();
// when
taskService.setAssignee(processTaskId, "foo");
taskService.setVariable(processTaskId, "foo", "bar");
// then
UserOperationLogQuery query = historyService.createUserOperationLogQuery().entityTypeIn(EntityTypes.TASK, EntityTypes.VARIABLE);
verifyQueryResults(query, 2);
}
use of org.camunda.bpm.engine.history.UserOperationLogQuery in project camunda-bpm-platform by camunda.
the class UserOperationLogQueryTest method testQueryByInvalidEntityTypes.
public void testQueryByInvalidEntityTypes() {
UserOperationLogQuery query = historyService.createUserOperationLogQuery().entityTypeIn("foo");
verifyQueryResults(query, 0);
try {
query.entityTypeIn(null);
fail();
} catch (ProcessEngineException e) {
// expected
}
try {
query.entityTypeIn(EntityTypes.TASK, null, EntityTypes.VARIABLE);
fail();
} catch (ProcessEngineException e) {
// expected
}
}
use of org.camunda.bpm.engine.history.UserOperationLogQuery in project camunda-bpm-platform by camunda.
the class UserOperationLogQueryTest method testQueryByDeploymentId.
public void testQueryByDeploymentId() {
// given
String deploymentId = repositoryService.createDeployment().addClasspathResource(ONE_TASK_PROCESS).deploy().getId();
// when
UserOperationLogQuery query = historyService.createUserOperationLogQuery().deploymentId(deploymentId);
// then
verifyQueryResults(query, 1);
repositoryService.deleteDeployment(deploymentId, true);
}
use of org.camunda.bpm.engine.history.UserOperationLogQuery in project camunda-bpm-platform by camunda.
the class UserOperationLogQueryTest method testQueryByCaseInstanceId.
@Deployment(resources = { ONE_TASK_CASE })
public void testQueryByCaseInstanceId() {
// given:
// a deployed case definition
String caseDefinitionId = repositoryService.createCaseDefinitionQuery().singleResult().getId();
// an active case instance
String caseInstanceId = caseService.withCaseDefinition(caseDefinitionId).create().getId();
Task task = taskService.createTaskQuery().singleResult();
assertNotNull(task);
// when
taskService.setAssignee(task.getId(), "demo");
// then
UserOperationLogQuery query = historyService.createUserOperationLogQuery().caseInstanceId(caseInstanceId);
verifyQueryResults(query, 1);
}
Aggregations