OSDN Git Service

commit java sdk doc and source code
[bytom/bytom-java-sdk.git] / src / test / java / io / bytom / TestUtils.java
1 package io.bytom;
2
3 import io.bytom.common.Configuration;
4 import io.bytom.exception.BytomException;
5 import io.bytom.http.Client;
6
7 /**
8  * TestUtils provides a simplified api for testing.
9  */
10 public class TestUtils {
11     public static Client generateClient_old() throws BytomException {
12
13         String coreURL = "http://127.0.0.1:9888";
14
15         return new Client(coreURL);
16     }
17
18     public static Client generateClient() throws BytomException {
19
20         String coreURL = Configuration.getValue("bytom.api.url");
21         String accessToken = Configuration.getValue("client.access.token");
22
23         if (coreURL == null || coreURL.isEmpty()) {
24             coreURL = "http://127.0.0.1:9888/";
25         }
26
27         return new Client(coreURL, accessToken);
28     }
29 }