use of com.evolveum.midpoint.repo.sql.audit.querymodel.QAuditEventRecord in project midpoint by Evolveum.
the class AuditTest method getAuditEventRecord.
private MAuditEventRecord getAuditEventRecord(int expectedCount, int index) throws QueryException {
// "create" does not actually create a new audit service, but returns the existing one
SqlRepoContext sqlRepoContext = auditServiceFactory.createAuditService().getSqlRepoContext();
SqlQueryContext<AuditEventRecordType, QAuditEventRecord, MAuditEventRecord> context = AuditSqlQueryContext.from(AuditEventRecordType.class, sqlRepoContext);
QAuditEventRecord aer = context.root();
context.sqlQuery().orderBy(aer.id.asc());
try (JdbcSession jdbcSession = sqlRepoContext.newJdbcSession().startReadOnlyTransaction()) {
PageOf<MAuditEventRecord> result = context.executeQuery(jdbcSession).map(t -> t.get(aer));
assertThat(result).hasSize(expectedCount);
return result.get(index);
}
}
Aggregations