use of com.evolveum.midpoint.schema.ObjectDeltaOperation in project midpoint by Evolveum.
the class AuditCleanupTest method prepareAuditRecords.
/**
* Prepares `count` audit records with timestamp starting with specified value
* and going up by second for each item.
* Removes any previous audit records for consistency.
*/
private void prepareAuditRecords(long startTimestamp, int count, OperationResult result) throws SchemaException {
clearAudit();
long timestamp = startTimestamp;
for (int i = 1; i <= count; i++) {
AuditEventRecord record = new AuditEventRecord();
record.setParameter(String.valueOf(i));
record.setTimestamp(timestamp);
record.getCustomColumnProperty().put("foo", "foo-value");
// to check that child tables (delta and refs) are also cleared
ObjectDeltaOperation<UserType> delta = new ObjectDeltaOperation<>();
delta.setObjectDelta(prismContext.deltaFor(UserType.class).item(UserType.F_FULL_NAME).replace(PolyString.fromOrig("newVal")).asObjectDelta(UUID.randomUUID().toString()));
record.addDelta(delta);
record.addReferenceValue("ref1", ObjectTypeUtil.createObjectRef(UUID.randomUUID().toString(), ObjectTypes.USER).asReferenceValue());
auditService.audit(record, NullTaskImpl.INSTANCE, result);
timestamp += 1000;
}
}
Aggregations