-
Notifications
You must be signed in to change notification settings - Fork 16
/
IdentityClientTest.java
71 lines (62 loc) · 2.51 KB
/
IdentityClientTest.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
package irita.sdk;
import irita.sdk.client.IritaClient;
import irita.sdk.config.ClientConfig;
import irita.sdk.config.OpbConfig;
import irita.sdk.constant.enums.BroadcastMode;
import irita.sdk.key.KeyManager;
import irita.sdk.key.KeyManagerFactory;
import irita.sdk.model.BaseTx;
import irita.sdk.model.Fee;
import irita.sdk.module.identity.IdentityClient;
import irita.sdk.util.ByteUtils;
import org.apache.commons.lang3.StringUtils;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import proto.identity.IdentityOuterClass;
import proto.identity.QueryGrpc;
import proto.identity.QueryOuterClass;
import java.util.Properties;
import static org.junit.jupiter.api.Assertions.assertEquals;
class IdentityClientTest extends ConfigTest {
private final BaseTx baseTx = new BaseTx(200000, new Fee("300000", "ugas"), BroadcastMode.Commit);
private IdentityClient identityClient;
private IritaClient client;
@BeforeEach
public void init() {
client = getTestClient();
identityClient = client.getIdentityClient();
}
@Test
@Disabled
void createIdentity() {
try {
String str = ByteUtils.getRandomStr(16);
//String id=Hex.toHexString(str.getBytes(StandardCharsets.UTF_8));
String id = "37644773453030353876796753344436";
System.out.println(id);
identityClient.createIdentity(id,
"53281ce4ba0b8c97e5b1434f8f298b064f03d4c1d21aae9276065e170fc90a5d52",
IdentityOuterClass.PubKeyAlgorithm.SM2.name(),
"", "https://security.com/kyc/10001/", baseTx);
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
@Disabled
void updateIdentity() {
try {
identityClient.updateIdentity("37644773453030353876796753344436", "53281ce4ba0b8c97e5b1434f8f298b064f03d4c1d21aae9276065e170fc90a5d58", IdentityOuterClass.PubKeyAlgorithm.SM2.name(), "", "https://security.com/kyc/10001/", baseTx);
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
@Disabled
public void queryId() {
QueryOuterClass.QueryIdentityRequest request = QueryOuterClass.QueryIdentityRequest.newBuilder().setId("37644773453030353876796753344436").build();
QueryOuterClass.QueryIdentityResponse response = QueryGrpc.newBlockingStub(client.getBaseClient().getGrpcClient()).identity(request);
System.out.println(response.getIdentity());
}
}