use of org.ff4j.audit.EventSeries in project ff4j by ff4j.
the class AuditBeanTest method testAverageDuration.
@Test
public void testAverageDuration() {
EventSeries es = new EventSeries();
es.add(new EventBuilder().duration(1).build());
es.add(new EventBuilder().duration(3).build());
Assert.assertEquals(new Double(2), new Double(es.getAverageDuration()));
}
use of org.ff4j.audit.EventSeries in project ff4j by ff4j.
the class EventRepositoryRedis method getAuditTrail.
/**
* {@inheritDoc}
*/
@Override
public EventSeries getAuditTrail(EventQueryDefinition query) {
Jedis jedis = null;
EventSeries eventSeries = new EventSeries();
try {
jedis = getJedis();
String hashKey = getHashKey(query.getFrom(), EventConstants.ACTION_CHECK_OK);
Set<String> events = jedis.zrangeByScore(hashKey, query.getFrom(), query.getTo(), 0, 100);
// FIXME: Server side pagination model isn't present? This could be a lot of data.
for (String event : events) {
eventSeries.add(marshallEvent(event));
}
} finally {
if (jedis != null) {
jedis.close();
}
}
return eventSeries;
}
use of org.ff4j.audit.EventSeries in project ff4j by ff4j.
the class EventRepositorySpringJdbc method searchEvents.
/**
* {@inheritDoc}
*/
private EventSeries searchEvents(String sqlQuery, long from, long to) {
EventSeries es = new EventSeries();
es.addAll(getJdbcTemplate().query(sqlQuery, EVENT_ROWMAPPER, new Timestamp(from), new Timestamp(to)));
return es;
}
Aggregations