use of org.ff4j.audit.repository.EventRepository in project ff4j by ff4j.
the class ConsoleRenderer method renderAuditRows.
private static final String renderAuditRows(FF4j ff4j, HttpServletRequest req) {
StringBuilder sb = new StringBuilder();
EventRepository er = ff4j.getEventRepository();
EventQueryDefinition query = new EventQueryDefinition();
for (Event event : er.searchFeatureUsageEvents(query)) {
sb.append("<tr>" + END_OF_LINE);
sb.append("<td>" + SDF.format(new Date(event.getTimestamp())) + "</td>");
sb.append("<td>" + event.getType() + "</td>");
sb.append("<td>" + event.getName() + "</td>");
sb.append("<td>" + event.getAction() + "</td>");
sb.append("</tr>");
}
return sb.toString();
}
use of org.ff4j.audit.repository.EventRepository in project ff4j by ff4j.
the class EventRepositoryCassandraTest method initRepository.
/**
* {@inheritDoc}
*/
@Override
protected EventRepository initRepository() {
EventRepository cassandraStore = new EventRepositoryCassandra(conn);
cassandraStore.createSchema();
return cassandraStore;
}
use of org.ff4j.audit.repository.EventRepository in project ff4j by ff4j.
the class EventRepositoryElasticTest method initRepository.
@Override
protected EventRepository initRepository() {
ElasticConnection connection = null;
try {
connection = new ElasticConnection(ElasticConnectionMode.JEST_CLIENT, "ff4j", new URL("http://localhost:9200"));
} catch (MalformedURLException e) {
logger.error(e.getMessage(), e);
}
EventRepository elasticStore = new EventRepositoryElastic(connection);
elasticStore.createSchema();
return elasticStore;
}
use of org.ff4j.audit.repository.EventRepository in project ff4j by ff4j.
the class EventRepositoryHBaseTest method initRepository.
/**
* {@inheritDoc}
*/
@Override
protected EventRepository initRepository() {
EventRepository hBaseEventRepo = new EventRepositoryHBase(new HBaseConnection(HBASE_HOST, HBASE_PORT, false));
hBaseEventRepo.createSchema();
return hBaseEventRepo;
}
use of org.ff4j.audit.repository.EventRepository in project ff4j by ff4j.
the class EventWorkerTest method testErrorOnSubmitEventPublisher.
@Test
public void testErrorOnSubmitEventPublisher() {
// Given
EventRepository er = mock(EventRepository.class);
Event evt = new Event(SOURCE_JAVA, TARGET_FEATURE, "F1", ACTION_CHECK_OFF);
doThrow(new RuntimeException("Erreur")).when(er).saveEvent(evt);
EventPublisher evtPublisher = new EventPublisher(er);
evtPublisher.publish(evt);
Assert.assertNotNull(evt);
}
Aggregations