diff --git a/hugegraph-client/src/main/java/org/apache/hugegraph/api/graphs/GraphsAPI.java b/hugegraph-client/src/main/java/org/apache/hugegraph/api/graphs/GraphsAPI.java index 3a85c3d82..8310e44f1 100644 --- a/hugegraph-client/src/main/java/org/apache/hugegraph/api/graphs/GraphsAPI.java +++ b/hugegraph-client/src/main/java/org/apache/hugegraph/api/graphs/GraphsAPI.java @@ -51,8 +51,7 @@ protected String type() { } @SuppressWarnings("unchecked") - public Map create(String name, String cloneGraphName, - String configText) { + public Map create(String name, String cloneGraphName, String configText) { this.client.checkApiVersion("0.67", "dynamic graph add"); RestHeaders headers = new RestHeaders().add(RestHeaders.CONTENT_TYPE, "text/plain"); Map params = null; @@ -87,8 +86,8 @@ public void drop(String graph, String message) { } public void mode(String graph, GraphMode mode) { - // NOTE: Must provide id for PUT. If use "graph/mode", "/" will - // be encoded to "%2F". So use "mode" here although inaccurate. + // NOTE: Must provide id for PUT. If you use "graph/mode", "/" will + // be encoded to "%2F". So use "mode" here, although inaccurate. this.client.put(joinPath(this.path(), graph, MODE), null, mode); } @@ -109,16 +108,15 @@ public GraphMode mode(String graph) { public void readMode(String graph, GraphReadMode readMode) { this.client.checkApiVersion("0.59", "graph read mode"); - // NOTE: Must provide id for PUT. If use "graph/graph_read_mode", "/" - // will be encoded to "%2F". So use "graph_read_mode" here although + // NOTE: Must provide id for PUT. If you use "graph/graph_read_mode", "/" + // will be encoded to "%2F". So use "graph_read_mode" here, although // inaccurate. this.client.put(joinPath(this.path(), graph, GRAPH_READ_MODE), null, readMode); } public GraphReadMode readMode(String graph) { this.client.checkApiVersion("0.59", "graph read mode"); - RestResult result = this.client.get(joinPath(this.path(), graph), - GRAPH_READ_MODE); + RestResult result = this.client.get(joinPath(this.path(), graph), GRAPH_READ_MODE); @SuppressWarnings("unchecked") Map readMode = result.readObject(Map.class); String value = readMode.get(GRAPH_READ_MODE); diff --git a/hugegraph-client/src/main/java/org/apache/hugegraph/driver/HugeClient.java b/hugegraph-client/src/main/java/org/apache/hugegraph/driver/HugeClient.java index 6b24407d5..56acc3376 100644 --- a/hugegraph-client/src/main/java/org/apache/hugegraph/driver/HugeClient.java +++ b/hugegraph-client/src/main/java/org/apache/hugegraph/driver/HugeClient.java @@ -112,7 +112,7 @@ private void initManagers(RestClient client, String graph) { private void checkServerApiVersion() { VersionUtil.Version apiVersion = VersionUtil.Version.of(this.version.getApiVersion()); // TODO: find a way to keep the range of api version correct automatically - // 0.81 equals to the {latest_api_version} +10 + // 0.81 equals to the {latest_api_version} +10 VersionUtil.check(apiVersion, "0.38", "0.81", "hugegraph-api in server"); this.client.apiVersion(apiVersion); } diff --git a/hugegraph-client/src/main/java/org/apache/hugegraph/exception/ServerException.java b/hugegraph-client/src/main/java/org/apache/hugegraph/exception/ServerException.java index fc3c95ea5..aa9826320 100644 --- a/hugegraph-client/src/main/java/org/apache/hugegraph/exception/ServerException.java +++ b/hugegraph-client/src/main/java/org/apache/hugegraph/exception/ServerException.java @@ -29,13 +29,11 @@ public class ServerException extends RuntimeException { private static final long serialVersionUID = 6335623004322652358L; - private static final String[] EXCEPTION_KEYS = {"exception", - "Exception-Class"}; + private static final String[] EXCEPTION_KEYS = {"exception", "Exception-Class"}; private static final String[] MESSAGE_KEYS = {"message"}; private static final String[] CAUSE_KEYS = {"cause", "exceptions"}; private static final String[] TRACE_KEYS = {"trace", "stackTrace"}; - private int status = 0; private String exception; private String message; @@ -54,7 +52,7 @@ public static ServerException fromResponse(okhttp3.Response response) { exception.cause = (String) getByKeys(json, CAUSE_KEYS); exception.trace = getByKeys(json, TRACE_KEYS); } catch (Exception ignored) { - LOG.error("ServerException fromResponse excepiton"); + LOG.error("ServerException fromResponse exception"); } return exception; diff --git a/hugegraph-client/src/test/java/org/apache/hugegraph/BaseClientTest.java b/hugegraph-client/src/test/java/org/apache/hugegraph/BaseClientTest.java index 80546b84f..471f135de 100644 --- a/hugegraph-client/src/test/java/org/apache/hugegraph/BaseClientTest.java +++ b/hugegraph-client/src/test/java/org/apache/hugegraph/BaseClientTest.java @@ -57,11 +57,8 @@ public class BaseClientTest { private static HugeClient client; - protected static HugeClient open() { - client = HugeClient.builder(BASE_URL, GRAPH) - .configUser(USERNAME, PASSWORD) - .build(); - return client; + protected static void open() { + client = HugeClient.builder(BASE_URL, GRAPH).configUser(USERNAME, PASSWORD).build(); } @BeforeClass @@ -125,8 +122,7 @@ public static MetricsManager metrics() { return client.metrics(); } - protected static Object getVertexId(String label, String key, - String value) { + protected static Object getVertexId(String label, String key, String value) { return getVertex(label, key, value).id(); } @@ -148,23 +144,19 @@ protected static Edge getEdge(String label, String key, String value) { return edges.get(0); } - protected static void assertContains(List propertyKeys, - PropertyKey propertyKey) { + protected static void assertContains(List propertyKeys, PropertyKey propertyKey) { Assert.assertTrue(Utils.contains(propertyKeys, propertyKey)); } - protected static void assertContains(List vertexLabels, - VertexLabel vertexLabel) { + protected static void assertContains(List vertexLabels, VertexLabel vertexLabel) { Assert.assertTrue(Utils.contains(vertexLabels, vertexLabel)); } - protected static void assertContains(List edgeLabels, - EdgeLabel edgeLabel) { + protected static void assertContains(List edgeLabels, EdgeLabel edgeLabel) { Assert.assertTrue(Utils.contains(edgeLabels, edgeLabel)); } - protected static void assertContains(List indexLabels, - IndexLabel indexLabel) { + protected static void assertContains(List indexLabels, IndexLabel indexLabel) { Assert.assertTrue(Utils.contains(indexLabels, indexLabel)); } diff --git a/hugegraph-client/src/test/java/org/apache/hugegraph/functional/EdgeTest.java b/hugegraph-client/src/test/java/org/apache/hugegraph/functional/EdgeTest.java index f379cbf4f..eafb2fe1e 100644 --- a/hugegraph-client/src/test/java/org/apache/hugegraph/functional/EdgeTest.java +++ b/hugegraph-client/src/test/java/org/apache/hugegraph/functional/EdgeTest.java @@ -46,9 +46,8 @@ public class EdgeTest extends BaseFuncTest { - private static void assertContains(List edges, Object source, - String label, Object target, - Object... keyValues) { + private static void assertContains(List edges, Object source, String label, + Object target, Object... keyValues) { Map properties = Utils.asMap(keyValues); Edge edge = new Edge(label);