try {
URL url = AuditEventDatabaseMock.class
.getResource("/sink-audit.log.gz");
log.info("Creating DatabaseMock from URL {}", url);
InputStream in = new GZIPInputStream(url.openStream());
AuditEventReader reader = new ModSecurity2AuditReader(in);
AuditEvent e = reader.readNext();
while (e != null) {
events.add(e);
variables.addAll(e.getVariables());
e = reader.readNext();
}
} catch (Exception ex) {
ex.printStackTrace();
}
log.info("DatabaseMock has {} events", events.size());