}
@Test
public void test_selectAudittrail() throws SQLException, Exception{
BatcherImpl batcher = new BatcherImpl(3);
@SuppressWarnings("rawtypes")
RetryingTxnBatchRunner<?,?> batchRunner = new RetryingTxnBatchRunner();
batchRunner.setDataSource(datasource);
batcher.setBatchRunner(batchRunner);
batcher.startup();
BatchingAuditTrail auditTrail = new BatchingAuditTrail();
auditTrail.setBatcher(batcher);
auditTrail.setDataSource(datasource);
// auditTrail.setMessagePostProcessor(new CompressedBase64PostProcessor());
try {
auditTrail.startup();
} catch (Exception e) {
throw new RuntimeException(e);
}
Date occurrence = new Date();
auditTrail.synchLog(1, occurrence, "1", "2", "", "", "", "detail", "Text");
try {
List<AuditTrailInfo> selectAuditTrails = monitoringDbDialect.selectAuditTrails(null, null, null, null, 3, datasource.getConnection());
assertEquals(1, selectAuditTrails.size());
assertEquals(occurrence.getTime(),selectAuditTrails.get(0).getOccurrence().getTime());
assertEquals(1,selectAuditTrails.get(0).getLoglevel());
} catch (SQLException e) {
throw new RuntimeException(e);
}
batcher.shutdown();
}