use of com.evolveum.midpoint.xml.ns._public.common.audit_3.AuditEventRecordType.F_TIMESTAMP in project midpoint by Evolveum.
the class QueryInterpreter2Test method test162QueryTriggerBeforeAfter.
@Test
public void test162QueryTriggerBeforeAfter() throws Exception {
final Date NOW = new Date();
Session session = open();
try {
XMLGregorianCalendar lastScanTimestamp = XmlTypeConverter.createXMLGregorianCalendar(NOW.getTime());
XMLGregorianCalendar thisScanTimestamp = XmlTypeConverter.createXMLGregorianCalendar(NOW.getTime());
ObjectQuery query = QueryBuilder.queryFor(ObjectType.class, prismContext).exists(ObjectType.F_TRIGGER).block().item(F_TIMESTAMP).gt(lastScanTimestamp).and().item(F_TIMESTAMP).le(thisScanTimestamp).endBlock().build();
String real = getInterpretedQuery2(session, ObjectType.class, query);
String expected = "select\n" + " o.oid, o.fullObject, o.stringsCount, o.longsCount, o.datesCount, o.referencesCount, o.polysCount, o.booleansCount\n" + "from\n" + " RObject o\n" + " left join o.trigger t\n" + "where\n" + " ( t.timestamp > :timestamp and t.timestamp <= :timestamp2 )\n";
assertEqualsIgnoreWhitespace(expected, real);
} finally {
close(session);
}
}
use of com.evolveum.midpoint.xml.ns._public.common.audit_3.AuditEventRecordType.F_TIMESTAMP in project midpoint by Evolveum.
the class QueryInterpreter2Test method test160QueryTrigger.
@Test
public void test160QueryTrigger() throws Exception {
final Date NOW = new Date();
Session session = open();
try {
XMLGregorianCalendar thisScanTimestamp = XmlTypeConverter.createXMLGregorianCalendar(NOW.getTime());
ObjectQuery query = QueryBuilder.queryFor(ObjectType.class, prismContext).item(ObjectType.F_TRIGGER, F_TIMESTAMP).le(thisScanTimestamp).build();
String real = getInterpretedQuery2(session, ObjectType.class, query);
String expected = "select\n" + " o.oid, o.fullObject, o.stringsCount, o.longsCount, o.datesCount, o.referencesCount, o.polysCount, o.booleansCount\n" + "from\n" + " RObject o\n" + " left join o.trigger t\n" + "where\n" + " t.timestamp <= :timestamp\n";
assertEqualsIgnoreWhitespace(expected, real);
} finally {
close(session);
}
}
use of com.evolveum.midpoint.xml.ns._public.common.audit_3.AuditEventRecordType.F_TIMESTAMP in project midpoint by Evolveum.
the class AbstractModelIntegrationTest method getObjectAuditRecords.
@NotNull
protected SearchResultList<AuditEventRecordType> getObjectAuditRecords(String oid) throws SecurityViolationException, SchemaException, ObjectNotFoundException, ExpressionEvaluationException, CommunicationException, ConfigurationException {
Task task = createTask("getObjectAuditRecords");
OperationResult result = task.getResult();
return modelAuditService.searchObjects(prismContext.queryFor(AuditEventRecordType.class).item(AuditEventRecordType.F_TARGET_REF).ref(oid).asc(F_TIMESTAMP).build(), null, task, result);
}
use of com.evolveum.midpoint.xml.ns._public.common.audit_3.AuditEventRecordType.F_TIMESTAMP in project midpoint by Evolveum.
the class QueryInterpreterTest method test088QueryTriggerBeforeAfter.
@Test
public void test088QueryTriggerBeforeAfter() throws Exception {
final Date NOW = new Date();
Session session = open();
try {
XMLGregorianCalendar lastScanTimestamp = XmlTypeConverter.createXMLGregorianCalendar(NOW.getTime());
XMLGregorianCalendar thisScanTimestamp = XmlTypeConverter.createXMLGregorianCalendar(NOW.getTime());
ObjectQuery query = prismContext.queryFor(ObjectType.class).exists(ObjectType.F_TRIGGER).block().item(F_TIMESTAMP).gt(lastScanTimestamp).and().item(F_TIMESTAMP).le(thisScanTimestamp).endBlock().build();
String real = getInterpretedQuery(session, ObjectType.class, query);
assertThat(real).isEqualToIgnoringWhitespace("select\n" + " o.oid, o.fullObject\n" + "from\n" + " RObject o\n" + " left join o.trigger t\n" + "where\n" + " ( t.timestamp > :timestamp and t.timestamp <= :timestamp2 )\n");
} finally {
close(session);
}
}
use of com.evolveum.midpoint.xml.ns._public.common.audit_3.AuditEventRecordType.F_TIMESTAMP in project midpoint by Evolveum.
the class QueryInterpreterTest method test086QueryTrigger.
@Test
public void test086QueryTrigger() throws Exception {
final Date NOW = new Date();
Session session = open();
try {
XMLGregorianCalendar thisScanTimestamp = XmlTypeConverter.createXMLGregorianCalendar(NOW.getTime());
ObjectQuery query = prismContext.queryFor(ObjectType.class).item(ObjectType.F_TRIGGER, F_TIMESTAMP).le(thisScanTimestamp).build();
String real = getInterpretedQuery(session, ObjectType.class, query);
assertThat(real).isEqualToIgnoringWhitespace("select\n" + " o.oid, o.fullObject\n" + "from\n" + " RObject o\n" + " left join o.trigger t\n" + "where\n" + " t.timestamp <= :timestamp\n");
} finally {
close(session);
}
}
Aggregations