Search in sources :

Example 1 with InMemoryEventRepository

use of org.ff4j.audit.repository.InMemoryEventRepository in project ff4j by ff4j.

the class FF4jTest method monitoringAudit.

@Test
public void monitoringAudit() {
    // Given
    FF4j ff4j = new FF4j();
    ff4j.setEventPublisher(new EventPublisher());
    ff4j.setEventRepository(new InMemoryEventRepository());
    ff4j.removeCurrentContext();
    ff4j.getCurrentContext();
    // When
    ff4j.stop();
    // When
    ff4j.setEventPublisher(null);
    ff4j.getEventPublisher();
    ff4j.stop();
    // When
    Event evt = new Event("f1", EventConstants.TARGET_FEATURE, "f2", EventConstants.ACTION_CHECK_OK);
    Assert.assertNotNull(evt.toJson());
    Assert.assertNotNull(evt.toString());
    // When
    EventPublisher ep = new EventPublisher();
    new EventPublisher(ep.getRepository(), null);
    ep.setRepository(new InMemoryEventRepository());
    // Then
    Assert.assertNotNull(ep.getRepository());
}
Also used : EventPublisher(org.ff4j.audit.EventPublisher) FF4j(org.ff4j.FF4j) InMemoryEventRepository(org.ff4j.audit.repository.InMemoryEventRepository) Event(org.ff4j.audit.Event) Test(org.junit.Test)

Example 2 with InMemoryEventRepository

use of org.ff4j.audit.repository.InMemoryEventRepository in project ff4j by ff4j.

the class EventWorkerTest method testEventWorker.

@Test
public void testEventWorker() {
    // Given
    EventRepository er = new InMemoryEventRepository();
    Event evt = new Event(SOURCE_JAVA, TARGET_FEATURE, "F1", ACTION_CHECK_OFF);
    EventWorker ew = new EventWorker(evt, er);
    // When
    ew.setName("NAME1");
    // Then
    Assert.assertEquals("NAME1", ew.getName());
}
Also used : EventWorker(org.ff4j.audit.EventWorker) InMemoryEventRepository(org.ff4j.audit.repository.InMemoryEventRepository) Event(org.ff4j.audit.Event) InMemoryEventRepository(org.ff4j.audit.repository.InMemoryEventRepository) EventRepository(org.ff4j.audit.repository.EventRepository) Test(org.junit.Test)

Aggregations

Event (org.ff4j.audit.Event)2 InMemoryEventRepository (org.ff4j.audit.repository.InMemoryEventRepository)2 Test (org.junit.Test)2 FF4j (org.ff4j.FF4j)1 EventPublisher (org.ff4j.audit.EventPublisher)1 EventWorker (org.ff4j.audit.EventWorker)1 EventRepository (org.ff4j.audit.repository.EventRepository)1