Skip to content

Commit 709ab31

Browse files
author
wangzihe
committed
Add stest http case
1 parent 2356d2d commit 709ab31

File tree

4 files changed

+62
-4
lines changed

4 files changed

+62
-4
lines changed

src/test/java/stest/tron/wallet/common/client/utils/HttpMethed.java

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -596,8 +596,9 @@ public static String triggerContractGetTxid(String httpNode, byte[] ownerAddress
596596
response = createConnect(requestUrl, userBaseObj2);
597597
transactionString = EntityUtils.toString(response.getEntity());
598598
logger.info(transactionString);
599+
599600
transactionSignString = gettransactionsign(httpNode,parseStringContent(transactionString)
600-
.getString("transaction"),fromKey);
601+
it st .getString("transaction"),fromKey);
601602
logger.info(transactionSignString);
602603
response = broadcastTransaction(httpNode,transactionSignString);
603604
} catch (Exception e) {
@@ -863,7 +864,7 @@ public static HttpResponse getSignWeight(String httpNode,String transactionSignS
863864
httppost.releaseConnection();
864865
return null;
865866
}
866-
httppost.releaseConnection();
867+
//httppost.releaseConnection();
867868
return response;
868869
}
869870

@@ -892,7 +893,7 @@ public static HttpResponse getTransactionApprovedList(String httpNode,
892893
httppost.releaseConnection();
893894
return null;
894895
}
895-
httppost.releaseConnection();
896+
//httppost.releaseConnection();
896897
return response;
897898
}
898899

@@ -913,6 +914,21 @@ public static HttpResponse listExchanges(String httpNode) {
913914
return response;
914915
}
915916

917+
/**
918+
* constructor.
919+
*/
920+
public static HttpResponse listNodes(String httpNode) {
921+
try {
922+
String requestUrl = "http://" + httpNode + "/wallet/listnodes";
923+
response = createConnect(requestUrl);
924+
} catch (Exception e) {
925+
e.printStackTrace();
926+
httppost.releaseConnection();
927+
return null;
928+
}
929+
return response;
930+
}
931+
916932
/**
917933
* constructor.
918934
*/
@@ -977,7 +993,22 @@ public static HttpResponse getProposalById(String httpNode, Integer proposalId)
977993
return response;
978994
}
979995

980-
996+
/**
997+
* constructor.
998+
*/
999+
public static HttpResponse getAssetIssueListByName(String httpNode, String name) {
1000+
try {
1001+
String requestUrl = "http://" + httpNode + "/wallet/getassetissuelistbyname";
1002+
JsonObject userBaseObj2 = new JsonObject();
1003+
userBaseObj2.addProperty("value", str2hex(name));
1004+
response = createConnect(requestUrl, userBaseObj2);
1005+
} catch (Exception e) {
1006+
e.printStackTrace();
1007+
httppost.releaseConnection();
1008+
return null;
1009+
}
1010+
return response;
1011+
}
9811012

9821013

9831014
/**

src/test/java/stest/tron/wallet/dailybuild/http/HttpTestBlock001.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,19 @@ public void get5BlockById() {
9797
Assert.assertEquals(blockId,responseContent.get("blockID").toString());
9898
}
9999

100+
/**
101+
* constructor.
102+
*/
103+
@Test(enabled = true, description = "List nodes by http")
104+
public void get6ListNodes() {
105+
response = HttpMethed.listNodes(httpnode);
106+
responseContent = HttpMethed.parseResponseContent(response);
107+
HttpMethed.printJsonContent(responseContent);
108+
JSONArray jsonArray = JSONArray.parseArray(responseContent.get("nodes").toString());
109+
Assert.assertTrue(jsonArray.size() >= 2);
110+
}
111+
112+
100113
/**
101114
* constructor.
102115
*/

src/test/java/stest/tron/wallet/dailybuild/http/HttpTestExchange001.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,18 @@ public void test6TransactionExchange() {
192192
}
193193

194194

195+
/**
196+
* constructor.
197+
*/
198+
@Test(enabled = true, description = "Get asset issue list by name by http")
199+
public void test7GetAssetIssueListByName() {
200+
response = HttpMethed.getAssetIssueListByName(httpnode,name);
201+
responseContent = HttpMethed.parseResponseContent(response);
202+
HttpMethed.printJsonContent(responseContent);
203+
JSONArray jsonArray = JSONArray.parseArray(responseContent.get("assetIssue").toString());
204+
Assert.assertTrue(jsonArray.size() >= 2);
205+
}
206+
195207

196208

197209

src/test/java/stest/tron/wallet/dailybuild/http/HttpTestSmartContract001.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ public void test1DeployContract() {
5858
2,3,description,url,1000L, 1000L,assetOwnerKey);
5959
Assert.assertTrue(HttpMethed.verificationResult(response));
6060

61+
HttpMethed.waitToProduceOneBlock(httpnode);
62+
6163
response = HttpMethed.getAccount(httpnode,assetOwnerAddress);
6264
responseContent = HttpMethed.parseResponseContent(response);
6365
HttpMethed.printJsonContent(responseContent);

0 commit comments

Comments
 (0)