Search in sources :

Example 1 with BlockHandler

use of org.aion.evtmgr.impl.handler.BlockHandler in project aion by aionnetwork.

the class AbstractHandlerTest method testStart.

@Test
public void testStart() throws InterruptedException {
    AbstractHandler handler = new BlockHandler();
    handler.addEvent(new EventBlock(EventBlock.CALLBACK.ONTRACE0));
    handler.addEvent(new EventBlock(EventBlock.CALLBACK.ONBLOCK0));
    handler.onEvent(new EventBlock(EventBlock.CALLBACK.ONTRACE0));
    handler.onEvent(new EventBlock(EventBlock.CALLBACK.ONBLOCK0));
    handler.eventCallback(new EventCallback(eventExecuteService, LOGGER_EVENT));
    handler.start();
    try {
        Thread.sleep(3 * 1000L);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    handler.stop();
}
Also used : EventBlock(org.aion.evtmgr.impl.evt.EventBlock) BlockHandler(org.aion.evtmgr.impl.handler.BlockHandler) IEventCallback(org.aion.evtmgr.IEventCallback) EventCallback(org.aion.evtmgr.impl.callback.EventCallback) Test(org.junit.Test)

Example 2 with BlockHandler

use of org.aion.evtmgr.impl.handler.BlockHandler in project aion by aionnetwork.

the class AbstractHandlerTest method testRemoveEvent.

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

Example 3 with BlockHandler

use of org.aion.evtmgr.impl.handler.BlockHandler 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

BlockHandler (org.aion.evtmgr.impl.handler.BlockHandler)3 Test (org.junit.Test)3 EventBlock (org.aion.evtmgr.impl.evt.EventBlock)2 EventConsensus (org.aion.evtmgr.impl.evt.EventConsensus)2 IEventCallback (org.aion.evtmgr.IEventCallback)1 EventCallback (org.aion.evtmgr.impl.callback.EventCallback)1 EventDummy (org.aion.evtmgr.impl.evt.EventDummy)1