Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
halibobo1205 committed Aug 29, 2023
1 parent 000fe38 commit bb83449
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import org.tron.core.capsule.TransactionCapsule;
import org.tron.core.config.args.Args;
import org.tron.core.services.NodeInfoService;
import org.tron.core.services.interfaceJsonRpcOnPBFT.JsonRpcServiceOnPBFT;
import org.tron.core.services.interfaceJsonRpcOnSolidity.JsonRpcServiceOnSolidity;
import org.tron.core.services.jsonrpc.FullNodeJsonRpcHttpService;
import org.tron.core.services.jsonrpc.TronJsonRpcImpl;
import org.tron.core.services.jsonrpc.types.BlockResult;
Expand All @@ -55,10 +57,18 @@ public class JsonrpcServiceTest extends BaseTest {
@Resource
private FullNodeJsonRpcHttpService fullNodeJsonRpcHttpService;

@Resource
private JsonRpcServiceOnPBFT jsonRpcServiceOnPBFT;

@Resource
private JsonRpcServiceOnSolidity jsonRpcServiceOnSolidity;

static {
dbPath = "output_jsonrpc_service_test";
Args.setParam(new String[]{"--output-directory", dbPath}, Constant.TEST_CONF);
CommonParameter.getInstance().setJsonRpcHttpFullNodeEnable(true);
CommonParameter.getInstance().setJsonRpcHttpPBFTNodeEnable(true);
CommonParameter.getInstance().setJsonRpcHttpSolidityNodeEnable(true);
CommonParameter.getInstance().setMetricsPrometheusEnable(true);
Metrics.init();

Expand Down Expand Up @@ -291,4 +301,17 @@ public void testGetBlockByNumber2() {
}
}

@Test
public void testServicesInit() {
try {
jsonRpcServiceOnPBFT.init(Args.getInstance());
jsonRpcServiceOnPBFT.start();
jsonRpcServiceOnSolidity.init(Args.getInstance());
jsonRpcServiceOnSolidity.start();
} finally {
jsonRpcServiceOnPBFT.stop();
jsonRpcServiceOnSolidity.stop();
}
}

}
2 changes: 1 addition & 1 deletion framework/src/test/java/org/tron/core/net/BaseNet.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public static void init() throws Exception {
//ignore
}
tronNetDelegate = context.getBean(TronNetDelegate.class);
rpcApiService.blockUntilShutdown();
appT.blockUntilShutdown();
});
int tryTimes = 0;
do {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public static void init() throws IOException {
.usePlaintext()
.build();
context = new TronApplicationContext(DefaultConfig.class);
context.registerShutdownHook();
blockingStubFull = WalletGrpc.newBlockingStub(channelFull);
blockingStubSolidity = WalletSolidityGrpc.newBlockingStub(channelSolidity);
blockingStubpBFT = WalletSolidityGrpc.newBlockingStub(channelpBFT);
Expand Down

0 comments on commit bb83449

Please sign in to comment.