|
4 | 4 | import io.netty.util.internal.ConcurrentSet; |
5 | 5 | import lombok.extern.slf4j.Slf4j; |
6 | 6 | import org.apache.commons.collections4.CollectionUtils; |
| 7 | +import org.junit.AfterClass; |
7 | 8 | import org.junit.Assert; |
8 | 9 | import org.junit.Before; |
9 | 10 | import org.junit.Test; |
|
18 | 19 | import org.tron.common.overlay.server.ChannelManager; |
19 | 20 | import org.tron.common.overlay.server.SyncPool; |
20 | 21 | import org.tron.common.utils.ByteArray; |
| 22 | +import org.tron.common.utils.FileUtil; |
21 | 23 | import org.tron.common.utils.ReflectUtils; |
22 | 24 | import org.tron.common.utils.Sha256Hash; |
23 | 25 | import org.tron.core.capsule.BlockCapsule; |
|
32 | 34 | import org.tron.core.services.WitnessService; |
33 | 35 | import org.tron.protos.Protocol; |
34 | 36 |
|
| 37 | +import java.io.File; |
35 | 38 | import java.lang.reflect.Field; |
36 | 39 | import java.util.*; |
37 | 40 | import java.util.concurrent.ConcurrentHashMap; |
|
40 | 43 |
|
41 | 44 | @Slf4j |
42 | 45 | public class HandleSyncBlockTest { |
| 46 | + private static AnnotationConfigApplicationContext context; |
43 | 47 | private NodeImpl node; |
44 | 48 | RpcApiService rpcApiService; |
45 | 49 | PeerClient peerClient; |
@@ -147,15 +151,15 @@ public void init() { |
147 | 151 | @Override |
148 | 152 | public void run() { |
149 | 153 | logger.info("Full node running."); |
150 | | - Args.setParam(new String[]{"-d","output-nodeImplTest/handleSyncBlock"}, "config.conf"); |
| 154 | + Args.setParam(new String[]{"-d","output-handleSyncBlock-test"}, "config.conf"); |
151 | 155 | Args cfgArgs = Args.getInstance(); |
152 | 156 | cfgArgs.setNodeListenPort(17889); |
153 | 157 | cfgArgs.setNodeDiscoveryEnable(false); |
154 | 158 | cfgArgs.getSeedNode().getIpList().clear(); |
155 | 159 | cfgArgs.setNeedSyncCheck(false); |
156 | 160 | cfgArgs.setNodeExternalIp("127.0.0.1"); |
157 | 161 |
|
158 | | - ApplicationContext context = new AnnotationConfigApplicationContext(DefaultConfig.class); |
| 162 | + context = new AnnotationConfigApplicationContext(DefaultConfig.class); |
159 | 163 |
|
160 | 164 | if (cfgArgs.isHelp()) { |
161 | 165 | logger.info("Here is the help message."); |
@@ -196,6 +200,14 @@ public void run() { |
196 | 200 | } |
197 | 201 | } |
198 | 202 |
|
| 203 | + @AfterClass |
| 204 | + public static void destroy() { |
| 205 | + Args.clearParam(); |
| 206 | + FileUtil.deleteDir(new File("output-handleSyncBlock-test")); |
| 207 | +// context.destroy(); |
| 208 | + } |
| 209 | + |
| 210 | + |
199 | 211 | private void prepare() { |
200 | 212 | try { |
201 | 213 | ExecutorService advertiseLoopThread = ReflectUtils.getFieldValue(node, "broadPool"); |
|
0 commit comments