Package org.ff4j.audit

Examples of org.ff4j.audit.EventPublisher


public class EventRepositoryTest {

    @Test
    public void testAudit() throws InterruptedException {
        int nb = 500;
        EventPublisher pub = new EventPublisher();
        for (int i = 0; i < nb; i++) {
            pub.publish(new Event("aer", EventType.HIT_FLIPPED));
            Thread.sleep(2);
        }
        Assert.assertEquals(nb, pub.getRepository().getTotalEventCount());
    }
View Full Code Here


    @Test
    public void testAuditWithLimit() throws InterruptedException {
        int nb = 500;
        int limit = 25;
        EventPublisher pub = new EventPublisher();
        pub.setRepository(new InMemoryEventRepository(limit));
        for (int i = 0; i < nb; i++) {
            pub.publish(new Event("aer", EventType.HIT_FLIPPED));
            Thread.sleep(2);
        }
        Assert.assertEquals(limit, pub.getRepository().getTotalEventCount());
    }
View Full Code Here

    @Test
    public void testCurve() throws InterruptedException {
        // Events to generate
        int nbEvent = 100;

        EventPublisher pub = new EventPublisher();
        for (int i = 0; i < nbEvent; i++) {
            pub.publish(new Event("aer", EventType.HIT_FLIPPED));
            Thread.sleep(2);
        }
        Assert.assertEquals(nbEvent, pub.getRepository().getTotalEventCount());
        long now = System.currentTimeMillis();
        pub.getRepository().getFeatureHitsCurve("aer", now - 3 * nbEvent, now, 10);
    }
View Full Code Here

     *
     * @return current value of 'eventPublisher'
     */
    public EventPublisher getEventPublisher() {
        if (eventPublisher == null) {
            eventPublisher = new EventPublisher(eventRepository);
        }
        return eventPublisher;
    }
View Full Code Here

TOP

Related Classes of org.ff4j.audit.EventPublisher

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.