Search in sources :

Example 1 with EventDummy

use of org.aion.evtmgr.impl.evt.EventDummy in project aion by aionnetwork.

the class EventExecuteServiceTest method testTakeWithMockito.

@Test
public void testTakeWithMockito() {
    EventExecuteService ees = new EventExecuteService(100, "test", Thread.NORM_PRIORITY, LOGGER_EVENT);
    assertTrue(ees.add(new EventDummy()));
    IEvent res = ees.take();
    assertEquals(IEvent.TYPE.DUMMY.getValue(), res.getEventType());
}
Also used : IEvent(org.aion.evtmgr.IEvent) EventDummy(org.aion.evtmgr.impl.evt.EventDummy) Test(org.junit.Test)

Example 2 with EventDummy

use of org.aion.evtmgr.impl.evt.EventDummy in project aion by aionnetwork.

the class EventExecuteServiceTest method testEES.

@Test
public void testEES() {
    eventExecuteService.setFilter(getFilter());
    eventExecuteService.add(new EventDummy());
    eventExecuteService.add(new EventTx(EventTx.CALLBACK.PENDINGTXSTATECHANGE0));
    eventExecuteService.add(new EventBlock(EventBlock.CALLBACK.ONBLOCK0));
    eventExecuteService.add(new EventMiner(EventMiner.CALLBACK.MININGSTARTED));
    eventExecuteService.add(new EventConsensus(EventConsensus.CALLBACK.ON_SYNC_DONE));
    eventExecuteService.take();
    eventExecuteService.take();
    eventExecuteService.take();
    eventExecuteService.take();
    eventExecuteService.take();
}
Also used : EventTx(org.aion.evtmgr.impl.evt.EventTx) EventBlock(org.aion.evtmgr.impl.evt.EventBlock) EventConsensus(org.aion.evtmgr.impl.evt.EventConsensus) EventDummy(org.aion.evtmgr.impl.evt.EventDummy) EventMiner(org.aion.evtmgr.impl.evt.EventMiner) Test(org.junit.Test)

Example 3 with EventDummy

use of org.aion.evtmgr.impl.evt.EventDummy in project aion by aionnetwork.

the class AbstractHandler method stop.

public void stop() throws InterruptedException {
    interrupt.set(true);
    try {
        this.queue.add(new EventDummy());
    } catch (Exception e) {
        LOG.error("stop exception ", e);
    }
    if (LOG.isInfoEnabled()) {
        LOG.info("Handler {} dispatcher interrupting..", this.getType());
    }
    int cnt = 0;
    while (!interrupted && (cnt++ < 10)) {
        System.out.print(".");
        Thread.sleep(1000);
    }
    if (cnt > 9) {
        if (LOG.isErrorEnabled()) {
            LOG.error("Handler {} dispatcher can't be closed!", this.getType());
        }
    }
    if (LOG.isInfoEnabled()) {
        LOG.info("Handler {} dispatcher closed!", this.getType());
    }
}
Also used : EventDummy(org.aion.evtmgr.impl.evt.EventDummy)

Example 4 with EventDummy

use of org.aion.evtmgr.impl.evt.EventDummy in project aion by aionnetwork.

the class EventMgrA0Test method getEventsList.

private List<IEvent> getEventsList() {
    List<IEvent> eventsList = new ArrayList<>();
    eventsList.add(new EventBlock(EventBlock.CALLBACK.ONBEST0));
    eventsList.add(new EventBlock(EventBlock.CALLBACK.ONTRACE0));
    eventsList.add(new EventBlock(EventBlock.CALLBACK.ONBLOCK0));
    eventsList.add(new EventDummy());
    return eventsList;
}
Also used : EventBlock(org.aion.evtmgr.impl.evt.EventBlock) IEvent(org.aion.evtmgr.IEvent) ArrayList(java.util.ArrayList) EventDummy(org.aion.evtmgr.impl.evt.EventDummy)

Example 5 with EventDummy

use of org.aion.evtmgr.impl.evt.EventDummy in project aion by aionnetwork.

the class AbstractHandlerTest method testAddEvent.

@Test
public void testAddEvent() {
    AbstractHandler handler = new BlockHandler();
    boolean res = handler.addEvent(new EventDummy());
    assertTrue(res);
    boolean res2 = handler.addEvent(new EventConsensus(EventConsensus.CALLBACK.ON_BLOCK_TEMPLATE));
    assertTrue(res2);
    boolean res3 = handler.addEvent(null);
    assertTrue(res3);
}
Also used : BlockHandler(org.aion.evtmgr.impl.handler.BlockHandler) EventConsensus(org.aion.evtmgr.impl.evt.EventConsensus) EventDummy(org.aion.evtmgr.impl.evt.EventDummy) Test(org.junit.Test)

Aggregations

EventDummy (org.aion.evtmgr.impl.evt.EventDummy)7 Test (org.junit.Test)4 EventBlock (org.aion.evtmgr.impl.evt.EventBlock)3 IEvent (org.aion.evtmgr.IEvent)2 EventConsensus (org.aion.evtmgr.impl.evt.EventConsensus)2 ArrayList (java.util.ArrayList)1 EventMiner (org.aion.evtmgr.impl.evt.EventMiner)1 EventTx (org.aion.evtmgr.impl.evt.EventTx)1 BlockHandler (org.aion.evtmgr.impl.handler.BlockHandler)1