Search in sources :

Example 1 with QAuditEventRecord

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);
    }
}
Also used : AuditEventRecordType(com.evolveum.midpoint.xml.ns._public.common.audit_3.AuditEventRecordType) MAuditEventRecord(com.evolveum.midpoint.repo.sql.audit.beans.MAuditEventRecord) QAuditEventRecord(com.evolveum.midpoint.repo.sql.audit.querymodel.QAuditEventRecord)

Aggregations

MAuditEventRecord (com.evolveum.midpoint.repo.sql.audit.beans.MAuditEventRecord)1 QAuditEventRecord (com.evolveum.midpoint.repo.sql.audit.querymodel.QAuditEventRecord)1 AuditEventRecordType (com.evolveum.midpoint.xml.ns._public.common.audit_3.AuditEventRecordType)1