File tree Expand file tree Collapse file tree 8 files changed +18
-1
lines changed
Expand file tree Collapse file tree 8 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,9 @@ public interface Application {
3434
3535 void startServices ();
3636
37+ default void blockUntilShutdown () {
38+ }
39+
3740 void shutdownServices ();
3841
3942 void addService (Service service );
Original file line number Diff line number Diff line change 33import lombok .extern .slf4j .Slf4j ;
44import org .springframework .beans .factory .annotation .Autowired ;
55import org .springframework .stereotype .Component ;
6- import org .tron .common .logsfilter .EventPluginLoader ;
76import org .tron .common .parameter .CommonParameter ;
87import org .tron .core .ChainBaseManager ;
98import org .tron .core .config .args .Args ;
@@ -77,6 +76,11 @@ public void shutdown() {
7776 @ Override
7877 public void startServices () {
7978 services .start ();
79+ }
80+
81+ @ Override
82+ // DO NOT USE THIS METHOD IN TEST CASES
83+ public void blockUntilShutdown () {
8084 services .blockUntilShutdown ();
8185 }
8286
Original file line number Diff line number Diff line change @@ -23,6 +23,11 @@ public interface Service {
2323
2424 void init (CommonParameter parameter );
2525
26+ /**
27+ * Start the service.
28+ * {@link Service#init(CommonParameter parameter) init(CommonParameter parameter)} must be called
29+ * before this method.
30+ */
2631 void start ();
2732
2833 void stop ();
Original file line number Diff line number Diff line change @@ -132,5 +132,6 @@ public static void main(String[] args) {
132132 appT .addService (jsonRpcServiceOnPBFT );
133133 }
134134 appT .startup ();
135+ appT .blockUntilShutdown ();
135136 }
136137}
Original file line number Diff line number Diff line change @@ -93,6 +93,7 @@ public static void main(String[] args) {
9393 SolidityNode node = new SolidityNode (appT .getDbManager ());
9494 node .start ();
9595 appT .startup ();
96+ appT .blockUntilShutdown ();
9697 }
9798
9899 private void start () {
Original file line number Diff line number Diff line change @@ -256,6 +256,7 @@ public void testGetTransactionByHash() {
256256
257257 @ Test
258258 public void testGetBlockByNumber2 () {
259+ fullNodeJsonRpcHttpService .init (Args .getInstance ());
259260 fullNodeJsonRpcHttpService .start ();
260261 JsonArray params = new JsonArray ();
261262 params .add (ByteArray .toJsonHex (blockCapsule .getNum ()));
Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ public void pbftapi() throws IOException {
5959
6060 Assert .assertTrue (dynamicPropertiesStore .getLatestBlockHeaderNumber () >= 10 );
6161 commonDataBase .saveLatestPbftBlockNum (6 );
62+ httpApiOnPBFTService .init (Args .getInstance ());
6263 httpApiOnPBFTService .start ();
6364 CloseableHttpResponse response ;
6465 try (CloseableHttpClient httpClient = HttpClients .createDefault ()) {
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ public class SolidityNodeTest {
3535 */
3636 @ BeforeClass
3737 public static void init () {
38+ rpcApiService .init (Args .getInstance ());
3839 rpcApiService .start ();
3940 }
4041
You can’t perform that action at this time.
0 commit comments