3 import io.bytom.offline.common.Configuration;
4 import io.bytom.offline.exception.BytomException;
5 import io.bytom.http.Client;
6 import org.apache.log4j.Logger;
9 * TestUtils provides a simplified api for testing.
11 public class TestUtils {
13 public static Logger logger = Logger.getLogger(TestUtils.class);
15 public static Client generateClient() throws BytomException {
17 String coreURL = Configuration.getValue("bytom.api.url");
18 String accessToken = Configuration.getValue("client.access.token");
20 if (coreURL == null || coreURL.isEmpty()) {
21 coreURL = "http://127.0.0.1:9888";
24 if (coreURL.endsWith("/")) {
25 //split the last char "/"
26 coreURL = coreURL.substring(0, coreURL.length()-1);
29 return new Client(coreURL, accessToken);