This is an automated email from the ASF dual-hosted git repository.
vaughn pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph.git
The following commit(s) were added to refs/heads/master by this push:
new 66b167422 fix: User-controlled data in numeric cast [#1987] (#1996)
66b167422 is described below
commit 66b167422f86d326171ce78e4a85548fac8a0d47
Author: zyxxoo <[email protected]>
AuthorDate: Sun Oct 30 23:29:50 2022 +0800
fix: User-controlled data in numeric cast [#1987] (#1996)
* fix: User-controlled data in numeric cast [#1987]
---
.../src/main/java/com/baidu/hugegraph/api/API.java | 1 -
.../com/baidu/hugegraph/api/auth/AccessAPI.java | 1 -
.../com/baidu/hugegraph/api/auth/BelongAPI.java | 1 -
.../com/baidu/hugegraph/api/auth/GroupAPI.java | 1 -
.../com/baidu/hugegraph/api/auth/LoginAPI.java | 1 -
.../com/baidu/hugegraph/api/auth/ProjectAPI.java | 1 -
.../com/baidu/hugegraph/api/auth/TargetAPI.java | 1 -
.../java/com/baidu/hugegraph/api/auth/UserAPI.java | 1 -
.../hugegraph/api/filter/CompressInterceptor.java | 1 -
.../com/baidu/hugegraph/api/job/ComputerAPI.java | 1 -
.../com/baidu/hugegraph/api/job/GremlinAPI.java | 1 -
.../java/com/baidu/hugegraph/api/job/TaskAPI.java | 1 -
.../com/baidu/hugegraph/api/profile/GraphsAPI.java | 1 -
.../hugegraph/api/traversers/AdamicAdarAPI.java | 2 +-
.../api/traversers/AllShortestPathsAPI.java | 1 -
.../baidu/hugegraph/api/traversers/CountAPI.java | 1 -
.../hugegraph/api/traversers/CrosspointsAPI.java | 3 +-
.../api/traversers/CustomizedCrosspointsAPI.java | 3 +-
.../api/traversers/CustomizedPathsAPI.java | 3 +-
.../baidu/hugegraph/api/traversers/EdgesAPI.java | 1 -
.../api/traversers/FusiformSimilarityAPI.java | 3 +-
.../api/traversers/JaccardSimilarityAPI.java | 1 -
.../hugegraph/api/traversers/KneighborAPI.java | 5 +-
.../baidu/hugegraph/api/traversers/KoutAPI.java | 5 +-
.../api/traversers/MultiNodeShortestPathAPI.java | 1 -
.../hugegraph/api/traversers/NeighborRankAPI.java | 1 -
.../baidu/hugegraph/api/traversers/PathsAPI.java | 5 +-
.../hugegraph/api/traversers/PersonalRankAPI.java | 3 +-
.../baidu/hugegraph/api/traversers/RaysAPI.java | 3 +-
.../api/traversers/ResourceAllocationAPI.java | 2 +-
.../baidu/hugegraph/api/traversers/RingsAPI.java | 3 +-
.../hugegraph/api/traversers/SameNeighborsAPI.java | 3 +-
.../hugegraph/api/traversers/ShortestPathAPI.java | 1 -
.../traversers/SingleSourceShortestPathAPI.java | 3 +-
.../hugegraph/api/traversers/TemplatePathsAPI.java | 3 +-
.../hugegraph/api/traversers/VerticesAPI.java | 1 -
.../api/traversers/WeightedShortestPathAPI.java | 1 -
.../hugegraph/api/variables/VariablesAPI.java | 1 -
.../baidu/hugegraph/auth/HugeAuthenticator.java | 2 +-
.../baidu/hugegraph/auth/HugeFactoryAuthProxy.java | 4 ++
.../baidu/hugegraph/auth/HugeGraphAuthProxy.java | 1 +
.../hugegraph/auth/StandardAuthenticator.java | 6 +-
.../baidu/hugegraph/license/LicenseVerifier.java | 1 -
.../baidu/hugegraph/analyzer/AnalyzerFactory.java | 12 ++--
.../hugegraph/backend/store/BackendStoreInfo.java | 1 -
.../election/RoleElectionStateMachineImpl.java | 8 +--
.../traversal/algorithm/PredictionTraverser.java | 6 +-
.../traversal/algorithm/SameNeighborTraverser.java | 4 +-
.../java/com/baidu/hugegraph/util/RateLimiter.java | 2 -
.../assembly/static/conf/rest-server.properties | 3 +-
.../backend/store/hbase/HbaseSessions.java | 9 +--
.../hugegraph/backend/store/palo/PaloTable.java | 1 -
.../store/postgresql/PostgresqlSessions.java | 1 -
.../core/RoleElectionStateMachineTest.java | 25 ++++++---
.../java/com/baidu/hugegraph/testutil/Utils.java | 6 ++
.../baidu/hugegraph/unit/core/AnalyzerTest.java | 64 +++++++++++-----------
56 files changed, 105 insertions(+), 123 deletions(-)
diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/API.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/API.java
index e1c98b156..ab84acad2 100644
--- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/API.java
+++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/API.java
@@ -36,7 +36,6 @@ import com.baidu.hugegraph.HugeGraph;
import com.baidu.hugegraph.core.GraphManager;
import com.baidu.hugegraph.define.Checkable;
import com.baidu.hugegraph.metrics.MetricsUtil;
-import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.util.E;
import com.baidu.hugegraph.util.JsonUtil;
import com.baidu.hugegraph.util.Log;
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/AccessAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/AccessAPI.java
index 7e9b61e2e..b616d6dd9 100644
--- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/AccessAPI.java
+++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/AccessAPI.java
@@ -46,7 +46,6 @@ import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.core.GraphManager;
import com.baidu.hugegraph.define.Checkable;
import com.baidu.hugegraph.exception.NotFoundException;
-import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.util.E;
import com.baidu.hugegraph.util.Log;
import com.codahale.metrics.annotation.Timed;
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/BelongAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/BelongAPI.java
index 1567be3ce..0435c6088 100644
--- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/BelongAPI.java
+++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/BelongAPI.java
@@ -45,7 +45,6 @@ import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.core.GraphManager;
import com.baidu.hugegraph.define.Checkable;
import com.baidu.hugegraph.exception.NotFoundException;
-import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.util.E;
import com.baidu.hugegraph.util.Log;
import com.codahale.metrics.annotation.Timed;
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/GroupAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/GroupAPI.java
index 753772402..943a5d8bb 100644
--- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/GroupAPI.java
+++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/GroupAPI.java
@@ -45,7 +45,6 @@ import com.baidu.hugegraph.backend.id.IdGenerator;
import com.baidu.hugegraph.core.GraphManager;
import com.baidu.hugegraph.define.Checkable;
import com.baidu.hugegraph.exception.NotFoundException;
-import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.util.E;
import com.baidu.hugegraph.util.Log;
import com.codahale.metrics.annotation.Timed;
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/LoginAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/LoginAPI.java
index 75b68e506..08e190393 100644
--- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/LoginAPI.java
+++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/LoginAPI.java
@@ -47,7 +47,6 @@ import com.baidu.hugegraph.auth.AuthConstant;
import com.baidu.hugegraph.auth.UserWithRole;
import com.baidu.hugegraph.core.GraphManager;
import com.baidu.hugegraph.define.Checkable;
-import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.util.E;
import com.baidu.hugegraph.util.Log;
import com.codahale.metrics.annotation.Timed;
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/ProjectAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/ProjectAPI.java
index 871824f40..6ecbe8de5 100644
--- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/ProjectAPI.java
+++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/ProjectAPI.java
@@ -50,7 +50,6 @@ import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.core.GraphManager;
import com.baidu.hugegraph.define.Checkable;
import com.baidu.hugegraph.exception.NotFoundException;
-import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.util.E;
import com.baidu.hugegraph.util.Log;
import com.codahale.metrics.annotation.Timed;
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/TargetAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/TargetAPI.java
index 5ac5fb5f5..c19facc8e 100644
--- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/TargetAPI.java
+++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/TargetAPI.java
@@ -45,7 +45,6 @@ import com.baidu.hugegraph.auth.HugeTarget;
import com.baidu.hugegraph.core.GraphManager;
import com.baidu.hugegraph.define.Checkable;
import com.baidu.hugegraph.exception.NotFoundException;
-import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.util.E;
import com.baidu.hugegraph.util.JsonUtil;
import com.baidu.hugegraph.util.Log;
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/UserAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/UserAPI.java
index 2c3334e87..ce4fe3b31 100644
--- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/UserAPI.java
+++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/UserAPI.java
@@ -47,7 +47,6 @@ import com.baidu.hugegraph.backend.id.IdGenerator;
import com.baidu.hugegraph.core.GraphManager;
import com.baidu.hugegraph.define.Checkable;
import com.baidu.hugegraph.exception.NotFoundException;
-import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.util.E;
import com.baidu.hugegraph.util.Log;
import com.baidu.hugegraph.util.StringEncoding;
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/CompressInterceptor.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/CompressInterceptor.java
index df342af8d..b7c3f24cf 100644
---
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/CompressInterceptor.java
+++
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/CompressInterceptor.java
@@ -36,7 +36,6 @@ import jakarta.inject.Singleton;
import org.slf4j.Logger;
-import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.util.Log;
@Provider
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/ComputerAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/ComputerAPI.java
index 5527cc7aa..f3825f893 100644
--- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/ComputerAPI.java
+++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/ComputerAPI.java
@@ -40,7 +40,6 @@ import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.core.GraphManager;
import com.baidu.hugegraph.job.ComputerJob;
import com.baidu.hugegraph.job.JobBuilder;
-import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.task.HugeTask;
import com.baidu.hugegraph.util.E;
import com.baidu.hugegraph.util.JsonUtil;
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/GremlinAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/GremlinAPI.java
index 1f6e177d0..46039271a 100644
--- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/GremlinAPI.java
+++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/GremlinAPI.java
@@ -49,7 +49,6 @@ import com.baidu.hugegraph.define.Checkable;
import com.baidu.hugegraph.job.GremlinJob;
import com.baidu.hugegraph.job.JobBuilder;
import com.baidu.hugegraph.metrics.MetricsUtil;
-import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.util.E;
import com.baidu.hugegraph.util.JsonUtil;
import com.baidu.hugegraph.util.Log;
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/TaskAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/TaskAPI.java
index c96fb6008..bdd7bdc8d 100644
--- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/TaskAPI.java
+++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/TaskAPI.java
@@ -49,7 +49,6 @@ import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.backend.id.IdGenerator;
import com.baidu.hugegraph.backend.page.PageInfo;
import com.baidu.hugegraph.core.GraphManager;
-import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.task.HugeTask;
import com.baidu.hugegraph.task.TaskScheduler;
import com.baidu.hugegraph.task.TaskStatus;
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/profile/GraphsAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/profile/GraphsAPI.java
index 1b784f759..d59a9afaa 100644
--- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/profile/GraphsAPI.java
+++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/profile/GraphsAPI.java
@@ -50,7 +50,6 @@ import
com.baidu.hugegraph.auth.HugeAuthenticator.RequiredPerm;
import com.baidu.hugegraph.auth.HugePermission;
import com.baidu.hugegraph.config.HugeConfig;
import com.baidu.hugegraph.core.GraphManager;
-import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.type.define.GraphMode;
import com.baidu.hugegraph.type.define.GraphReadMode;
import com.baidu.hugegraph.util.E;
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/AdamicAdarAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/AdamicAdarAPI.java
index f8bcd5d60..2f3dc115e 100644
---
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/AdamicAdarAPI.java
+++
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/AdamicAdarAPI.java
@@ -67,7 +67,7 @@ public class AdamicAdarAPI extends API {
@QueryParam("max_degree")
@DefaultValue(DEFAULT_MAX_DEGREE) long maxDegree,
@QueryParam("limit")
- @DefaultValue(DEFAULT_ELEMENTS_LIMIT) long limit) {
+ @DefaultValue(DEFAULT_ELEMENTS_LIMIT) int limit) {
LOG.debug("Graph [{}] get adamic adar between '{}' and '{}' with " +
"direction {}, edge label {}, max degree '{}' and limit
'{}'",
graph, current, other, direction, edgeLabel, maxDegree,
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/AllShortestPathsAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/AllShortestPathsAPI.java
index 5f33a6f5d..2b8660f90 100644
---
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/AllShortestPathsAPI.java
+++
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/AllShortestPathsAPI.java
@@ -42,7 +42,6 @@ import com.baidu.hugegraph.api.graph.EdgeAPI;
import com.baidu.hugegraph.api.graph.VertexAPI;
import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.core.GraphManager;
-import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.traversal.algorithm.HugeTraverser;
import com.baidu.hugegraph.traversal.algorithm.ShortestPathTraverser;
import com.baidu.hugegraph.type.define.Directions;
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CountAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CountAPI.java
index ef93aa8e3..3a0ebb2e6 100644
---
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CountAPI.java
+++
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CountAPI.java
@@ -41,7 +41,6 @@ import com.baidu.hugegraph.HugeGraph;
import com.baidu.hugegraph.api.API;
import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.core.GraphManager;
-import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.structure.HugeVertex;
import com.baidu.hugegraph.traversal.algorithm.CountTraverser;
import com.baidu.hugegraph.traversal.algorithm.steps.EdgeStep;
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CrosspointsAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CrosspointsAPI.java
index 689df287b..53daf2f1d 100644
---
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CrosspointsAPI.java
+++
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CrosspointsAPI.java
@@ -41,7 +41,6 @@ import com.baidu.hugegraph.api.graph.EdgeAPI;
import com.baidu.hugegraph.api.graph.VertexAPI;
import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.core.GraphManager;
-import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.traversal.algorithm.HugeTraverser;
import com.baidu.hugegraph.traversal.algorithm.PathsTraverser;
import com.baidu.hugegraph.type.define.Directions;
@@ -70,7 +69,7 @@ public class CrosspointsAPI extends API {
@QueryParam("capacity")
@DefaultValue(DEFAULT_CAPACITY) long capacity,
@QueryParam("limit")
- @DefaultValue(DEFAULT_PATHS_LIMIT) long limit) {
+ @DefaultValue(DEFAULT_PATHS_LIMIT) int limit) {
LOG.debug("Graph [{}] get crosspoints with paths from '{}', to '{}' " +
"with direction '{}', edge label '{}', max depth '{}', " +
"max degree '{}', capacity '{}' and limit '{}'",
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedCrosspointsAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedCrosspointsAPI.java
index 5af4a3cb2..c1699e9bd 100644
---
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedCrosspointsAPI.java
+++
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedCrosspointsAPI.java
@@ -47,7 +47,6 @@ import com.baidu.hugegraph.api.API;
import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.backend.query.QueryResults;
import com.baidu.hugegraph.core.GraphManager;
-import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.traversal.algorithm.CustomizedCrosspointsTraverser;
import com.baidu.hugegraph.traversal.algorithm.HugeTraverser;
import com.baidu.hugegraph.type.define.Directions;
@@ -141,7 +140,7 @@ public class CustomizedCrosspointsAPI extends API {
@JsonProperty("capacity")
public long capacity = Long.parseLong(DEFAULT_CAPACITY);
@JsonProperty("limit")
- public long limit = Long.parseLong(DEFAULT_PATHS_LIMIT);
+ public int limit = Integer.parseInt(DEFAULT_PATHS_LIMIT);
@JsonProperty("with_path")
public boolean withPath = false;
@JsonProperty("with_vertex")
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedPathsAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedPathsAPI.java
index 3c1d9559a..4e525f287 100644
---
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedPathsAPI.java
+++
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedPathsAPI.java
@@ -49,7 +49,6 @@ import com.baidu.hugegraph.api.API;
import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.backend.query.QueryResults;
import com.baidu.hugegraph.core.GraphManager;
-import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.traversal.algorithm.CustomizePathsTraverser;
import com.baidu.hugegraph.traversal.algorithm.HugeTraverser;
import com.baidu.hugegraph.traversal.algorithm.steps.WeightedEdgeStep;
@@ -141,7 +140,7 @@ public class CustomizedPathsAPI extends API {
@JsonProperty("capacity")
public long capacity = Long.parseLong(DEFAULT_CAPACITY);
@JsonProperty("limit")
- public long limit = Long.parseLong(DEFAULT_PATHS_LIMIT);
+ public int limit = Integer.parseInt(DEFAULT_PATHS_LIMIT);
@JsonProperty("with_vertex")
public boolean withVertex = false;
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/EdgesAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/EdgesAPI.java
index a155b0e52..200d0b1ae 100644
---
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/EdgesAPI.java
+++
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/EdgesAPI.java
@@ -44,7 +44,6 @@ import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.backend.query.ConditionQuery;
import com.baidu.hugegraph.backend.store.Shard;
import com.baidu.hugegraph.core.GraphManager;
-import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.structure.HugeEdge;
import com.baidu.hugegraph.type.HugeType;
import com.baidu.hugegraph.util.E;
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/FusiformSimilarityAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/FusiformSimilarityAPI.java
index 6a34e9e6f..8e659c101 100644
---
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/FusiformSimilarityAPI.java
+++
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/FusiformSimilarityAPI.java
@@ -43,7 +43,6 @@ import com.baidu.hugegraph.HugeGraph;
import com.baidu.hugegraph.api.API;
import com.baidu.hugegraph.backend.query.QueryResults;
import com.baidu.hugegraph.core.GraphManager;
-import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.traversal.algorithm.FusiformSimilarityTraverser;
import
com.baidu.hugegraph.traversal.algorithm.FusiformSimilarityTraverser.SimilarsMap;
import com.baidu.hugegraph.type.define.Directions;
@@ -146,7 +145,7 @@ public class FusiformSimilarityAPI extends API {
@JsonProperty("capacity")
public long capacity = Long.parseLong(DEFAULT_CAPACITY);
@JsonProperty("limit")
- public long limit = Long.parseLong(DEFAULT_PATHS_LIMIT);
+ public int limit = Integer.parseInt(DEFAULT_PATHS_LIMIT);
@JsonProperty("with_intermediary")
public boolean withIntermediary = false;
@JsonProperty("with_vertex")
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/JaccardSimilarityAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/JaccardSimilarityAPI.java
index d8ec29562..3a31cf4eb 100644
---
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/JaccardSimilarityAPI.java
+++
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/JaccardSimilarityAPI.java
@@ -44,7 +44,6 @@ import com.baidu.hugegraph.api.graph.EdgeAPI;
import com.baidu.hugegraph.api.graph.VertexAPI;
import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.core.GraphManager;
-import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.structure.HugeVertex;
import com.baidu.hugegraph.traversal.algorithm.steps.EdgeStep;
import com.baidu.hugegraph.traversal.algorithm.JaccardSimilarTraverser;
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/KneighborAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/KneighborAPI.java
index 71e85b528..31fd626f8 100644
---
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/KneighborAPI.java
+++
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/KneighborAPI.java
@@ -49,7 +49,6 @@ import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.backend.query.Query;
import com.baidu.hugegraph.backend.query.QueryResults;
import com.baidu.hugegraph.core.GraphManager;
-import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.structure.HugeVertex;
import com.baidu.hugegraph.traversal.algorithm.HugeTraverser;
import com.baidu.hugegraph.traversal.algorithm.KneighborTraverser;
@@ -81,7 +80,7 @@ public class KneighborAPI extends TraverserAPI {
@QueryParam("max_degree")
@DefaultValue(DEFAULT_MAX_DEGREE) long maxDegree,
@QueryParam("limit")
- @DefaultValue(DEFAULT_ELEMENTS_LIMIT) long limit) {
+ @DefaultValue(DEFAULT_ELEMENTS_LIMIT) int limit) {
LOG.debug("Graph [{}] get k-neighbor from '{}' with " +
"direction '{}', edge label '{}', max depth '{}', " +
"max degree '{}' and limit '{}'",
@@ -172,7 +171,7 @@ public class KneighborAPI extends TraverserAPI {
@JsonProperty("max_depth")
public int maxDepth;
@JsonProperty("limit")
- public long limit = Long.parseLong(DEFAULT_ELEMENTS_LIMIT);
+ public int limit = Integer.parseInt(DEFAULT_ELEMENTS_LIMIT);
@JsonProperty("count_only")
public boolean countOnly = false;
@JsonProperty("with_vertex")
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/KoutAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/KoutAPI.java
index ef315dd36..11a069cf8 100644
---
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/KoutAPI.java
+++
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/KoutAPI.java
@@ -50,7 +50,6 @@ import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.backend.query.Query;
import com.baidu.hugegraph.backend.query.QueryResults;
import com.baidu.hugegraph.core.GraphManager;
-import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.structure.HugeVertex;
import com.baidu.hugegraph.traversal.algorithm.HugeTraverser;
import com.baidu.hugegraph.traversal.algorithm.KoutTraverser;
@@ -86,7 +85,7 @@ public class KoutAPI extends TraverserAPI {
@QueryParam("capacity")
@DefaultValue(DEFAULT_CAPACITY) long capacity,
@QueryParam("limit")
- @DefaultValue(DEFAULT_ELEMENTS_LIMIT) long limit) {
+ @DefaultValue(DEFAULT_ELEMENTS_LIMIT) int limit) {
LOG.debug("Graph [{}] get k-out from '{}' with " +
"direction '{}', edge label '{}', max depth '{}', nearest " +
"'{}', max degree '{}', capacity '{}' and limit '{}'",
@@ -188,7 +187,7 @@ public class KoutAPI extends TraverserAPI {
@JsonProperty("capacity")
public long capacity = Long.parseLong(DEFAULT_CAPACITY);
@JsonProperty("limit")
- public long limit = Long.parseLong(DEFAULT_ELEMENTS_LIMIT);
+ public int limit = Integer.parseInt(DEFAULT_ELEMENTS_LIMIT);
@JsonProperty("with_vertex")
public boolean withVertex = false;
@JsonProperty("with_path")
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/MultiNodeShortestPathAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/MultiNodeShortestPathAPI.java
index f09da7385..dcf9d715f 100644
---
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/MultiNodeShortestPathAPI.java
+++
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/MultiNodeShortestPathAPI.java
@@ -42,7 +42,6 @@ import com.baidu.hugegraph.HugeGraph;
import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.backend.query.QueryResults;
import com.baidu.hugegraph.core.GraphManager;
-import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.traversal.algorithm.steps.EdgeStep;
import com.baidu.hugegraph.traversal.algorithm.HugeTraverser;
import com.baidu.hugegraph.traversal.algorithm.MultiNodeShortestPathTraverser;
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankAPI.java
index d164db502..7361c27a1 100644
---
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankAPI.java
+++
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankAPI.java
@@ -42,7 +42,6 @@ import com.baidu.hugegraph.HugeGraph;
import com.baidu.hugegraph.api.API;
import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.core.GraphManager;
-import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.structure.HugeVertex;
import com.baidu.hugegraph.traversal.algorithm.NeighborRankTraverser;
import com.baidu.hugegraph.type.define.Directions;
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PathsAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PathsAPI.java
index fa87db58a..c227c283e 100644
---
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PathsAPI.java
+++
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PathsAPI.java
@@ -50,7 +50,6 @@ import com.baidu.hugegraph.api.graph.VertexAPI;
import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.backend.query.QueryResults;
import com.baidu.hugegraph.core.GraphManager;
-import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.traversal.algorithm.CollectionPathsTraverser;
import com.baidu.hugegraph.traversal.algorithm.HugeTraverser;
import com.baidu.hugegraph.traversal.algorithm.PathsTraverser;
@@ -83,7 +82,7 @@ public class PathsAPI extends TraverserAPI {
@QueryParam("capacity")
@DefaultValue(DEFAULT_CAPACITY) long capacity,
@QueryParam("limit")
- @DefaultValue(DEFAULT_PATHS_LIMIT) long limit) {
+ @DefaultValue(DEFAULT_PATHS_LIMIT) int limit) {
LOG.debug("Graph [{}] get paths from '{}', to '{}' with " +
"direction {}, edge label {}, max depth '{}', " +
"max degree '{}', capacity '{}' and limit '{}'",
@@ -169,7 +168,7 @@ public class PathsAPI extends TraverserAPI {
@JsonProperty("capacity")
public long capacity = Long.parseLong(DEFAULT_CAPACITY);
@JsonProperty("limit")
- public long limit = Long.parseLong(DEFAULT_PATHS_LIMIT);
+ public int limit = Integer.parseInt(DEFAULT_PATHS_LIMIT);
@JsonProperty("with_vertex")
public boolean withVertex = false;
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankAPI.java
index da74ef04b..96c17e9e8 100644
---
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankAPI.java
+++
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankAPI.java
@@ -40,7 +40,6 @@ import com.baidu.hugegraph.HugeGraph;
import com.baidu.hugegraph.api.API;
import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.core.GraphManager;
-import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.structure.HugeVertex;
import com.baidu.hugegraph.traversal.algorithm.HugeTraverser;
import com.baidu.hugegraph.traversal.algorithm.PersonalRankTraverser;
@@ -121,7 +120,7 @@ public class PersonalRankAPI extends API {
@JsonProperty("max_degree")
private long maxDegree = Long.parseLong(DEFAULT_MAX_DEGREE);
@JsonProperty("limit")
- private long limit = Long.parseLong(DEFAULT_LIMIT);
+ private int limit = Integer.parseInt(DEFAULT_LIMIT);
@JsonProperty("max_depth")
private int maxDepth = DEFAULT_DEPTH;
@JsonProperty("with_label")
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/RaysAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/RaysAPI.java
index 321b4eb2c..c2b78f43d 100644
---
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/RaysAPI.java
+++
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/RaysAPI.java
@@ -41,7 +41,6 @@ import com.baidu.hugegraph.api.graph.EdgeAPI;
import com.baidu.hugegraph.api.graph.VertexAPI;
import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.core.GraphManager;
-import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.traversal.algorithm.HugeTraverser;
import com.baidu.hugegraph.traversal.algorithm.SubGraphTraverser;
import com.baidu.hugegraph.type.define.Directions;
@@ -69,7 +68,7 @@ public class RaysAPI extends API {
@QueryParam("capacity")
@DefaultValue(DEFAULT_CAPACITY) long capacity,
@QueryParam("limit")
- @DefaultValue(DEFAULT_PATHS_LIMIT) long limit) {
+ @DefaultValue(DEFAULT_PATHS_LIMIT) int limit) {
LOG.debug("Graph [{}] get rays paths from '{}' with " +
"direction '{}', edge label '{}', max depth '{}', " +
"max degree '{}', capacity '{}' and limit '{}'",
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/ResourceAllocationAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/ResourceAllocationAPI.java
index 5c4b1e8b2..ed729ad1c 100644
---
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/ResourceAllocationAPI.java
+++
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/ResourceAllocationAPI.java
@@ -67,7 +67,7 @@ public class ResourceAllocationAPI extends API {
@QueryParam("max_degree")
@DefaultValue(DEFAULT_MAX_DEGREE) long maxDegree,
@QueryParam("limit")
- @DefaultValue(DEFAULT_ELEMENTS_LIMIT) long limit) {
+ @DefaultValue(DEFAULT_ELEMENTS_LIMIT) int limit) {
LOG.debug("Graph [{}] get resource allocation between '{}' and '{}' " +
"with direction {}, edge label {}, max degree '{}' and " +
"limit '{}'", graph, current, other, direction, edgeLabel,
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/RingsAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/RingsAPI.java
index 0bb1cb0a5..057420816 100644
---
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/RingsAPI.java
+++
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/RingsAPI.java
@@ -41,7 +41,6 @@ import com.baidu.hugegraph.api.graph.EdgeAPI;
import com.baidu.hugegraph.api.graph.VertexAPI;
import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.core.GraphManager;
-import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.traversal.algorithm.HugeTraverser;
import com.baidu.hugegraph.traversal.algorithm.SubGraphTraverser;
import com.baidu.hugegraph.type.define.Directions;
@@ -71,7 +70,7 @@ public class RingsAPI extends API {
@QueryParam("capacity")
@DefaultValue(DEFAULT_CAPACITY) long capacity,
@QueryParam("limit")
- @DefaultValue(DEFAULT_PATHS_LIMIT) long limit) {
+ @DefaultValue(DEFAULT_PATHS_LIMIT) int limit) {
LOG.debug("Graph [{}] get rings paths reachable from '{}' with " +
"direction '{}', edge label '{}', max depth '{}', " +
"source in ring '{}', max degree '{}', capacity '{}' " +
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SameNeighborsAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SameNeighborsAPI.java
index 6d87ec1d0..1653e040e 100644
---
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SameNeighborsAPI.java
+++
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SameNeighborsAPI.java
@@ -42,7 +42,6 @@ import com.baidu.hugegraph.api.graph.EdgeAPI;
import com.baidu.hugegraph.api.graph.VertexAPI;
import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.core.GraphManager;
-import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.traversal.algorithm.SameNeighborTraverser;
import com.baidu.hugegraph.type.define.Directions;
import com.baidu.hugegraph.util.Log;
@@ -67,7 +66,7 @@ public class SameNeighborsAPI extends API {
@QueryParam("max_degree")
@DefaultValue(DEFAULT_MAX_DEGREE) long maxDegree,
@QueryParam("limit")
- @DefaultValue(DEFAULT_ELEMENTS_LIMIT) long limit) {
+ @DefaultValue(DEFAULT_ELEMENTS_LIMIT) int limit) {
LOG.debug("Graph [{}] get same neighbors between '{}' and '{}' with " +
"direction {}, edge label {}, max degree '{}' and limit
'{}'",
graph, vertex, other, direction, edgeLabel, maxDegree,
limit);
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/ShortestPathAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/ShortestPathAPI.java
index fbe6555f2..f64e369b2 100644
---
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/ShortestPathAPI.java
+++
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/ShortestPathAPI.java
@@ -42,7 +42,6 @@ import com.baidu.hugegraph.api.graph.EdgeAPI;
import com.baidu.hugegraph.api.graph.VertexAPI;
import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.core.GraphManager;
-import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.traversal.algorithm.HugeTraverser;
import com.baidu.hugegraph.traversal.algorithm.ShortestPathTraverser;
import com.baidu.hugegraph.type.define.Directions;
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SingleSourceShortestPathAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SingleSourceShortestPathAPI.java
index fd3ebd345..6e0b612ea 100644
---
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SingleSourceShortestPathAPI.java
+++
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SingleSourceShortestPathAPI.java
@@ -45,7 +45,6 @@ import com.baidu.hugegraph.api.graph.VertexAPI;
import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.backend.query.QueryResults;
import com.baidu.hugegraph.core.GraphManager;
-import com.baidu.hugegraph.server.RestServer;
import
com.baidu.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser;
import
com.baidu.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser.WeightedPaths;
import com.baidu.hugegraph.type.define.Directions;
@@ -75,7 +74,7 @@ public class SingleSourceShortestPathAPI extends API {
@QueryParam("capacity")
@DefaultValue(DEFAULT_CAPACITY) long capacity,
@QueryParam("limit")
- @DefaultValue(DEFAULT_PATHS_LIMIT) long limit,
+ @DefaultValue(DEFAULT_PATHS_LIMIT) int limit,
@QueryParam("with_vertex") boolean withVertex) {
LOG.debug("Graph [{}] get single source shortest path from '{}' " +
"with direction {}, edge label {}, weight property {}, " +
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/TemplatePathsAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/TemplatePathsAPI.java
index b593aa0a7..fdc8eca28 100644
---
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/TemplatePathsAPI.java
+++
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/TemplatePathsAPI.java
@@ -44,7 +44,6 @@ import com.baidu.hugegraph.HugeGraph;
import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.backend.query.QueryResults;
import com.baidu.hugegraph.core.GraphManager;
-import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.traversal.algorithm.HugeTraverser;
import com.baidu.hugegraph.traversal.algorithm.TemplatePathsTraverser;
import com.baidu.hugegraph.traversal.algorithm.steps.RepeatEdgeStep;
@@ -136,7 +135,7 @@ public class TemplatePathsAPI extends TraverserAPI {
@JsonProperty("capacity")
public long capacity = Long.parseLong(DEFAULT_CAPACITY);
@JsonProperty("limit")
- public long limit = Long.parseLong(DEFAULT_PATHS_LIMIT);
+ public int limit = Integer.parseInt(DEFAULT_PATHS_LIMIT);
@JsonProperty("with_vertex")
public boolean withVertex = false;
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/VerticesAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/VerticesAPI.java
index d9c0b7078..56b10d8f4 100644
---
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/VerticesAPI.java
+++
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/VerticesAPI.java
@@ -45,7 +45,6 @@ import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.backend.query.ConditionQuery;
import com.baidu.hugegraph.backend.store.Shard;
import com.baidu.hugegraph.core.GraphManager;
-import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.type.HugeType;
import com.baidu.hugegraph.util.E;
import com.baidu.hugegraph.util.Log;
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/WeightedShortestPathAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/WeightedShortestPathAPI.java
index 4cdd1f257..65dfdf52a 100644
---
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/WeightedShortestPathAPI.java
+++
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/WeightedShortestPathAPI.java
@@ -44,7 +44,6 @@ import com.baidu.hugegraph.api.graph.VertexAPI;
import com.baidu.hugegraph.backend.id.Id;
import com.baidu.hugegraph.backend.query.QueryResults;
import com.baidu.hugegraph.core.GraphManager;
-import com.baidu.hugegraph.server.RestServer;
import
com.baidu.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser;
import
com.baidu.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser.NodeWithWeight;
import com.baidu.hugegraph.type.define.Directions;
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/variables/VariablesAPI.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/variables/VariablesAPI.java
index bacce9c4b..ab931ff12 100644
---
a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/variables/VariablesAPI.java
+++
b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/variables/VariablesAPI.java
@@ -39,7 +39,6 @@ import org.slf4j.Logger;
import com.baidu.hugegraph.HugeGraph;
import com.baidu.hugegraph.api.API;
import com.baidu.hugegraph.core.GraphManager;
-import com.baidu.hugegraph.server.RestServer;
import com.baidu.hugegraph.util.E;
import com.baidu.hugegraph.util.Log;
import com.codahale.metrics.annotation.Timed;
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeAuthenticator.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeAuthenticator.java
index 88c5c7870..66c6a935e 100644
---
a/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeAuthenticator.java
+++
b/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeAuthenticator.java
@@ -81,7 +81,7 @@ public interface HugeAuthenticator extends Authenticator {
@Override
default User authenticate(final Map<String, String> credentials)
- throws AuthenticationException {
+ throws AuthenticationException {
HugeGraphAuthProxy.resetContext();
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeFactoryAuthProxy.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeFactoryAuthProxy.java
index 498b24f1e..2fd14536d 100644
---
a/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeFactoryAuthProxy.java
+++
b/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeFactoryAuthProxy.java
@@ -309,13 +309,17 @@ public final class HugeFactoryAuthProxy {
code = String.format("Reflection.registerFieldsToFilter(%s.class,
\"%s\");",
clazz.getCanonicalName(), String.join("\", \"",
fields));
if (!fields.isEmpty()) {
+ // CHECKSTYLE:OFF
System.out.println(code);
+ // CHECKSTYLE:ON
}
code = String.format("Reflection.registerMethodsToFilter(%s.class,
\"%s\");",
clazz.getCanonicalName(), String.join("\", \"",
methods));
if (!methods.isEmpty()) {
+ // CHECKSTYLE:OFF
System.out.println(code);
+ // CHECKSTYLE:ON
}
return true;
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeGraphAuthProxy.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeGraphAuthProxy.java
index 78a3fabf0..8fac1fdf1 100644
---
a/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeGraphAuthProxy.java
+++
b/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeGraphAuthProxy.java
@@ -1679,6 +1679,7 @@ public final class HugeGraphAuthProxy implements
HugeGraph {
@Override
public TraversalStrategies clone() {
+ // CHECKSTYLE:OFF
return this.strategies.clone();
}
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/StandardAuthenticator.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/StandardAuthenticator.java
index b8e559680..6006aad92 100644
---
a/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/StandardAuthenticator.java
+++
b/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/StandardAuthenticator.java
@@ -87,7 +87,9 @@ public class StandardAuthenticator implements
HugeAuthenticator {
char[] chars = console.readPassword(inputPrompt);
password = new String(chars);
} else {
- System.out.print(inputPrompt);
+ // CHECKSTYLE:OFF
+ System.out.println(inputPrompt);
+ // CHECKSTYLE:ON
@SuppressWarnings("resource") // just wrapper of System.in
Scanner scanner = new Scanner(System.in);
password = scanner.nextLine();
@@ -95,7 +97,9 @@ public class StandardAuthenticator implements
HugeAuthenticator {
if (!password.isEmpty()) {
return password;
}
+ // CHECKSTYLE:OFF
System.out.println(notEmptyPrompt);
+ // CHECKSTYLE:ON
}
}
diff --git
a/hugegraph-api/src/main/java/com/baidu/hugegraph/license/LicenseVerifier.java
b/hugegraph-api/src/main/java/com/baidu/hugegraph/license/LicenseVerifier.java
index c1fab55ee..6b3ab4ab1 100644
---
a/hugegraph-api/src/main/java/com/baidu/hugegraph/license/LicenseVerifier.java
+++
b/hugegraph-api/src/main/java/com/baidu/hugegraph/license/LicenseVerifier.java
@@ -28,7 +28,6 @@ import org.apache.commons.codec.digest.DigestUtils;
import org.slf4j.Logger;
import com.baidu.hugegraph.HugeException;
-import com.baidu.hugegraph.HugeGraph;
import com.baidu.hugegraph.config.HugeConfig;
import com.baidu.hugegraph.core.GraphManager;
import com.baidu.hugegraph.util.Log;
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/analyzer/AnalyzerFactory.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/analyzer/AnalyzerFactory.java
index fbd043be2..ab84dba63 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/analyzer/AnalyzerFactory.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/analyzer/AnalyzerFactory.java
@@ -27,10 +27,10 @@ import
com.baidu.hugegraph.backend.serializer.SerializerFactory;
public class AnalyzerFactory {
- private static final Map<String, Class<? extends Analyzer>> analyzers;
+ private static final Map<String, Class<? extends Analyzer>> ANALYZERS;
static {
- analyzers = new ConcurrentHashMap<>();
+ ANALYZERS = new ConcurrentHashMap<>();
}
public static Analyzer analyzer(String name, String mode) {
@@ -58,7 +58,7 @@ public class AnalyzerFactory {
}
private static Analyzer customizedAnalyzer(String name, String mode) {
- Class<? extends Analyzer> clazz = analyzers.get(name);
+ Class<? extends Analyzer> clazz = ANALYZERS.get(name);
if (clazz == null) {
throw new HugeException("Not exists analyzer: %s", name);
}
@@ -91,12 +91,12 @@ public class AnalyzerFactory {
}
// Check exists
- if (analyzers.containsKey(name)) {
+ if (ANALYZERS.containsKey(name)) {
throw new HugeException("Exists analyzer: %s(%s)",
- name, analyzers.get(name).getName());
+ name, ANALYZERS.get(name).getName());
}
// Register class
- analyzers.put(name, (Class) clazz);
+ ANALYZERS.put(name, (Class) clazz);
}
}
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendStoreInfo.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendStoreInfo.java
index 86021301b..3c7f9dc4d 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendStoreInfo.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendStoreInfo.java
@@ -22,7 +22,6 @@ package com.baidu.hugegraph.backend.store;
import com.baidu.hugegraph.config.HugeConfig;
import org.slf4j.Logger;
-import com.baidu.hugegraph.HugeGraph;
import com.baidu.hugegraph.util.Log;
public class BackendStoreInfo {
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/election/RoleElectionStateMachineImpl.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/election/RoleElectionStateMachineImpl.java
index 016f51cb8..69f8d5a3d 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/election/RoleElectionStateMachineImpl.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/election/RoleElectionStateMachineImpl.java
@@ -57,7 +57,7 @@ public class RoleElectionStateMachineImpl implements
RoleElectionStateMachine {
failCount = 0;
} catch (Throwable e) {
stateMachineCallback.error(context, e);
- failCount ++;
+ failCount++;
if (failCount >= this.config.exceedsFailCount()) {
this.state = new AbdicationState(context.epoch());
Callback runnable =
this.state.callback(stateMachineCallback);
@@ -69,7 +69,7 @@ public class RoleElectionStateMachineImpl implements
RoleElectionStateMachine {
private interface RoleState {
- SecureRandom secureRandom = new SecureRandom();
+ SecureRandom SECURE_RANDOM = new SecureRandom();
RoleState transform(StateMachineContext context);
@@ -83,7 +83,7 @@ public class RoleElectionStateMachineImpl implements
RoleElectionStateMachine {
static void randomPark(StateMachineContext context) {
long randomTimeout = context.config().randomTimeoutMillisecond();
long baseTime = context.config().baseTimeoutMillisecond();
- long timeout = (long) (baseTime + (randomTimeout / 10.0 *
secureRandom.nextInt(11)));
+ long timeout = (long) (baseTime + (randomTimeout / 10.0 *
SECURE_RANDOM.nextInt(11)));
LockSupport.parkNanos(timeout * 1_000_000);
}
}
@@ -216,7 +216,7 @@ public class RoleElectionStateMachineImpl implements
RoleElectionStateMachine {
if (state.roleTypeData.epoch() > this.roleTypeData.epoch()) {
this.clock = 0;
this.roleTypeData = state.roleTypeData;
- } else if (state.roleTypeData.epoch() < this.roleTypeData.epoch()){
+ } else if (state.roleTypeData.epoch() < this.roleTypeData.epoch())
{
throw new IllegalStateException("Epoch must increase");
} else if (state.roleTypeData.epoch() == this.roleTypeData.epoch()
&&
state.roleTypeData.clock() < this.roleTypeData.clock())
{
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/PredictionTraverser.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/PredictionTraverser.java
index da6e924a8..86191453d 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/PredictionTraverser.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/PredictionTraverser.java
@@ -35,7 +35,7 @@ public class PredictionTraverser extends OltpTraverser {
}
public double adamicAdar(Id source, Id target, Directions dir,
- String label, long degree, long limit) {
+ String label, long degree, int limit) {
Set<Id> neighbors = checkAndGetCommonNeighbors(source, target, dir,
label, degree, limit);
EdgeStep step = label == null ? new EdgeStep(graph(), dir) :
@@ -52,7 +52,7 @@ public class PredictionTraverser extends OltpTraverser {
}
public double resourceAllocation(Id source, Id target, Directions dir,
- String label, long degree, long limit) {
+ String label, long degree, int limit) {
Set<Id> neighbors = checkAndGetCommonNeighbors(source, target, dir,
label, degree, limit);
EdgeStep step = label == null ? new EdgeStep(graph(), dir) :
@@ -70,7 +70,7 @@ public class PredictionTraverser extends OltpTraverser {
private Set<Id> checkAndGetCommonNeighbors(Id source, Id target,
Directions dir, String label,
- long degree, long limit) {
+ long degree, int limit) {
E.checkNotNull(source, "source id");
E.checkNotNull(target, "the target id");
this.checkVertexExist(source, "source");
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/SameNeighborTraverser.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/SameNeighborTraverser.java
index 6cb14b6db..cafcd9059 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/SameNeighborTraverser.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/SameNeighborTraverser.java
@@ -36,7 +36,7 @@ public class SameNeighborTraverser extends HugeTraverser {
}
public Set<Id> sameNeighbors(Id vertex, Id other, Directions direction,
- String label, long degree, long limit) {
+ String label, long degree, int limit) {
E.checkNotNull(vertex, "vertex id");
E.checkNotNull(other, "the other vertex id");
this.checkVertexExist(vertex, "vertex");
@@ -54,7 +54,7 @@ public class SameNeighborTraverser extends HugeTraverser {
Set<Id> sameNeighbors = (Set<Id>) CollectionUtil.intersect(
sourceNeighbors, targetNeighbors);
if (limit != NO_LIMIT) {
- int end = Math.min(sameNeighbors.size(), (int) limit);
+ int end = Math.min(sameNeighbors.size(), limit);
sameNeighbors = CollectionUtil.subSet(sameNeighbors, 0, end);
}
return sameNeighbors;
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/util/RateLimiter.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/util/RateLimiter.java
index c2983da68..9888be99f 100644
--- a/hugegraph-core/src/main/java/com/baidu/hugegraph/util/RateLimiter.java
+++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/util/RateLimiter.java
@@ -19,8 +19,6 @@
package com.baidu.hugegraph.util;
-import org.slf4j.Logger;
-
// TODO: Move to common module (concurrent package)
public interface RateLimiter {
diff --git a/hugegraph-dist/src/assembly/static/conf/rest-server.properties
b/hugegraph-dist/src/assembly/static/conf/rest-server.properties
index f7eda0010..9e54fcf45 100644
--- a/hugegraph-dist/src/assembly/static/conf/rest-server.properties
+++ b/hugegraph-dist/src/assembly/static/conf/rest-server.properties
@@ -10,7 +10,8 @@ batch.max_write_ratio=80
batch.max_write_threads=0
# authentication configs
-# choose 'com.baidu.hugegraph.auth.StandardAuthenticator' or
'com.baidu.hugegraph.auth.ConfigAuthenticator'
+# choose 'com.baidu.hugegraph.auth.StandardAuthenticator' or
+# 'com.baidu.hugegraph.auth.ConfigAuthenticator'
#auth.authenticator=
# for StandardAuthenticator mode
diff --git
a/hugegraph-hbase/src/main/java/com/baidu/hugegraph/backend/store/hbase/HbaseSessions.java
b/hugegraph-hbase/src/main/java/com/baidu/hugegraph/backend/store/hbase/HbaseSessions.java
index 03d0d5596..89f82d63c 100644
---
a/hugegraph-hbase/src/main/java/com/baidu/hugegraph/backend/store/hbase/HbaseSessions.java
+++
b/hugegraph-hbase/src/main/java/com/baidu/hugegraph/backend/store/hbase/HbaseSessions.java
@@ -457,7 +457,7 @@ public class HbaseSessions extends BackendSessionPool {
* Session implement for HBase
*/
public class Session extends AbstractBackendSession
- implements HbaseSession<RowIterator> {
+ implements HbaseSession<RowIterator> {
private final Map<String, List<Row>> batch;
@@ -483,7 +483,7 @@ public class HbaseSessions extends BackendSessionPool {
}
private void checkBatchResults(Object[] results, List<Row> rows)
- throws Throwable {
+ throws Throwable {
assert rows.size() == results.length;
for (int i = 0; i < results.length; i++) {
Object result = results[i];
@@ -552,7 +552,7 @@ public class HbaseSessions extends BackendSessionPool {
} catch (Throwable e) {
// TODO: Mark and delete committed records
throw new BackendException("Failed to commit, " +
- "there may be inconsistent
states for HBase", e);
+ "there may be inconsistent states for HBase", e);
}
}
@@ -806,7 +806,8 @@ public class HbaseSessions extends BackendSessionPool {
Cell cell = cellScanner.current();
byte[] key = CellUtil.cloneQualifier(cell);
byte[] val = CellUtil.cloneValue(cell);
- LOG.info(" {}={}", StringEncoding.format(key),
+ LOG.info(" {}={}",
+ StringEncoding.format(key),
StringEncoding.format(val));
}
}
diff --git
a/hugegraph-palo/src/main/java/com/baidu/hugegraph/backend/store/palo/PaloTable.java
b/hugegraph-palo/src/main/java/com/baidu/hugegraph/backend/store/palo/PaloTable.java
index 6a7558993..16721a6f0 100644
---
a/hugegraph-palo/src/main/java/com/baidu/hugegraph/backend/store/palo/PaloTable.java
+++
b/hugegraph-palo/src/main/java/com/baidu/hugegraph/backend/store/palo/PaloTable.java
@@ -32,7 +32,6 @@ import com.baidu.hugegraph.backend.BackendException;
import com.baidu.hugegraph.backend.store.TableDefine;
import com.baidu.hugegraph.backend.store.mysql.MysqlBackendEntry;
import com.baidu.hugegraph.backend.store.mysql.MysqlSessions;
-import com.baidu.hugegraph.backend.store.mysql.MysqlStore;
import com.baidu.hugegraph.backend.store.mysql.MysqlTable;
import com.baidu.hugegraph.type.define.HugeKeys;
import com.baidu.hugegraph.util.Log;
diff --git
a/hugegraph-postgresql/src/main/java/com/baidu/hugegraph/backend/store/postgresql/PostgresqlSessions.java
b/hugegraph-postgresql/src/main/java/com/baidu/hugegraph/backend/store/postgresql/PostgresqlSessions.java
index 448c07fa4..4603b9dae 100644
---
a/hugegraph-postgresql/src/main/java/com/baidu/hugegraph/backend/store/postgresql/PostgresqlSessions.java
+++
b/hugegraph-postgresql/src/main/java/com/baidu/hugegraph/backend/store/postgresql/PostgresqlSessions.java
@@ -31,7 +31,6 @@ import org.slf4j.Logger;
import com.baidu.hugegraph.backend.BackendException;
import com.baidu.hugegraph.backend.store.mysql.MysqlSessions;
-import com.baidu.hugegraph.backend.store.mysql.MysqlStore;
import com.baidu.hugegraph.backend.store.mysql.MysqlUtil;
import com.baidu.hugegraph.config.HugeConfig;
import com.baidu.hugegraph.util.Log;
diff --git
a/hugegraph-test/src/main/java/com/baidu/hugegraph/core/RoleElectionStateMachineTest.java
b/hugegraph-test/src/main/java/com/baidu/hugegraph/core/RoleElectionStateMachineTest.java
index 6e8af972d..c32e1ee23 100644
---
a/hugegraph-test/src/main/java/com/baidu/hugegraph/core/RoleElectionStateMachineTest.java
+++
b/hugegraph-test/src/main/java/com/baidu/hugegraph/core/RoleElectionStateMachineTest.java
@@ -40,6 +40,7 @@ import com.baidu.hugegraph.election.RoleTypeDataAdapter;
import com.baidu.hugegraph.election.StateMachineCallback;
import com.baidu.hugegraph.election.StateMachineContext;
import com.baidu.hugegraph.testutil.Assert;
+import com.baidu.hugegraph.testutil.Utils;
import org.junit.Test;
public class RoleElectionStateMachineTest {
@@ -149,7 +150,7 @@ public class RoleElectionStateMachineTest {
if (logRecords.size() > MAX_COUNT) {
context.stateMachine().shutdown();
}
- System.out.println("master node: " + node);
+ Utils.println("master node: " + node);
masterNodes.add(node);
}
@@ -195,7 +196,9 @@ public class RoleElectionStateMachineTest {
@Override
public void error(StateMachineContext context, Throwable e) {
- System.out.println("state machine error: node " +
context.node() + " message " + e.getMessage());
+ Utils.println("state machine error: node " +
+ context.node() +
+ " message " + e.getMessage());
}
};
@@ -225,14 +228,14 @@ public class RoleElectionStateMachineTest {
this.epoch = copy.epoch();
Assert.assertNull(value);
metaDataLogs.add(copy);
- System.out.println("The node " + copy + " become new
master:");
+ Utils.println("The node " + copy + " become new
master:");
return copy;
}
Assert.assertEquals(value.epoch(), copy.epoch());
if (Objects.equals(value.node(), copy.node()) &&
value.clock() <= copy.clock()) {
- System.out.println("The master node " + copy + " keep
heartbeat");
+ Utils.println("The master node " + copy + " keep
heartbeat");
metaDataLogs.add(copy);
if (value.clock() == copy.clock()) {
Assert.fail("Clock must increase when same epoch
and node id");
@@ -247,14 +250,16 @@ public class RoleElectionStateMachineTest {
@Override
public Optional<RoleTypeData> query() {
- return
Optional.ofNullable(this.copy(this.data.get(this.epoch)));
+ return Optional.ofNullable(
+ this.copy(this.data.get(this.epoch)));
}
};
RoleElectionStateMachine[] machines = new RoleElectionStateMachine[4];
Thread node1 = new Thread(() -> {
Config config = new TestConfig("1");
- RoleElectionStateMachine stateMachine = new
RoleElectionStateMachineImpl(config, adapter);
+ RoleElectionStateMachine stateMachine =
+ new RoleElectionStateMachineImpl(config,
adapter);
machines[1] = stateMachine;
stateMachine.apply(callback);
stop.countDown();
@@ -262,7 +267,8 @@ public class RoleElectionStateMachineTest {
Thread node2 = new Thread(() -> {
Config config = new TestConfig("2");
- RoleElectionStateMachine stateMachine = new
RoleElectionStateMachineImpl(config, adapter);
+ RoleElectionStateMachine stateMachine =
+ new RoleElectionStateMachineImpl(config,
adapter);
machines[2] = stateMachine;
stateMachine.apply(callback);
stop.countDown();
@@ -270,7 +276,8 @@ public class RoleElectionStateMachineTest {
Thread node3 = new Thread(() -> {
Config config = new TestConfig("3");
- RoleElectionStateMachine stateMachine = new
RoleElectionStateMachineImpl(config, adapter);
+ RoleElectionStateMachine stateMachine =
+ new RoleElectionStateMachineImpl(config,
adapter);
machines[3] = stateMachine;
stateMachine.apply(callback);
stop.countDown();
@@ -294,7 +301,7 @@ public class RoleElectionStateMachineTest {
}
machines[Integer.parseInt(node)].shutdown();
dropNodes.add(node);
- System.out.println("----shutdown machine " + node);
+ Utils.println("----shutdown machine " + node);
}
stop.countDown();
});
diff --git
a/hugegraph-test/src/main/java/com/baidu/hugegraph/testutil/Utils.java
b/hugegraph-test/src/main/java/com/baidu/hugegraph/testutil/Utils.java
index d1f245b32..770b0f26e 100644
--- a/hugegraph-test/src/main/java/com/baidu/hugegraph/testutil/Utils.java
+++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/testutil/Utils.java
@@ -105,4 +105,10 @@ public class Utils {
}
return config;
}
+
+ public static void println(String message) {
+ // CHECKSTYLE:OFF
+ System.out.println(message);
+ // CHECKSTYLE:ON
+ }
}
diff --git
a/hugegraph-test/src/main/java/com/baidu/hugegraph/unit/core/AnalyzerTest.java
b/hugegraph-test/src/main/java/com/baidu/hugegraph/unit/core/AnalyzerTest.java
index fdd749993..3674ee83f 100644
---
a/hugegraph-test/src/main/java/com/baidu/hugegraph/unit/core/AnalyzerTest.java
+++
b/hugegraph-test/src/main/java/com/baidu/hugegraph/unit/core/AnalyzerTest.java
@@ -33,8 +33,8 @@ import com.baidu.hugegraph.testutil.Assert;
public class AnalyzerTest {
- private static final String text1 = "England wins World Cup";
- private static final String text2 = "英格兰世界杯夺冠,中华人民共和国国歌," +
+ private static final String TEXT_1 = "England wins World Cup";
+ private static final String TEXT_2 = "英格兰世界杯夺冠,中华人民共和国国歌," +
"百度科技园位于北京市海淀区西北旺东路10号院";
@Before
@@ -52,20 +52,20 @@ public class AnalyzerTest {
// MaximumMatching mode
Analyzer analyzer = AnalyzerFactory.analyzer("word",
"MaximumMatching");
Assert.assertEquals(setOf("england", "wins", "world", "cup"),
- analyzer.segment(text1));
+ analyzer.segment(TEXT_1));
Assert.assertEquals(setOf("英格兰", "世界杯", "夺冠", "中华人民共和国",
"国歌", "百度", "科技园", "位于", "北京市",
"海淀区", "西北旺", "东路", "10号", "院"),
- analyzer.segment(text2));
+ analyzer.segment(TEXT_2));
// ReverseMaximumMatching mode
analyzer = AnalyzerFactory.analyzer("word", "ReverseMaximumMatching");
Assert.assertEquals(setOf("england", "wins", "world", "cup"),
- analyzer.segment(text1));
+ analyzer.segment(TEXT_1));
Assert.assertEquals(setOf("英格兰", "世界杯", "夺冠", "中华人民共和国",
"国歌", "百度", "科技园", "位于", "北京市",
"海淀区", "西北旺", "东路", "10号", "院"),
- analyzer.segment(text2));
+ analyzer.segment(TEXT_2));
}
@Test
@@ -73,20 +73,20 @@ public class AnalyzerTest {
// BaseAnalysis mode
Analyzer analyzer = AnalyzerFactory.analyzer("ansj", "BaseAnalysis");
Assert.assertEquals(setOf("england", " ", "wins", "world", "cup"),
- analyzer.segment(text1));
+ analyzer.segment(TEXT_1));
Assert.assertEquals(setOf("英格兰", "世界杯", "夺冠", ",", "中华人民共和国",
"国歌", "百度", "科技", "园", "位于", "北京市",
"海淀区", "西北", "旺", "东路", "10", "号", "院"),
- analyzer.segment(text2));
+ analyzer.segment(TEXT_2));
// IndexAnalysis mode
analyzer = AnalyzerFactory.analyzer("ansj", "IndexAnalysis");
Assert.assertEquals(setOf("england", " ", "wins", "world", "cup"),
- analyzer.segment(text1));
+ analyzer.segment(TEXT_1));
Assert.assertEquals(setOf("英格兰", "世界杯", "夺冠", ",", "中华人民共和国",
"国歌", "百度", "科技", "园", "位于", "北京市",
"海淀区", "西北", "旺", "东路", "10号", "院"),
- analyzer.segment(text2));
+ analyzer.segment(TEXT_2));
}
@Test
@@ -94,36 +94,36 @@ public class AnalyzerTest {
// standard mode
Analyzer analyzer = AnalyzerFactory.analyzer("hanlp", "standard");
Assert.assertEquals(setOf("England", " ", "wins", "World", "Cup"),
- analyzer.segment(text1));
+ analyzer.segment(TEXT_1));
Assert.assertEquals(setOf("英格兰", "世界杯", "夺冠", ",", "中华人民共和国",
"国歌", "百度", "科技园", "位于", "北京市",
"海淀区", "西北旺", "东路", "10", "号", "院"),
- analyzer.segment(text2));
+ analyzer.segment(TEXT_2));
// Note latest hanlp portable version not contains model data
//
https://github.com/hankcs/HanLP/tree/portable#%E6%96%B9%E5%BC%8F%E4%B8%80maven
// So test IndexTokenizer instead
analyzer = AnalyzerFactory.analyzer("hanlp", "index");
Assert.assertEquals(setOf("England", " ", "wins", "World", "Cup"),
- analyzer.segment(text1));
+ analyzer.segment(TEXT_1));
Assert.assertEquals(setOf("英格兰", "英格", "格兰", "世界杯", "世界", "夺冠", ",",
"中华人民共和国", "中华", "华人", "人民", "共和国",
"共和","国歌", "百度", "科技园", "科技", "位于",
"北京市", "北京", "海淀区", "海淀", "淀区", "西北旺",
"西北", "东路", "10", "号", "院"),
- analyzer.segment(text2));
+ analyzer.segment(TEXT_2));
}
@Test
public void testSmartCNAnalyzer() {
Analyzer analyzer = AnalyzerFactory.analyzer("smartcn", "");
Assert.assertEquals(setOf("england", "win", "world", "cup"),
- analyzer.segment(text1));
+ analyzer.segment(TEXT_1));
Assert.assertEquals(setOf("英格兰", "世界杯", "夺冠", "中华人民共和国",
"国歌", "百", "度", "科技", "园", "位于",
"北京市", "海淀区", "西北", "旺", "东", "路",
"10", "号", "院"),
- analyzer.segment(text2));
+ analyzer.segment(TEXT_2));
}
@Test
@@ -131,22 +131,22 @@ public class AnalyzerTest {
// SEARCH mode
Analyzer analyzer = AnalyzerFactory.analyzer("jieba", "SEARCH");
Assert.assertEquals(setOf("england", " ", "wins", "world", "cup"),
- analyzer.segment(text1));
+ analyzer.segment(TEXT_1));
Assert.assertEquals(setOf("英格兰", "世界杯", "夺冠", ",", "中华人民共和国",
"国歌", "百度", "科技园", "位于", "北京市",
"海淀区", "西北", "旺", "东路", "10", "号院"),
- analyzer.segment(text2));
+ analyzer.segment(TEXT_2));
// INDEX mode
analyzer = AnalyzerFactory.analyzer("jieba", "INDEX");
Assert.assertEquals(setOf("england", " ", "wins", "world", "cup"),
- analyzer.segment(text1));
+ analyzer.segment(TEXT_1));
Assert.assertEquals(setOf("英格兰", "世界", "世界杯", "夺冠", ",", "中华",
"华人", "人民", "共和", "共和国", "中华人民共和国",
"国歌", "百度", "科技", "科技园", "位于", "北京",
"京市", "北京市", "海淀", "淀区", "海淀区", "西北",
"旺", "东路", "10", "号院"),
- analyzer.segment(text2));
+ analyzer.segment(TEXT_2));
}
@Test
@@ -154,22 +154,22 @@ public class AnalyzerTest {
// Simple mode
Analyzer analyzer = AnalyzerFactory.analyzer("jcseg", "Simple");
Assert.assertEquals(setOf("england", "wins", "world", "cup"),
- analyzer.segment(text1));
+ analyzer.segment(TEXT_1));
Assert.assertEquals(setOf("英格兰", "世界杯", "夺冠", ",", "中华",
"人民共和国", "国歌", "百度", "科技", "园", "位于",
"北京市", "海淀区", "西北", "旺", "东路", "1", "0",
"号", "院"),
- analyzer.segment(text2));
+ analyzer.segment(TEXT_2));
// Complex mode
analyzer = AnalyzerFactory.analyzer("jcseg", "Complex");
Assert.assertEquals(setOf("england", "wins", "world", "cup"),
- analyzer.segment(text1));
+ analyzer.segment(TEXT_1));
Assert.assertEquals(setOf("英格兰", "世界杯", "夺冠", ",", "中华",
"人民共和国", "国歌", "百度", "科技", "园", "位于",
"北京市", "海淀区", "西北", "旺", "东路", "1", "0",
"号", "院"),
- analyzer.segment(text2));
+ analyzer.segment(TEXT_2));
}
@Test
@@ -177,22 +177,22 @@ public class AnalyzerTest {
// Simple mode
Analyzer analyzer = AnalyzerFactory.analyzer("mmseg4j", "Simple");
Assert.assertEquals(setOf("england", "wins", "world", "cup"),
- analyzer.segment(text1));
+ analyzer.segment(TEXT_1));
Assert.assertEquals(setOf("英格兰", "世界杯", "夺冠", "中华人民共和国",
"国歌", "百度", "科技园", "位于", "北京市",
"海淀区", "西北", "旺", "东路", "10", "号",
"院"),
- analyzer.segment(text2));
+ analyzer.segment(TEXT_2));
// Complex mode
analyzer = AnalyzerFactory.analyzer("mmseg4j", "Complex");
Assert.assertEquals(setOf("england", "wins", "world", "cup"),
- analyzer.segment(text1));
+ analyzer.segment(TEXT_1));
Assert.assertEquals(setOf("英格兰", "世界杯", "夺冠", "中华人民共和国",
"国歌", "百度", "科技园", "位于", "北京市",
"海淀区", "西北", "旺", "东路", "10", "号",
"院"),
- analyzer.segment(text2));
+ analyzer.segment(TEXT_2));
}
@Test
@@ -200,16 +200,16 @@ public class AnalyzerTest {
// Smart mode
Analyzer analyzer = AnalyzerFactory.analyzer("ikanalyzer", "smart");
Assert.assertEquals(setOf("england", "wins", "world", "cup"),
- analyzer.segment(text1));
+ analyzer.segment(TEXT_1));
Assert.assertEquals(setOf("英格兰", "世界杯", "夺冠", "中华人民共和国",
"国歌", "百度", "科技园", "位于", "北京市",
"海淀区", "西北", "旺", "东路", "10号", "院"),
- analyzer.segment(text2));
+ analyzer.segment(TEXT_2));
// Max_word mode
analyzer = AnalyzerFactory.analyzer("ikanalyzer", "max_word");
Assert.assertEquals(setOf("england", "wins", "world", "cup"),
- analyzer.segment(text1));
+ analyzer.segment(TEXT_1));
Assert.assertEquals(setOf("英格兰", "世界杯", "世界", "杯", "夺冠",
"中华人民共和国", "中华人民", "中华", "华人",
"人民共和国", "人民", "共和国", "共和", "国",
@@ -217,7 +217,7 @@ public class AnalyzerTest {
"园", "位于", "北京市", "北京", "市", "海淀区",
"海淀", "淀区", "西北", "旺", "东路", "10",
"号", "院"),
- analyzer.segment(text2));
+ analyzer.segment(TEXT_2));
}
private static Set<String> setOf(String... elems) {