forked from bianjieai/avata-sdk-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AccountTest.java
77 lines (70 loc) · 2.5 KB
/
AccountTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import ai.bianjie.avatasdk.AvataClient;
import ai.bianjie.avatasdk.model.account.*;
import org.junit.jupiter.api.Test;
public class AccountTest {
AvataClient client = new AvataClient.Builder()
.setDomain("")
.setApiKey("")
.setApiSecret("")
.setHttpTimeout(10000)
.init();
String OperationID = String.valueOf(System.currentTimeMillis());
@Test
//请求创建链账户接口示例
void TestCreateAccount() {
CreateAccountReq req = new CreateAccountReq();
req.setName("21233");
req.setOperationId("234231");
try {
CreateAccountRes account = client.accountClient.createAccount(req);
System.out.println(account.getData());
System.out.println("no ai.bianjie.avatasdk.exception");
} catch (Exception e) {
System.out.println(e);
e.printStackTrace();
}
}
@Test
//请求查询链账户接口示例
void TestQueryAccount() {
QueryAccountsReq req = new QueryAccountsReq();
req.setLimit("3");
try {
QueryAccountsRes account = client.accountClient.queryAccounts(req);
System.out.println(account.getData());
System.out.println("no ai.bianjie.avatasdk.exception");
} catch (Exception e) {
System.out.println(e);
e.printStackTrace();
}
}
@Test
//请求批量创建链账户接口示例
void TestBatchCreateAccount() {
BatchCreateAccountReq req = new BatchCreateAccountReq();
req.setCount(2);
req.setOperationId(OperationID);
try {
BatchCreateAccountRes account = client.accountClient.batchCreateAccounts(req);
System.out.println(account.getData());
System.out.println("no ai.bianjie.avatasdk.exception");
} catch (Exception e) {
System.out.println(e);
e.printStackTrace();
}
}
@Test
//请求查询链账户操作记录接口示例
void TestQueryAccountHistory() {
QueryAccountsHistoryReq req = new QueryAccountsHistoryReq();
req.setLimit("2");
try {
QueryAccountsHistoryRes account = client.accountClient.queryAccountsHistory(req);
System.out.println(account.getData());
System.out.println("no ai.bianjie.avatasdk.exception");
} catch (Exception e) {
System.out.println(e);
e.printStackTrace();
}
}
}