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