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();
}
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);
}
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);
}
Aggregations