1010import java .util .concurrent .TimeUnit ;
1111import lombok .extern .slf4j .Slf4j ;
1212import org .junit .After ;
13- import org .junit .ClassRule ;
1413import org .junit .Rule ;
1514import org .junit .rules .TemporaryFolder ;
1615import org .tron .api .WalletGrpc ;
@@ -54,7 +53,8 @@ public void startApp() {
5453 channelFull = ManagedChannelBuilder .forTarget (fullNode )
5554 .usePlaintext ()
5655 .build ();
57- blockingStubFull = WalletGrpc .newBlockingStub (channelFull );
56+ blockingStubFull = WalletGrpc .newBlockingStub (channelFull )
57+ .withDeadlineAfter (5 , TimeUnit .SECONDS );
5858 }
5959
6060 /**
@@ -69,8 +69,8 @@ public void shutdown() throws InterruptedException {
6969
7070 public void init (String dbType ) throws IOException {
7171 dbPath = folder .newFolder ().toString ();
72- Args .setParam (new String []{
73- "-d" , dbPath , "-w" , "--p2p-disable" , "true" , "--storage-db-engine" , dbType },
72+ Args .setParam (new String [] {
73+ "-d" , dbPath , "-w" , "--p2p-disable" , "true" , "--storage-db-engine" , dbType },
7474 "config-localtest.conf" );
7575 // allow account root
7676 Args .getInstance ().setAllowAccountStateRoot (1 );
@@ -92,15 +92,15 @@ public void testTools(String dbType, int checkpointVersion)
9292 dbPath = String .format ("%s_%s_%d" , dbPath , dbType , System .currentTimeMillis ());
9393 init (dbType );
9494 final String [] argsForSnapshot =
95- new String []{"-o" , "split" , "-t" , "snapshot" , "--fn-data-path" ,
95+ new String [] {"-o" , "split" , "-t" , "snapshot" , "--fn-data-path" ,
9696 dbPath + File .separator + databaseDir , "--dataset-path" ,
9797 dbPath };
9898 final String [] argsForHistory =
99- new String []{"-o" , "split" , "-t" , "history" , "--fn-data-path" ,
99+ new String [] {"-o" , "split" , "-t" , "history" , "--fn-data-path" ,
100100 dbPath + File .separator + databaseDir , "--dataset-path" ,
101101 dbPath };
102102 final String [] argsForMerge =
103- new String []{"-o" , "merge" , "--fn-data-path" , dbPath + File .separator + databaseDir ,
103+ new String [] {"-o" , "merge" , "--fn-data-path" , dbPath + File .separator + databaseDir ,
104104 "--dataset-path" , dbPath + File .separator + "history" };
105105 Args .getInstance ().getStorage ().setCheckpointVersion (checkpointVersion );
106106 DbLite .setRecentBlks (3 );
@@ -126,15 +126,15 @@ public void testTools(String dbType, int checkpointVersion)
126126 File database = new File (Paths .get (dbPath , databaseDir ).toString ());
127127 if (!database .renameTo (new File (Paths .get (dbPath , databaseDir + "_bak" ).toString ()))) {
128128 throw new RuntimeException (
129- String .format ("rename %s to %s failed" , database .getPath (),
130- Paths .get (dbPath , databaseDir )));
129+ String .format ("rename %s to %s failed" , database .getPath (),
130+ Paths .get (dbPath , databaseDir )));
131131 }
132132 // change snapshot to the new database
133133 File snapshot = new File (Paths .get (dbPath , "snapshot" ).toString ());
134134 if (!snapshot .renameTo (new File (Paths .get (dbPath , databaseDir ).toString ()))) {
135135 throw new RuntimeException (
136- String .format ("rename snapshot to %s failed" ,
137- Paths .get (dbPath , databaseDir )));
136+ String .format ("rename snapshot to %s failed" ,
137+ Paths .get (dbPath , databaseDir )));
138138 }
139139 // start and validate the snapshot
140140 startApp ();
@@ -161,7 +161,7 @@ private void generateSomeTransactions(int during) {
161161 String sunPri = getRandomPrivateKey ();
162162 byte [] sunAddress = PublicMethod .getFinalAddress (sunPri );
163163 PublicMethod .sendcoin (address , 1L ,
164- sunAddress , sunPri , blockingStubFull );
164+ sunAddress , sunPri , blockingStubFull );
165165 try {
166166 Thread .sleep (sleepOnce );
167167 } catch (InterruptedException e ) {
0 commit comments