Skip to content

Commit c8195ca

Browse files
committed
fix EventServiceTest unit test
1 parent bfb1197 commit c8195ca

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

framework/src/main/java/org/tron/common/application/ApplicationImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ public void startup() {
5252
@Override
5353
public void shutdown() {
5454
this.shutdownServices();
55-
eventService.close();
5655
if (!Args.getInstance().isSolidityNode() && (!Args.getInstance().p2pDisable)) {
5756
tronNetService.close();
5857
}
5958
consensusService.stop();
59+
eventService.close();
6060
dbManager.close();
6161
shutdown.countDown();
6262
}

framework/src/test/java/org/tron/core/event/EventServiceTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,30 @@
55
import org.junit.Test;
66
import org.mockito.Mockito;
77
import org.tron.common.utils.ReflectUtils;
8+
import org.tron.core.capsule.BlockCapsule;
89
import org.tron.core.db.Manager;
10+
import org.tron.core.services.event.BlockEventCache;
911
import org.tron.core.services.event.BlockEventLoad;
1012
import org.tron.core.services.event.EventService;
1113
import org.tron.core.services.event.HistoryEventService;
1214
import org.tron.core.services.event.RealtimeEventService;
15+
import org.tron.core.services.event.SolidEventService;
1316

1417
public class EventServiceTest {
1518

1619
@Test
1720
public void test() {
21+
BlockCapsule.BlockId b1 = new BlockCapsule.BlockId(BlockEventCacheTest.getBlockId(), 1);
22+
BlockEventCache.init(b1);
23+
1824
EventService eventService = new EventService();
1925
HistoryEventService historyEventService = new HistoryEventService();
2026
RealtimeEventService realtimeEventService = new RealtimeEventService();
27+
SolidEventService solidEventService = new SolidEventService();
2128
BlockEventLoad blockEventLoad = new BlockEventLoad();
2229

2330
ReflectUtils.setFieldValue(eventService, "historyEventService", historyEventService);
31+
ReflectUtils.setFieldValue(eventService, "solidEventService", solidEventService);
2432
ReflectUtils.setFieldValue(eventService, "realtimeEventService", realtimeEventService);
2533
ReflectUtils.setFieldValue(eventService, "blockEventLoad", blockEventLoad);
2634

0 commit comments

Comments
 (0)