Skip to content

Commit b5efa96

Browse files
committed
Add Stest http solidityNode interface case
1 parent 5e063da commit b5efa96

7 files changed

Lines changed: 178 additions & 168 deletions

File tree

‎src/test/java/stest/tron/wallet/dailybuild/http/HttpTestAccount001.java‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ public class HttpTestAccount001 {
2020
private HttpResponse response;
2121
private String httpnode = Configuration.getByPath("testng.conf").getStringList("httpnode.ip.list")
2222
.get(0);
23-
private String httpSoliditynode = Configuration.getByPath("testng.conf").getStringList("httpnode.ip.list")
24-
.get(2);
23+
private String httpSoliditynode = Configuration.getByPath("testng.conf")
24+
.getStringList("httpnode.ip.list").get(2);
2525

2626
/**
2727
* constructor.
@@ -60,7 +60,8 @@ public void getAccountNet() {
6060
responseContent = HttpMethed.parseResponseContent(response);
6161
HttpMethed.printJsonContent(responseContent);
6262
Assert.assertEquals(Integer.parseInt(responseContent.get("freeNetLimit").toString()),5000);
63-
Assert.assertEquals(Long.parseLong(responseContent.get("TotalNetLimit").toString()),43200000000L);
63+
Assert.assertEquals(
64+
Long.parseLong(responseContent.get("TotalNetLimit").toString()),43200000000L);
6465
Assert.assertTrue(responseContent.size() >= 2);
6566
}
6667

@@ -74,7 +75,8 @@ public void getAccountResource() {
7475
Assert.assertEquals(response.getStatusLine().getStatusCode(), 200);
7576
responseContent = HttpMethed.parseResponseContent(response);
7677
HttpMethed.printJsonContent(responseContent);
77-
Assert.assertTrue(Long.parseLong(responseContent.get("TotalEnergyLimit").toString()) >= 50000000000L);
78+
Assert.assertTrue(
79+
Long.parseLong(responseContent.get("TotalEnergyLimit").toString()) >= 50000000000L);
7880
Assert.assertTrue(responseContent.size() >= 3);
7981
}
8082

‎src/test/java/stest/tron/wallet/dailybuild/http/HttpTestAccount002.java‎

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ public class HttpTestAccount002 {
2424
private HttpResponse response;
2525
private String httpnode = Configuration.getByPath("testng.conf").getStringList("httpnode.ip.list")
2626
.get(1);
27-
private String httpSoliditynode = Configuration.getByPath("testng.conf").getStringList("httpnode.ip.list").get(2);
27+
private String httpSoliditynode = Configuration.getByPath("testng.conf")
28+
.getStringList("httpnode.ip.list").get(2);
2829

2930
ECKey ecKey1 = new ECKey(Utils.getRandom());
3031
byte[] freezeBalanceAddress = ecKey1.getAddress();
@@ -43,7 +44,7 @@ public class HttpTestAccount002 {
4344
* constructor.
4445
*/
4546
@Test(enabled = true, description = "FreezeBalance for bandwidth by http")
46-
public void test1FreezebalanceForBandwidth() {
47+
public void test01FreezebalanceForBandwidth() {
4748
PublicMethed.printAddress(freezeBalanceKey);
4849
//Send trx to test account
4950
response = HttpMethed.sendCoin(httpnode,fromAddress,freezeBalanceAddress,amount,testKey002);
@@ -65,7 +66,7 @@ public void test1FreezebalanceForBandwidth() {
6566
* constructor.
6667
*/
6768
@Test(enabled = true, description = "UnFreezeBalance for bandwidth by http")
68-
public void test2UnFreezebalanceForBandwidth() {
69+
public void test02UnFreezebalanceForBandwidth() {
6970
berforeBalance = HttpMethed.getBalance(httpnode,freezeBalanceAddress);
7071

7172
//UnFreeze balance for bandwidth
@@ -80,7 +81,7 @@ public void test2UnFreezebalanceForBandwidth() {
8081
* constructor.
8182
*/
8283
@Test(enabled = true, description = "FreezeBalance for energy by http")
83-
public void test3FreezebalanceForEnergy() {
84+
public void test03FreezebalanceForEnergy() {
8485
berforeBalance = HttpMethed.getBalance(httpnode,freezeBalanceAddress);
8586

8687
//Freeze balance for energy
@@ -96,7 +97,7 @@ public void test3FreezebalanceForEnergy() {
9697
* constructor.
9798
*/
9899
@Test(enabled = true, description = "UnFreezeBalance for energy by http")
99-
public void test4UnFreezebalanceForEnergy() {
100+
public void test04UnFreezebalanceForEnergy() {
100101

101102
berforeBalance = HttpMethed.getBalance(httpnode,freezeBalanceAddress);
102103
HttpMethed.waitToProduceOneBlock(httpnode);
@@ -112,7 +113,7 @@ public void test4UnFreezebalanceForEnergy() {
112113
* constructor.
113114
*/
114115
@Test(enabled = true, description = "FreezeBalance with bandwidth for others by http")
115-
public void test5FreezebalanceOfBandwidthForOthers() {
116+
public void test05FreezebalanceOfBandwidthForOthers() {
116117
response = HttpMethed.sendCoin(httpnode,fromAddress,receiverResourceAddress,amount,testKey002);
117118
Assert.assertTrue(HttpMethed.verificationResult(response));
118119
HttpMethed.waitToProduceOneBlock(httpnode);
@@ -131,7 +132,7 @@ public void test5FreezebalanceOfBandwidthForOthers() {
131132
* constructor.
132133
*/
133134
@Test(enabled = true, description = "Get Delegated Resource by http")
134-
public void test6GetDelegatedResource() {
135+
public void test06GetDelegatedResource() {
135136
response = HttpMethed.getDelegatedResource(
136137
httpnode,freezeBalanceAddress,receiverResourceAddress);
137138
responseContent = HttpMethed.parseResponseContent(response);
@@ -149,8 +150,9 @@ public void test6GetDelegatedResource() {
149150
/**
150151
* constructor.
151152
*/
152-
@Test(enabled = true, description = "Get Delegated Resource from solidity by http")
153-
public void test6GetDelegatedResourceFromSolidity() {
153+
@Test(enabled = false, description = "Get Delegated Resource from solidity by http")
154+
public void test07GetDelegatedResourceFromSolidity() {
155+
HttpMethed.waitToProduceOneBlockFromSolidity(httpnode,httpSoliditynode);
154156
response = HttpMethed.getDelegatedResourceFromSolidity(
155157
httpSoliditynode,freezeBalanceAddress,receiverResourceAddress);
156158
responseContent = HttpMethed.parseResponseContent(response);
@@ -169,7 +171,7 @@ public void test6GetDelegatedResourceFromSolidity() {
169171
* constructor.
170172
*/
171173
@Test(enabled = true, description = "Get Delegated Resource Account Index by http")
172-
public void test7GetDelegatedResourceAccountIndex() {
174+
public void test08GetDelegatedResourceAccountIndex() {
173175
response = HttpMethed.getDelegatedResourceAccountIndex(httpnode,freezeBalanceAddress);
174176
responseContent = HttpMethed.parseResponseContent(response);
175177
HttpMethed.printJsonContent(responseContent);
@@ -181,9 +183,10 @@ public void test7GetDelegatedResourceAccountIndex() {
181183
/**
182184
* constructor.
183185
*/
184-
@Test(enabled = true, description = "Get Delegated Resource Account Index from solidity by http")
185-
public void test7GetDelegatedResourceAccountIndexFromSolidity() {
186-
response = HttpMethed.getDelegatedResourceAccountIndexFromSolidity(httpSoliditynode,freezeBalanceAddress);
186+
@Test(enabled = false, description = "Get Delegated Resource Account Index from solidity by http")
187+
public void test09GetDelegatedResourceAccountIndexFromSolidity() {
188+
response = HttpMethed.getDelegatedResourceAccountIndexFromSolidity(httpSoliditynode,
189+
freezeBalanceAddress);
187190
responseContent = HttpMethed.parseResponseContent(response);
188191
HttpMethed.printJsonContent(responseContent);
189192
Assert.assertFalse(responseContent.get("toAccounts").toString().isEmpty());
@@ -195,7 +198,7 @@ public void test7GetDelegatedResourceAccountIndexFromSolidity() {
195198
* constructor.
196199
*/
197200
@Test(enabled = true, description = "UnFreezeBalance with bandwidth for others by http")
198-
public void test8UnFreezebalanceOfBandwidthForOthers() {
201+
public void test10UnFreezebalanceOfBandwidthForOthers() {
199202
HttpMethed.waitToProduceOneBlock(httpnode);
200203
berforeBalance = HttpMethed.getBalance(httpnode,freezeBalanceAddress);
201204

@@ -212,7 +215,7 @@ public void test8UnFreezebalanceOfBandwidthForOthers() {
212215
* constructor.
213216
*/
214217
@Test(enabled = true, description = "FreezeBalance with energy for others by http")
215-
public void test9FreezebalanceOfEnergyForOthers() {
218+
public void test11FreezebalanceOfEnergyForOthers() {
216219
response = HttpMethed.sendCoin(httpnode,fromAddress,receiverResourceAddress,amount,testKey002);
217220
Assert.assertTrue(HttpMethed.verificationResult(response));
218221
HttpMethed.waitToProduceOneBlock(httpnode);
@@ -231,7 +234,7 @@ public void test9FreezebalanceOfEnergyForOthers() {
231234
* constructor.
232235
*/
233236
@Test(enabled = true, description = "UnFreezeBalance with energy for others by http")
234-
public void test9UnFreezebalanceOfEnergyForOthers() {
237+
public void test12UnFreezebalanceOfEnergyForOthers() {
235238
berforeBalance = HttpMethed.getBalance(httpnode,freezeBalanceAddress);
236239

237240
//UnFreeze balance with energy for others

‎src/test/java/stest/tron/wallet/dailybuild/http/HttpTestAccount003.java‎

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ public class HttpTestAccount003 {
2626
private HttpResponse response;
2727
private String httpnode = Configuration.getByPath("testng.conf").getStringList("httpnode.ip.list")
2828
.get(0);
29-
private String httpSoliditynode = Configuration.getByPath("testng.conf").getStringList("httpnode.ip.list").get(2);
29+
private String httpSoliditynode = Configuration.getByPath("testng.conf")
30+
.getStringList("httpnode.ip.list").get(2);
3031
private final String witnessKey001 = Configuration.getByPath("testng.conf")
3132
.getString("witness.key1");
3233
private final byte[] witness1Address = PublicMethed.getFinalAddress(witnessKey001);
@@ -123,7 +124,8 @@ public void test3ListWitness() {
123124
* constructor.
124125
*/
125126
@Test(enabled = true, description = "List witnesses from solidity by http")
126-
public void test3ListWitnessFromSolidity() {
127+
public void test4ListWitnessFromSolidity() {
128+
HttpMethed.waitToProduceOneBlockFromSolidity(httpnode,httpSoliditynode);
127129
response = HttpMethed.listwitnessesFromSolidity(httpSoliditynode);
128130
responseContent = HttpMethed.parseResponseContent(response);
129131
HttpMethed.printJsonContent(responseContent);
@@ -135,7 +137,7 @@ public void test3ListWitnessFromSolidity() {
135137
* constructor.
136138
*/
137139
@Test(enabled = true, description = "Update witness by http")
138-
public void test4UpdateWitness() {
140+
public void test5UpdateWitness() {
139141
response = HttpMethed.updateWitness(httpnode,witness1Address,updateUrl,witnessKey001);
140142
Assert.assertTrue(HttpMethed.verificationResult(response));
141143
HttpMethed.waitToProduceOneBlock(httpnode);
@@ -151,7 +153,7 @@ public void test4UpdateWitness() {
151153
* constructor.
152154
*/
153155
@Test(enabled = true, description = "Create account by http")
154-
public void test5CreateAccount() {
156+
public void test6CreateAccount() {
155157
PublicMethed.printAddress(newAccountKey);
156158
response = HttpMethed.createAccount(httpnode,fromAddress,newAccountAddress,testKey002);
157159
Assert.assertTrue(HttpMethed.verificationResult(response));
@@ -166,8 +168,9 @@ public void test5CreateAccount() {
166168
* constructor.
167169
*/
168170
@Test(enabled = true, description = "Create witness by http")
169-
public void test6CreateWitness() {
170-
response = HttpMethed.sendCoin(httpnode,fromAddress,newAccountAddress,createWitnessAmount,testKey002);
171+
public void test7CreateWitness() {
172+
response = HttpMethed.sendCoin(httpnode,fromAddress,newAccountAddress,createWitnessAmount,
173+
testKey002);
171174
Assert.assertTrue(HttpMethed.verificationResult(response));
172175
HttpMethed.waitToProduceOneBlock(httpnode);
173176
PublicMethed.printAddress(newAccountKey);
@@ -182,18 +185,14 @@ public void test6CreateWitness() {
182185
* constructor.
183186
*/
184187
@Test(enabled = true, description = "Withdraw by http")
185-
public void test7Withdraw() {
188+
public void test8Withdraw() {
186189
response = HttpMethed.withdrawBalance(httpnode,witness1Address);
187190
responseContent = HttpMethed.parseResponseContent(response);
188191
HttpMethed.printJsonContent(responseContent);
189-
Assert.assertTrue(responseContent.getString("Error").indexOf("is a guard representative") != -1);
190-
192+
Assert.assertTrue(
193+
responseContent.getString("Error").indexOf("is a guard representative") != -1);
191194
}
192195

193-
194-
195-
196-
197196
/**
198197
* constructor.
199198
*/

‎src/test/java/stest/tron/wallet/dailybuild/http/HttpTestAsset001.java‎

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ public class HttpTestAsset001 {
2626
private HttpResponse response;
2727
private String httpnode = Configuration.getByPath("testng.conf").getStringList("httpnode.ip.list")
2828
.get(1);
29-
private String httpSoliditynode = Configuration.getByPath("testng.conf").getStringList("httpnode.ip.list").get(2);
29+
private String httpSoliditynode = Configuration.getByPath("testng.conf")
30+
.getStringList("httpnode.ip.list").get(2);
3031

3132

3233
ECKey ecKey1 = new ECKey(Utils.getRandom());
@@ -54,7 +55,7 @@ public class HttpTestAsset001 {
5455
* constructor.
5556
*/
5657
@Test(enabled = true, description = "Create asset issue by http")
57-
public void test1CreateAssetIssue() {
58+
public void test01CreateAssetIssue() {
5859
response = HttpMethed.sendCoin(httpnode, fromAddress, assetAddress, amount, testKey002);
5960
Assert.assertTrue(HttpMethed.verificationResult(response));
6061
HttpMethed.waitToProduceOneBlock(httpnode);
@@ -81,7 +82,7 @@ public void test1CreateAssetIssue() {
8182
* constructor.
8283
*/
8384
@Test(enabled = true, description = "GetAssetIssueById by http")
84-
public void test2GetAssetIssueById() {
85+
public void test02GetAssetIssueById() {
8586
HttpMethed.waitToProduceOneBlock(httpnode);
8687
response = HttpMethed.getAssetIssueById(httpnode, assetIssueId);
8788
getAssetIssueByIdContent = HttpMethed.parseResponseContent(response);
@@ -92,8 +93,8 @@ public void test2GetAssetIssueById() {
9293
/**
9394
* constructor.
9495
*/
95-
@Test(enabled = true, description = "GetAssetIssueById from solidity by http")
96-
public void test2GetAssetIssueByIdFromSolidity() {
96+
@Test(enabled = false, description = "GetAssetIssueById from solidity by http")
97+
public void test03GetAssetIssueByIdFromSolidity() {
9798
HttpMethed.waitToProduceOneBlockFromSolidity(httpnode, httpSoliditynode);
9899
response = HttpMethed.getAssetIssueByIdFromSolidity(httpSoliditynode, assetIssueId);
99100
getAssetIssueByIdContent = HttpMethed.parseResponseContent(response);
@@ -105,7 +106,7 @@ public void test2GetAssetIssueByIdFromSolidity() {
105106
* constructor.
106107
*/
107108
@Test(enabled = true, description = "GetAssetIssueByName by http")
108-
public void test3GetAssetIssueByName() {
109+
public void test04GetAssetIssueByName() {
109110
response = HttpMethed.getAssetIssueByName(httpnode, name);
110111
getAssetIssueByNameContent = HttpMethed.parseResponseContent(response);
111112
HttpMethed.printJsonContent(getAssetIssueByNameContent);
@@ -115,7 +116,7 @@ public void test3GetAssetIssueByName() {
115116
* constructor.
116117
*/
117118
@Test(enabled = true, description = "GetAssetIssueByName from solidity by http")
118-
public void test3GetAssetIssueByNameFromSolidity() {
119+
public void test05GetAssetIssueByNameFromSolidity() {
119120
response = HttpMethed.getAssetIssueByNameFromSolidity(httpSoliditynode, name);
120121
getAssetIssueByNameContent = HttpMethed.parseResponseContent(response);
121122
HttpMethed.printJsonContent(getAssetIssueByNameContent);
@@ -125,7 +126,7 @@ public void test3GetAssetIssueByNameFromSolidity() {
125126
* constructor.
126127
*/
127128
@Test(enabled = true, description = "TransferAsset by http")
128-
public void test4TransferAsset() {
129+
public void test06TransferAsset() {
129130
response = HttpMethed.transferAsset(httpnode, assetAddress, participateAddress, assetIssueId,
130131
100L, assetKey);
131132
Assert.assertTrue(HttpMethed.verificationResult(response));
@@ -140,7 +141,7 @@ public void test4TransferAsset() {
140141
* constructor.
141142
*/
142143
@Test(enabled = true, description = "Participate asset issue by http")
143-
public void test5ParticipateAssetIssue() {
144+
public void test07ParticipateAssetIssue() {
144145
HttpMethed.waitToProduceOneBlock(httpnode);
145146
response = HttpMethed.participateAssetIssue(httpnode, assetAddress, participateAddress,
146147
assetIssueId, 1000L, participateKey);
@@ -156,7 +157,7 @@ public void test5ParticipateAssetIssue() {
156157
* constructor.
157158
*/
158159
@Test(enabled = true, description = "Update asset issue by http")
159-
public void test6UpdateAssetIssue() {
160+
public void test08UpdateAssetIssue() {
160161
response = HttpMethed.updateAssetIssue(httpnode, assetAddress, updateDescription, updateUrl,
161162
290L, 390L, assetKey);
162163
Assert.assertTrue(HttpMethed.verificationResult(response));
@@ -180,7 +181,7 @@ public void test6UpdateAssetIssue() {
180181
* * constructor. *
181182
*/
182183
@Test(enabled = true, description = "Get asset issue list by http")
183-
public void test7GetAssetissueList() {
184+
public void test09GetAssetissueList() {
184185

185186
response = HttpMethed.getAssetissueList(httpnode);
186187
responseContent = HttpMethed.parseResponseContent(response);
@@ -196,8 +197,8 @@ public void test7GetAssetissueList() {
196197
* * constructor. *
197198
*/
198199
@Test(enabled = true, description = "Get asset issue list from solidity by http")
199-
public void test7GetAssetissueListFromSolidity() {
200-
200+
public void test10GetAssetissueListFromSolidity() {
201+
HttpMethed.waitToProduceOneBlockFromSolidity(httpnode,httpSoliditynode);
201202
response = HttpMethed.getAssetIssueListFromSolidity(httpSoliditynode);
202203
responseContent = HttpMethed.parseResponseContent(response);
203204
HttpMethed.printJsonContent(responseContent);
@@ -212,7 +213,7 @@ public void test7GetAssetissueListFromSolidity() {
212213
* * constructor. *
213214
*/
214215
@Test(enabled = true, description = "Get paginated asset issue list by http")
215-
public void test8GetPaginatedAssetissueList() {
216+
public void test11GetPaginatedAssetissueList() {
216217
response = HttpMethed.getPaginatedAssetissueList(httpnode, 0, 1);
217218
responseContent = HttpMethed.parseResponseContent(response);
218219
HttpMethed.printJsonContent(responseContent);
@@ -227,7 +228,7 @@ public void test8GetPaginatedAssetissueList() {
227228
* * constructor. *
228229
*/
229230
@Test(enabled = true, description = "Get paginated asset issue list from solidity by http")
230-
public void test8GetPaginatedAssetissueListFromSolidity() {
231+
public void test12GetPaginatedAssetissueListFromSolidity() {
231232
response = HttpMethed.getPaginatedAssetissueListFromSolidity(httpSoliditynode, 0, 1);
232233
responseContent = HttpMethed.parseResponseContent(response);
233234
HttpMethed.printJsonContent(responseContent);

0 commit comments

Comments
 (0)