You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hugegraph.apache.org by ji...@apache.org on 2024/02/20 09:22:58 UTC
(incubator-hugegraph) branch master updated: fix: format and clean code in modules (#2439)
This is an automated email from the ASF dual-hosted git repository.
jin 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 5cb9aad6e fix: format and clean code in modules (#2439)
5cb9aad6e is described below
commit 5cb9aad6ee5f2a2979ea98074309e6aa3bd2bbdb
Author: M <87...@users.noreply.github.com>
AuthorDate: Tue Feb 20 17:22:54 2024 +0800
fix: format and clean code in modules (#2439)
Format & clean code in submodels:
1. API
2. Scylladb
3. Postgresql
4. Rocksdb
5. Palo
6. Mysql
7. Hbase
8. Cassandra
9. Test
---------
Co-authored-by: imbajin <ji...@apache.org>
---
.../main/java/org/apache/hugegraph/api/API.java | 15 +-
.../org/apache/hugegraph/api/arthas/ArthasAPI.java | 1 -
.../org/apache/hugegraph/api/auth/AccessAPI.java | 36 +-
.../org/apache/hugegraph/api/auth/BelongAPI.java | 34 +-
.../org/apache/hugegraph/api/auth/GroupAPI.java | 34 +-
.../org/apache/hugegraph/api/auth/ProjectAPI.java | 36 +-
.../org/apache/hugegraph/api/auth/TargetAPI.java | 32 +-
.../org/apache/hugegraph/api/auth/UserAPI.java | 36 +-
.../org/apache/hugegraph/api/cypher/CypherAPI.java | 1 -
.../apache/hugegraph/api/cypher/CypherClient.java | 26 +-
.../apache/hugegraph/api/cypher/CypherModel.java | 2 +
.../hugegraph/api/filter/AuthenticationFilter.java | 10 +-
.../hugegraph/api/filter/CompressInterceptor.java | 19 +-
.../api/filter/DecompressInterceptor.java | 3 +-
.../hugegraph/api/filter/ExceptionFilter.java | 52 +--
.../hugegraph/api/filter/LoadDetectFilter.java | 35 +-
.../hugegraph/api/filter/LoadReleaseFilter.java | 4 +-
.../hugegraph/api/filter/RedirectFilter.java | 1 +
.../apache/hugegraph/api/filter/StatusFilter.java | 3 +-
.../org/apache/hugegraph/api/graph/BatchAPI.java | 37 +-
.../org/apache/hugegraph/api/graph/EdgeAPI.java | 166 ++++----
.../org/apache/hugegraph/api/graph/VertexAPI.java | 98 ++---
.../api/gremlin/AbstractJerseyRestClient.java | 2 +-
.../apache/hugegraph/api/gremlin/GremlinAPI.java | 16 +-
.../hugegraph/api/gremlin/GremlinQueryAPI.java | 1 +
.../org/apache/hugegraph/api/job/AlgorithmAPI.java | 1 -
.../org/apache/hugegraph/api/job/GremlinAPI.java | 4 +-
.../java/org/apache/hugegraph/api/job/TaskAPI.java | 12 +-
.../apache/hugegraph/api/metrics/MetricsAPI.java | 1 -
.../apache/hugegraph/api/profile/GraphsAPI.java | 48 +--
.../apache/hugegraph/api/profile/ProfileAPI.java | 31 +-
.../apache/hugegraph/api/profile/VersionAPI.java | 19 +-
.../hugegraph/api/profile/WhiteIpListAPI.java | 6 +-
.../org/apache/hugegraph/api/raft/RaftAPI.java | 34 +-
.../hugegraph/api/traversers/AdamicAdarAPI.java | 21 +-
.../apache/hugegraph/api/traversers/CountAPI.java | 22 +-
.../hugegraph/api/traversers/EdgeExistenceAPI.java | 1 -
.../hugegraph/api/traversers/NeighborRankAPI.java | 22 +-
.../hugegraph/api/traversers/PersonalRankAPI.java | 20 +-
.../api/traversers/ResourceAllocationAPI.java | 21 +-
.../apache/hugegraph/api/traversers/Vertices.java | 10 +-
.../hugegraph/api/variables/VariablesAPI.java | 22 +-
.../apache/hugegraph/auth/ConfigAuthenticator.java | 5 +-
.../hugegraph/auth/ContextGremlinServer.java | 8 +-
.../apache/hugegraph/auth/HugeAuthenticator.java | 10 +-
.../hugegraph/auth/HugeFactoryAuthProxy.java | 441 +++++++++++++++++----
.../apache/hugegraph/auth/HugeGraphAuthProxy.java | 62 +--
.../hugegraph/auth/StandardAuthenticator.java | 7 +-
.../hugegraph/auth/WsAndHttpBasicAuthHandler.java | 10 +-
.../org/apache/hugegraph/config/ServerOptions.java | 48 +--
.../org/apache/hugegraph/core/GraphManager.java | 16 +-
.../apache/hugegraph/define/UpdateStrategy.java | 9 +-
.../apache/hugegraph/metrics/MetricsModule.java | 2 +-
.../apache/hugegraph/metrics/ServerReporter.java | 5 +-
.../apache/hugegraph/metrics/SystemMetrics.java | 5 +-
.../hugegraph/opencypher/CypherOpProcessor.java | 38 +-
.../apache/hugegraph/opencypher/CypherPlugin.java | 28 +-
.../hugegraph/rpc/RpcClientProviderWithAuth.java | 3 +-
.../apache/hugegraph/server/ApplicationConfig.java | 32 +-
.../org/apache/hugegraph/server/RestServer.java | 21 +-
.../store/cassandra/CassandraEntryIterator.java | 2 +-
.../backend/store/cassandra/CassandraMetrics.java | 6 +-
.../store/cassandra/CassandraSerializer.java | 1 +
.../store/cassandra/CassandraSessionPool.java | 1 +
.../backend/store/cassandra/CassandraShard.java | 42 +-
.../backend/store/cassandra/CassandraStore.java | 48 ++-
.../backend/store/cassandra/CassandraTable.java | 35 +-
.../backend/store/cassandra/CassandraTables.java | 8 +-
hugegraph-server/hugegraph-dist/docker/README.md | 2 +-
.../backend/store/hbase/HbaseMetrics.java | 10 +-
.../backend/store/hbase/HbaseOptions.java | 2 +-
.../backend/store/hbase/HbaseSerializer.java | 3 +-
.../backend/store/hbase/HbaseSessions.java | 18 +-
.../hugegraph/backend/store/hbase/HbaseStore.java | 55 +--
.../hugegraph/backend/store/hbase/HbaseTable.java | 16 +-
.../hugegraph/backend/store/hbase/HbaseTables.java | 3 +-
.../backend/store/mysql/MysqlEntryIterator.java | 4 +-
.../backend/store/mysql/MysqlMetrics.java | 1 +
.../backend/store/mysql/MysqlOptions.java | 6 +-
.../backend/store/mysql/MysqlSerializer.java | 3 +-
.../backend/store/mysql/MysqlSessions.java | 20 +-
.../hugegraph/backend/store/mysql/MysqlStore.java | 13 +-
.../hugegraph/backend/store/mysql/MysqlTable.java | 24 +-
.../hugegraph/backend/store/mysql/MysqlTables.java | 21 +-
.../backend/store/mysql/WhereBuilder.java | 34 +-
.../hugegraph/backend/store/palo/PaloFile.java | 2 +-
.../hugegraph/backend/store/palo/PaloSessions.java | 6 +-
.../hugegraph/backend/store/palo/PaloStore.java | 3 +-
.../backend/store/palo/PaloStoreProvider.java | 4 +-
.../hugegraph/backend/store/palo/PaloTable.java | 5 +-
.../hugegraph/backend/store/palo/PaloTables.java | 10 +-
.../store/postgresql/PostgresqlSerializer.java | 5 +-
.../store/postgresql/PostgresqlSessions.java | 34 +-
.../store/postgresql/PostgresqlStoreProvider.java | 9 +-
.../backend/store/postgresql/PostgresqlTable.java | 6 +-
.../backend/store/postgresql/PostgresqlTables.java | 34 +-
.../backend/store/rocksdb/RocksDBStdSessions.java | 36 +-
.../backend/store/rocksdb/RocksDBStore.java | 4 +-
.../backend/store/rocksdb/RocksDBTable.java | 2 +-
.../store/rocksdbsst/RocksDBSstSessions.java | 4 +-
.../backend/store/rocksdbsst/RocksDBSstStore.java | 2 +-
.../backend/store/scylladb/ScyllaDBMetrics.java | 1 -
.../store/scylladb/ScyllaDBStoreProvider.java | 9 +-
.../store/scylladb/ScyllaDBTablesWithMV.java | 51 +--
hugegraph-server/hugegraph-test/pom.xml | 2 +-
.../org/apache/hugegraph/api/ApiTestSuite.java | 32 +-
.../java/org/apache/hugegraph/api/BaseApiTest.java | 274 ++++++-------
.../org/apache/hugegraph/api/CypherApiTest.java | 2 +-
.../java/org/apache/hugegraph/api/EdgeApiTest.java | 176 ++++----
.../org/apache/hugegraph/api/EdgeLabelApiTest.java | 96 ++---
.../org/apache/hugegraph/api/GremlinApiTest.java | 193 ++++-----
.../apache/hugegraph/api/IndexLabelApiTest.java | 102 ++---
.../org/apache/hugegraph/api/LoginApiTest.java | 9 +-
.../org/apache/hugegraph/api/ProjectApiTest.java | 6 +-
.../apache/hugegraph/api/PropertyKeyApiTest.java | 40 +-
.../java/org/apache/hugegraph/api/TaskApiTest.java | 10 +-
.../java/org/apache/hugegraph/api/UserApiTest.java | 10 +-
.../org/apache/hugegraph/api/VertexApiTest.java | 48 +--
.../apache/hugegraph/api/VertexLabelApiTest.java | 72 ++--
.../api/traversers/AdamicAdarAPITest.java | 6 +-
.../api/traversers/AllShortestPathsApiTest.java | 2 +-
.../hugegraph/api/traversers/CountApiTest.java | 6 +-
.../api/traversers/CrosspointsApiTest.java | 9 +-
.../traversers/CustomizedCrosspointsApiTest.java | 4 +-
.../hugegraph/api/traversers/EdgesApiTest.java | 9 +-
.../api/traversers/FusiformSimilarityApiTest.java | 4 +-
.../traversers/MultiNodeShortestPathApiTest.java | 4 +-
.../api/traversers/NeighborRankApiTest.java | 4 +-
.../hugegraph/api/traversers/PathsApiTest.java | 6 +-
.../api/traversers/PersonalRankApiTest.java | 4 +-
.../api/traversers/ResourceAllocationAPITest.java | 6 +-
.../hugegraph/api/traversers/RingsApiTest.java | 5 +-
.../api/traversers/ShortestPathApiTest.java | 5 +-
.../api/traversers/TemplatePathsApiTest.java | 5 +-
.../api/traversers/TraversersApiTestSuite.java | 45 ++-
.../traversers/WeightedShortestPathApiTest.java | 5 +-
.../java/org/apache/hugegraph/core/AuthTest.java | 100 ++---
.../org/apache/hugegraph/core/CoreTestSuite.java | 27 +-
.../org/apache/hugegraph/core/EdgeCoreTest.java | 319 +++++++--------
.../apache/hugegraph/core/EdgeLabelCoreTest.java | 48 +--
.../apache/hugegraph/core/IndexLabelCoreTest.java | 72 ++--
.../apache/hugegraph/core/PropertyCoreTest.java | 22 +-
.../apache/hugegraph/core/PropertyKeyCoreTest.java | 12 +-
.../org/apache/hugegraph/core/RamTableTest.java | 31 +-
.../org/apache/hugegraph/core/RestoreCoreTest.java | 127 +++---
.../core/RoleElectionStateMachineTest.java | 2 +-
.../org/apache/hugegraph/core/SchemaCoreTest.java | 5 +-
.../org/apache/hugegraph/core/TaskCoreTest.java | 157 ++++----
.../org/apache/hugegraph/core/VertexCoreTest.java | 390 +++++++++---------
.../apache/hugegraph/core/VertexLabelCoreTest.java | 40 +-
.../org/apache/hugegraph/testutil/FakeObjects.java | 3 +-
.../java/org/apache/hugegraph/testutil/Utils.java | 7 +-
.../hugegraph/tinkerpop/ProcessBasicSuite.java | 286 ++++++-------
.../hugegraph/tinkerpop/ProcessStandardTest.java | 1 +
.../hugegraph/tinkerpop/StructureBasicSuite.java | 61 +--
.../hugegraph/tinkerpop/StructureStandardTest.java | 1 +
.../org/apache/hugegraph/tinkerpop/TestGraph.java | 5 +-
.../hugegraph/tinkerpop/TestGraphFactory.java | 2 +-
.../hugegraph/tinkerpop/TestGraphProvider.java | 50 +--
.../tinkerpop/tests/HugeGraphWriteTest.java | 11 +-
.../org/apache/hugegraph/unit/BaseUnitTest.java | 7 +-
.../org/apache/hugegraph/unit/FakeObjects.java | 9 +-
.../org/apache/hugegraph/unit/UnitTestSuite.java | 137 +++----
.../hugegraph/unit/cache/CacheManagerTest.java | 20 +-
.../org/apache/hugegraph/unit/cache/CacheTest.java | 16 +-
.../unit/cache/CachedGraphTransactionTest.java | 9 +-
.../unit/cache/CachedSchemaTransactionTest.java | 8 +-
.../apache/hugegraph/unit/cache/RamTableTest.java | 9 +-
.../hugegraph/unit/cassandra/CassandraTest.java | 20 +-
.../apache/hugegraph/unit/core/AnalyzerTest.java | 11 +-
.../hugegraph/unit/core/BackendMutationTest.java | 7 +-
.../hugegraph/unit/core/BackendStoreInfoTest.java | 7 +-
.../unit/core/ConditionQueryFlattenTest.java | 8 +-
.../apache/hugegraph/unit/core/ConditionTest.java | 4 +-
.../apache/hugegraph/unit/core/DataTypeTest.java | 5 +-
.../apache/hugegraph/unit/core/DirectionsTest.java | 5 +-
.../apache/hugegraph/unit/core/ExceptionTest.java | 4 +-
.../apache/hugegraph/unit/core/LocksTableTest.java | 10 +-
.../apache/hugegraph/unit/core/PageStateTest.java | 3 +-
.../org/apache/hugegraph/unit/core/QueryTest.java | 4 +-
.../org/apache/hugegraph/unit/core/RangeTest.java | 11 +-
.../hugegraph/unit/core/RolePermissionTest.java | 46 ++-
.../apache/hugegraph/unit/core/RowLockTest.java | 11 +-
.../hugegraph/unit/core/SecurityManagerTest.java | 14 +-
.../apache/hugegraph/unit/core/SerialEnumTest.java | 3 +-
.../hugegraph/unit/core/SystemSchemaStoreTest.java | 5 +-
.../hugegraph/unit/core/TraversalUtilTest.java | 19 +-
.../org/apache/hugegraph/unit/id/EdgeIdTest.java | 10 +-
.../java/org/apache/hugegraph/unit/id/IdTest.java | 12 +-
.../org/apache/hugegraph/unit/id/IdUtilTest.java | 5 +-
.../hugegraph/unit/id/SplicingIdGeneratorTest.java | 16 +-
.../apache/hugegraph/unit/mysql/MysqlUtilTest.java | 3 +-
.../hugegraph/unit/mysql/WhereBuilderTest.java | 4 +-
.../hugegraph/unit/rocksdb/RocksDBPerfTest.java | 4 +-
.../hugegraph/unit/rocksdb/RocksDBSessionTest.java | 23 +-
.../hugegraph/unit/serializer/BytesBufferTest.java | 10 +-
.../unit/serializer/SerializerFactoryTest.java | 5 +-
.../unit/serializer/StoreSerializerTest.java | 7 +-
.../unit/serializer/TableBackendEntryTest.java | 4 +-
.../unit/serializer/TextBackendEntryTest.java | 4 +-
.../hugegraph/unit/util/CompressUtilTest.java | 6 +-
.../apache/hugegraph/unit/util/JsonUtilTest.java | 33 +-
.../hugegraph/unit/util/RateLimiterTest.java | 5 +-
.../hugegraph/unit/util/StringEncodingTest.java | 13 +-
.../apache/hugegraph/unit/util/VersionTest.java | 5 +-
.../util/collection/CollectionFactoryTest.java | 12 +-
.../hugegraph/unit/util/collection/IdSetTest.java | 9 +-
.../unit/util/collection/Int2IntsMapTest.java | 47 ++-
.../hugegraph/unit/util/collection/IntMapTest.java | 18 +-
.../hugegraph/unit/util/collection/IntSetTest.java | 11 +-
.../unit/util/collection/ObjectIntMappingTest.java | 9 +-
.../hugegraph-test/src/main/resources/log4j2.xml | 26 +-
.../map/MapRandomGetPutThroughputTest.java | 8 +-
213 files changed, 3152 insertions(+), 2899 deletions(-)
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/API.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/API.java
index 444549a80..b7f564e8d 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/API.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/API.java
@@ -48,22 +48,23 @@ public class API {
public static final String TEXT_PLAIN = MediaType.TEXT_PLAIN;
public static final String APPLICATION_JSON = MediaType.APPLICATION_JSON;
public static final String APPLICATION_JSON_WITH_CHARSET =
- APPLICATION_JSON + ";charset=" + CHARSET;
- public static final String APPLICATION_TEXT_WITH_CHARSET = MediaType.TEXT_PLAIN + ";charset=" + CHARSET;
+ APPLICATION_JSON + ";charset=" + CHARSET;
+ public static final String APPLICATION_TEXT_WITH_CHARSET =
+ MediaType.TEXT_PLAIN + ";charset=" + CHARSET;
public static final String JSON = MediaType.APPLICATION_JSON_TYPE
- .getSubtype();
+ .getSubtype();
public static final String ACTION_APPEND = "append";
public static final String ACTION_ELIMINATE = "eliminate";
public static final String ACTION_CLEAR = "clear";
protected static final Logger LOG = Log.logger(API.class);
private static final Meter SUCCEED_METER =
- MetricsUtil.registerMeter(API.class, "commit-succeed");
+ MetricsUtil.registerMeter(API.class, "commit-succeed");
private static final Meter ILLEGAL_ARG_ERROR_METER =
- MetricsUtil.registerMeter(API.class, "illegal-arg");
+ MetricsUtil.registerMeter(API.class, "illegal-arg");
private static final Meter EXPECTED_ERROR_METER =
- MetricsUtil.registerMeter(API.class, "expected-error");
+ MetricsUtil.registerMeter(API.class, "expected-error");
private static final Meter UNKNOWN_ERROR_METER =
- MetricsUtil.registerMeter(API.class, "unknown-error");
+ MetricsUtil.registerMeter(API.class, "unknown-error");
public static HugeGraph graph(GraphManager manager, String graph) {
HugeGraph g = manager.graph(graph);
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java
index cb819057c..7cd9a98f8 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java
@@ -29,7 +29,6 @@ import com.taobao.arthas.agent.attach.ArthasAgent;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
-
import jakarta.inject.Singleton;
import jakarta.ws.rs.PUT;
import jakarta.ws.rs.Path;
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/AccessAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/AccessAPI.java
index 75dbad7fb..5c07681da 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/AccessAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/AccessAPI.java
@@ -19,37 +19,37 @@ package org.apache.hugegraph.api.auth;
import java.util.List;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.ws.rs.Consumes;
-import jakarta.ws.rs.DELETE;
-import jakarta.ws.rs.DefaultValue;
-import jakarta.ws.rs.GET;
-import jakarta.ws.rs.POST;
-import jakarta.ws.rs.PUT;
-import jakarta.ws.rs.PathParam;
-import jakarta.ws.rs.Produces;
-import jakarta.ws.rs.QueryParam;
-import jakarta.ws.rs.core.Context;
-
-import jakarta.inject.Singleton;
-import jakarta.ws.rs.Path;
-import org.apache.hugegraph.core.GraphManager;
-import org.apache.hugegraph.define.Checkable;
-import org.slf4j.Logger;
-
import org.apache.hugegraph.HugeGraph;
import org.apache.hugegraph.api.API;
import org.apache.hugegraph.api.filter.StatusFilter.Status;
import org.apache.hugegraph.auth.HugeAccess;
import org.apache.hugegraph.auth.HugePermission;
import org.apache.hugegraph.backend.id.Id;
+import org.apache.hugegraph.core.GraphManager;
+import org.apache.hugegraph.define.Checkable;
import org.apache.hugegraph.exception.NotFoundException;
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
+
import com.codahale.metrics.annotation.Timed;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.inject.Singleton;
+import jakarta.ws.rs.Consumes;
+import jakarta.ws.rs.DELETE;
+import jakarta.ws.rs.DefaultValue;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.PUT;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.QueryParam;
+import jakarta.ws.rs.core.Context;
+
@Path("graphs/{graph}/auth/accesses")
@Singleton
@Tag(name = "AccessAPI")
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/BelongAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/BelongAPI.java
index 7880e434e..da66c0cec 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/BelongAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/BelongAPI.java
@@ -19,7 +19,24 @@ package org.apache.hugegraph.api.auth;
import java.util.List;
+import org.apache.hugegraph.HugeGraph;
+import org.apache.hugegraph.api.API;
+import org.apache.hugegraph.api.filter.StatusFilter.Status;
+import org.apache.hugegraph.auth.HugeBelong;
+import org.apache.hugegraph.backend.id.Id;
+import org.apache.hugegraph.core.GraphManager;
+import org.apache.hugegraph.define.Checkable;
+import org.apache.hugegraph.exception.NotFoundException;
+import org.apache.hugegraph.util.E;
+import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
+
+import com.codahale.metrics.annotation.Timed;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.inject.Singleton;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.DELETE;
import jakarta.ws.rs.DefaultValue;
@@ -32,23 +49,6 @@ import jakarta.ws.rs.Produces;
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.Context;
-import jakarta.inject.Singleton;
-import org.apache.hugegraph.core.GraphManager;
-import org.apache.hugegraph.define.Checkable;
-import org.slf4j.Logger;
-
-import org.apache.hugegraph.HugeGraph;
-import org.apache.hugegraph.api.API;
-import org.apache.hugegraph.api.filter.StatusFilter.Status;
-import org.apache.hugegraph.auth.HugeBelong;
-import org.apache.hugegraph.backend.id.Id;
-import org.apache.hugegraph.exception.NotFoundException;
-import org.apache.hugegraph.util.E;
-import org.apache.hugegraph.util.Log;
-import com.codahale.metrics.annotation.Timed;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
@Path("graphs/{graph}/auth/belongs")
@Singleton
@Tag(name = "BelongAPI")
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/GroupAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/GroupAPI.java
index e70c88d31..f0ac7f6ea 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/GroupAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/GroupAPI.java
@@ -19,7 +19,24 @@ package org.apache.hugegraph.api.auth;
import java.util.List;
+import org.apache.hugegraph.HugeGraph;
+import org.apache.hugegraph.api.API;
+import org.apache.hugegraph.api.filter.StatusFilter.Status;
+import org.apache.hugegraph.auth.HugeGroup;
+import org.apache.hugegraph.backend.id.IdGenerator;
+import org.apache.hugegraph.core.GraphManager;
+import org.apache.hugegraph.define.Checkable;
+import org.apache.hugegraph.exception.NotFoundException;
+import org.apache.hugegraph.util.E;
+import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
+
+import com.codahale.metrics.annotation.Timed;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.inject.Singleton;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.DELETE;
import jakarta.ws.rs.DefaultValue;
@@ -32,23 +49,6 @@ import jakarta.ws.rs.Produces;
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.Context;
-import jakarta.inject.Singleton;
-import org.apache.hugegraph.core.GraphManager;
-import org.apache.hugegraph.define.Checkable;
-import org.slf4j.Logger;
-
-import org.apache.hugegraph.HugeGraph;
-import org.apache.hugegraph.api.API;
-import org.apache.hugegraph.api.filter.StatusFilter.Status;
-import org.apache.hugegraph.auth.HugeGroup;
-import org.apache.hugegraph.backend.id.IdGenerator;
-import org.apache.hugegraph.exception.NotFoundException;
-import org.apache.hugegraph.util.E;
-import org.apache.hugegraph.util.Log;
-import com.codahale.metrics.annotation.Timed;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
@Path("graphs/{graph}/auth/groups")
@Singleton
@Tag(name = "GroupAPI")
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/ProjectAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/ProjectAPI.java
index 1f048e9a0..c90323ef9 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/ProjectAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/ProjectAPI.java
@@ -21,39 +21,39 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.inject.Singleton;
-import jakarta.ws.rs.Consumes;
-import jakarta.ws.rs.DELETE;
-import jakarta.ws.rs.DefaultValue;
-import jakarta.ws.rs.GET;
-import jakarta.ws.rs.POST;
-import jakarta.ws.rs.PUT;
-import jakarta.ws.rs.Path;
-import jakarta.ws.rs.PathParam;
-import jakarta.ws.rs.Produces;
-import jakarta.ws.rs.QueryParam;
-import jakarta.ws.rs.core.Context;
-
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
-import org.apache.hugegraph.core.GraphManager;
-import org.apache.hugegraph.define.Checkable;
-import org.slf4j.Logger;
-
import org.apache.hugegraph.HugeGraph;
import org.apache.hugegraph.api.API;
import org.apache.hugegraph.api.filter.StatusFilter.Status;
import org.apache.hugegraph.auth.AuthManager;
import org.apache.hugegraph.auth.HugeProject;
import org.apache.hugegraph.backend.id.Id;
+import org.apache.hugegraph.core.GraphManager;
+import org.apache.hugegraph.define.Checkable;
import org.apache.hugegraph.exception.NotFoundException;
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
+
import com.codahale.metrics.annotation.Timed;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.inject.Singleton;
+import jakarta.ws.rs.Consumes;
+import jakarta.ws.rs.DELETE;
+import jakarta.ws.rs.DefaultValue;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.PUT;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.QueryParam;
+import jakarta.ws.rs.core.Context;
+
@Path("graphs/{graph}/auth/projects")
@Singleton
@Tag(name = "ProjectAPI")
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/TargetAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/TargetAPI.java
index c13fff151..eb52e455c 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/TargetAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/TargetAPI.java
@@ -20,6 +20,22 @@ package org.apache.hugegraph.api.auth;
import java.util.List;
import java.util.Map;
+import org.apache.hugegraph.HugeGraph;
+import org.apache.hugegraph.api.API;
+import org.apache.hugegraph.api.filter.StatusFilter.Status;
+import org.apache.hugegraph.auth.HugeTarget;
+import org.apache.hugegraph.core.GraphManager;
+import org.apache.hugegraph.define.Checkable;
+import org.apache.hugegraph.exception.NotFoundException;
+import org.apache.hugegraph.util.E;
+import org.apache.hugegraph.util.JsonUtil;
+import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
+
+import com.codahale.metrics.annotation.Timed;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.inject.Singleton;
import jakarta.ws.rs.Consumes;
@@ -34,22 +50,6 @@ import jakarta.ws.rs.Produces;
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.Context;
-import org.apache.hugegraph.core.GraphManager;
-import org.apache.hugegraph.define.Checkable;
-import org.slf4j.Logger;
-
-import org.apache.hugegraph.HugeGraph;
-import org.apache.hugegraph.api.API;
-import org.apache.hugegraph.api.filter.StatusFilter.Status;
-import org.apache.hugegraph.auth.HugeTarget;
-import org.apache.hugegraph.exception.NotFoundException;
-import org.apache.hugegraph.util.E;
-import org.apache.hugegraph.util.JsonUtil;
-import org.apache.hugegraph.util.Log;
-import com.codahale.metrics.annotation.Timed;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
@Path("graphs/{graph}/auth/targets")
@Singleton
@Tag(name = "TargetAPI")
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/UserAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/UserAPI.java
index 25d812104..ed26573f8 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/UserAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/UserAPI.java
@@ -19,39 +19,39 @@ package org.apache.hugegraph.api.auth;
import java.util.List;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.inject.Singleton;
-import jakarta.ws.rs.Consumes;
-import jakarta.ws.rs.DELETE;
-import jakarta.ws.rs.DefaultValue;
-import jakarta.ws.rs.GET;
-import jakarta.ws.rs.POST;
-import jakarta.ws.rs.PUT;
-import jakarta.ws.rs.Path;
-import jakarta.ws.rs.PathParam;
-import jakarta.ws.rs.Produces;
-import jakarta.ws.rs.QueryParam;
-import jakarta.ws.rs.core.Context;
-
import org.apache.commons.lang3.StringUtils;
-import org.apache.hugegraph.core.GraphManager;
-import org.apache.hugegraph.define.Checkable;
-import org.slf4j.Logger;
-
import org.apache.hugegraph.HugeGraph;
import org.apache.hugegraph.api.API;
import org.apache.hugegraph.api.filter.StatusFilter.Status;
import org.apache.hugegraph.auth.HugeUser;
import org.apache.hugegraph.backend.id.Id;
import org.apache.hugegraph.backend.id.IdGenerator;
+import org.apache.hugegraph.core.GraphManager;
+import org.apache.hugegraph.define.Checkable;
import org.apache.hugegraph.exception.NotFoundException;
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.Log;
import org.apache.hugegraph.util.StringEncoding;
+import org.slf4j.Logger;
+
import com.codahale.metrics.annotation.Timed;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.inject.Singleton;
+import jakarta.ws.rs.Consumes;
+import jakarta.ws.rs.DELETE;
+import jakarta.ws.rs.DefaultValue;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.PUT;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.QueryParam;
+import jakarta.ws.rs.core.Context;
+
@Path("graphs/{graph}/auth/users")
@Singleton
@Tag(name = "UserAPI")
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherAPI.java
index c8cc3929f..b24169aaa 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherAPI.java
@@ -34,7 +34,6 @@ import org.slf4j.Logger;
import com.codahale.metrics.annotation.Timed;
import io.swagger.v3.oas.annotations.tags.Tag;
-
import jakarta.inject.Singleton;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.GET;
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherClient.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherClient.java
index eb3a86ff6..92ae18c54 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherClient.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherClient.java
@@ -17,16 +17,6 @@
package org.apache.hugegraph.api.cypher;
-import org.apache.hugegraph.util.E;
-import org.apache.hugegraph.util.Log;
-import org.apache.commons.configuration2.Configuration;
-import org.apache.tinkerpop.gremlin.driver.*;
-import org.apache.tinkerpop.gremlin.driver.message.RequestMessage;
-import org.slf4j.Logger;
-
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.ThreadSafe;
-
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -35,6 +25,20 @@ import java.util.Objects;
import java.util.concurrent.ExecutionException;
import java.util.function.Supplier;
+import javax.annotation.Nullable;
+import javax.annotation.concurrent.ThreadSafe;
+
+import org.apache.commons.configuration2.Configuration;
+import org.apache.hugegraph.util.E;
+import org.apache.hugegraph.util.Log;
+import org.apache.tinkerpop.gremlin.driver.Client;
+import org.apache.tinkerpop.gremlin.driver.Cluster;
+import org.apache.tinkerpop.gremlin.driver.Result;
+import org.apache.tinkerpop.gremlin.driver.ResultSet;
+import org.apache.tinkerpop.gremlin.driver.Tokens;
+import org.apache.tinkerpop.gremlin.driver.message.RequestMessage;
+import org.slf4j.Logger;
+
@ThreadSafe
public final class CypherClient {
@@ -93,7 +97,7 @@ public final class CypherClient {
}
private List<Object> doQueryList(Client client, RequestMessage request)
- throws ExecutionException, InterruptedException {
+ throws ExecutionException, InterruptedException {
ResultSet results = client.submitAsync(request).get();
Iterator<Result> iter = results.iterator();
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherModel.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherModel.java
index c85a0aff0..cd5a76923 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherModel.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherModel.java
@@ -50,12 +50,14 @@ public class CypherModel {
}
public static class Status {
+
public String message = "";
public int code;
public Map<String, Object> attributes = Collections.EMPTY_MAP;
}
private static class Result {
+
public List<Object> data;
public Map<String, Object> meta = Collections.EMPTY_MAP;
}
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AuthenticationFilter.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AuthenticationFilter.java
index ba69fd9c0..fffe5ef9e 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AuthenticationFilter.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AuthenticationFilter.java
@@ -143,8 +143,8 @@ public class AuthenticationFilter implements ContainerRequestFilter {
String auth = context.getHeaderString(HttpHeaders.AUTHORIZATION);
if (auth == null) {
throw new NotAuthorizedException(
- "Authentication credentials are required",
- "Missing authentication credentials");
+ "Authentication credentials are required",
+ "Missing authentication credentials");
}
if (auth.startsWith(BASIC_AUTH_PREFIX)) {
@@ -154,7 +154,7 @@ public class AuthenticationFilter implements ContainerRequestFilter {
String[] values = auth.split(":");
if (values.length != 2) {
throw new BadRequestException(
- "Invalid syntax for username and password");
+ "Invalid syntax for username and password");
}
final String username = values[0];
@@ -163,7 +163,7 @@ public class AuthenticationFilter implements ContainerRequestFilter {
if (StringUtils.isEmpty(username) ||
StringUtils.isEmpty(password)) {
throw new BadRequestException(
- "Invalid syntax for username and password");
+ "Invalid syntax for username and password");
}
credentials.put(HugeAuthenticator.KEY_USERNAME, username);
@@ -173,7 +173,7 @@ public class AuthenticationFilter implements ContainerRequestFilter {
credentials.put(HugeAuthenticator.KEY_TOKEN, token);
} else {
throw new BadRequestException(
- "Only HTTP Basic or Bearer authentication is supported");
+ "Only HTTP Basic or Bearer authentication is supported");
}
credentials.put(HugeAuthenticator.KEY_ADDRESS, peer);
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/CompressInterceptor.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/CompressInterceptor.java
index a5cf78aa4..f38ffd78f 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/CompressInterceptor.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/CompressInterceptor.java
@@ -24,18 +24,17 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.zip.GZIPOutputStream;
+import org.apache.hugegraph.api.filter.CompressInterceptor.Compress;
+import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
+
+import jakarta.inject.Singleton;
import jakarta.ws.rs.NameBinding;
import jakarta.ws.rs.WebApplicationException;
import jakarta.ws.rs.core.MultivaluedMap;
import jakarta.ws.rs.ext.Provider;
import jakarta.ws.rs.ext.WriterInterceptor;
import jakarta.ws.rs.ext.WriterInterceptorContext;
-import jakarta.inject.Singleton;
-
-import org.slf4j.Logger;
-
-import org.apache.hugegraph.api.filter.CompressInterceptor.Compress;
-import org.apache.hugegraph.util.Log;
@Provider
@Singleton
@@ -51,7 +50,7 @@ public class CompressInterceptor implements WriterInterceptor {
@Override
public void aroundWriteTo(WriterInterceptorContext context)
- throws IOException, WebApplicationException {
+ throws IOException, WebApplicationException {
// If there is no annotation(like exception), we don't compress it
if (context.getAnnotations().length > 0) {
try {
@@ -70,14 +69,14 @@ public class CompressInterceptor implements WriterInterceptor {
}
private void compress(WriterInterceptorContext context)
- throws IOException {
+ throws IOException {
// Get compress info from the @Compress annotation
final Compress compression = getCompressAnnotation(context);
final String encoding = compression.value();
final int buffer = compression.buffer();
// Update header
- MultivaluedMap<String,Object> headers = context.getHeaders();
+ MultivaluedMap<String, Object> headers = context.getHeaders();
headers.remove("Content-Length");
headers.add("Content-Encoding", encoding);
@@ -104,7 +103,9 @@ public class CompressInterceptor implements WriterInterceptor {
@NameBinding
@Retention(RetentionPolicy.RUNTIME)
public @interface Compress {
+
String value() default GZIP;
+
int buffer() default BUFFER_SIZE;
}
}
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/DecompressInterceptor.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/DecompressInterceptor.java
index d8de56090..af8615a4c 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/DecompressInterceptor.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/DecompressInterceptor.java
@@ -37,7 +37,7 @@ public class DecompressInterceptor implements ReaderInterceptor {
@Override
public Object aroundReadFrom(ReaderInterceptorContext context)
- throws IOException {
+ throws IOException {
// NOTE: Currently we just support GZIP
String encoding = context.getHeaders().getFirst("Content-Encoding");
if (!GZIP.equalsIgnoreCase(encoding)) {
@@ -51,6 +51,7 @@ public class DecompressInterceptor implements ReaderInterceptor {
@NameBinding
@Retention(RetentionPolicy.RUNTIME)
public @interface Decompress {
+
String value() default GZIP;
}
}
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/ExceptionFilter.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/ExceptionFilter.java
index 894f38c66..ded04b354 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/ExceptionFilter.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/ExceptionFilter.java
@@ -25,6 +25,18 @@ import javax.json.Json;
import javax.json.JsonArrayBuilder;
import javax.json.JsonObjectBuilder;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.hugegraph.HugeException;
+import org.apache.hugegraph.api.API;
+import org.apache.hugegraph.config.HugeConfig;
+import org.apache.hugegraph.config.ServerOptions;
+import org.apache.hugegraph.exception.HugeGremlinException;
+import org.apache.hugegraph.exception.NotFoundException;
+import org.glassfish.hk2.api.MultiException;
+
+import com.codahale.metrics.annotation.Timed;
+import com.google.common.collect.ImmutableMap;
+
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.security.RolesAllowed;
import jakarta.inject.Singleton;
@@ -41,18 +53,6 @@ import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.ext.ExceptionMapper;
import jakarta.ws.rs.ext.Provider;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.hugegraph.config.ServerOptions;
-import org.glassfish.hk2.api.MultiException;
-
-import org.apache.hugegraph.HugeException;
-import org.apache.hugegraph.api.API;
-import org.apache.hugegraph.config.HugeConfig;
-import org.apache.hugegraph.exception.HugeGremlinException;
-import org.apache.hugegraph.exception.NotFoundException;
-import com.codahale.metrics.annotation.Timed;
-import com.google.common.collect.ImmutableMap;
-
public class ExceptionFilter {
private static final int BAD_REQUEST_ERROR =
@@ -107,8 +107,8 @@ public class ExceptionFilter {
@Provider
public static class HugeExceptionMapper
- extends TracedExceptionMapper
- implements ExceptionMapper<HugeException> {
+ extends TracedExceptionMapper
+ implements ExceptionMapper<HugeException> {
@Override
public Response toResponse(HugeException exception) {
@@ -121,8 +121,8 @@ public class ExceptionFilter {
@Provider
public static class IllegalArgumentExceptionMapper
- extends TracedExceptionMapper
- implements ExceptionMapper<IllegalArgumentException> {
+ extends TracedExceptionMapper
+ implements ExceptionMapper<IllegalArgumentException> {
@Override
public Response toResponse(IllegalArgumentException exception) {
@@ -135,8 +135,8 @@ public class ExceptionFilter {
@Provider
public static class NotFoundExceptionMapper
- extends TracedExceptionMapper
- implements ExceptionMapper<NotFoundException> {
+ extends TracedExceptionMapper
+ implements ExceptionMapper<NotFoundException> {
@Override
public Response toResponse(NotFoundException exception) {
@@ -149,8 +149,8 @@ public class ExceptionFilter {
@Provider
public static class NoSuchElementExceptionMapper
- extends TracedExceptionMapper
- implements ExceptionMapper<NoSuchElementException> {
+ extends TracedExceptionMapper
+ implements ExceptionMapper<NoSuchElementException> {
@Override
public Response toResponse(NoSuchElementException exception) {
@@ -163,8 +163,8 @@ public class ExceptionFilter {
@Provider
public static class WebApplicationExceptionMapper
- extends TracedExceptionMapper
- implements ExceptionMapper<WebApplicationException> {
+ extends TracedExceptionMapper
+ implements ExceptionMapper<WebApplicationException> {
@Override
public Response toResponse(WebApplicationException exception) {
@@ -189,8 +189,8 @@ public class ExceptionFilter {
@Provider
public static class HugeGremlinExceptionMapper
- extends TracedExceptionMapper
- implements ExceptionMapper<HugeGremlinException> {
+ extends TracedExceptionMapper
+ implements ExceptionMapper<HugeGremlinException> {
@Override
public Response toResponse(HugeGremlinException exception) {
@@ -204,7 +204,7 @@ public class ExceptionFilter {
@Provider
public static class AssertionErrorMapper extends TracedExceptionMapper
- implements ExceptionMapper<AssertionError> {
+ implements ExceptionMapper<AssertionError> {
@Override
public Response toResponse(AssertionError exception) {
@@ -217,7 +217,7 @@ public class ExceptionFilter {
@Provider
public static class UnknownExceptionMapper extends TracedExceptionMapper
- implements ExceptionMapper<Throwable> {
+ implements ExceptionMapper<Throwable> {
@Override
public Response toResponse(Throwable exception) {
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadDetectFilter.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadDetectFilter.java
index 42344e613..7bda2b756 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadDetectFilter.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadDetectFilter.java
@@ -20,6 +20,15 @@ package org.apache.hugegraph.api.filter;
import java.util.List;
import java.util.Set;
+import org.apache.hugegraph.config.HugeConfig;
+import org.apache.hugegraph.config.ServerOptions;
+import org.apache.hugegraph.define.WorkLoad;
+import org.apache.hugegraph.util.Bytes;
+import org.apache.hugegraph.util.E;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.common.util.concurrent.RateLimiter;
+
import jakarta.inject.Singleton;
import jakarta.ws.rs.ServiceUnavailableException;
import jakarta.ws.rs.container.ContainerRequestContext;
@@ -29,14 +38,6 @@ import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.core.PathSegment;
import jakarta.ws.rs.ext.Provider;
-import org.apache.hugegraph.config.HugeConfig;
-import org.apache.hugegraph.config.ServerOptions;
-import org.apache.hugegraph.define.WorkLoad;
-import org.apache.hugegraph.util.Bytes;
-import org.apache.hugegraph.util.E;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.util.concurrent.RateLimiter;
-
@Provider
@Singleton
@PreMatching
@@ -51,7 +52,7 @@ public class LoadDetectFilter implements ContainerRequestFilter {
// Call gc every 30+ seconds if memory is low and request frequently
private static final RateLimiter GC_RATE_LIMITER =
- RateLimiter.create(1.0 / 30);
+ RateLimiter.create(1.0 / 30);
@Context
private jakarta.inject.Provider<HugeConfig> configProvider;
@@ -71,9 +72,9 @@ public class LoadDetectFilter implements ContainerRequestFilter {
// There will be a thread doesn't work, dedicated to statistics
if (load.incrementAndGet() >= maxWorkerThreads) {
throw new ServiceUnavailableException(String.format(
- "The server is too busy to process the request, " +
- "you can config %s to adjust it or try again later",
- ServerOptions.MAX_WORKER_THREADS.name()));
+ "The server is too busy to process the request, " +
+ "you can config %s to adjust it or try again later",
+ ServerOptions.MAX_WORKER_THREADS.name()));
}
long minFreeMemory = config.get(ServerOptions.MIN_FREE_MEMORY);
@@ -84,11 +85,11 @@ public class LoadDetectFilter implements ContainerRequestFilter {
if (presumableFreeMem < minFreeMemory) {
gcIfNeeded();
throw new ServiceUnavailableException(String.format(
- "The server available memory %s(MB) is below than " +
- "threshold %s(MB) and can't process the request, " +
- "you can config %s to adjust it or try again later",
- presumableFreeMem, minFreeMemory,
- ServerOptions.MIN_FREE_MEMORY.name()));
+ "The server available memory %s(MB) is below than " +
+ "threshold %s(MB) and can't process the request, " +
+ "you can config %s to adjust it or try again later",
+ presumableFreeMem, minFreeMemory,
+ ServerOptions.MIN_FREE_MEMORY.name()));
}
}
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadReleaseFilter.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadReleaseFilter.java
index 04f2fada5..83a6b0d73 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadReleaseFilter.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/LoadReleaseFilter.java
@@ -17,6 +17,8 @@
package org.apache.hugegraph.api.filter;
+import org.apache.hugegraph.define.WorkLoad;
+
import jakarta.inject.Singleton;
import jakarta.ws.rs.container.ContainerRequestContext;
import jakarta.ws.rs.container.ContainerResponseContext;
@@ -24,8 +26,6 @@ import jakarta.ws.rs.container.ContainerResponseFilter;
import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.ext.Provider;
-import org.apache.hugegraph.define.WorkLoad;
-
@Provider
@Singleton
public class LoadReleaseFilter implements ContainerResponseFilter {
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/RedirectFilter.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/RedirectFilter.java
index 35dc3793d..2a2a9142e 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/RedirectFilter.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/RedirectFilter.java
@@ -151,5 +151,6 @@ public class RedirectFilter implements ContainerRequestFilter {
@NameBinding
@Retention(RetentionPolicy.RUNTIME)
public @interface RedirectMasterRole {
+
}
}
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/StatusFilter.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/StatusFilter.java
index 70f6cb16d..980c714d3 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/StatusFilter.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/StatusFilter.java
@@ -34,7 +34,7 @@ public class StatusFilter implements ContainerResponseFilter {
@Override
public void filter(ContainerRequestContext requestContext,
ContainerResponseContext responseContext)
- throws IOException {
+ throws IOException {
if (responseContext.getStatus() == 200) {
for (Annotation i : responseContext.getEntityAnnotations()) {
if (i instanceof Status) {
@@ -48,6 +48,7 @@ public class StatusFilter implements ContainerResponseFilter {
@NameBinding
@Retention(RetentionPolicy.RUNTIME)
public @interface Status {
+
int OK = 200;
int CREATED = 201;
int ACCEPTED = 202;
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/BatchAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/BatchAPI.java
index c533a7d99..2ba95e5bc 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/BatchAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/BatchAPI.java
@@ -21,21 +21,21 @@ import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicInteger;
-import org.apache.tinkerpop.gremlin.structure.Element;
+import org.apache.hugegraph.HugeException;
+import org.apache.hugegraph.HugeGraph;
+import org.apache.hugegraph.api.API;
+import org.apache.hugegraph.config.HugeConfig;
import org.apache.hugegraph.config.ServerOptions;
import org.apache.hugegraph.define.Checkable;
import org.apache.hugegraph.define.UpdateStrategy;
import org.apache.hugegraph.metrics.MetricsUtil;
import org.apache.hugegraph.server.RestServer;
-import org.slf4j.Logger;
-
-import org.apache.hugegraph.HugeException;
-import org.apache.hugegraph.HugeGraph;
-import org.apache.hugegraph.api.API;
-import org.apache.hugegraph.config.HugeConfig;
import org.apache.hugegraph.structure.HugeElement;
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.Log;
+import org.apache.tinkerpop.gremlin.structure.Element;
+import org.slf4j.Logger;
+
import com.codahale.metrics.Meter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -49,14 +49,13 @@ public class BatchAPI extends API {
static {
MetricsUtil.registerGauge(RestServer.class, "batch-write-threads",
- () -> BATCH_WRITE_THREADS.intValue());
+ BATCH_WRITE_THREADS::intValue);
}
private final Meter batchMeter;
public BatchAPI() {
- this.batchMeter = MetricsUtil.registerMeter(this.getClass(),
- "batch-commit");
+ this.batchMeter = MetricsUtil.registerMeter(this.getClass(), "batch-commit");
}
public <R> R commit(HugeConfig config, HugeGraph g, int size,
@@ -99,8 +98,7 @@ public class BatchAPI extends API {
protected abstract Object[] properties();
}
- protected void updateExistElement(JsonElement oldElement,
- JsonElement newElement,
+ protected void updateExistElement(JsonElement oldElement, JsonElement newElement,
Map<String, UpdateStrategy> strategies) {
if (oldElement == null) {
return;
@@ -113,8 +111,8 @@ public class BatchAPI extends API {
if (oldElement.properties.get(key) != null &&
newElement.properties.get(key) != null) {
Object value = updateStrategy.checkAndUpdateProperty(
- oldElement.properties.get(key),
- newElement.properties.get(key));
+ oldElement.properties.get(key),
+ newElement.properties.get(key));
newElement.properties.put(key, value);
} else if (oldElement.properties.get(key) != null &&
newElement.properties.get(key) == null) {
@@ -124,9 +122,7 @@ public class BatchAPI extends API {
}
}
- protected void updateExistElement(HugeGraph g,
- Element oldElement,
- JsonElement newElement,
+ protected void updateExistElement(HugeGraph g, Element oldElement, JsonElement newElement,
Map<String, UpdateStrategy> strategies) {
if (oldElement == null) {
return;
@@ -139,8 +135,8 @@ public class BatchAPI extends API {
if (oldElement.property(key).isPresent() &&
newElement.properties.get(key) != null) {
Object value = updateStrategy.checkAndUpdateProperty(
- oldElement.property(key).value(),
- newElement.properties.get(key));
+ oldElement.property(key).value(),
+ newElement.properties.get(key));
value = g.propertyKey(key).validValueOrThrow(value);
newElement.properties.put(key, value);
} else if (oldElement.property(key).isPresent() &&
@@ -151,8 +147,7 @@ public class BatchAPI extends API {
}
}
- protected static void updateProperties(HugeElement element,
- JsonElement jsonElement,
+ protected static void updateProperties(HugeElement element, JsonElement jsonElement,
boolean append) {
for (Map.Entry<String, Object> e : jsonElement.properties.entrySet()) {
String key = e.getKey();
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/EdgeAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/EdgeAPI.java
index c0a8577e5..25e8cacf0 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/EdgeAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/EdgeAPI.java
@@ -24,31 +24,6 @@ import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.annotation.security.RolesAllowed;
-import jakarta.inject.Singleton;
-import jakarta.ws.rs.Consumes;
-import jakarta.ws.rs.DELETE;
-import jakarta.ws.rs.DefaultValue;
-import jakarta.ws.rs.GET;
-import jakarta.ws.rs.POST;
-import jakarta.ws.rs.PUT;
-import jakarta.ws.rs.Path;
-import jakarta.ws.rs.PathParam;
-import jakarta.ws.rs.Produces;
-import jakarta.ws.rs.QueryParam;
-import jakarta.ws.rs.core.Context;
-
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
-import org.apache.tinkerpop.gremlin.structure.Direction;
-import org.apache.tinkerpop.gremlin.structure.Edge;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.apache.tinkerpop.gremlin.util.function.TriFunction;
-import org.apache.hugegraph.config.ServerOptions;
-import org.apache.hugegraph.core.GraphManager;
-import org.apache.hugegraph.define.UpdateStrategy;
-import org.slf4j.Logger;
-
import org.apache.hugegraph.HugeGraph;
import org.apache.hugegraph.api.API;
import org.apache.hugegraph.api.filter.CompressInterceptor.Compress;
@@ -58,6 +33,9 @@ import org.apache.hugegraph.backend.id.EdgeId;
import org.apache.hugegraph.backend.id.Id;
import org.apache.hugegraph.backend.query.ConditionQuery;
import org.apache.hugegraph.config.HugeConfig;
+import org.apache.hugegraph.config.ServerOptions;
+import org.apache.hugegraph.core.GraphManager;
+import org.apache.hugegraph.define.UpdateStrategy;
import org.apache.hugegraph.exception.NotFoundException;
import org.apache.hugegraph.schema.EdgeLabel;
import org.apache.hugegraph.schema.PropertyKey;
@@ -69,9 +47,31 @@ import org.apache.hugegraph.traversal.optimize.TraversalUtil;
import org.apache.hugegraph.type.define.Directions;
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.Log;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
+import org.apache.tinkerpop.gremlin.structure.Direction;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.util.function.TriFunction;
+import org.slf4j.Logger;
+
import com.codahale.metrics.annotation.Timed;
import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.annotation.security.RolesAllowed;
+import jakarta.inject.Singleton;
+import jakarta.ws.rs.Consumes;
+import jakarta.ws.rs.DELETE;
+import jakarta.ws.rs.DefaultValue;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.PUT;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.QueryParam;
+import jakarta.ws.rs.core.Context;
+
@Path("graphs/{graph}/graph/edges")
@Singleton
@Tag(name = "EdgeAPI")
@@ -98,18 +98,15 @@ public class EdgeAPI extends BatchAPI {
* NOTE: If the vertex id is correct but label not match with id,
* we allow to create it here
*/
- vertexLabel(g, jsonEdge.sourceLabel,
- "Invalid source vertex label '%s'");
- vertexLabel(g, jsonEdge.targetLabel,
- "Invalid target vertex label '%s'");
+ vertexLabel(g, jsonEdge.sourceLabel, "Invalid source vertex label '%s'");
+ vertexLabel(g, jsonEdge.targetLabel, "Invalid target vertex label '%s'");
}
Vertex srcVertex = getVertex(g, jsonEdge.source, jsonEdge.sourceLabel);
Vertex tgtVertex = getVertex(g, jsonEdge.target, jsonEdge.targetLabel);
Edge edge = commit(g, () -> {
- return srcVertex.addEdge(jsonEdge.label, tgtVertex,
- jsonEdge.properties());
+ return srcVertex.addEdge(jsonEdge.label, tgtVertex, jsonEdge.properties());
});
return manager.serializer(g).writeEdge(edge);
@@ -136,7 +133,7 @@ public class EdgeAPI extends BatchAPI {
HugeGraph g = graph(manager, graph);
TriFunction<HugeGraph, Object, String, Vertex> getVertex =
- checkVertex ? EdgeAPI::getVertex : EdgeAPI::newVertex;
+ checkVertex ? EdgeAPI::getVertex : EdgeAPI::newVertex;
return this.commit(config, g, jsonEdges.size(), () -> {
List<Id> ids = new ArrayList<>(jsonEdges.size());
@@ -146,12 +143,9 @@ public class EdgeAPI extends BatchAPI {
* then the label is correct and not matched id,
* it will be allowed currently
*/
- Vertex srcVertex = getVertex.apply(g, jsonEdge.source,
- jsonEdge.sourceLabel);
- Vertex tgtVertex = getVertex.apply(g, jsonEdge.target,
- jsonEdge.targetLabel);
- Edge edge = srcVertex.addEdge(jsonEdge.label, tgtVertex,
- jsonEdge.properties());
+ Vertex srcVertex = getVertex.apply(g, jsonEdge.source, jsonEdge.sourceLabel);
+ Vertex tgtVertex = getVertex.apply(g, jsonEdge.target, jsonEdge.targetLabel);
+ Edge edge = srcVertex.addEdge(jsonEdge.label, tgtVertex, jsonEdge.properties());
ids.add((Id) edge.id());
}
return manager.serializer(g).writeIds(ids);
@@ -179,16 +173,16 @@ public class EdgeAPI extends BatchAPI {
HugeGraph g = graph(manager, graph);
Map<Id, JsonEdge> map = new HashMap<>(req.jsonEdges.size());
- TriFunction<HugeGraph, Object, String, Vertex> getVertex =
- req.checkVertex ? EdgeAPI::getVertex : EdgeAPI::newVertex;
+ TriFunction<HugeGraph, Object, String, Vertex> getVertex = req.checkVertex ?
+ EdgeAPI::getVertex :
+ EdgeAPI::newVertex;
- return this.commit(config, g, map.size(), () -> {
+ return this.commit(config, g, 0, () -> {
// 1.Put all newEdges' properties into map (combine first)
req.jsonEdges.forEach(newEdge -> {
Id newEdgeId = getEdgeId(graph(manager, graph), newEdge);
JsonEdge oldEdge = map.get(newEdgeId);
- this.updateExistElement(oldEdge, newEdge,
- req.updateStrategies);
+ this.updateExistElement(oldEdge, newEdge, req.updateStrategies);
map.put(newEdgeId, newEdge);
});
@@ -197,19 +191,15 @@ public class EdgeAPI extends BatchAPI {
Iterator<Edge> oldEdges = g.edges(ids);
oldEdges.forEachRemaining(oldEdge -> {
JsonEdge newEdge = map.get(oldEdge.id());
- this.updateExistElement(g, oldEdge, newEdge,
- req.updateStrategies);
+ this.updateExistElement(g, oldEdge, newEdge, req.updateStrategies);
});
// 3.Add all finalEdges
List<Edge> edges = new ArrayList<>(map.size());
map.values().forEach(finalEdge -> {
- Vertex srcVertex = getVertex.apply(g, finalEdge.source,
- finalEdge.sourceLabel);
- Vertex tgtVertex = getVertex.apply(g, finalEdge.target,
- finalEdge.targetLabel);
- edges.add(srcVertex.addEdge(finalEdge.label, tgtVertex,
- finalEdge.properties()));
+ Vertex srcVertex = getVertex.apply(g, finalEdge.source, finalEdge.sourceLabel);
+ Vertex tgtVertex = getVertex.apply(g, finalEdge.target, finalEdge.targetLabel);
+ edges.add(srcVertex.addEdge(finalEdge.label, tgtVertex, finalEdge.properties()));
});
// If return ids, the ids.size() maybe different with the origins'
@@ -253,7 +243,6 @@ public class EdgeAPI extends BatchAPI {
}
commit(g, () -> updateProperties(edge, jsonEdge, append));
-
return manager.serializer(g).writeEdge(edge);
}
@@ -281,8 +270,7 @@ public class EdgeAPI extends BatchAPI {
Map<String, Object> props = parseProperties(properties);
if (page != null) {
E.checkArgument(offset == 0,
- "Not support querying edges based on paging " +
- "and offset together");
+ "Not support querying edges based on paging and offset together");
}
Id vertex = VertexAPI.checkAndParseVertexId(vertexId);
@@ -321,8 +309,7 @@ public class EdgeAPI extends BatchAPI {
if (page == null) {
traversal = traversal.range(offset, offset + limit);
} else {
- traversal = traversal.has(QueryHolder.SYSPROP_PAGE, page)
- .limit(limit);
+ traversal = traversal.has(QueryHolder.SYSPROP_PAGE, page).limit(limit);
}
try {
@@ -372,42 +359,38 @@ public class EdgeAPI extends BatchAPI {
g.removeEdge(label, id);
} catch (NotFoundException e) {
throw new IllegalArgumentException(String.format(
- "No such edge with id: '%s', %s", id, e));
+ "No such edge with id: '%s', %s", id, e));
} catch (NoSuchElementException e) {
throw new IllegalArgumentException(String.format(
- "No such edge with id: '%s'", id));
+ "No such edge with id: '%s'", id));
}
});
}
- private static void checkBatchSize(HugeConfig config,
- List<JsonEdge> edges) {
+ private static void checkBatchSize(HugeConfig config, List<JsonEdge> edges) {
int max = config.get(ServerOptions.MAX_EDGES_PER_BATCH);
if (edges.size() > max) {
throw new IllegalArgumentException(String.format(
- "Too many edges for one time post, " +
- "the maximum number is '%s'", max));
+ "Too many edges for one time post, " +
+ "the maximum number is '%s'", max));
}
- if (edges.size() == 0) {
- throw new IllegalArgumentException(
- "The number of edges can't be 0");
+ if (edges.isEmpty()) {
+ throw new IllegalArgumentException("The number of edges can't be 0");
}
}
- private static Vertex getVertex(HugeGraph graph,
- Object id, String label) {
+ private static Vertex getVertex(HugeGraph graph, Object id, String label) {
HugeVertex vertex;
try {
vertex = (HugeVertex) graph.vertices(id).next();
} catch (NoSuchElementException e) {
- throw new IllegalArgumentException(String.format(
- "Invalid vertex id '%s'", id));
+ throw new IllegalArgumentException(String.format("Invalid vertex id '%s'", id));
}
if (label != null && !vertex.label().equals(label)) {
throw new IllegalArgumentException(String.format(
- "The label of vertex '%s' is unmatched, users expect " +
- "label '%s', actual label stored is '%s'",
- id, label, vertex.label()));
+ "The label of vertex '%s' is unmatched, users expect " +
+ "label '%s', actual label stored is '%s'",
+ id, label, vertex.label()));
}
// Clone a new vertex to support multi-thread access
return vertex.copy();
@@ -419,8 +402,7 @@ public class EdgeAPI extends BatchAPI {
return new HugeVertex(g, idValue, vl);
}
- private static VertexLabel vertexLabel(HugeGraph graph, String label,
- String message) {
+ private static VertexLabel vertexLabel(HugeGraph graph, String label, String message) {
try {
// NOTE: don't use SchemaManager because it will throw 404
return graph.vertexLabel(label);
@@ -437,8 +419,8 @@ public class EdgeAPI extends BatchAPI {
return Direction.valueOf(direction);
} catch (Exception e) {
throw new IllegalArgumentException(String.format(
- "Direction value must be in [OUT, IN, BOTH], " +
- "but got '%s'", direction));
+ "Direction value must be in [OUT, IN, BOTH], " +
+ "but got '%s'", direction));
}
}
@@ -453,8 +435,7 @@ public class EdgeAPI extends BatchAPI {
String sortKey = pk.name();
Object sortKeyValue = newEdge.properties.get(sortKey);
E.checkArgument(sortKeyValue != null,
- "The value of sort key '%s' can't be null",
- sortKey);
+ "The value of sort key '%s' can't be null", sortKey);
sortKeyValue = pk.validValueOrThrow(sortKeyValue);
sortKeyValues.add(sortKeyValue);
});
@@ -487,14 +468,11 @@ public class EdgeAPI extends BatchAPI {
private static void checkUpdate(BatchEdgeRequest req) {
E.checkArgumentNotNull(req, "BatchEdgeRequest can't be null");
- E.checkArgumentNotNull(req.jsonEdges,
- "Parameter 'edges' can't be null");
- E.checkArgument(req.updateStrategies != null &&
- !req.updateStrategies.isEmpty(),
+ E.checkArgumentNotNull(req.jsonEdges, "Parameter 'edges' can't be null");
+ E.checkArgument(req.updateStrategies != null && !req.updateStrategies.isEmpty(),
"Parameter 'update_strategies' can't be empty");
- E.checkArgument(req.createIfNotExist == true,
- "Parameter 'create_if_not_exist' " +
- "dose not support false now");
+ E.checkArgument(req.createIfNotExist,
+ "Parameter 'create_if_not_exist' dose not support false now");
}
@Override
@@ -524,15 +502,11 @@ public class EdgeAPI extends BatchAPI {
E.checkArgumentNotNull(this.source, "Expect source vertex id");
E.checkArgumentNotNull(this.target, "Expect target vertex id");
if (isBatch) {
- E.checkArgumentNotNull(this.sourceLabel,
- "Expect source vertex label");
- E.checkArgumentNotNull(this.targetLabel,
- "Expect target vertex label");
+ E.checkArgumentNotNull(this.sourceLabel, "Expect source vertex label");
+ E.checkArgumentNotNull(this.targetLabel, "Expect target vertex label");
} else {
- E.checkArgument(this.sourceLabel == null &&
- this.targetLabel == null ||
- this.sourceLabel != null &&
- this.targetLabel != null,
+ E.checkArgument(this.sourceLabel == null && this.targetLabel == null ||
+ this.sourceLabel != null && this.targetLabel != null,
"The both source and target vertex label " +
"are either passed in, or not passed in");
}
@@ -541,15 +515,13 @@ public class EdgeAPI extends BatchAPI {
@Override
public void checkUpdate() {
- E.checkArgumentNotNull(this.properties,
- "The properties of edge can't be null");
+ E.checkArgumentNotNull(this.properties, "The properties of edge can't be null");
for (Map.Entry<String, Object> entry : this.properties.entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
E.checkArgumentNotNull(value, "Not allowed to set value of " +
- "property '%s' to null for edge '%s'",
- key, this.id);
+ "property '%s' to null for edge '%s'", key, this.id);
}
}
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/VertexAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/VertexAPI.java
index 98032d2ad..e25e7888b 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/VertexAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/VertexAPI.java
@@ -25,29 +25,6 @@ import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.annotation.security.RolesAllowed;
-import jakarta.inject.Singleton;
-import jakarta.ws.rs.Consumes;
-import jakarta.ws.rs.DELETE;
-import jakarta.ws.rs.DefaultValue;
-import jakarta.ws.rs.GET;
-import jakarta.ws.rs.POST;
-import jakarta.ws.rs.PUT;
-import jakarta.ws.rs.Path;
-import jakarta.ws.rs.PathParam;
-import jakarta.ws.rs.Produces;
-import jakarta.ws.rs.QueryParam;
-import jakarta.ws.rs.core.Context;
-
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
-import org.apache.tinkerpop.gremlin.structure.T;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.apache.hugegraph.config.ServerOptions;
-import org.apache.hugegraph.core.GraphManager;
-import org.apache.hugegraph.define.UpdateStrategy;
-import org.slf4j.Logger;
-
import org.apache.hugegraph.HugeGraph;
import org.apache.hugegraph.api.API;
import org.apache.hugegraph.api.filter.CompressInterceptor.Compress;
@@ -57,6 +34,9 @@ import org.apache.hugegraph.backend.id.Id;
import org.apache.hugegraph.backend.id.SplicingIdGenerator;
import org.apache.hugegraph.backend.query.ConditionQuery;
import org.apache.hugegraph.config.HugeConfig;
+import org.apache.hugegraph.config.ServerOptions;
+import org.apache.hugegraph.core.GraphManager;
+import org.apache.hugegraph.define.UpdateStrategy;
import org.apache.hugegraph.exception.NotFoundException;
import org.apache.hugegraph.schema.PropertyKey;
import org.apache.hugegraph.schema.VertexLabel;
@@ -68,9 +48,29 @@ import org.apache.hugegraph.type.define.IdStrategy;
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.JsonUtil;
import org.apache.hugegraph.util.Log;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
+import org.apache.tinkerpop.gremlin.structure.T;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.slf4j.Logger;
+
import com.codahale.metrics.annotation.Timed;
import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.annotation.security.RolesAllowed;
+import jakarta.inject.Singleton;
+import jakarta.ws.rs.Consumes;
+import jakarta.ws.rs.DELETE;
+import jakarta.ws.rs.DefaultValue;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.PUT;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.QueryParam;
+import jakarta.ws.rs.core.Context;
+
@Path("graphs/{graph}/graph/vertices")
@Singleton
@Tag(name = "VertexAPI")
@@ -148,7 +148,7 @@ public class VertexAPI extends BatchAPI {
HugeGraph g = graph(manager, graph);
Map<Id, JsonVertex> map = new HashMap<>(req.jsonVertices.size());
- return this.commit(config, g, map.size(), () -> {
+ return this.commit(config, g, 0, () -> {
/*
* 1.Put all newVertices' properties into map (combine first)
* - Consider primary-key & user-define ID mode first
@@ -156,8 +156,7 @@ public class VertexAPI extends BatchAPI {
req.jsonVertices.forEach(newVertex -> {
Id newVertexId = getVertexId(g, newVertex);
JsonVertex oldVertex = map.get(newVertexId);
- this.updateExistElement(oldVertex, newVertex,
- req.updateStrategies);
+ this.updateExistElement(oldVertex, newVertex, req.updateStrategies);
map.put(newVertexId, newVertex);
});
@@ -166,8 +165,7 @@ public class VertexAPI extends BatchAPI {
Iterator<Vertex> oldVertices = g.vertices(ids);
oldVertices.forEachRemaining(oldVertex -> {
JsonVertex newVertex = map.get(oldVertex.id());
- this.updateExistElement(g, oldVertex, newVertex,
- req.updateStrategies);
+ this.updateExistElement(g, oldVertex, newVertex, req.updateStrategies);
});
// 3.Add finalVertices and return them
@@ -177,8 +175,7 @@ public class VertexAPI extends BatchAPI {
});
// If return ids, the ids.size() maybe different with the origins'
- return manager.serializer(g)
- .writeVertices(vertices.iterator(), false);
+ return manager.serializer(g).writeVertices(vertices.iterator(), false);
});
}
@@ -238,8 +235,7 @@ public class VertexAPI extends BatchAPI {
Map<String, Object> props = parseProperties(properties);
if (page != null) {
E.checkArgument(offset == 0,
- "Not support querying vertices based on paging " +
- "and offset together");
+ "Not support querying vertices based on paging and offset together");
}
HugeGraph g = graph(manager, graph);
@@ -265,13 +261,11 @@ public class VertexAPI extends BatchAPI {
if (page == null) {
traversal = traversal.range(offset, offset + limit);
} else {
- traversal = traversal.has(QueryHolder.SYSPROP_PAGE, page)
- .limit(limit);
+ traversal = traversal.has(QueryHolder.SYSPROP_PAGE, page).limit(limit);
}
try {
- return manager.serializer(g).writeVertices(traversal,
- page != null);
+ return manager.serializer(g).writeVertices(traversal, page != null);
} finally {
if (g.tx().isOpen()) {
g.tx().close();
@@ -319,10 +313,10 @@ public class VertexAPI extends BatchAPI {
g.removeVertex(label, id);
} catch (NotFoundException e) {
throw new IllegalArgumentException(String.format(
- "No such vertex with id: '%s', %s", id, e));
+ "No such vertex with id: '%s', %s", id, e));
} catch (NoSuchElementException e) {
throw new IllegalArgumentException(String.format(
- "No such vertex with id: '%s'", id));
+ "No such vertex with id: '%s'", id));
}
});
}
@@ -340,22 +334,19 @@ public class VertexAPI extends BatchAPI {
return uuid ? Text.uuid((String) id) : HugeVertex.getIdValue(id);
} catch (Exception e) {
throw new IllegalArgumentException(String.format(
- "The vertex id must be formatted as Number/String/UUID" +
- ", but got '%s'", idValue));
+ "The vertex id must be formatted as Number/String/UUID" +
+ ", but got '%s'", idValue));
}
}
- private static void checkBatchSize(HugeConfig config,
- List<JsonVertex> vertices) {
+ private static void checkBatchSize(HugeConfig config, List<JsonVertex> vertices) {
int max = config.get(ServerOptions.MAX_VERTICES_PER_BATCH);
if (vertices.size() > max) {
throw new IllegalArgumentException(String.format(
- "Too many vertices for one time post, " +
- "the maximum number is '%s'", max));
+ "Too many vertices for one time post, the maximum number is '%s'", max));
}
- if (vertices.size() == 0) {
- throw new IllegalArgumentException(
- "The number of vertices can't be 0");
+ if (vertices.isEmpty()) {
+ throw new IllegalArgumentException("The number of vertices can't be 0");
}
}
@@ -373,8 +364,7 @@ public class VertexAPI extends BatchAPI {
String propertyKey = g.propertyKey(pkId).name();
Object propertyValue = vertex.properties.get(propertyKey);
E.checkArgument(propertyValue != null,
- "The value of primary key '%s' can't be null",
- propertyKey);
+ "The value of primary key '%s' can't be null", propertyKey);
pkValues.add(propertyValue);
}
@@ -402,8 +392,7 @@ public class VertexAPI extends BatchAPI {
E.checkArgumentNotNull(req, "BatchVertexRequest can't be null");
E.checkArgumentNotNull(req.jsonVertices,
"Parameter 'vertices' can't be null");
- E.checkArgument(req.updateStrategies != null &&
- !req.updateStrategies.isEmpty(),
+ E.checkArgument(req.updateStrategies != null && !req.updateStrategies.isEmpty(),
"Parameter 'update_strategies' can't be empty");
E.checkArgument(req.createIfNotExist,
"Parameter 'create_if_not_exist' " +
@@ -428,14 +417,13 @@ public class VertexAPI extends BatchAPI {
@Override
public void checkUpdate() {
- E.checkArgumentNotNull(this.properties,
- "The properties of vertex can't be null");
+ E.checkArgumentNotNull(this.properties, "The properties of vertex can't be null");
for (Map.Entry<String, Object> e : this.properties.entrySet()) {
String key = e.getKey();
Object value = e.getValue();
E.checkArgumentNotNull(value, "Not allowed to set value of " +
- "property '%s' to null for vertex '%s'",
+ "property '%s' to null for vertex '%s'",
key, this.id);
}
}
@@ -462,7 +450,7 @@ public class VertexAPI extends BatchAPI {
}
if (this.id != null) {
newProps[appendIndex++] = T.id;
- // Keep value++ to avoid code trap
+ // Note: Here we keep value++ to avoid code trap
newProps[appendIndex++] = this.id;
}
return newProps;
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/AbstractJerseyRestClient.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/AbstractJerseyRestClient.java
index 37963a371..810dbc8b4 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/AbstractJerseyRestClient.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/AbstractJerseyRestClient.java
@@ -83,7 +83,7 @@ public abstract class AbstractJerseyRestClient {
* repository seems to have a bug: https://github.com/jersey/jersey/pull/3752
*/
PoolingHttpClientConnectionManager pool =
- new PoolingHttpClientConnectionManager(TTL, TimeUnit.HOURS);
+ new PoolingHttpClientConnectionManager(TTL, TimeUnit.HOURS);
Integer maxTotal = (Integer) conf.getProperty(PROPERTY_MAX_TOTAL);
Integer maxPerRoute = (Integer) conf.getProperty(PROPERTY_MAX_PER_ROUTE);
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinAPI.java
index 09459ca4c..4373b0f00 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinAPI.java
@@ -17,7 +17,15 @@
package org.apache.hugegraph.api.gremlin;
+import org.apache.hugegraph.api.filter.CompressInterceptor.Compress;
+import org.apache.hugegraph.config.HugeConfig;
+import org.apache.hugegraph.metrics.MetricsUtil;
+
+import com.codahale.metrics.Histogram;
+import com.codahale.metrics.annotation.Timed;
+
import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.inject.Singleton;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.POST;
@@ -29,14 +37,6 @@ import jakarta.ws.rs.core.MultivaluedMap;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.UriInfo;
-import org.apache.hugegraph.api.filter.CompressInterceptor.Compress;
-import org.apache.hugegraph.api.filter.RedirectFilter;
-import org.apache.hugegraph.config.HugeConfig;
-import org.apache.hugegraph.metrics.MetricsUtil;
-import com.codahale.metrics.Histogram;
-import com.codahale.metrics.annotation.Timed;
-import jakarta.inject.Singleton;
-
@Path("gremlin")
@Singleton
@Tag(name = "GremlinAPI")
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinQueryAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinQueryAPI.java
index 009f44dbd..ad4a6452b 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinQueryAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinQueryAPI.java
@@ -24,6 +24,7 @@ import org.apache.hugegraph.api.API;
import org.apache.hugegraph.config.HugeConfig;
import org.apache.hugegraph.config.ServerOptions;
import org.apache.hugegraph.exception.HugeGremlinException;
+
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/AlgorithmAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/AlgorithmAPI.java
index 408d27a39..8ebf1f6d1 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/AlgorithmAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/AlgorithmAPI.java
@@ -37,7 +37,6 @@ import com.codahale.metrics.annotation.Timed;
import com.google.common.collect.ImmutableMap;
import io.swagger.v3.oas.annotations.tags.Tag;
-
import jakarta.inject.Singleton;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.NotFoundException;
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/GremlinAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/GremlinAPI.java
index 5bb8274b7..e7def0506 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/GremlinAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/GremlinAPI.java
@@ -190,11 +190,11 @@ public class GremlinAPI extends API {
String gremlin = (String) map.get("gremlin");
@SuppressWarnings("unchecked")
Map<String, Object> bindings = (Map<String, Object>)
- map.get("bindings");
+ map.get("bindings");
String language = (String) map.get("language");
@SuppressWarnings("unchecked")
Map<String, String> aliases = (Map<String, String>)
- map.get("aliases");
+ map.get("aliases");
GremlinRequest request = new GremlinRequest();
request.gremlin(gremlin);
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/TaskAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/TaskAPI.java
index 4705df54b..42cc7d7f0 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/TaskAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/TaskAPI.java
@@ -92,7 +92,7 @@ public class TaskAPI extends API {
// Set limit to NO_LIMIT to ignore limit when query task by ids
limit = NO_LIMIT;
List<Id> idList = ids.stream().map(IdGenerator::of)
- .collect(Collectors.toList());
+ .collect(Collectors.toList());
iter = scheduler.tasks(idList);
} else {
if (status == null) {
@@ -158,7 +158,7 @@ public class TaskAPI extends API {
if (!ACTION_CANCEL.equals(action)) {
throw new NotSupportedException(String.format(
- "Not support action '%s'", action));
+ "Not support action '%s'", action));
}
TaskScheduler scheduler = graph(manager, graph).taskScheduler();
@@ -172,8 +172,8 @@ public class TaskAPI extends API {
assert task.completed() || task.cancelling();
throw new BadRequestException(String.format(
- "Can't cancel task '%s' which is completed or cancelling",
- id));
+ "Can't cancel task '%s' which is completed or cancelling",
+ id));
}
private static TaskStatus parseStatus(String status) {
@@ -181,8 +181,8 @@ public class TaskAPI extends API {
return TaskStatus.valueOf(status.toUpperCase());
} catch (Exception e) {
throw new IllegalArgumentException(String.format(
- "Status value must be in %s, but got '%s'",
- Arrays.asList(TaskStatus.values()), status));
+ "Status value must be in %s, but got '%s'",
+ Arrays.asList(TaskStatus.values()), status));
}
}
}
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java
index 605abef1d..4682c35df 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java
@@ -72,7 +72,6 @@ import com.codahale.metrics.annotation.Timed;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
-
import jakarta.annotation.security.RolesAllowed;
import jakarta.inject.Singleton;
import jakarta.ws.rs.GET;
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/GraphsAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/GraphsAPI.java
index 8bcc9311d..f45c228ba 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/GraphsAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/GraphsAPI.java
@@ -22,6 +22,23 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.hugegraph.HugeGraph;
+import org.apache.hugegraph.api.API;
+import org.apache.hugegraph.auth.HugeAuthenticator.RequiredPerm;
+import org.apache.hugegraph.auth.HugePermission;
+import org.apache.hugegraph.config.HugeConfig;
+import org.apache.hugegraph.core.GraphManager;
+import org.apache.hugegraph.type.define.GraphMode;
+import org.apache.hugegraph.type.define.GraphReadMode;
+import org.apache.hugegraph.util.E;
+import org.apache.hugegraph.util.JsonUtil;
+import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
+
+import com.codahale.metrics.annotation.Timed;
+import com.google.common.collect.ImmutableMap;
+
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.security.RolesAllowed;
import jakarta.inject.Singleton;
@@ -30,8 +47,8 @@ import jakarta.ws.rs.DELETE;
import jakarta.ws.rs.ForbiddenException;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.NotSupportedException;
-import jakarta.ws.rs.PUT;
import jakarta.ws.rs.POST;
+import jakarta.ws.rs.PUT;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
@@ -39,23 +56,6 @@ import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.core.SecurityContext;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.hugegraph.core.GraphManager;
-import org.slf4j.Logger;
-
-import org.apache.hugegraph.HugeGraph;
-import org.apache.hugegraph.api.API;
-import org.apache.hugegraph.auth.HugeAuthenticator.RequiredPerm;
-import org.apache.hugegraph.auth.HugePermission;
-import org.apache.hugegraph.config.HugeConfig;
-import org.apache.hugegraph.type.define.GraphMode;
-import org.apache.hugegraph.type.define.GraphReadMode;
-import org.apache.hugegraph.util.E;
-import org.apache.hugegraph.util.JsonUtil;
-import org.apache.hugegraph.util.Log;
-import com.codahale.metrics.annotation.Timed;
-import com.google.common.collect.ImmutableMap;
-
@Path("graphs")
@Singleton
@Tag(name = "GraphsAPI")
@@ -154,7 +154,7 @@ public class GraphsAPI extends API {
File file = config.file();
if (file == null) {
throw new NotSupportedException("Can't access the api in " +
- "a node which started with non local file config.");
+ "a node which started with non local file config.");
}
return file;
}
@@ -255,9 +255,9 @@ public class GraphsAPI extends API {
@Produces(APPLICATION_JSON_WITH_CHARSET)
@RolesAllowed("admin")
public Map<String, GraphReadMode> graphReadMode(
- @Context GraphManager manager,
- @PathParam("name") String name,
- GraphReadMode readMode) {
+ @Context GraphManager manager,
+ @PathParam("name") String name,
+ GraphReadMode readMode) {
LOG.debug("Set graph-read-mode to: '{}' of graph '{}'",
readMode, name);
@@ -275,8 +275,8 @@ public class GraphsAPI extends API {
@Produces(APPLICATION_JSON_WITH_CHARSET)
@RolesAllowed({"admin", "$owner=$name"})
public Map<String, GraphReadMode> graphReadMode(
- @Context GraphManager manager,
- @PathParam("name") String name) {
+ @Context GraphManager manager,
+ @PathParam("name") String name) {
LOG.debug("Get graph-read-mode of graph '{}'", name);
HugeGraph g = graph(manager, name);
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java
index 26a7873e4..279f09556 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java
@@ -24,31 +24,30 @@ import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.inject.Singleton;
-import jakarta.ws.rs.GET;
-import jakarta.ws.rs.Path;
-import jakarta.ws.rs.Produces;
-import jakarta.ws.rs.core.Application;
-import jakarta.ws.rs.core.Context;
-import jakarta.ws.rs.core.MediaType;
-
import org.apache.commons.lang3.StringUtils;
import org.apache.hugegraph.config.HugeConfig;
import org.apache.hugegraph.config.ServerOptions;
+import org.apache.hugegraph.util.E;
+import org.apache.hugegraph.util.InsertionOrderUtil;
+import org.apache.hugegraph.util.JsonUtil;
+import org.apache.hugegraph.version.CoreVersion;
import org.apache.tinkerpop.shaded.jackson.annotation.JsonProperty;
import org.glassfish.jersey.model.Parameter.Source;
import org.glassfish.jersey.server.model.Parameter;
import org.glassfish.jersey.server.model.Resource;
import org.glassfish.jersey.server.model.ResourceMethod;
-import org.apache.hugegraph.util.E;
-import org.apache.hugegraph.util.InsertionOrderUtil;
-import org.apache.hugegraph.util.JsonUtil;
-import org.apache.hugegraph.version.CoreVersion;
-
import com.codahale.metrics.annotation.Timed;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.inject.Singleton;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.Application;
+import jakarta.ws.rs.core.Context;
+import jakarta.ws.rs.core.MediaType;
+
@Path("/")
@Singleton
@Tag(name = "ProfileAPI")
@@ -154,8 +153,8 @@ public class ProfileAPI {
categories = this.apis.computeIfAbsent(category.dir,
k -> new TreeMap<>());
List<APIProfile> profiles = categories.computeIfAbsent(
- category.category,
- k -> new ArrayList<>());
+ category.category,
+ k -> new ArrayList<>());
profiles.add(profile);
}
}
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/VersionAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/VersionAPI.java
index b6a095c9e..5f951e7ac 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/VersionAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/VersionAPI.java
@@ -19,6 +19,13 @@ package org.apache.hugegraph.api.profile;
import java.util.Map;
+import org.apache.hugegraph.api.API;
+import org.apache.hugegraph.version.ApiVersion;
+import org.apache.hugegraph.version.CoreVersion;
+
+import com.codahale.metrics.annotation.Timed;
+import com.google.common.collect.ImmutableMap;
+
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.security.PermitAll;
import jakarta.inject.Singleton;
@@ -26,12 +33,6 @@ import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
-import org.apache.hugegraph.api.API;
-import org.apache.hugegraph.version.ApiVersion;
-import org.apache.hugegraph.version.CoreVersion;
-import com.codahale.metrics.annotation.Timed;
-import com.google.common.collect.ImmutableMap;
-
@Path("versions")
@Singleton
@Tag(name = "VersionAPI")
@@ -43,9 +44,9 @@ public class VersionAPI extends API {
@PermitAll
public Object list() {
Map<String, String> versions = ImmutableMap.of("version", "v1",
- "core", CoreVersion.VERSION.toString(),
- "gremlin", CoreVersion.GREMLIN_VERSION,
- "api", ApiVersion.VERSION.toString());
+ "core", CoreVersion.VERSION.toString(),
+ "gremlin", CoreVersion.GREMLIN_VERSION,
+ "api", ApiVersion.VERSION.toString());
return ImmutableMap.of("versions", versions);
}
}
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/WhiteIpListAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/WhiteIpListAPI.java
index f765ff46a..e965ed21a 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/WhiteIpListAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/WhiteIpListAPI.java
@@ -76,7 +76,8 @@ public class WhiteIpListAPI extends API {
@Produces(APPLICATION_JSON_WITH_CHARSET)
@RolesAllowed("admin")
@Operation(summary = "update white ip list")
- public Map<String, Object> updateWhiteIPs(@Context GraphManager manager, Map<String, Object> actionMap) {
+ public Map<String, Object> updateWhiteIPs(@Context GraphManager manager,
+ Map<String, Object> actionMap) {
E.checkArgument(actionMap != null,
"Missing argument: actionMap");
Set<String> whiteIpList = manager.authManager().listWhiteIPs();
@@ -137,7 +138,8 @@ public class WhiteIpListAPI extends API {
@Produces(APPLICATION_JSON_WITH_CHARSET)
@RolesAllowed("admin")
@Operation(summary = "enable/disable the white ip list")
- public Map<String, Object> updateStatus(@Context GraphManager manager, @QueryParam("status") String status) {
+ public Map<String, Object> updateStatus(@Context GraphManager manager,
+ @QueryParam("status") String status) {
LOG.debug("Enable or disable white ip list");
E.checkArgument("true".equals(status) ||
"false".equals(status),
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/raft/RaftAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/raft/RaftAPI.java
index 2c2d893b6..76f44a524 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/raft/RaftAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/raft/RaftAPI.java
@@ -21,38 +21,38 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.annotation.security.RolesAllowed;
-import jakarta.inject.Singleton;
-import jakarta.ws.rs.Consumes;
-import jakarta.ws.rs.DefaultValue;
-import jakarta.ws.rs.GET;
-import jakarta.ws.rs.POST;
-import jakarta.ws.rs.Path;
-import jakarta.ws.rs.PathParam;
-import jakarta.ws.rs.Produces;
-import jakarta.ws.rs.QueryParam;
-import jakarta.ws.rs.core.Context;
-
-import org.apache.hugegraph.api.filter.RedirectFilter;
-import org.apache.hugegraph.core.GraphManager;
-import org.slf4j.Logger;
-
import org.apache.hugegraph.HugeException;
import org.apache.hugegraph.HugeGraph;
import org.apache.hugegraph.api.API;
+import org.apache.hugegraph.api.filter.RedirectFilter;
import org.apache.hugegraph.api.filter.StatusFilter.Status;
import org.apache.hugegraph.backend.id.Id;
import org.apache.hugegraph.backend.store.raft.RaftAddPeerJob;
import org.apache.hugegraph.backend.store.raft.RaftGroupManager;
import org.apache.hugegraph.backend.store.raft.RaftRemovePeerJob;
+import org.apache.hugegraph.core.GraphManager;
import org.apache.hugegraph.job.JobBuilder;
import org.apache.hugegraph.util.DateUtil;
import org.apache.hugegraph.util.JsonUtil;
import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
+
import com.codahale.metrics.annotation.Timed;
import com.google.common.collect.ImmutableMap;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.annotation.security.RolesAllowed;
+import jakarta.inject.Singleton;
+import jakarta.ws.rs.Consumes;
+import jakarta.ws.rs.DefaultValue;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.QueryParam;
+import jakarta.ws.rs.core.Context;
+
@Path("graphs/{graph}/raft")
@Singleton
@Tag(name = "RaftAPI")
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/AdamicAdarAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/AdamicAdarAPI.java
index 1154d7144..82ad79e38 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/AdamicAdarAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/AdamicAdarAPI.java
@@ -20,16 +20,6 @@ package org.apache.hugegraph.api.traversers;
import static org.apache.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_ELEMENTS_LIMIT;
import static org.apache.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_MAX_DEGREE;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.inject.Singleton;
-import jakarta.ws.rs.DefaultValue;
-import jakarta.ws.rs.GET;
-import jakarta.ws.rs.Path;
-import jakarta.ws.rs.PathParam;
-import jakarta.ws.rs.Produces;
-import jakarta.ws.rs.QueryParam;
-import jakarta.ws.rs.core.Context;
-
import org.apache.hugegraph.HugeGraph;
import org.apache.hugegraph.api.API;
import org.apache.hugegraph.api.graph.EdgeAPI;
@@ -40,9 +30,20 @@ import org.apache.hugegraph.traversal.algorithm.PredictionTraverser;
import org.apache.hugegraph.type.define.Directions;
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.JsonUtil;
+
import com.codahale.metrics.annotation.Timed;
import com.google.common.collect.ImmutableMap;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.inject.Singleton;
+import jakarta.ws.rs.DefaultValue;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.QueryParam;
+import jakarta.ws.rs.core.Context;
+
/**
* AdamicAdar is one of the prediction algorithms in graph, you can get more
* info and definition in:
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CountAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CountAPI.java
index f2e3f0c9a..0855c8cb6 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CountAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CountAPI.java
@@ -25,31 +25,31 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.inject.Singleton;
-import jakarta.ws.rs.POST;
-import jakarta.ws.rs.Path;
-import jakarta.ws.rs.PathParam;
-import jakarta.ws.rs.Produces;
-import jakarta.ws.rs.core.Context;
-
-import org.apache.hugegraph.core.GraphManager;
-import org.slf4j.Logger;
-
import org.apache.hugegraph.HugeGraph;
import org.apache.hugegraph.api.API;
import org.apache.hugegraph.backend.id.Id;
+import org.apache.hugegraph.core.GraphManager;
import org.apache.hugegraph.structure.HugeVertex;
import org.apache.hugegraph.traversal.algorithm.CountTraverser;
import org.apache.hugegraph.traversal.algorithm.steps.EdgeStep;
import org.apache.hugegraph.type.define.Directions;
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
+
import com.codahale.metrics.annotation.Timed;
import com.fasterxml.jackson.annotation.JsonAlias;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.ImmutableMap;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.inject.Singleton;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.Context;
+
@Path("graphs/{graph}/traversers/count")
@Singleton
@Tag(name = "CountAPI")
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/EdgeExistenceAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/EdgeExistenceAPI.java
index 5237fdcdb..f52c2b57e 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/EdgeExistenceAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/EdgeExistenceAPI.java
@@ -25,7 +25,6 @@ import org.apache.hugegraph.HugeGraph;
import org.apache.hugegraph.api.graph.VertexAPI;
import org.apache.hugegraph.backend.id.Id;
import org.apache.hugegraph.core.GraphManager;
-import org.apache.hugegraph.structure.HugeVertex;
import org.apache.hugegraph.traversal.algorithm.EdgeExistenceTraverser;
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.Log;
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/NeighborRankAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/NeighborRankAPI.java
index 9c1fda3be..d5bf74ee2 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/NeighborRankAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/NeighborRankAPI.java
@@ -26,29 +26,29 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.inject.Singleton;
-import jakarta.ws.rs.POST;
-import jakarta.ws.rs.Path;
-import jakarta.ws.rs.PathParam;
-import jakarta.ws.rs.Produces;
-import jakarta.ws.rs.core.Context;
-
-import org.apache.hugegraph.core.GraphManager;
-import org.slf4j.Logger;
-
import org.apache.hugegraph.HugeGraph;
import org.apache.hugegraph.api.API;
import org.apache.hugegraph.backend.id.Id;
+import org.apache.hugegraph.core.GraphManager;
import org.apache.hugegraph.structure.HugeVertex;
import org.apache.hugegraph.traversal.algorithm.NeighborRankTraverser;
import org.apache.hugegraph.type.define.Directions;
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
+
import com.codahale.metrics.annotation.Timed;
import com.fasterxml.jackson.annotation.JsonAlias;
import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.inject.Singleton;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.Context;
+
@Path("graphs/{graph}/traversers/neighborrank")
@Singleton
@Tag(name = "NeighborRankAPI")
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/PersonalRankAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/PersonalRankAPI.java
index 8619fb171..aefc9daaa 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/PersonalRankAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/PersonalRankAPI.java
@@ -24,16 +24,6 @@ import static org.apache.hugegraph.traversal.algorithm.HugeTraverser.NO_LIMIT;
import java.util.Map;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.inject.Singleton;
-import jakarta.ws.rs.POST;
-import jakarta.ws.rs.Path;
-import jakarta.ws.rs.PathParam;
-import jakarta.ws.rs.Produces;
-import jakarta.ws.rs.core.Context;
-
-import org.slf4j.Logger;
-
import org.apache.hugegraph.HugeGraph;
import org.apache.hugegraph.api.API;
import org.apache.hugegraph.backend.id.Id;
@@ -43,9 +33,19 @@ import org.apache.hugegraph.traversal.algorithm.HugeTraverser;
import org.apache.hugegraph.traversal.algorithm.PersonalRankTraverser;
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
+
import com.codahale.metrics.annotation.Timed;
import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.inject.Singleton;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.Context;
+
@Path("graphs/{graph}/traversers/personalrank")
@Singleton
@Tag(name = "PersonalRankAPI")
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/ResourceAllocationAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/ResourceAllocationAPI.java
index 881138bbf..fb4d73e5a 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/ResourceAllocationAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/ResourceAllocationAPI.java
@@ -20,16 +20,6 @@ package org.apache.hugegraph.api.traversers;
import static org.apache.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_ELEMENTS_LIMIT;
import static org.apache.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_MAX_DEGREE;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.inject.Singleton;
-import jakarta.ws.rs.DefaultValue;
-import jakarta.ws.rs.GET;
-import jakarta.ws.rs.Path;
-import jakarta.ws.rs.PathParam;
-import jakarta.ws.rs.Produces;
-import jakarta.ws.rs.QueryParam;
-import jakarta.ws.rs.core.Context;
-
import org.apache.hugegraph.HugeGraph;
import org.apache.hugegraph.api.API;
import org.apache.hugegraph.api.graph.EdgeAPI;
@@ -40,9 +30,20 @@ import org.apache.hugegraph.traversal.algorithm.PredictionTraverser;
import org.apache.hugegraph.type.define.Directions;
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.JsonUtil;
+
import com.codahale.metrics.annotation.Timed;
import com.google.common.collect.ImmutableMap;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.inject.Singleton;
+import jakarta.ws.rs.DefaultValue;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.QueryParam;
+import jakarta.ws.rs.core.Context;
+
/**
* ResourceAllocation is one of the prediction algorithms in graph, you can get
* more info and definition in:
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/Vertices.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/Vertices.java
index 183c27d87..bf231ca90 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/Vertices.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/Vertices.java
@@ -23,8 +23,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-
import org.apache.hugegraph.HugeGraph;
import org.apache.hugegraph.backend.id.Id;
import org.apache.hugegraph.backend.query.ConditionQuery;
@@ -33,6 +31,8 @@ import org.apache.hugegraph.traversal.optimize.TraversalUtil;
import org.apache.hugegraph.type.HugeType;
import org.apache.hugegraph.type.define.HugeKeys;
import org.apache.hugegraph.util.E;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+
import com.fasterxml.jackson.annotation.JsonProperty;
public class Vertices {
@@ -47,8 +47,8 @@ public class Vertices {
public Iterator<Vertex> vertices(HugeGraph g) {
Map<String, Object> props = this.properties;
E.checkArgument(!((this.ids == null || this.ids.isEmpty()) &&
- (props == null || props.isEmpty()) &&
- this.label == null), "No source vertices provided");
+ (props == null || props.isEmpty()) &&
+ this.label == null), "No source vertices provided");
Iterator<Vertex> iterator;
if (this.ids != null && !this.ids.isEmpty()) {
List<Id> sourceIds = new ArrayList<>(this.ids.size());
@@ -72,7 +72,7 @@ public class Vertices {
assert !query.empty();
iterator = g.vertices(query);
E.checkArgument(iterator.hasNext(), "Not exist source vertex " +
- "with label '%s' and properties '%s'",
+ "with label '%s' and properties '%s'",
this.label, props);
}
return iterator;
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/variables/VariablesAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/variables/VariablesAPI.java
index 89272fb8f..2ea29aaf1 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/variables/VariablesAPI.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/variables/VariablesAPI.java
@@ -20,6 +20,16 @@ package org.apache.hugegraph.api.variables;
import java.util.Map;
import java.util.Optional;
+import org.apache.hugegraph.HugeGraph;
+import org.apache.hugegraph.api.API;
+import org.apache.hugegraph.core.GraphManager;
+import org.apache.hugegraph.util.E;
+import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
+
+import com.codahale.metrics.annotation.Timed;
+import com.google.common.collect.ImmutableMap;
+
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.inject.Singleton;
import jakarta.ws.rs.Consumes;
@@ -32,16 +42,6 @@ import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.Context;
-import org.apache.hugegraph.core.GraphManager;
-import org.slf4j.Logger;
-
-import org.apache.hugegraph.HugeGraph;
-import org.apache.hugegraph.api.API;
-import org.apache.hugegraph.util.E;
-import org.apache.hugegraph.util.Log;
-import com.codahale.metrics.annotation.Timed;
-import com.google.common.collect.ImmutableMap;
-
@Path("graphs/{graph}/variables")
@Singleton
@Tag(name = "VariablesAPI")
@@ -91,7 +91,7 @@ public class VariablesAPI extends API {
Optional<?> object = g.variables().get(key);
if (!object.isPresent()) {
throw new NotFoundException(String.format(
- "Variable '%s' does not exist", key));
+ "Variable '%s' does not exist", key));
}
return ImmutableMap.of(key, object.get());
}
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ConfigAuthenticator.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ConfigAuthenticator.java
index 2106d54dc..21cf39682 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ConfigAuthenticator.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ConfigAuthenticator.java
@@ -50,8 +50,9 @@ public class ConfigAuthenticator implements HugeAuthenticator {
/**
* Verify if a user is legal
- * @param username the username for authentication
- * @param password the password for authentication
+ *
+ * @param username the username for authentication
+ * @param password the password for authentication
* @return String No permission if return ROLE_NONE else return a role
*/
@Override
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ContextGremlinServer.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ContextGremlinServer.java
index f753fc2ca..7f8829974 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ContextGremlinServer.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ContextGremlinServer.java
@@ -115,8 +115,8 @@ public class ContextGremlinServer extends GremlinServer {
String gName = G_PREFIX + graph;
if (manager.getTraversalSource(gName) != null) {
throw new HugeException(
- "Found existing name '%s' in global bindings, " +
- "it may lead to gremlin query error.", gName);
+ "Found existing name '%s' in global bindings, " +
+ "it may lead to gremlin query error.", gName);
}
// Add a traversal source for all graphs with customed rule.
manager.putTraversalSource(gName, g);
@@ -136,7 +136,7 @@ public class ContextGremlinServer extends GremlinServer {
manager.putTraversalSource(G_PREFIX + name, g);
Whitebox.invoke(executor, "globalBindings",
- new Class<?>[]{ String.class, Object.class },
+ new Class<?>[]{String.class, Object.class},
"put", name, graph);
}
@@ -149,7 +149,7 @@ public class ContextGremlinServer extends GremlinServer {
manager.removeGraph(name);
manager.removeTraversalSource(G_PREFIX + name);
Whitebox.invoke(executor, "globalBindings",
- new Class<?>[]{ Object.class },
+ new Class<?>[]{Object.class},
"remove", name);
} catch (Exception e) {
throw new HugeException("Failed to remove graph '%s' from " +
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeAuthenticator.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeAuthenticator.java
index e1077d946..1e6768095 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeAuthenticator.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/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();
@@ -118,11 +118,7 @@ public interface HugeAuthenticator extends Authenticator {
}
default boolean verifyRole(RolePermission role) {
- if (role == ROLE_NONE || role == null) {
- return false;
- } else {
- return true;
- }
+ return role != ROLE_NONE && role != null;
}
void initAdminUser(String password) throws Exception;
@@ -334,7 +330,7 @@ public interface HugeAuthenticator extends Authenticator {
return null;
}
- @SuppressWarnings({ "unchecked", "rawtypes" })
+ @SuppressWarnings({"unchecked", "rawtypes"})
public static RolePerm fromJson(Object role) {
RolePermission table = RolePermission.fromJson(role);
return new RolePerm((Map) table.map());
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeFactoryAuthProxy.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeFactoryAuthProxy.java
index 0c748445a..201511fe8 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeFactoryAuthProxy.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeFactoryAuthProxy.java
@@ -65,7 +65,7 @@ import com.google.common.collect.ImmutableSet;
public final class HugeFactoryAuthProxy {
public static final String GRAPH_FACTORY =
- "gremlin.graph=org.apache.hugegraph.auth.HugeFactoryAuthProxy";
+ "gremlin.graph=org.apache.hugegraph.auth.HugeFactoryAuthProxy";
private static final Set<String> PROTECT_METHODS = ImmutableSet.of("instance");
@@ -92,108 +92,385 @@ public final class HugeFactoryAuthProxy {
private static void registerPrivateActions() {
// Thread
- Reflection.registerFieldsToFilter(java.lang.Thread.class, "name", "priority", "threadQ", "eetop", "single_step", "daemon", "stillborn", "target", "group", "contextClassLoader", "inheritedAccessControlContext", "threadInitNumber", "threadLocals", "inheritableThreadLocals", "stackSize", "nativeParkEventPointer", "tid", "threadSeqNumber", "threadStatus", "parkBlocker", "blocker", "blockerLock", "EMPTY_STACK_TRACE", "SUBCLASS_IMPLEMENTATION_PERMISSION", "uncaughtExceptionHandler", "d [...]
- Reflection.registerMethodsToFilter(java.lang.Thread.class, "exit", "dispatchUncaughtException", "clone", "isInterrupted", "registerNatives", "init", "init", "nextThreadNum", "nextThreadID", "blockedOn", "start0", "isCCLOverridden", "auditSubclass", "dumpThreads", "getThreads", "processQueue", "setPriority0", "stop0", "suspend0", "resume0", "interrupt0", "setNativeName");
- Reflection.registerFieldsToFilter(java.lang.ThreadLocal.class, "threadLocalHashCode", "nextHashCode", "HASH_INCREMENT");
- Reflection.registerMethodsToFilter(java.lang.ThreadLocal.class, "access$400", "createInheritedMap", "nextHashCode", "initialValue", "setInitialValue", "getMap", "createMap", "childValue");
- Reflection.registerMethodsToFilter(java.lang.InheritableThreadLocal.class, "getMap", "createMap", "childValue");
+ Reflection.registerFieldsToFilter(java.lang.Thread.class, "name", "priority", "threadQ",
+ "eetop", "single_step", "daemon", "stillborn", "target",
+ "group", "contextClassLoader",
+ "inheritedAccessControlContext", "threadInitNumber",
+ "threadLocals", "inheritableThreadLocals", "stackSize",
+ "nativeParkEventPointer", "tid", "threadSeqNumber",
+ "threadStatus", "parkBlocker", "blocker", "blockerLock",
+ "EMPTY_STACK_TRACE", "SUBCLASS_IMPLEMENTATION_PERMISSION",
+ "uncaughtExceptionHandler",
+ "defaultUncaughtExceptionHandler",
+ "threadLocalRandomSeed",
+ "threadLocalRandomSecondarySeed");
+ Reflection.registerMethodsToFilter(java.lang.Thread.class, "exit",
+ "dispatchUncaughtException", "clone", "isInterrupted",
+ "registerNatives", "init", "init", "nextThreadNum",
+ "nextThreadID", "blockedOn", "start0", "isCCLOverridden",
+ "auditSubclass", "dumpThreads", "getThreads",
+ "processQueue", "setPriority0", "stop0", "suspend0",
+ "resume0", "interrupt0", "setNativeName");
+ Reflection.registerFieldsToFilter(java.lang.ThreadLocal.class, "threadLocalHashCode",
+ "nextHashCode", "HASH_INCREMENT");
+ Reflection.registerMethodsToFilter(java.lang.ThreadLocal.class, "access$400",
+ "createInheritedMap", "nextHashCode", "initialValue",
+ "setInitialValue", "getMap", "createMap", "childValue");
+ Reflection.registerMethodsToFilter(java.lang.InheritableThreadLocal.class, "getMap",
+ "createMap", "childValue");
// HugeGraph
Reflection.registerFieldsToFilter(StandardAuthenticator.class, "graph");
- Reflection.registerMethodsToFilter(StandardAuthenticator.class, "initAdminUser", "inputPassword", "graph");
+ Reflection.registerMethodsToFilter(StandardAuthenticator.class, "initAdminUser",
+ "inputPassword", "graph");
Reflection.registerFieldsToFilter(ConfigAuthenticator.class, "tokens");
Reflection.registerFieldsToFilter(HugeFactoryAuthProxy.class, "PROTECT_METHODS");
- Reflection.registerMethodsToFilter(HugeFactoryAuthProxy.class, "genRegisterPrivateActions", "registerClass", "registerPrivateActions", "registerPrivateActions", "c");
+ Reflection.registerMethodsToFilter(HugeFactoryAuthProxy.class, "genRegisterPrivateActions",
+ "registerClass", "registerPrivateActions",
+ "registerPrivateActions", "c");
Reflection.registerFieldsToFilter(HugeAuthenticator.User.class, "role", "client");
- Reflection.registerFieldsToFilter(org.apache.tinkerpop.gremlin.server.auth.AuthenticatedUser.class, "name");
- Reflection.registerFieldsToFilter(HugeGraphAuthProxy.class, "LOG", "hugegraph", "taskScheduler", "authManager", "contexts", "$assertionsDisabled");
- Reflection.registerMethodsToFilter(HugeGraphAuthProxy.class, "lambda$0", "access$3", "access$4", "access$2", "access$5", "resetContext", "logUser", "verifyAdminPermission", "verifyStatusPermission", "verifyPermission", "verifySchemaPermission", "verifySchemaPermission", "verifySchemaPermission", "verifySchemaPermission", "verifyNamePermission", "verifyNameExistsPermission", "verifyElemPermission", "verifyElemPermission", "verifyElemPermission", "verifyElemPermission", "verifyResP [...]
- Reflection.registerFieldsToFilter(HugeGraphAuthProxy.AuthManagerProxy.class, "authManager", "this$0");
- Reflection.registerMethodsToFilter(HugeGraphAuthProxy.AuthManagerProxy.class, "currentUsername", "updateCreator");
- Reflection.registerFieldsToFilter(HugeGraphAuthProxy.TaskSchedulerProxy.class, "taskScheduler", "this$0");
- Reflection.registerMethodsToFilter(HugeGraphAuthProxy.TaskSchedulerProxy.class, "lambda$0", "lambda$1", "lambda$2", "verifyTaskPermission", "verifyTaskPermission", "verifyTaskPermission", "verifyTaskPermission", "hasTaskPermission");
- Reflection.registerFieldsToFilter(HugeGraphAuthProxy.GraphTraversalSourceProxy.class, "this$0");
- Reflection.registerFieldsToFilter(org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource.class, "connection", "graph", "strategies", "bytecode");
- Reflection.registerFieldsToFilter(HugeGraphAuthProxy.TraversalStrategiesProxy.class, "REST_WOEKER", "serialVersionUID", "strategies", "this$0");
- Reflection.registerMethodsToFilter(HugeGraphAuthProxy.TraversalStrategiesProxy.class, "translate");
- Reflection.registerFieldsToFilter(HugeGraphAuthProxy.VariablesProxy.class, "variables", "this$0");
+ Reflection.registerFieldsToFilter(
+ org.apache.tinkerpop.gremlin.server.auth.AuthenticatedUser.class, "name");
+ Reflection.registerFieldsToFilter(HugeGraphAuthProxy.class, "LOG", "hugegraph",
+ "taskScheduler", "authManager", "contexts",
+ "$assertionsDisabled");
+ Reflection.registerMethodsToFilter(HugeGraphAuthProxy.class, "lambda$0", "access$3",
+ "access$4", "access$2", "access$5", "resetContext",
+ "logUser", "verifyAdminPermission",
+ "verifyStatusPermission", "verifyPermission",
+ "verifySchemaPermission", "verifySchemaPermission",
+ "verifySchemaPermission", "verifySchemaPermission",
+ "verifyNamePermission", "verifyNameExistsPermission",
+ "verifyElemPermission", "verifyElemPermission",
+ "verifyElemPermission", "verifyElemPermission",
+ "verifyResPermission", "verifyResPermission",
+ "verifyUserPermission", "verifyUserPermission",
+ "verifyUserPermission", "getContextString", "access$6",
+ "access$7", "lambda$1", "lambda$2", "lambda$3",
+ "lambda$4", "lambda$5", "lambda$6", "lambda$7",
+ "lambda$8", "lambda$9", "lambda$10", "lambda$11",
+ "lambda$12", "lambda$13", "lambda$14", "lambda$15",
+ "lambda$16", "lambda$17", "lambda$18", "lambda$19",
+ "lambda$20", "lambda$21", "lambda$22", "lambda$23",
+ "lambda$24", "access$8", "access$9", "access$10",
+ "setContext", "getContext");
+ Reflection.registerFieldsToFilter(HugeGraphAuthProxy.AuthManagerProxy.class, "authManager",
+ "this$0");
+ Reflection.registerMethodsToFilter(HugeGraphAuthProxy.AuthManagerProxy.class,
+ "currentUsername", "updateCreator");
+ Reflection.registerFieldsToFilter(HugeGraphAuthProxy.TaskSchedulerProxy.class,
+ "taskScheduler", "this$0");
+ Reflection.registerMethodsToFilter(HugeGraphAuthProxy.TaskSchedulerProxy.class, "lambda$0",
+ "lambda$1", "lambda$2", "verifyTaskPermission",
+ "verifyTaskPermission", "verifyTaskPermission",
+ "verifyTaskPermission", "hasTaskPermission");
+ Reflection.registerFieldsToFilter(HugeGraphAuthProxy.GraphTraversalSourceProxy.class,
+ "this$0");
+ Reflection.registerFieldsToFilter(
+ org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource.class,
+ "connection", "graph", "strategies", "bytecode");
+ Reflection.registerFieldsToFilter(HugeGraphAuthProxy.TraversalStrategiesProxy.class,
+ "REST_WOEKER", "serialVersionUID", "strategies",
+ "this$0");
+ Reflection.registerMethodsToFilter(HugeGraphAuthProxy.TraversalStrategiesProxy.class,
+ "translate");
+ Reflection.registerFieldsToFilter(HugeGraphAuthProxy.VariablesProxy.class, "variables",
+ "this$0");
Reflection.registerFieldsToFilter(HugeGraphAuthProxy.Context.class, "ADMIN", "user");
- Reflection.registerFieldsToFilter(HugeGraphAuthProxy.ContextTask.class, "runner", "context");
- Reflection.registerFieldsToFilter(StandardHugeGraph.class, "LOG", "started", "closed", "mode", "variables", "name", "params", "configuration", "schemaEventHub", "graphEventHub", "indexEventHub", "writeRateLimiter", "readRateLimiter", "taskManager", "authManager", "features", "storeProvider", "tx", "ramtable", "$assertionsDisabled");
- Reflection.registerMethodsToFilter(StandardHugeGraph.class, "lambda$0", "access$3", "access$4", "access$2", "access$5", "access$6", "access$7", "waitUntilAllTasksCompleted", "access$8", "loadStoreProvider", "graphTransaction", "schemaTransaction", "openSchemaTransaction", "checkGraphNotClosed", "openSystemTransaction", "openGraphTransaction", "systemTransaction", "access$9", "access$10", "access$11", "access$12", "access$13", "access$14", "access$15", "access$16", "access$17", "a [...]
- Reflection.registerFieldsToFilter(loadClass("org.apache.hugegraph.StandardHugeGraph$StandardHugeGraphParams"), "graph", "this$0");
- Reflection.registerMethodsToFilter(loadClass("org.apache.hugegraph.StandardHugeGraph$StandardHugeGraphParams"), "access$1", "graph");
- Reflection.registerFieldsToFilter(loadClass("org.apache.hugegraph.StandardHugeGraph$TinkerPopTransaction"), "refs", "opened", "transactions", "this$0", "$assertionsDisabled");
- Reflection.registerMethodsToFilter(loadClass("org.apache.hugegraph.StandardHugeGraph$TinkerPopTransaction"), "lambda$0", "access$3", "access$2", "lambda$1", "graphTransaction", "schemaTransaction", "systemTransaction", "access$1", "setOpened", "doCommit", "verifyOpened", "doRollback", "doClose", "destroyTransaction", "doOpen", "setClosed", "getOrNewTransaction", "access$0", "resetState");
- Reflection.registerFieldsToFilter(org.apache.tinkerpop.gremlin.structure.util.AbstractThreadLocalTransaction.class, "readWriteConsumerInternal", "closeConsumerInternal", "transactionListeners");
- Reflection.registerMethodsToFilter(org.apache.tinkerpop.gremlin.structure.util.AbstractThreadLocalTransaction.class, "doClose", "fireOnCommit", "fireOnRollback", "doReadWrite", "lambda$fireOnRollback$1", "lambda$fireOnCommit$0");
- Reflection.registerFieldsToFilter(org.apache.tinkerpop.gremlin.structure.util.AbstractTransaction.class, "g");
- Reflection.registerMethodsToFilter(org.apache.tinkerpop.gremlin.structure.util.AbstractTransaction.class, "doCommit", "doRollback", "doClose", "doOpen", "fireOnCommit", "fireOnRollback", "doReadWrite");
- Reflection.registerFieldsToFilter(loadClass("org.apache.hugegraph.StandardHugeGraph$Txs"), "schemaTx", "systemTx", "graphTx", "openedTime", "$assertionsDisabled");
- Reflection.registerMethodsToFilter(loadClass("org.apache.hugegraph.StandardHugeGraph$Txs"), "access$2", "access$1", "access$0");
- Reflection.registerFieldsToFilter(GraphTransaction.class, "indexTx", "addedVertices", "removedVertices", "addedEdges", "removedEdges", "addedProps", "removedProps", "updatedVertices", "updatedEdges", "updatedOldestProps", "locksTable", "checkCustomVertexExist", "checkAdjacentVertexExist", "lazyLoadAdjacentVertex", "ignoreInvalidEntry", "commitPartOfAdjacentEdges", "batchSize", "pageSize", "verticesCapacity", "edgesCapacity", "$assertionsDisabled", "$SWITCH_TABLE$com$baidu$hugegra [...]
- Reflection.registerMethodsToFilter(GraphTransaction.class, "lambda$0", "lambda$1", "lambda$2", "lambda$3", "lambda$4", "lambda$5", "lambda$6", "lambda$7", "lambda$8", "lambda$9", "lambda$10", "lambda$11", "lambda$12", "lambda$13", "lambda$14", "lambda$15", "lambda$16", "lambda$17", "lambda$18", "lambda$19", "access$1", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy", "indexTransaction", "indexTransaction", "beforeWrite", "prepareCommit", "verticesInTxSize", "edgesInTxS [...]
+ Reflection.registerFieldsToFilter(HugeGraphAuthProxy.ContextTask.class, "runner",
+ "context");
+ Reflection.registerFieldsToFilter(StandardHugeGraph.class, "LOG", "started", "closed",
+ "mode", "variables", "name", "params", "configuration",
+ "schemaEventHub", "graphEventHub", "indexEventHub",
+ "writeRateLimiter", "readRateLimiter", "taskManager",
+ "authManager", "features", "storeProvider", "tx",
+ "ramtable", "$assertionsDisabled");
+ Reflection.registerMethodsToFilter(StandardHugeGraph.class, "lambda$0", "access$3",
+ "access$4", "access$2", "access$5", "access$6",
+ "access$7", "waitUntilAllTasksCompleted", "access$8",
+ "loadStoreProvider", "graphTransaction",
+ "schemaTransaction", "openSchemaTransaction",
+ "checkGraphNotClosed", "openSystemTransaction",
+ "openGraphTransaction", "systemTransaction", "access$9",
+ "access$10", "access$11", "access$12", "access$13",
+ "access$14", "access$15", "access$16", "access$17",
+ "access$18", "serializer", "loadSchemaStore",
+ "loadSystemStore", "loadGraphStore", "closeTx",
+ "analyzer", "serverInfoManager", "reloadRamtable",
+ "reloadRamtable", "access$19", "access$20", "access$21");
+ Reflection.registerFieldsToFilter(
+ loadClass("org.apache.hugegraph.StandardHugeGraph$StandardHugeGraphParams"),
+ "graph", "this$0");
+ Reflection.registerMethodsToFilter(
+ loadClass("org.apache.hugegraph.StandardHugeGraph$StandardHugeGraphParams"),
+ "access$1", "graph");
+ Reflection.registerFieldsToFilter(
+ loadClass("org.apache.hugegraph.StandardHugeGraph$TinkerPopTransaction"), "refs",
+ "opened", "transactions", "this$0", "$assertionsDisabled");
+ Reflection.registerMethodsToFilter(
+ loadClass("org.apache.hugegraph.StandardHugeGraph$TinkerPopTransaction"),
+ "lambda$0", "access$3", "access$2", "lambda$1", "graphTransaction",
+ "schemaTransaction", "systemTransaction", "access$1", "setOpened", "doCommit",
+ "verifyOpened", "doRollback", "doClose", "destroyTransaction", "doOpen",
+ "setClosed", "getOrNewTransaction", "access$0", "resetState");
+ Reflection.registerFieldsToFilter(
+ org.apache.tinkerpop.gremlin.structure.util.AbstractThreadLocalTransaction.class,
+ "readWriteConsumerInternal", "closeConsumerInternal", "transactionListeners");
+ Reflection.registerMethodsToFilter(
+ org.apache.tinkerpop.gremlin.structure.util.AbstractThreadLocalTransaction.class,
+ "doClose", "fireOnCommit", "fireOnRollback", "doReadWrite",
+ "lambda$fireOnRollback$1", "lambda$fireOnCommit$0");
+ Reflection.registerFieldsToFilter(
+ org.apache.tinkerpop.gremlin.structure.util.AbstractTransaction.class, "g");
+ Reflection.registerMethodsToFilter(
+ org.apache.tinkerpop.gremlin.structure.util.AbstractTransaction.class, "doCommit",
+ "doRollback", "doClose", "doOpen", "fireOnCommit", "fireOnRollback", "doReadWrite");
+ Reflection.registerFieldsToFilter(loadClass("org.apache.hugegraph.StandardHugeGraph$Txs"),
+ "schemaTx", "systemTx", "graphTx", "openedTime",
+ "$assertionsDisabled");
+ Reflection.registerMethodsToFilter(loadClass("org.apache.hugegraph.StandardHugeGraph$Txs"),
+ "access$2", "access$1", "access$0");
+ Reflection.registerFieldsToFilter(GraphTransaction.class, "indexTx", "addedVertices",
+ "removedVertices", "addedEdges", "removedEdges",
+ "addedProps", "removedProps", "updatedVertices",
+ "updatedEdges", "updatedOldestProps", "locksTable",
+ "checkCustomVertexExist", "checkAdjacentVertexExist",
+ "lazyLoadAdjacentVertex", "ignoreInvalidEntry",
+ "commitPartOfAdjacentEdges", "batchSize", "pageSize",
+ "verticesCapacity", "edgesCapacity",
+ "$assertionsDisabled",
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy");
+ Reflection.registerMethodsToFilter(GraphTransaction.class, "lambda$0", "lambda$1",
+ "lambda$2", "lambda$3", "lambda$4", "lambda$5",
+ "lambda$6", "lambda$7", "lambda$8", "lambda$9",
+ "lambda$10", "lambda$11", "lambda$12", "lambda$13",
+ "lambda$14", "lambda$15", "lambda$16", "lambda$17",
+ "lambda$18", "lambda$19", "access$1",
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy",
+ "indexTransaction", "indexTransaction", "beforeWrite",
+ "prepareCommit", "verticesInTxSize", "edgesInTxSize",
+ "checkTxVerticesCapacity", "checkTxEdgesCapacity",
+ "verticesInTxUpdated", "verticesInTxRemoved",
+ "removingEdgeOwner", "prepareDeletions",
+ "prepareDeletions", "prepareUpdates", "prepareAdditions",
+ "checkVertexExistIfCustomizedId",
+ "checkAggregateProperty", "checkAggregateProperty",
+ "checkNonnullProperty", "queryEdgesFromBackend",
+ "commitPartOfEdgeDeletions", "optimizeQueries",
+ "checkVertexLabel", "checkId",
+ "queryVerticesFromBackend", "joinTxVertices",
+ "joinTxEdges", "lockForUpdateProperty", "optimizeQuery",
+ "verifyVerticesConditionQuery",
+ "verifyEdgesConditionQuery", "indexQuery",
+ "joinTxRecords", "propertyUpdated", "parseEntry",
+ "traverseByLabel", "reset", "queryVerticesByIds",
+ "filterUnmatchedRecords", "skipOffsetOrStopLimit",
+ "filterExpiredResultFromFromBackend", "queryEdgesByIds",
+ "matchEdgeSortKeys", "rightResultFromIndexQuery");
Reflection.registerFieldsToFilter(IndexableTransaction.class, "$assertionsDisabled");
- Reflection.registerMethodsToFilter(IndexableTransaction.class, "indexTransaction", "commit2Backend", "reset");
- Reflection.registerFieldsToFilter(AbstractTransaction.class, "LOG", "ownerThread", "autoCommit", "closed", "committing", "committing2Backend", "graph", "store", "mutation", "serializer", "$assertionsDisabled");
- Reflection.registerMethodsToFilter(AbstractTransaction.class, "beforeWrite", "prepareCommit", "params", "mutation", "commit2Backend", "autoCommit", "beforeRead", "afterWrite", "afterRead", "commitMutation2Backend", "checkOwnerThread", "doAction", "store", "reset");
+ Reflection.registerMethodsToFilter(IndexableTransaction.class, "indexTransaction",
+ "commit2Backend", "reset");
+ Reflection.registerFieldsToFilter(AbstractTransaction.class, "LOG", "ownerThread",
+ "autoCommit", "closed", "committing",
+ "committing2Backend", "graph", "store", "mutation",
+ "serializer", "$assertionsDisabled");
+ Reflection.registerMethodsToFilter(AbstractTransaction.class, "beforeWrite",
+ "prepareCommit", "params", "mutation", "commit2Backend",
+ "autoCommit", "beforeRead", "afterWrite", "afterRead",
+ "commitMutation2Backend", "checkOwnerThread", "doAction",
+ "store", "reset");
Reflection.registerFieldsToFilter(HugeFactory.class, "LOG", "NAME_REGEX", "graphs");
Reflection.registerMethodsToFilter(HugeFactory.class, "lambda$0");
- Reflection.registerFieldsToFilter(SchemaElement.class, "graph", "id", "name", "userdata", "status");
- Reflection.registerFieldsToFilter(HugeVertex.class, "EMPTY_SET", "id", "label", "edges", "$assertionsDisabled", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$HugeKeys");
- Reflection.registerMethodsToFilter(HugeVertex.class, "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy", "newProperty", "newProperty", "tx", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$HugeKeys", "checkIdLength", "onUpdateProperty", "ensureFilledProperties", "clone", "clone");
- Reflection.registerFieldsToFilter(HugeElement.class, "EMPTY_MAP", "MAX_PROPERTIES", "graph", "properties", "expiredTime", "removed", "fresh", "propLoaded", "defaultValueUpdated", "$assertionsDisabled", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Cardinality");
- Reflection.registerMethodsToFilter(HugeElement.class, "removed", "addProperty", "newProperty", "tx", "onUpdateProperty", "ensureFilledProperties", "propLoaded", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Cardinality", "getIdValue", "fresh", "updateToDefaultValueIfNone", "copyProperties");
- Reflection.registerFieldsToFilter(HugeEdge.class, "id", "label", "name", "sourceVertex", "targetVertex", "isOutEdge", "$assertionsDisabled", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$HugeKeys", "$SWITCH_TABLE$org$apache$tinkerpop$gremlin$structure$Direction");
- Reflection.registerMethodsToFilter(HugeEdge.class, "checkAdjacentVertexExist", "newProperty", "newProperty", "tx", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$HugeKeys", "onUpdateProperty", "ensureFilledProperties", "$SWITCH_TABLE$org$apache$tinkerpop$gremlin$structure$Direction", "clone", "clone");
+ Reflection.registerFieldsToFilter(SchemaElement.class, "graph", "id", "name", "userdata",
+ "status");
+ Reflection.registerFieldsToFilter(HugeVertex.class, "EMPTY_SET", "id", "label", "edges",
+ "$assertionsDisabled",
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy",
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$HugeKeys");
+ Reflection.registerMethodsToFilter(HugeVertex.class,
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy",
+ "newProperty", "newProperty", "tx",
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$HugeKeys",
+ "checkIdLength", "onUpdateProperty",
+ "ensureFilledProperties", "clone", "clone");
+ Reflection.registerFieldsToFilter(HugeElement.class, "EMPTY_MAP", "MAX_PROPERTIES", "graph",
+ "properties", "expiredTime", "removed", "fresh",
+ "propLoaded", "defaultValueUpdated",
+ "$assertionsDisabled",
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Cardinality");
+ Reflection.registerMethodsToFilter(HugeElement.class, "removed", "addProperty",
+ "newProperty", "tx", "onUpdateProperty",
+ "ensureFilledProperties", "propLoaded",
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Cardinality",
+ "getIdValue", "fresh", "updateToDefaultValueIfNone",
+ "copyProperties");
+ Reflection.registerFieldsToFilter(HugeEdge.class, "id", "label", "name", "sourceVertex",
+ "targetVertex", "isOutEdge", "$assertionsDisabled",
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$HugeKeys",
+ "$SWITCH_TABLE$org$apache$tinkerpop$gremlin$structure$Direction");
+ Reflection.registerMethodsToFilter(HugeEdge.class, "checkAdjacentVertexExist",
+ "newProperty", "newProperty", "tx",
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$HugeKeys",
+ "onUpdateProperty", "ensureFilledProperties",
+ "$SWITCH_TABLE$org$apache$tinkerpop$gremlin$structure$Direction",
+ "clone", "clone");
Reflection.registerFieldsToFilter(HugeProperty.class, "owner", "pkey", "value");
- Reflection.registerFieldsToFilter(HugeVariables.class, "LOG", "VARIABLES", "VARIABLE_KEY", "VARIABLE_TYPE", "BYTE_VALUE", "BOOLEAN_VALUE", "INTEGER_VALUE", "LONG_VALUE", "FLOAT_VALUE", "DOUBLE_VALUE", "STRING_VALUE", "LIST", "SET", "TYPES", "params", "graph");
- Reflection.registerMethodsToFilter(HugeVariables.class, "createPropertyKey", "queryAllVariableVertices", "queryVariableVertex", "createVariableVertex", "removeVariableVertex", "extractSingleObject", "setProperty");
+ Reflection.registerFieldsToFilter(HugeVariables.class, "LOG", "VARIABLES", "VARIABLE_KEY",
+ "VARIABLE_TYPE", "BYTE_VALUE", "BOOLEAN_VALUE",
+ "INTEGER_VALUE", "LONG_VALUE", "FLOAT_VALUE",
+ "DOUBLE_VALUE", "STRING_VALUE", "LIST", "SET", "TYPES",
+ "params", "graph");
+ Reflection.registerMethodsToFilter(HugeVariables.class, "createPropertyKey",
+ "queryAllVariableVertices", "queryVariableVertex",
+ "createVariableVertex", "removeVariableVertex",
+ "extractSingleObject", "setProperty");
Reflection.registerFieldsToFilter(SchemaManager.class, "transaction", "graph");
- Reflection.registerMethodsToFilter(SchemaManager.class, "lambda$0", "lambda$1", "lambda$2", "lambda$3", "checkExists");
- Reflection.registerFieldsToFilter(PropertyKeyBuilder.class, "id", "name", "dataType", "cardinality", "aggregateType", "checkExist", "userdata", "$assertionsDisabled");
- Reflection.registerMethodsToFilter(PropertyKeyBuilder.class, "lambda$0", "checkStableVars", "checkAggregateType", "hasSameProperties");
+ Reflection.registerMethodsToFilter(SchemaManager.class, "lambda$0", "lambda$1", "lambda$2",
+ "lambda$3", "checkExists");
+ Reflection.registerFieldsToFilter(PropertyKeyBuilder.class, "id", "name", "dataType",
+ "cardinality", "aggregateType", "checkExist", "userdata",
+ "$assertionsDisabled");
+ Reflection.registerMethodsToFilter(PropertyKeyBuilder.class, "lambda$0", "checkStableVars",
+ "checkAggregateType", "hasSameProperties");
Reflection.registerFieldsToFilter(AbstractBuilder.class, "transaction", "graph");
- Reflection.registerMethodsToFilter(AbstractBuilder.class, "rebuildIndex", "graph", "checkSchemaName", "validOrGenerateId", "lockCheckAndCreateSchema", "propertyKeyOrNull", "checkSchemaIdIfRestoringMode", "vertexLabelOrNull", "edgeLabelOrNull", "indexLabelOrNull", "updateSchemaStatus");
- Reflection.registerFieldsToFilter(VertexLabelBuilder.class, "id", "name", "idStrategy", "properties", "primaryKeys", "nullableKeys", "ttl", "ttlStartTime", "enableLabelIndex", "userdata", "checkExist", "$assertionsDisabled", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Action", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy");
- Reflection.registerMethodsToFilter(VertexLabelBuilder.class, "lambda$0", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy", "checkStableVars", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Action", "checkProperties", "checkNullableKeys", "checkIdStrategy", "checkPrimaryKeys", "hasSameProperties", "checkTtl", "checkUserdata", "mapPkId2Name", "mapPkId2Name");
- Reflection.registerFieldsToFilter(EdgeLabelBuilder.class, "id", "name", "sourceLabel", "targetLabel", "frequency", "properties", "sortKeys", "nullableKeys", "ttl", "ttlStartTime", "enableLabelIndex", "userdata", "checkExist", "$assertionsDisabled", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Action");
- Reflection.registerMethodsToFilter(EdgeLabelBuilder.class, "lambda$0", "checkStableVars", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Action", "checkProperties", "checkNullableKeys", "checkSortKeys", "checkRelation", "hasSameProperties", "checkTtl", "checkUserdata", "mapPkId2Name", "mapPkId2Name");
- Reflection.registerFieldsToFilter(IndexLabelBuilder.class, "id", "name", "baseType", "baseValue", "indexType", "indexFields", "userdata", "checkExist", "rebuild", "$assertionsDisabled", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$DataType", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IndexType");
- Reflection.registerMethodsToFilter(IndexLabelBuilder.class, "lambda$0", "checkStableVars", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$DataType", "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IndexType", "checkBaseType", "checkIndexType", "checkFields4Range", "loadElement", "checkFields", "checkRepeatIndex", "checkRepeatIndex", "checkRepeatIndex", "checkPrimaryKeyIndex", "checkRepeatRangeIndex", "checkRepeatSearchIndex", "checkRepeatSecondaryIndex", "checkRepeatShardIndex", " [...]
- Reflection.registerFieldsToFilter(TaskManager.class, "LOG", "SCHEDULE_PERIOD", "THREADS", "MANAGER", "schedulers", "taskExecutor", "taskDbExecutor", "serverInfoDbExecutor", "schedulerExecutor", "contexts", "$assertionsDisabled");
- Reflection.registerMethodsToFilter(TaskManager.class, "lambda$0", "resetContext", "closeTaskTx", "setContext", "instance", "closeSchedulerTx", "notifyNewTask", "scheduleOrExecuteJob", "scheduleOrExecuteJobForGraph");
- Reflection.registerFieldsToFilter(StandardTaskScheduler.class, "LOG", "graph", "serverManager", "taskExecutor", "taskDbExecutor", "eventListener", "tasks", "taskTx", "NO_LIMIT", "PAGE_SIZE", "QUERY_INTERVAL", "MAX_PENDING_TASKS", "$assertionsDisabled");
- Reflection.registerMethodsToFilter(StandardTaskScheduler.class, "lambda$0", "lambda$1", "lambda$2", "lambda$3", "lambda$4", "lambda$5", "lambda$6", "lambda$7", "tx", "listenChanges", "unlistenChanges", "submitTask", "queryTask", "queryTask", "queryTask", "call", "call", "remove", "sleep", "taskDone", "serverManager", "supportsPaging", "restore", "checkOnMasterNode", "waitUntilTaskCompleted", "scheduleTasks", "executeTasksOnWorker", "cancelTasksOnWorker");
- Reflection.registerFieldsToFilter(HugeTask.class, "LOG", "DECOMPRESS_RATIO", "scheduler", "callable", "type", "name", "id", "parent", "dependencies", "description", "context", "create", "server", "load", "status", "progress", "update", "retries", "input", "result", "$assertionsDisabled");
- Reflection.registerMethodsToFilter(HugeTask.class, "property", "scheduler", "scheduler", "asArray", "checkPropertySize", "checkPropertySize", "checkDependenciesSuccess", "toOrderSet", "done", "callable", "setException", "set", "result", "status");
- Reflection.registerFieldsToFilter(TaskCallable.class, "LOG", "ERROR_COMMIT", "ERROR_MESSAGES", "task", "graph", "lastSaveTime", "saveInterval");
- Reflection.registerMethodsToFilter(TaskCallable.class, "graph", "closeTx", "cancelled", "done", "task", "save", "needSaveWithEx");
+ Reflection.registerMethodsToFilter(AbstractBuilder.class, "rebuildIndex", "graph",
+ "checkSchemaName", "validOrGenerateId",
+ "lockCheckAndCreateSchema", "propertyKeyOrNull",
+ "checkSchemaIdIfRestoringMode", "vertexLabelOrNull",
+ "edgeLabelOrNull", "indexLabelOrNull",
+ "updateSchemaStatus");
+ Reflection.registerFieldsToFilter(VertexLabelBuilder.class, "id", "name", "idStrategy",
+ "properties", "primaryKeys", "nullableKeys", "ttl",
+ "ttlStartTime", "enableLabelIndex", "userdata",
+ "checkExist", "$assertionsDisabled",
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Action",
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy");
+ Reflection.registerMethodsToFilter(VertexLabelBuilder.class, "lambda$0",
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IdStrategy",
+ "checkStableVars",
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Action",
+ "checkProperties", "checkNullableKeys",
+ "checkIdStrategy", "checkPrimaryKeys",
+ "hasSameProperties", "checkTtl", "checkUserdata",
+ "mapPkId2Name", "mapPkId2Name");
+ Reflection.registerFieldsToFilter(EdgeLabelBuilder.class, "id", "name", "sourceLabel",
+ "targetLabel", "frequency", "properties", "sortKeys",
+ "nullableKeys", "ttl", "ttlStartTime", "enableLabelIndex",
+ "userdata", "checkExist", "$assertionsDisabled",
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Action");
+ Reflection.registerMethodsToFilter(EdgeLabelBuilder.class, "lambda$0", "checkStableVars",
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$Action",
+ "checkProperties", "checkNullableKeys", "checkSortKeys",
+ "checkRelation", "hasSameProperties", "checkTtl",
+ "checkUserdata", "mapPkId2Name", "mapPkId2Name");
+ Reflection.registerFieldsToFilter(IndexLabelBuilder.class, "id", "name", "baseType",
+ "baseValue", "indexType", "indexFields", "userdata",
+ "checkExist", "rebuild", "$assertionsDisabled",
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$DataType",
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IndexType");
+ Reflection.registerMethodsToFilter(IndexLabelBuilder.class, "lambda$0", "checkStableVars",
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$DataType",
+ "$SWITCH_TABLE$com$baidu$hugegraph$type$define$IndexType",
+ "checkBaseType", "checkIndexType", "checkFields4Range",
+ "loadElement", "checkFields", "checkRepeatIndex",
+ "checkRepeatIndex", "checkRepeatIndex",
+ "checkPrimaryKeyIndex", "checkRepeatRangeIndex",
+ "checkRepeatSearchIndex", "checkRepeatSecondaryIndex",
+ "checkRepeatShardIndex", "checkRepeatUniqueIndex",
+ "removeSubIndex", "hasSubIndex", "allStringIndex",
+ "oneNumericField", "hasSameProperties");
+ Reflection.registerFieldsToFilter(TaskManager.class, "LOG", "SCHEDULE_PERIOD", "THREADS",
+ "MANAGER", "schedulers", "taskExecutor", "taskDbExecutor",
+ "serverInfoDbExecutor", "schedulerExecutor", "contexts",
+ "$assertionsDisabled");
+ Reflection.registerMethodsToFilter(TaskManager.class, "lambda$0", "resetContext",
+ "closeTaskTx", "setContext", "instance",
+ "closeSchedulerTx", "notifyNewTask",
+ "scheduleOrExecuteJob", "scheduleOrExecuteJobForGraph");
+ Reflection.registerFieldsToFilter(StandardTaskScheduler.class, "LOG", "graph",
+ "serverManager", "taskExecutor", "taskDbExecutor",
+ "eventListener", "tasks", "taskTx", "NO_LIMIT",
+ "PAGE_SIZE", "QUERY_INTERVAL", "MAX_PENDING_TASKS",
+ "$assertionsDisabled");
+ Reflection.registerMethodsToFilter(StandardTaskScheduler.class, "lambda$0", "lambda$1",
+ "lambda$2", "lambda$3", "lambda$4", "lambda$5",
+ "lambda$6", "lambda$7", "tx", "listenChanges",
+ "unlistenChanges", "submitTask", "queryTask",
+ "queryTask", "queryTask", "call", "call", "remove",
+ "sleep", "taskDone", "serverManager", "supportsPaging",
+ "restore", "checkOnMasterNode", "waitUntilTaskCompleted",
+ "scheduleTasks", "executeTasksOnWorker",
+ "cancelTasksOnWorker");
+ Reflection.registerFieldsToFilter(HugeTask.class, "LOG", "DECOMPRESS_RATIO", "scheduler",
+ "callable", "type", "name", "id", "parent",
+ "dependencies", "description", "context", "create",
+ "server", "load", "status", "progress", "update",
+ "retries", "input", "result", "$assertionsDisabled");
+ Reflection.registerMethodsToFilter(HugeTask.class, "property", "scheduler", "scheduler",
+ "asArray", "checkPropertySize", "checkPropertySize",
+ "checkDependenciesSuccess", "toOrderSet", "done",
+ "callable", "setException", "set", "result", "status");
+ Reflection.registerFieldsToFilter(TaskCallable.class, "LOG", "ERROR_COMMIT",
+ "ERROR_MESSAGES", "task", "graph", "lastSaveTime",
+ "saveInterval");
+ Reflection.registerMethodsToFilter(TaskCallable.class, "graph", "closeTx", "cancelled",
+ "done", "task", "save", "needSaveWithEx");
Reflection.registerFieldsToFilter(TaskCallable.SysTaskCallable.class, "params");
Reflection.registerMethodsToFilter(TaskCallable.SysTaskCallable.class, "params", "params");
- Reflection.registerFieldsToFilter(StandardAuthManager.class, "CACHE_EXPIRE", "graph", "eventListener", "usersCache", "users", "groups", "targets", "belong", "access", "$assertionsDisabled");
- Reflection.registerMethodsToFilter(StandardAuthManager.class, "lambda$0", "listenChanges", "unlistenChanges", "invalidCache", "initSchemaIfNeeded", "rolePermission", "rolePermission", "rolePermission", "cache");
+ Reflection.registerFieldsToFilter(StandardAuthManager.class, "CACHE_EXPIRE", "graph",
+ "eventListener", "usersCache", "users", "groups",
+ "targets", "belong", "access", "$assertionsDisabled");
+ Reflection.registerMethodsToFilter(StandardAuthManager.class, "lambda$0", "listenChanges",
+ "unlistenChanges", "invalidCache", "initSchemaIfNeeded",
+ "rolePermission", "rolePermission", "rolePermission",
+ "cache");
Reflection.registerFieldsToFilter(SchemaDefine.class, "graph", "label");
- Reflection.registerMethodsToFilter(SchemaDefine.class, "schema", "createPropertyKey", "createPropertyKey", "createPropertyKey", "existEdgeLabel", "createRangeIndex", "unhideField", "hideField", "existVertexLabel", "initProperties");
- Reflection.registerFieldsToFilter(EntityManager.class, "graph", "label", "deser", "NO_LIMIT", "$assertionsDisabled");
- Reflection.registerMethodsToFilter(EntityManager.class, "toList", "graph", "tx", "commitOrRollback", "unhideLabel", "queryById", "queryEntity", "constructVertex", "save", "query");
- Reflection.registerFieldsToFilter(RelationshipManager.class, "graph", "label", "deser", "NO_LIMIT", "$assertionsDisabled");
- Reflection.registerMethodsToFilter(RelationshipManager.class, "lambda$0", "toList", "graph", "tx", "commitOrRollback", "unhideLabel", "queryById", "queryRelationship", "newVertex", "save");
- Reflection.registerFieldsToFilter(CacheManager.class, "LOG", "INSTANCE", "TIMER_TICK_PERIOD", "LOG_TICK_COST_TIME", "caches", "timer");
- Reflection.registerMethodsToFilter(CacheManager.class, "access$0", "scheduleTimer", "instance");
- Reflection.registerFieldsToFilter(org.apache.hugegraph.concurrent.LockManager.class, "INSTANCE", "lockGroupMap");
- Reflection.registerMethodsToFilter(org.apache.hugegraph.concurrent.LockManager.class, "instance");
- Reflection.registerFieldsToFilter(ServerReporter.class, "instance", "gauges", "counters", "histograms", "meters", "timers");
+ Reflection.registerMethodsToFilter(SchemaDefine.class, "schema", "createPropertyKey",
+ "createPropertyKey", "createPropertyKey",
+ "existEdgeLabel", "createRangeIndex", "unhideField",
+ "hideField", "existVertexLabel", "initProperties");
+ Reflection.registerFieldsToFilter(EntityManager.class, "graph", "label", "deser",
+ "NO_LIMIT", "$assertionsDisabled");
+ Reflection.registerMethodsToFilter(EntityManager.class, "toList", "graph", "tx",
+ "commitOrRollback", "unhideLabel", "queryById",
+ "queryEntity", "constructVertex", "save", "query");
+ Reflection.registerFieldsToFilter(RelationshipManager.class, "graph", "label", "deser",
+ "NO_LIMIT", "$assertionsDisabled");
+ Reflection.registerMethodsToFilter(RelationshipManager.class, "lambda$0", "toList", "graph",
+ "tx", "commitOrRollback", "unhideLabel", "queryById",
+ "queryRelationship", "newVertex", "save");
+ Reflection.registerFieldsToFilter(CacheManager.class, "LOG", "INSTANCE",
+ "TIMER_TICK_PERIOD", "LOG_TICK_COST_TIME", "caches",
+ "timer");
+ Reflection.registerMethodsToFilter(CacheManager.class, "access$0", "scheduleTimer",
+ "instance");
+ Reflection.registerFieldsToFilter(org.apache.hugegraph.concurrent.LockManager.class,
+ "INSTANCE", "lockGroupMap");
+ Reflection.registerMethodsToFilter(org.apache.hugegraph.concurrent.LockManager.class,
+ "instance");
+ Reflection.registerFieldsToFilter(ServerReporter.class, "instance", "gauges", "counters",
+ "histograms", "meters", "timers");
Reflection.registerMethodsToFilter(ServerReporter.class, "instance", "instance");
- Reflection.registerFieldsToFilter(com.codahale.metrics.ScheduledReporter.class, "LOG", "FACTORY_ID", "registry", "executor", "shutdownExecutorOnStop", "disabledMetricAttributes", "scheduledFuture", "filter", "durationFactor", "durationUnit", "rateFactor", "rateUnit");
- Reflection.registerMethodsToFilter(com.codahale.metrics.ScheduledReporter.class, "convertDuration", "convertRate", "getRateUnit", "getDurationUnit", "isShutdownExecutorOnStop", "getDisabledMetricAttributes", "calculateRateUnit", "createDefaultExecutor", "lambda$start$0", "start");
+ Reflection.registerFieldsToFilter(com.codahale.metrics.ScheduledReporter.class, "LOG",
+ "FACTORY_ID", "registry", "executor",
+ "shutdownExecutorOnStop", "disabledMetricAttributes",
+ "scheduledFuture", "filter", "durationFactor",
+ "durationUnit", "rateFactor", "rateUnit");
+ Reflection.registerMethodsToFilter(com.codahale.metrics.ScheduledReporter.class,
+ "convertDuration", "convertRate", "getRateUnit",
+ "getDurationUnit", "isShutdownExecutorOnStop",
+ "getDisabledMetricAttributes", "calculateRateUnit",
+ "createDefaultExecutor", "lambda$start$0", "start");
Reflection.registerFieldsToFilter(JsonSerializer.class, "LBUF_SIZE", "INSTANCE");
Reflection.registerMethodsToFilter(JsonSerializer.class, "writeIterator", "instance");
- Reflection.registerFieldsToFilter(HugeVertexStepStrategy.class, "serialVersionUID", "INSTANCE");
+ Reflection.registerFieldsToFilter(HugeVertexStepStrategy.class, "serialVersionUID",
+ "INSTANCE");
Reflection.registerMethodsToFilter(HugeVertexStepStrategy.class, "instance");
- Reflection.registerFieldsToFilter(HugeGraphStepStrategy.class, "serialVersionUID", "INSTANCE");
+ Reflection.registerFieldsToFilter(HugeGraphStepStrategy.class, "serialVersionUID",
+ "INSTANCE");
Reflection.registerMethodsToFilter(HugeGraphStepStrategy.class, "instance");
- Reflection.registerFieldsToFilter(HugeCountStepStrategy.class, "serialVersionUID", "INSTANCE");
+ Reflection.registerFieldsToFilter(HugeCountStepStrategy.class, "serialVersionUID",
+ "INSTANCE");
Reflection.registerMethodsToFilter(HugeCountStepStrategy.class, "lambda$0", "instance");
// Enable this line to generate registration statement
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeGraphAuthProxy.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeGraphAuthProxy.java
index a038ef67f..796c38c32 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeGraphAuthProxy.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeGraphAuthProxy.java
@@ -147,7 +147,7 @@ public final class HugeGraphAuthProxy implements HugeGraph {
@Override
public <C extends GraphComputer> C compute(Class<C> clazz)
- throws IllegalArgumentException {
+ throws IllegalArgumentException {
this.verifyAnyPermission();
return this.hugegraph.compute(clazz);
}
@@ -164,7 +164,7 @@ public final class HugeGraphAuthProxy implements HugeGraph {
return new GraphTraversalSourceProxy(this);
}
- @SuppressWarnings({ "rawtypes", "deprecation" })
+ @SuppressWarnings({"rawtypes", "deprecation"})
@Override
public <I extends Io> I io(final Io.Builder<I> builder) {
this.verifyAnyPermission();
@@ -832,14 +832,14 @@ public final class HugeGraphAuthProxy implements HugeGraph {
}
private <V extends AuthElement> V verifyUserPermission(
- HugePermission actionPerm,
- V elementFetcher) {
+ HugePermission actionPerm,
+ V elementFetcher) {
return verifyUserPermission(actionPerm, true, () -> elementFetcher);
}
private <V extends AuthElement> List<V> verifyUserPermission(
- HugePermission actionPerm,
- List<V> elems) {
+ HugePermission actionPerm,
+ List<V> elems) {
List<V> results = new ArrayList<>();
for (V elem : elems) {
V r = verifyUserPermission(actionPerm, false, () -> elem);
@@ -851,9 +851,9 @@ public final class HugeGraphAuthProxy implements HugeGraph {
}
private <V extends AuthElement> V verifyUserPermission(
- HugePermission actionPerm,
- boolean throwIfNoPerm,
- Supplier<V> elementFetcher) {
+ HugePermission actionPerm,
+ boolean throwIfNoPerm,
+ Supplier<V> elementFetcher) {
return verifyResPermission(actionPerm, throwIfNoPerm, () -> {
String graph = this.hugegraph.name();
V elem = elementFetcher.get();
@@ -869,14 +869,14 @@ public final class HugeGraphAuthProxy implements HugeGraph {
}
private <V extends HugeElement> V verifyElemPermission(
- HugePermission actionPerm,
- Supplier<V> elementFetcher) {
+ HugePermission actionPerm,
+ Supplier<V> elementFetcher) {
return verifyElemPermission(actionPerm, true, elementFetcher);
}
private <V extends Element> Iterator<V> verifyElemPermission(
- HugePermission actionPerm,
- Iterator<V> elems) {
+ HugePermission actionPerm,
+ Iterator<V> elems) {
return new FilterIterator<>(elems, elem -> {
V r = verifyElemPermission(actionPerm, false, () -> elem);
return r != null;
@@ -884,9 +884,9 @@ public final class HugeGraphAuthProxy implements HugeGraph {
}
private <V extends Element> V verifyElemPermission(
- HugePermission actionPerm,
- boolean throwIfNoPerm,
- Supplier<V> elementFetcher) {
+ HugePermission actionPerm,
+ boolean throwIfNoPerm,
+ Supplier<V> elementFetcher) {
return verifyResPermission(actionPerm, throwIfNoPerm, () -> {
String graph = this.hugegraph.name();
HugeElement elem = (HugeElement) elementFetcher.get();
@@ -916,8 +916,8 @@ public final class HugeGraphAuthProxy implements HugeGraph {
}
private <V extends SchemaElement> Collection<V> verifySchemaPermission(
- HugePermission actionPerm,
- Collection<V> schemas) {
+ HugePermission actionPerm,
+ Collection<V> schemas) {
List<V> results = new ArrayList<>();
for (V schema : schemas) {
V r = verifySchemaPermission(actionPerm, false, () -> schema);
@@ -929,15 +929,15 @@ public final class HugeGraphAuthProxy implements HugeGraph {
}
private <V extends SchemaElement> V verifySchemaPermission(
- HugePermission actionPerm,
- Supplier<V> schemaFetcher) {
+ HugePermission actionPerm,
+ Supplier<V> schemaFetcher) {
return verifySchemaPermission(actionPerm, true, schemaFetcher);
}
private <V extends SchemaElement> V verifySchemaPermission(
- HugePermission actionPerm,
- boolean throwIfNoPerm,
- Supplier<V> schemaFetcher) {
+ HugePermission actionPerm,
+ boolean throwIfNoPerm,
+ Supplier<V> schemaFetcher) {
return verifyResPermission(actionPerm, throwIfNoPerm, () -> {
String graph = this.hugegraph.name();
SchemaElement elem = schemaFetcher.get();
@@ -1099,21 +1099,21 @@ public final class HugeGraphAuthProxy implements HugeGraph {
@Override
public <V> HugeTask<V> waitUntilTaskCompleted(Id id, long seconds)
- throws TimeoutException {
+ throws TimeoutException {
verifyAnyPermission();
return this.taskScheduler.waitUntilTaskCompleted(id, seconds);
}
@Override
public <V> HugeTask<V> waitUntilTaskCompleted(Id id)
- throws TimeoutException {
+ throws TimeoutException {
verifyAnyPermission();
return this.taskScheduler.waitUntilTaskCompleted(id);
}
@Override
public void waitUntilAllTasksCompleted(long seconds)
- throws TimeoutException {
+ throws TimeoutException {
verifyAnyPermission();
this.taskScheduler.waitUntilAllTasksCompleted(seconds);
}
@@ -1134,8 +1134,8 @@ public final class HugeGraphAuthProxy implements HugeGraph {
}
private <V> Iterator<HugeTask<V>> verifyTaskPermission(
- HugePermission actionPerm,
- Iterator<HugeTask<V>> tasks) {
+ HugePermission actionPerm,
+ Iterator<HugeTask<V>> tasks) {
return new FilterIterator<>(tasks, task -> {
return verifyTaskPermission(actionPerm, false, task) != null;
});
@@ -1695,7 +1695,7 @@ public final class HugeGraphAuthProxy implements HugeGraph {
@SuppressWarnings({"unchecked"})
@Override
public TraversalStrategies removeStrategies(
- Class<? extends TraversalStrategy>... strategyClasses) {
+ Class<? extends TraversalStrategy>... strategyClasses) {
return this.strategies.removeStrategies(strategyClasses);
}
@@ -1724,14 +1724,14 @@ public final class HugeGraphAuthProxy implements HugeGraph {
}
private final class TraversalStrategyProxy<T extends TraversalStrategy<?>>
- implements TraversalStrategy<T> {
+ implements TraversalStrategy<T> {
private static final long serialVersionUID = 2071829024642435735L;
private final TraversalStrategy<T> origin;
public TraversalStrategyProxy(TraversalStrategy<?> origin) {
- @SuppressWarnings({ "rawtypes", "unchecked" })
+ @SuppressWarnings({"rawtypes", "unchecked"})
TraversalStrategy<T> strategy = (TraversalStrategy) origin;
this.origin = strategy;
}
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/StandardAuthenticator.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/StandardAuthenticator.java
index 492253376..3e276046f 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/StandardAuthenticator.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/StandardAuthenticator.java
@@ -110,7 +110,7 @@ public class StandardAuthenticator implements HugeAuthenticator {
public void setup(HugeConfig config) {
String graphName = config.get(ServerOptions.AUTH_GRAPH_STORE);
Map<String, String> graphConfs = ConfigUtil.scanGraphsDir(
- config.get(ServerOptions.GRAPHS));
+ config.get(ServerOptions.GRAPHS));
String graphPath = graphConfs.get(graphName);
E.checkArgument(graphPath != null,
"Can't find graph name '%s' in config '%s' at " +
@@ -137,7 +137,7 @@ public class StandardAuthenticator implements HugeAuthenticator {
String remoteUrl = config.get(ServerOptions.AUTH_REMOTE_URL);
if (StringUtils.isNotEmpty(remoteUrl)) {
RpcClientProviderWithAuth clientProvider =
- new RpcClientProviderWithAuth(config);
+ new RpcClientProviderWithAuth(config);
this.graph.switchAuthManager(clientProvider.authManager());
}
}
@@ -159,9 +159,10 @@ public class StandardAuthenticator implements HugeAuthenticator {
/**
* Verify if a user is legal
+ *
* @param username the username for authentication
* @param password the password for authentication
- * @param token the token for authentication
+ * @param token the token for authentication
* @return String No permission if return ROLE_NONE else return a role
*/
@Override
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/WsAndHttpBasicAuthHandler.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/WsAndHttpBasicAuthHandler.java
index 205074ae7..1b329e19f 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/WsAndHttpBasicAuthHandler.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/WsAndHttpBasicAuthHandler.java
@@ -24,7 +24,7 @@ import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1;
import static org.apache.tinkerpop.gremlin.groovy.jsr223.dsl.credential.CredentialGraphTokens.PROPERTY_PASSWORD;
import static org.apache.tinkerpop.gremlin.groovy.jsr223.dsl.credential.CredentialGraphTokens.PROPERTY_USERNAME;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.util.Base64;
import java.util.HashMap;
import java.util.Map;
@@ -61,7 +61,7 @@ public class WsAndHttpBasicAuthHandler extends SaslAuthenticationHandler {
@Override
public void channelRead(final ChannelHandlerContext ctx, final Object obj)
- throws Exception {
+ throws Exception {
if (obj instanceof HttpMessage && !isWebSocket((HttpMessage) obj)) {
ChannelPipeline pipeline = ctx.pipeline();
ChannelHandler authHandler = pipeline.get(HTTP_AUTH);
@@ -86,7 +86,7 @@ public class WsAndHttpBasicAuthHandler extends SaslAuthenticationHandler {
@ChannelHandler.Sharable
private static class HttpBasicAuthHandler
- extends AbstractAuthenticationHandler {
+ extends AbstractAuthenticationHandler {
private final Base64.Decoder decoder = Base64.getUrlDecoder();
@@ -122,7 +122,7 @@ public class WsAndHttpBasicAuthHandler extends SaslAuthenticationHandler {
return;
}
String authorization = new String(userPass,
- Charset.forName("UTF-8"));
+ StandardCharsets.UTF_8);
String[] split = authorization.split(":");
if (split.length != 2) {
sendError(ctx, msg);
@@ -134,7 +134,7 @@ public class WsAndHttpBasicAuthHandler extends SaslAuthenticationHandler {
address = address.substring(1);
}
- final Map<String,String> credentials = new HashMap<>();
+ final Map<String, String> credentials = new HashMap<>();
credentials.put(PROPERTY_USERNAME, split[0]);
credentials.put(PROPERTY_PASSWORD, split[1]);
credentials.put(HugeAuthenticator.KEY_ADDRESS, address);
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java
index e18d5139a..b46735c8f 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java
@@ -274,36 +274,36 @@ public class ServerOptions extends OptionHolder {
);
public static final ConfigOption<String> ARTHAS_TELNET_PORT =
- new ConfigOption<>(
- "arthas.telnet_port",
- "The telnet port provided by Arthas, it can be accessible from the outside.",
- disallowEmpty(),
- "8562"
- );
+ new ConfigOption<>(
+ "arthas.telnet_port",
+ "The telnet port provided by Arthas, it can be accessible from the outside.",
+ disallowEmpty(),
+ "8562"
+ );
public static final ConfigOption<String> ARTHAS_HTTP_PORT =
- new ConfigOption<>(
- "arthas.http_port",
- "The HTTP port provided by Arthas, it can be accessible from the outside.",
- disallowEmpty(),
- "8561"
- );
+ new ConfigOption<>(
+ "arthas.http_port",
+ "The HTTP port provided by Arthas, it can be accessible from the outside.",
+ disallowEmpty(),
+ "8561"
+ );
public static final ConfigOption<String> ARTHAS_IP =
- new ConfigOption<>(
- "arthas.ip",
- "The IP provided by Arthas, it can be accessible from the outside.",
- disallowEmpty(),
- "0.0.0.0"
- );
+ new ConfigOption<>(
+ "arthas.ip",
+ "The IP provided by Arthas, it can be accessible from the outside.",
+ disallowEmpty(),
+ "0.0.0.0"
+ );
public static final ConfigOption<String> ARTHAS_DISABLED_COMMANDS =
- new ConfigOption<>(
- "arthas.disabled_commands",
- "The disabled Arthas commands due to high risk.",
- null,
- "jad"
- );
+ new ConfigOption<>(
+ "arthas.disabled_commands",
+ "The disabled Arthas commands due to high risk.",
+ null,
+ "jad"
+ );
public static final ConfigOption<Long> SLOW_QUERY_LOG_TIME_THRESHOLD =
new ConfigOption<>(
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/core/GraphManager.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/core/GraphManager.java
index 9b3c3a10a..1830d81c7 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/core/GraphManager.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/core/GraphManager.java
@@ -158,7 +158,7 @@ public final class GraphManager {
HugeConfig cloneConfig = cloneGraph.cloneConfig(newName);
if (StringUtils.isNotEmpty(configText)) {
PropertiesConfiguration propConfig = ConfigUtil.buildConfig(
- configText);
+ configText);
// Use the passed config to overwrite the old one
propConfig.getKeys().forEachRemaining(key -> {
cloneConfig.setProperty(key, propConfig.getProperty(key));
@@ -259,7 +259,7 @@ public final class GraphManager {
}
public HugeAuthenticator.User authenticate(Map<String, String> credentials)
- throws AuthenticationException {
+ throws AuthenticationException {
return this.authenticator().authenticate(credentials);
}
@@ -436,20 +436,20 @@ public final class GraphManager {
this.authenticator().initAdminUser(token);
} catch (Exception e) {
throw new BackendException(
- "The backend store of '%s' can't " +
- "initialize admin user", hugegraph.name());
+ "The backend store of '%s' can't " +
+ "initialize admin user", hugegraph.name());
}
}
}
BackendStoreInfo info = hugegraph.backendStoreInfo();
if (!info.exists()) {
throw new BackendException(
- "The backend store of '%s' has not been initialized",
- hugegraph.name());
+ "The backend store of '%s' has not been initialized",
+ hugegraph.name());
}
if (!info.checkVersion()) {
throw new BackendException(
- "The backend store version is inconsistent");
+ "The backend store version is inconsistent");
}
}
}
@@ -521,7 +521,7 @@ public final class GraphManager {
});
// Add metrics for caches
- @SuppressWarnings({ "rawtypes", "unchecked" })
+ @SuppressWarnings({"rawtypes", "unchecked"})
Map<String, Cache<?, ?>> caches = (Map) CacheManager.instance()
.caches();
registerCacheMetrics(caches);
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/define/UpdateStrategy.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/define/UpdateStrategy.java
index c910dc8c2..887bf7d45 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/define/UpdateStrategy.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/define/UpdateStrategy.java
@@ -26,6 +26,7 @@ import java.util.Set;
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.NumericUtil;
+
import com.google.common.collect.Sets;
public enum UpdateStrategy {
@@ -113,7 +114,7 @@ public enum UpdateStrategy {
// Batch update Set should use union because of higher efficiency
APPEND {
@Override
- @SuppressWarnings({ "rawtypes", "unchecked" })
+ @SuppressWarnings({"rawtypes", "unchecked"})
Object updatePropertyValue(Object oldProperty, Object newProperty) {
((Collection) oldProperty).addAll((Collection) newProperty);
return oldProperty;
@@ -127,7 +128,7 @@ public enum UpdateStrategy {
ELIMINATE {
@Override
- @SuppressWarnings({ "rawtypes", "unchecked" })
+ @SuppressWarnings({"rawtypes", "unchecked"})
Object updatePropertyValue(Object oldProperty, Object newProperty) {
((Collection) oldProperty).removeAll((Collection) newProperty);
return oldProperty;
@@ -186,7 +187,7 @@ public enum UpdateStrategy {
Number newNum = NumericUtil.convertToNumber(newProperty);
int result = NumericUtil.compareNumber(oldNum, newNum);
return strategy == BIGGER ? (result > 0 ? oldProperty : newProperty) :
- (result < 0 ? oldProperty : newProperty);
+ (result < 0 ? oldProperty : newProperty);
}
protected static Set<?> combineSet(Object oldProperty, Object newProperty,
@@ -198,6 +199,6 @@ public enum UpdateStrategy {
(Set<?>) newProperty :
new HashSet<>((List<?>) newProperty);
return strategy == UNION ? Sets.union(oldSet, newSet) :
- Sets.intersection(oldSet, newSet);
+ Sets.intersection(oldSet, newSet);
}
}
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsModule.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsModule.java
index 5107b4611..0d42b6369 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsModule.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsModule.java
@@ -227,7 +227,7 @@ public class MetricsModule extends Module {
}
private static class MetricRegistrySerializer
- extends StdSerializer<MetricRegistry> {
+ extends StdSerializer<MetricRegistry> {
private static final long serialVersionUID = 3717001164181726933L;
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/ServerReporter.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/ServerReporter.java
index d3cd6855b..b302ddc5d 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/ServerReporter.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/ServerReporter.java
@@ -26,6 +26,7 @@ import java.util.SortedMap;
import java.util.concurrent.TimeUnit;
import org.apache.hugegraph.util.E;
+
import com.codahale.metrics.Counter;
import com.codahale.metrics.Gauge;
import com.codahale.metrics.Histogram;
@@ -47,7 +48,7 @@ public class ServerReporter extends ScheduledReporter {
private SortedMap<String, Timer> timers;
public static synchronized ServerReporter instance(
- MetricRegistry registry) {
+ MetricRegistry registry) {
if (instance == null) {
synchronized (ServerReporter.class) {
if (instance == null) {
@@ -97,7 +98,7 @@ public class ServerReporter extends ScheduledReporter {
return Collections.unmodifiableMap(this.meters);
}
- @SuppressWarnings({ "rawtypes", "unchecked" })
+ @SuppressWarnings({"rawtypes", "unchecked"})
@Override
public void report(SortedMap<String, Gauge> gauges,
SortedMap<String, Counter> counters,
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/SystemMetrics.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/SystemMetrics.java
index 903ac6103..3aeaca344 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/SystemMetrics.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/SystemMetrics.java
@@ -27,7 +27,6 @@ import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
-
import org.apache.hugegraph.util.Bytes;
public class SystemMetrics {
@@ -112,7 +111,7 @@ public class SystemMetrics {
private Map<String, Object> getClassLoadingMetrics() {
Map<String, Object> metrics = new LinkedHashMap<>();
ClassLoadingMXBean classLoadingMxBean = ManagementFactory
- .getClassLoadingMXBean();
+ .getClassLoadingMXBean();
metrics.put("count", classLoadingMxBean.getLoadedClassCount());
metrics.put("loaded", classLoadingMxBean.getTotalLoadedClassCount());
metrics.put("unloaded", classLoadingMxBean.getUnloadedClassCount());
@@ -122,7 +121,7 @@ public class SystemMetrics {
private Map<String, Object> getGarbageCollectionMetrics() {
Map<String, Object> metrics = new LinkedHashMap<>();
List<GarbageCollectorMXBean> gcMxBeans = ManagementFactory
- .getGarbageCollectorMXBeans();
+ .getGarbageCollectorMXBeans();
for (GarbageCollectorMXBean gcMxBean : gcMxBeans) {
String name = formatName(gcMxBean.getName());
metrics.put(name + "_count", gcMxBean.getCollectionCount());
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherOpProcessor.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherOpProcessor.java
index a4dfff60a..dfad9b959 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherOpProcessor.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherOpProcessor.java
@@ -16,7 +16,22 @@
package org.apache.hugegraph.opencypher;
-import io.netty.channel.ChannelHandlerContext;
+import static java.util.Collections.emptyMap;
+import static java.util.Collections.singletonList;
+import static java.util.Optional.empty;
+import static org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode.SERVER_ERROR;
+import static org.opencypher.gremlin.translation.StatementOption.EXPLAIN;
+import static org.slf4j.LoggerFactory.getLogger;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.Future;
+import java.util.concurrent.FutureTask;
+import java.util.concurrent.TimeUnit;
import org.apache.tinkerpop.gremlin.driver.Tokens;
import org.apache.tinkerpop.gremlin.driver.message.RequestMessage;
@@ -45,20 +60,9 @@ import org.opencypher.gremlin.traversal.ProcedureContext;
import org.opencypher.gremlin.traversal.ReturnNormalizer;
import org.slf4j.Logger;
+import io.netty.channel.ChannelHandlerContext;
import scala.collection.Seq;
-import java.util.*;
-import java.util.concurrent.Future;
-import java.util.concurrent.FutureTask;
-import java.util.concurrent.TimeUnit;
-
-import static java.util.Collections.emptyMap;
-import static java.util.Collections.singletonList;
-import static java.util.Optional.empty;
-import static org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode.SERVER_ERROR;
-import static org.opencypher.gremlin.translation.StatementOption.EXPLAIN;
-import static org.slf4j.LoggerFactory.getLogger;
-
/**
* Description of the modifications:
* <p>
@@ -80,7 +84,7 @@ import static org.slf4j.LoggerFactory.getLogger;
* <p>
* 3) Set the logger level from info to trace
* </p>
- *
+ * <p>
* {@link OpProcessor} implementation for processing Cypher {@link RequestMessage}s:
* <pre>
* {
@@ -94,7 +98,7 @@ import static org.slf4j.LoggerFactory.getLogger;
public class CypherOpProcessor extends AbstractEvalOpProcessor {
private static final String DEFAULT_TRANSLATOR_DEFINITION =
- "gremlin+cfog_server_extensions+inline_parameters";
+ "gremlin+cfog_server_extensions+inline_parameters";
private static final Logger logger = getLogger(CypherOpProcessor.class);
@@ -242,8 +246,8 @@ public class CypherOpProcessor extends AbstractEvalOpProcessor {
.getExecutorService().submit(evalFuture);
if (timeout > 0) {
context.getScheduledExecutorService().schedule(
- () -> executionFuture.cancel(true)
- , timeout, TimeUnit.MILLISECONDS);
+ () -> executionFuture.cancel(true)
+ , timeout, TimeUnit.MILLISECONDS);
}
}
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherPlugin.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherPlugin.java
index 98cf98eee..6d7899dd1 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherPlugin.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherPlugin.java
@@ -28,13 +28,6 @@
package org.apache.hugegraph.opencypher;
-import org.apache.tinkerpop.gremlin.jsr223.Customizer;
-import org.apache.tinkerpop.gremlin.jsr223.DefaultImportCustomizer;
-import org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin;
-import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
-import org.opencypher.gremlin.traversal.CustomFunctions;
-import org.opencypher.gremlin.traversal.CustomPredicate;
-
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.List;
@@ -42,15 +35,24 @@ import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
+import org.apache.tinkerpop.gremlin.jsr223.Customizer;
+import org.apache.tinkerpop.gremlin.jsr223.DefaultImportCustomizer;
+import org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin;
+import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
+import org.opencypher.gremlin.traversal.CustomFunctions;
+import org.opencypher.gremlin.traversal.CustomPredicate;
+
public class CypherPlugin implements GremlinPlugin {
private static final ImportCustomizer IMPORTS =
- DefaultImportCustomizer.build()
- .addClassImports(CustomPredicate.class)
- .addMethodImports(getDeclaredPublicMethods(CustomPredicate.class))
- .addClassImports(CustomFunctions.class)
- .addMethodImports(getDeclaredPublicMethods(CustomFunctions.class))
- .create();
+ DefaultImportCustomizer.build()
+ .addClassImports(CustomPredicate.class)
+ .addMethodImports(
+ getDeclaredPublicMethods(CustomPredicate.class))
+ .addClassImports(CustomFunctions.class)
+ .addMethodImports(
+ getDeclaredPublicMethods(CustomFunctions.class))
+ .create();
private static List<Method> getDeclaredPublicMethods(Class<?> klass) {
Method[] declaredMethods = klass.getDeclaredMethods();
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/rpc/RpcClientProviderWithAuth.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/rpc/RpcClientProviderWithAuth.java
index 1311e3e32..80af0ab36 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/rpc/RpcClientProviderWithAuth.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/rpc/RpcClientProviderWithAuth.java
@@ -17,12 +17,13 @@
package org.apache.hugegraph.rpc;
-import com.alipay.sofa.rpc.common.utils.StringUtils;
import org.apache.hugegraph.auth.AuthManager;
import org.apache.hugegraph.config.HugeConfig;
import org.apache.hugegraph.config.ServerOptions;
import org.apache.hugegraph.util.E;
+import com.alipay.sofa.rpc.common.utils.StringUtils;
+
public class RpcClientProviderWithAuth extends RpcClientProvider {
private final RpcConsumerConfig authConsumerConfig;
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/server/ApplicationConfig.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/server/ApplicationConfig.java
index e477fce1d..7784613f5 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/server/ApplicationConfig.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/server/ApplicationConfig.java
@@ -42,32 +42,32 @@ import com.codahale.metrics.jersey3.InstrumentedResourceMethodApplicationListene
import io.swagger.v3.jaxrs2.integration.resources.OpenApiResource;
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.enums.SecuritySchemeType;
import io.swagger.v3.oas.annotations.info.Contact;
import io.swagger.v3.oas.annotations.info.Info;
-import io.swagger.v3.oas.annotations.enums.SecuritySchemeType;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.security.SecurityScheme;
import jakarta.ws.rs.ApplicationPath;
@SecurityScheme(
- name = "basic",
- type = SecuritySchemeType.HTTP,
- scheme = "basic"
+ name = "basic",
+ type = SecuritySchemeType.HTTP,
+ scheme = "basic"
)
@SecurityScheme(
- name = "bearer",
- type = SecuritySchemeType.HTTP,
- scheme = "bearer"
+ name = "bearer",
+ type = SecuritySchemeType.HTTP,
+ scheme = "bearer"
)
@ApplicationPath("/")
@OpenAPIDefinition(
- info = @Info(
- title = "HugeGraph RESTful API",
- version = CoreVersion.DEFAULT_VERSION,
- description = "All management API for HugeGraph",
- contact = @Contact(url = "https://github.com/apache/hugegraph", name = "HugeGraph")
- ),
- security = {@SecurityRequirement(name = "basic"), @SecurityRequirement(name = "bearer")}
+ info = @Info(
+ title = "HugeGraph RESTful API",
+ version = CoreVersion.DEFAULT_VERSION,
+ description = "All management API for HugeGraph",
+ contact = @Contact(url = "https://github.com/apache/hugegraph", name = "HugeGraph")
+ ),
+ security = {@SecurityRequirement(name = "basic"), @SecurityRequirement(name = "bearer")}
)
public class ApplicationConfig extends ResourceConfig {
@@ -131,9 +131,9 @@ public class ApplicationConfig extends ResourceConfig {
public GraphManagerFactory(HugeConfig conf, EventHub hub) {
register(new ApplicationEventListener() {
private final ApplicationEvent.Type eventInited =
- ApplicationEvent.Type.INITIALIZATION_FINISHED;
+ ApplicationEvent.Type.INITIALIZATION_FINISHED;
private final ApplicationEvent.Type eventDestroyed =
- ApplicationEvent.Type.DESTROY_FINISHED;
+ ApplicationEvent.Type.DESTROY_FINISHED;
@Override
public void onEvent(ApplicationEvent event) {
diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/server/RestServer.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/server/RestServer.java
index 01ce8da94..90e4e19f4 100644
--- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/server/RestServer.java
+++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/server/RestServer.java
@@ -23,8 +23,12 @@ import java.util.Collection;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Future;
-import jakarta.ws.rs.core.UriBuilder;
-
+import org.apache.hugegraph.config.HugeConfig;
+import org.apache.hugegraph.config.ServerOptions;
+import org.apache.hugegraph.event.EventHub;
+import org.apache.hugegraph.util.E;
+import org.apache.hugegraph.util.Log;
+import org.apache.hugegraph.version.ApiVersion;
import org.glassfish.grizzly.CompletionHandler;
import org.glassfish.grizzly.GrizzlyFuture;
import org.glassfish.grizzly.http.server.HttpServer;
@@ -36,12 +40,7 @@ import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory;
import org.glassfish.jersey.server.ResourceConfig;
import org.slf4j.Logger;
-import org.apache.hugegraph.config.HugeConfig;
-import org.apache.hugegraph.config.ServerOptions;
-import org.apache.hugegraph.event.EventHub;
-import org.apache.hugegraph.util.E;
-import org.apache.hugegraph.util.Log;
-import org.apache.hugegraph.version.ApiVersion;
+import jakarta.ws.rs.core.UriBuilder;
public class RestServer {
@@ -82,13 +81,13 @@ public class RestServer {
if (protocol != null && protocol.equals("https")) {
SSLContextConfigurator sslContext = new SSLContextConfigurator();
String keystoreFile = this.conf.get(
- ServerOptions.SSL_KEYSTORE_FILE);
+ ServerOptions.SSL_KEYSTORE_FILE);
String keystorePass = this.conf.get(
- ServerOptions.SSL_KEYSTORE_PASSWORD);
+ ServerOptions.SSL_KEYSTORE_PASSWORD);
sslContext.setKeyStoreFile(keystoreFile);
sslContext.setKeyStorePass(keystorePass);
SSLEngineConfigurator sslConfig = new SSLEngineConfigurator(
- sslContext);
+ sslContext);
sslConfig.setClientMode(false);
sslConfig.setWantClientAuth(true);
server = GrizzlyHttpServerFactory.createHttpServer(uri, rc, true,
diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraEntryIterator.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraEntryIterator.java
index 8cb0bc78b..2f057007f 100644
--- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraEntryIterator.java
+++ b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraEntryIterator.java
@@ -43,7 +43,7 @@ public class CassandraEntryIterator extends BackendEntryIterator {
private BackendEntry next;
public CassandraEntryIterator(ResultSet results, Query query,
- BiFunction<BackendEntry, Row, BackendEntry> merger) {
+ BiFunction<BackendEntry, Row, BackendEntry> merger) {
super(query);
this.results = results;
this.rows = results.iterator();
diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraMetrics.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraMetrics.java
index e3e3eb51a..400efd024 100644
--- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraMetrics.java
+++ b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraMetrics.java
@@ -108,7 +108,7 @@ public class CassandraMetrics implements BackendMetrics {
metrics.put(MEM_UNIT, "MB");
long diskSize = UnitUtil.bytesFromReadableString(
- probe.getLoadString());
+ probe.getLoadString());
metrics.put(DISK_USAGE, UnitUtil.bytesToGB(diskSize));
metrics.put(DISK_USAGE + READABLE,
UnitUtil.bytesToReadableString(diskSize));
@@ -213,7 +213,7 @@ public class CassandraMetrics implements BackendMetrics {
String name = humpToLine(metric + "_" + suffix);
// Aggregation of metrics for the whole host if keyspace=null
JmxTimerMBean value = (JmxTimerMBean) probe.getColumnFamilyMetric(
- keyspace, null, metric);
+ keyspace, null, metric);
Map<String, Object> timerMap = InsertionOrderUtil.newMap();
timerMap.put("count", value.getCount());
timerMap.put("min", value.getMin());
@@ -316,7 +316,7 @@ public class CassandraMetrics implements BackendMetrics {
}
private NodeProbe newNodeProbe(String host) throws IOException {
- LOG.debug("Probe to cassandra node: '{}:{}'", host, this.port);
+ LOG.debug("Probe to cassandra node: '{}:{}'", host, this.port);
return this.username.isEmpty() ?
new NodeProbe(host, this.port) :
new NodeProbe(host, this.port, this.username, this.password);
diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSerializer.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSerializer.java
index 0901a0231..fc3c499a8 100644
--- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSerializer.java
+++ b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSerializer.java
@@ -45,6 +45,7 @@ import org.apache.hugegraph.type.define.HugeKeys;
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.InsertionOrderUtil;
import org.apache.hugegraph.util.JsonUtil;
+
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSessionPool.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSessionPool.java
index a50cc3099..7a9ffa2b9 100644
--- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSessionPool.java
+++ b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSessionPool.java
@@ -26,6 +26,7 @@ import org.apache.hugegraph.backend.store.BackendSession.AbstractBackendSession;
import org.apache.hugegraph.backend.store.BackendSessionPool;
import org.apache.hugegraph.config.HugeConfig;
import org.apache.hugegraph.util.E;
+
import com.datastax.driver.core.BatchStatement;
import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.Cluster.Builder;
diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraShard.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraShard.java
index 30bd14834..5f3792298 100644
--- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraShard.java
+++ b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraShard.java
@@ -32,7 +32,6 @@ import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
-import org.apache.cassandra.schema.SchemaConstants;
import org.apache.cassandra.db.SystemKeyspace;
import org.apache.cassandra.dht.ByteOrderedPartitioner;
import org.apache.cassandra.dht.IPartitioner;
@@ -41,10 +40,11 @@ import org.apache.cassandra.dht.OrderPreservingPartitioner;
import org.apache.cassandra.dht.Range;
import org.apache.cassandra.dht.Token;
import org.apache.cassandra.dht.Token.TokenFactory;
-
+import org.apache.cassandra.schema.SchemaConstants;
import org.apache.hugegraph.backend.BackendException;
import org.apache.hugegraph.backend.store.Shard;
import org.apache.hugegraph.util.Bytes;
+
import com.datastax.driver.core.Host;
import com.datastax.driver.core.Metadata;
import com.datastax.driver.core.ResultSet;
@@ -82,9 +82,10 @@ public class CassandraShard {
/**
* Get splits of a table
+ *
* @param splitPartitions: expected partitions count per split
- * @param splitSize: expected size(bytes) per split,
- * splitPartitions will be ignored if splitSize is passed
+ * @param splitSize: expected size(bytes) per split,
+ * splitPartitions will be ignored if splitSize is passed
* @return a list of Shard
*/
public List<Shard> getSplits(long splitPartitions, long splitSize) {
@@ -105,7 +106,7 @@ public class CassandraShard {
* compute bite-sized splits.
*/
futures.add(executor.submit(new SplitCallable(
- range, splitPartitions, splitSize)));
+ range, splitPartitions, splitSize)));
}
// Wait until we have all the results back
@@ -128,11 +129,12 @@ public class CassandraShard {
/**
* Get splits of a table in specified range
* NOTE: maybe we don't need this method
- * @param start: the start of range
- * @param end: the end of range
+ *
+ * @param start: the start of range
+ * @param end: the end of range
* @param splitPartitions: expected partitions count per split
- * @param splitSize: expected size(bytes) per split,
- * splitPartitions will be ignored if splitSize is passed
+ * @param splitSize: expected size(bytes) per split,
+ * splitPartitions will be ignored if splitSize is passed
* @return a list of Shard
*/
public List<Shard> getSplits(String start, String end,
@@ -146,8 +148,8 @@ public class CassandraShard {
List<Future<List<Shard>>> futures = new ArrayList<>();
TokenFactory tokenFactory = this.partitioner.getTokenFactory();
TokenRange tokenRange = rangeToTokenRange(new Range<>(
- tokenFactory.fromString(start),
- tokenFactory.fromString(end)));
+ tokenFactory.fromString(start),
+ tokenFactory.fromString(end)));
// Canonical ranges and nodes holding replicas
Map<TokenRange, Set<Host>> masterRangeNodes = getRangeMap();
@@ -157,7 +159,7 @@ public class CassandraShard {
// For each tokenRange, pick a live owner and ask it
// to compute bite-sized splits
futures.add(executor.submit(new SplitCallable(
- r, splitPartitions, splitSize)));
+ r, splitPartitions, splitSize)));
}
}
@@ -187,8 +189,8 @@ public class CassandraShard {
TokenFactory tokenFactory = this.partitioner.getTokenFactory();
Metadata metadata = this.session.metadata();
return metadata.newTokenRange(
- metadata.newToken(tokenFactory.toString(range.left)),
- metadata.newToken(tokenFactory.toString(range.right)));
+ metadata.newToken(tokenFactory.toString(range.left)),
+ metadata.newToken(tokenFactory.toString(range.right)));
}
private Map<TokenRange, Long> getSubSplits(TokenRange tokenRange,
@@ -205,8 +207,8 @@ public class CassandraShard {
private Map<TokenRange, Set<Host>> getRangeMap() {
Metadata metadata = this.session.metadata();
return metadata.getTokenRanges().stream().collect(Collectors.toMap(
- p -> p,
- p -> metadata.getReplicas('"' + this.keyspace + '"', p)));
+ p -> p,
+ p -> metadata.getReplicas('"' + this.keyspace + '"', p)));
}
private static Map<TokenRange, Long> describeSplits(
@@ -274,15 +276,15 @@ public class CassandraShard {
long splitPartitions, long splitSize) {
if (splitSize <= 0 && splitPartitions <= 0) {
throw new IllegalArgumentException(String.format(
- "The split-partitions must be > 0, but got %s",
- splitPartitions));
+ "The split-partitions must be > 0, but got %s",
+ splitPartitions));
}
if (splitSize > 0 && splitSize < MIN_SHARD_SIZE) {
// splitSize should be at least 1M if passed
throw new IllegalArgumentException(String.format(
- "The split-size must be >= %s bytes, but got %s",
- MIN_SHARD_SIZE, splitSize));
+ "The split-size must be >= %s bytes, but got %s",
+ MIN_SHARD_SIZE, splitSize));
}
this.tokenRange = tokenRange;
diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStore.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStore.java
index 4c9ef8334..8e5fe4d9d 100644
--- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStore.java
+++ b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStore.java
@@ -26,8 +26,6 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
-import org.slf4j.Logger;
-
import org.apache.hugegraph.HugeException;
import org.apache.hugegraph.backend.BackendException;
import org.apache.hugegraph.backend.id.Id;
@@ -45,6 +43,7 @@ import org.apache.hugegraph.exception.ConnectionException;
import org.apache.hugegraph.type.HugeType;
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.KeyspaceMetadata;
@@ -169,13 +168,13 @@ public abstract class CassandraStore extends AbstractBackendStore<CassandraSessi
this.sessions.session().open();
} catch (InvalidQueryException e) {
// TODO: the error message may be changed in different versions
- if (!e.getMessage().contains(String.format(
- "Keyspace '%s' does not exist", this.keyspace))) {
+ if (!e.getMessage().contains(String.format("Keyspace '%s' does not exist",
+ this.keyspace))) {
throw e;
}
if (this.isSchemaStore()) {
- LOG.info("Failed to connect keyspace: {}, " +
- "try to init keyspace later", this.keyspace);
+ LOG.info("Failed to connect keyspace: {}, try to init keyspace later",
+ this.keyspace);
}
}
} catch (Throwable e) {
@@ -211,13 +210,12 @@ public abstract class CassandraStore extends AbstractBackendStore<CassandraSessi
this.checkOpened();
CassandraSessionPool.Session session = this.sessions.session();
- for (Iterator<BackendAction> it = mutation.mutation(); it.hasNext();) {
+ for (Iterator<BackendAction> it = mutation.mutation(); it.hasNext(); ) {
this.mutate(session, it.next());
}
}
- private void mutate(CassandraSessionPool.Session session,
- BackendAction item) {
+ private void mutate(CassandraSessionPool.Session session, BackendAction item) {
CassandraBackendEntry entry = castBackendEntry(item.entry());
// Check if the entry has no change
@@ -296,7 +294,7 @@ public abstract class CassandraStore extends AbstractBackendStore<CassandraSessi
break;
default:
throw new AssertionError(String.format(
- "Unsupported mutate action: %s", item.action()));
+ "Unsupported mutate action: %s", item.action()));
}
}
@@ -305,7 +303,7 @@ public abstract class CassandraStore extends AbstractBackendStore<CassandraSessi
this.checkOpened();
HugeType type = CassandraTable.tableType(query);
String tableName = query.olap() ? this.olapTableName(type) :
- type.string();
+ type.string();
CassandraTable table = this.table(tableName);
Iterator<BackendEntry> entries = table.query(this.session(null), query);
// Merge olap results as needed
@@ -443,11 +441,11 @@ public abstract class CassandraStore extends AbstractBackendStore<CassandraSessi
} catch (DriverException e) {
session.txState(TxState.COMMITT_FAIL);
LOG.error("Failed to commit statements due to:", e);
- assert session.statements().size() > 0;
+ assert !session.statements().isEmpty();
throw new BackendException(
- "Failed to commit %s statements: '%s'...", e,
- session.statements().size(),
- session.statements().iterator().next());
+ "Failed to commit %s statements: '%s'...", e,
+ session.statements().size(),
+ session.statements().iterator().next());
}
}
@@ -512,7 +510,7 @@ public abstract class CassandraStore extends AbstractBackendStore<CassandraSessi
switch (strategy) {
case "SimpleStrategy":
List<String> replicas =
- conf.get(CassandraOptions.CASSANDRA_REPLICATION);
+ conf.get(CassandraOptions.CASSANDRA_REPLICATION);
E.checkArgument(replicas.size() == 1,
"Individual factor value should be provided " +
"with SimpleStrategy for Cassandra");
@@ -522,7 +520,7 @@ public abstract class CassandraStore extends AbstractBackendStore<CassandraSessi
case "NetworkTopologyStrategy":
// The replicas format is like 'dc1:2,dc2:1'
Map<String, String> replicaMap =
- conf.getMap(CassandraOptions.CASSANDRA_REPLICATION);
+ conf.getMap(CassandraOptions.CASSANDRA_REPLICATION);
for (Map.Entry<String, String> e : replicaMap.entrySet()) {
E.checkArgument(!e.getKey().isEmpty(),
"The datacenter can't be empty");
@@ -531,9 +529,9 @@ public abstract class CassandraStore extends AbstractBackendStore<CassandraSessi
break;
default:
throw new AssertionError(String.format(
- "Illegal replication strategy '%s', valid strategy " +
- "is 'SimpleStrategy' or 'NetworkTopologyStrategy'",
- strategy));
+ "Illegal replication strategy '%s', valid strategy " +
+ "is 'SimpleStrategy' or 'NetworkTopologyStrategy'",
+ strategy));
}
return replication;
}
@@ -543,8 +541,8 @@ public abstract class CassandraStore extends AbstractBackendStore<CassandraSessi
return Integer.valueOf(factor);
} catch (NumberFormatException e) {
throw new BackendException(
- "Expect int factor value for SimpleStrategy, " +
- "but got '%s'", factor);
+ "Expect int factor value for SimpleStrategy, " +
+ "but got '%s'", factor);
}
}
@@ -720,19 +718,19 @@ public abstract class CassandraStore extends AbstractBackendStore<CassandraSessi
@Override
public Id nextId(HugeType type) {
throw new UnsupportedOperationException(
- "CassandraGraphStore.nextId()");
+ "CassandraGraphStore.nextId()");
}
@Override
public void increaseCounter(HugeType type, long num) {
throw new UnsupportedOperationException(
- "CassandraGraphStore.increaseCounter()");
+ "CassandraGraphStore.increaseCounter()");
}
@Override
public long getCounter(HugeType type) {
throw new UnsupportedOperationException(
- "CassandraGraphStore.getCounter()");
+ "CassandraGraphStore.getCounter()");
}
@Override
diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTable.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTable.java
index 633c98bc8..15ad1a7bd 100644
--- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTable.java
+++ b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTable.java
@@ -27,9 +27,6 @@ import java.util.Set;
import java.util.function.BiFunction;
import java.util.function.Function;
-import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
-import org.slf4j.Logger;
-
import org.apache.hugegraph.backend.BackendException;
import org.apache.hugegraph.backend.id.Id;
import org.apache.hugegraph.backend.page.PageState;
@@ -51,6 +48,9 @@ import org.apache.hugegraph.type.define.HugeKeys;
import org.apache.hugegraph.util.CopyUtil;
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.Log;
+import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
+import org.slf4j.Logger;
+
import com.datastax.driver.core.ColumnDefinitions.Definition;
import com.datastax.driver.core.DataType;
import com.datastax.driver.core.PagingState;
@@ -74,7 +74,7 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
public abstract class CassandraTable
- extends BackendTable<CassandraSessionPool.Session, CassandraBackendEntry.Row> {
+ extends BackendTable<CassandraSessionPool.Session, CassandraBackendEntry.Row> {
private static final Logger LOG = Log.logger(CassandraTable.class);
private static final int MAX_ELEMENTS_IN_CLAUSE = 65535;
@@ -90,8 +90,8 @@ public abstract class CassandraTable
"The args count of %s must be 1", meta);
long splitSize = (long) args[0];
CassandraShard splitter = new CassandraShard(session,
- session.keyspace(),
- this.table());
+ session.keyspace(),
+ this.table());
return splitter.getSplits(0, splitSize);
});
}
@@ -118,12 +118,12 @@ public abstract class CassandraTable
statement.setReadTimeoutMillis(timeout * 1000);
return session.query(statement);
}, (q, rs) -> {
- Row row = rs.one();
- if (row == null) {
- return IteratorUtils.of(aggregate.defaultValue());
- }
- return IteratorUtils.of(row.getLong(0));
- });
+ Row row = rs.one();
+ if (row == null) {
+ return IteratorUtils.of(aggregate.defaultValue());
+ }
+ return IteratorUtils.of(row.getLong(0));
+ });
return aggregate.reduce(results);
}
@@ -135,8 +135,7 @@ public abstract class CassandraTable
protected <R> Iterator<R> query(Query query,
Function<Statement, ResultSet> fetcher,
- BiFunction<Query, ResultSet, Iterator<R>>
- parser) {
+ BiFunction<Query, ResultSet, Iterator<R>> parser) {
ExtendableIterator<R> rs = new ExtendableIterator<>();
if (query.limit() == 0L && !query.noLimit()) {
@@ -279,8 +278,8 @@ public abstract class CassandraTable
List<Object> idParts = this.idColumnValue(id);
if (nameParts.size() != idParts.size()) {
throw new NotFoundException(
- "Unsupported ID format: '%s' (should contain %s)",
- id, nameParts);
+ "Unsupported ID format: '%s' (should contain %s)",
+ id, nameParts);
}
ids.add(idParts);
}
@@ -373,7 +372,7 @@ public abstract class CassandraTable
return QueryBuilder.containsKey(key, value);
case SCAN:
String[] col = pkColumnName().stream()
- .map(pk -> formatKey(pk))
+ .map(CassandraTable::formatKey)
.toArray(String[]::new);
Shard shard = (Shard) value;
Object start = QueryBuilder.raw(shard.start());
@@ -510,7 +509,7 @@ public abstract class CassandraTable
}
protected Insert buildInsert(CassandraBackendEntry.Row entry) {
- assert entry.columns().size() > 0;
+ assert !entry.columns().isEmpty();
Insert insert = QueryBuilder.insertInto(this.table());
for (Map.Entry<HugeKeys, Object> c : entry.columns().entrySet()) {
diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTables.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTables.java
index 1b9b8509c..5f7490cb1 100644
--- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTables.java
+++ b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTables.java
@@ -476,7 +476,7 @@ public class CassandraTables {
rs = session.execute(select);
} catch (DriverException e) {
throw new BackendException("Failed to query edges " +
- "with label '%s' for deleting", e, label);
+ "with label '%s' for deleting", e, label);
}
// Delete edges
@@ -548,7 +548,7 @@ public class CassandraTables {
E.checkState(ownerVertex != null, "Invalid backend entry");
Id vertexId = IdGenerator.of(ownerVertex);
CassandraBackendEntry vertex = new CassandraBackendEntry(
- HugeType.VERTEX, vertexId);
+ HugeType.VERTEX, vertexId);
vertex.column(HugeKeys.ID, ownerVertex);
vertex.column(HugeKeys.PROPERTIES, ImmutableMap.of());
@@ -635,8 +635,8 @@ public class CassandraTables {
rs = session.execute(select);
} catch (DriverException e) {
throw new BackendException("Failed to query secondary " +
- "indexes with index label id '%s' for deleting",
- indexLabel, e);
+ "indexes with index label id '%s' for deleting",
+ indexLabel, e);
}
final String FIELD_VALUES = formatKey(HugeKeys.FIELD_VALUES);
diff --git a/hugegraph-server/hugegraph-dist/docker/README.md b/hugegraph-server/hugegraph-dist/docker/README.md
index 413ac7fd8..c47d66f8a 100644
--- a/hugegraph-server/hugegraph-dist/docker/README.md
+++ b/hugegraph-server/hugegraph-dist/docker/README.md
@@ -80,4 +80,4 @@ If you want to customize the pre-loaded data, please mount the the groovy script
environment:
- AUTH=true
- PASSWORD=123456
- ```
\ No newline at end of file
+ ```
diff --git a/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseMetrics.java b/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseMetrics.java
index d593e7075..9a30c7aa7 100644
--- a/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseMetrics.java
+++ b/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseMetrics.java
@@ -29,11 +29,11 @@ import org.apache.hadoop.hbase.ServerMetrics;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.Size;
import org.apache.hadoop.hbase.client.Admin;
-
import org.apache.hugegraph.backend.store.BackendMetrics;
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.InsertionOrderUtil;
import org.apache.hugegraph.util.UnitUtil;
+
import com.google.common.collect.ImmutableMap;
public class HbaseMetrics implements BackendMetrics {
@@ -55,7 +55,7 @@ public class HbaseMetrics implements BackendMetrics {
try (Admin admin = this.hbase.hbase().getAdmin()) {
ClusterMetrics clusterMetrics = admin.getClusterMetrics();
Map<ServerName, ServerMetrics> metrics =
- clusterMetrics.getLiveServerMetrics();
+ clusterMetrics.getLiveServerMetrics();
Map<String, Object> regionServers = InsertionOrderUtil.newMap();
for (Map.Entry<ServerName, ServerMetrics> e : metrics.entrySet()) {
ServerName server = e.getKey();
@@ -109,7 +109,7 @@ public class HbaseMetrics implements BackendMetrics {
}
private static Map<String, Object> formatMetrics(
- ServerMetrics serverMetrics) {
+ ServerMetrics serverMetrics) {
Map<String, Object> metrics = InsertionOrderUtil.newMap();
Size memMax = serverMetrics.getMaxHeapSize();
@@ -144,7 +144,7 @@ public class HbaseMetrics implements BackendMetrics {
}
private static Map<String, Object> formatRegions(
- Collection<RegionMetrics> regions) {
+ Collection<RegionMetrics> regions) {
Map<String, Object> metrics = InsertionOrderUtil.newMap();
for (RegionMetrics region : regions) {
metrics.put(region.getNameAsString(), formatRegion(region));
@@ -193,7 +193,7 @@ public class HbaseMetrics implements BackendMetrics {
}
private static List<String> serversAddress(
- Collection<ServerName> servers) {
+ Collection<ServerName> servers) {
return servers.stream().map(server -> {
return server.getAddress().toString();
}).collect(Collectors.toList());
diff --git a/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseOptions.java b/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseOptions.java
index a88322933..60b6ba475 100644
--- a/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseOptions.java
+++ b/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseOptions.java
@@ -18,9 +18,9 @@
package org.apache.hugegraph.backend.store.hbase;
import static org.apache.hugegraph.config.OptionChecker.disallowEmpty;
+import static org.apache.hugegraph.config.OptionChecker.nonNegativeInt;
import static org.apache.hugegraph.config.OptionChecker.positiveInt;
import static org.apache.hugegraph.config.OptionChecker.rangeInt;
-import static org.apache.hugegraph.config.OptionChecker.nonNegativeInt;
import org.apache.hugegraph.config.ConfigOption;
import org.apache.hugegraph.config.OptionHolder;
diff --git a/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseSerializer.java b/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseSerializer.java
index 9385a6130..5b528daf8 100644
--- a/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseSerializer.java
+++ b/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseSerializer.java
@@ -17,13 +17,14 @@
package org.apache.hugegraph.backend.store.hbase;
+import java.util.Arrays;
+
import org.apache.hugegraph.backend.id.Id;
import org.apache.hugegraph.backend.serializer.BinarySerializer;
import org.apache.hugegraph.config.HugeConfig;
import org.apache.hugegraph.type.HugeType;
import org.apache.hugegraph.util.Log;
import org.slf4j.Logger;
-import java.util.Arrays;
public class HbaseSerializer extends BinarySerializer {
diff --git a/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseSessions.java b/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseSessions.java
index 6570efd7d..1b9c4afe7 100644
--- a/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseSessions.java
+++ b/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseSessions.java
@@ -29,7 +29,6 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.Future;
-import org.apache.hugegraph.util.Log;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
@@ -68,8 +67,6 @@ import org.apache.hadoop.hbase.filter.PageFilter;
import org.apache.hadoop.hbase.filter.PrefixFilter;
import org.apache.hadoop.hbase.util.VersionInfo;
import org.apache.hadoop.security.UserGroupInformation;
-import org.slf4j.Logger;
-
import org.apache.hugegraph.backend.BackendException;
import org.apache.hugegraph.backend.store.BackendEntry.BackendColumn;
import org.apache.hugegraph.backend.store.BackendEntry.BackendIterator;
@@ -79,8 +76,11 @@ import org.apache.hugegraph.config.HugeConfig;
import org.apache.hugegraph.exception.NotSupportException;
import org.apache.hugegraph.util.Bytes;
import org.apache.hugegraph.util.E;
+import org.apache.hugegraph.util.Log;
import org.apache.hugegraph.util.StringEncoding;
import org.apache.hugegraph.util.VersionUtil;
+import org.slf4j.Logger;
+
import com.google.common.util.concurrent.Futures;
public class HbaseSessions extends BackendSessionPool {
@@ -218,7 +218,7 @@ public class HbaseSessions extends BackendSessionPool {
public void createTable(String table, List<byte[]> cfs) throws IOException {
TableDescriptorBuilder tdb = TableDescriptorBuilder.newBuilder(
- TableName.valueOf(this.namespace, table));
+ TableName.valueOf(this.namespace, table));
for (byte[] cf : cfs) {
tdb.setColumnFamily(ColumnFamilyDescriptorBuilder.newBuilder(cf)
.build());
@@ -237,7 +237,7 @@ public class HbaseSessions extends BackendSessionPool {
builder.setColumnFamily(ColumnFamilyDescriptorBuilder.newBuilder(cf).build());
}
byte[][] splits = new byte[numOfPartitions - 1]
- [org.apache.hadoop.hbase.util.Bytes.SIZEOF_SHORT];
+ [org.apache.hadoop.hbase.util.Bytes.SIZEOF_SHORT];
for (short split = 1; split < numOfPartitions; split++) {
splits[split - 1] = org.apache.hadoop.hbase.util.Bytes.toBytes(split);
}
@@ -421,7 +421,7 @@ public class HbaseSessions extends BackendSessionPool {
default R scan(String table, byte[] startRow, boolean inclusiveStart,
byte[] prefix) {
final Scan scan = new Scan();
- if(startRow == prefix) {
+ if (startRow == prefix) {
scan.setRowPrefixFilter(prefix);
} else {
scan.withStartRow(startRow, inclusiveStart)
@@ -465,7 +465,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;
@@ -491,7 +491,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];
@@ -560,7 +560,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);
}
}
diff --git a/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseStore.java b/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseStore.java
index 43eecf5fa..cb5ff3113 100644
--- a/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseStore.java
+++ b/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseStore.java
@@ -30,8 +30,6 @@ import java.util.stream.Collectors;
import org.apache.hadoop.hbase.NamespaceExistException;
import org.apache.hadoop.hbase.TableExistsException;
import org.apache.hadoop.hbase.TableNotFoundException;
-import org.slf4j.Logger;
-
import org.apache.hugegraph.backend.BackendException;
import org.apache.hugegraph.backend.id.Id;
import org.apache.hugegraph.backend.query.Query;
@@ -46,6 +44,7 @@ import org.apache.hugegraph.exception.ConnectionException;
import org.apache.hugegraph.type.HugeType;
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
public abstract class HbaseStore extends AbstractBackendStore<HbaseSessions.Session> {
@@ -111,7 +110,7 @@ public abstract class HbaseStore extends AbstractBackendStore<HbaseSessions.Sess
protected List<String> tableNames() {
return this.tables.values().stream().map(t -> t.table())
- .collect(Collectors.toList());
+ .collect(Collectors.toList());
}
public String namespace() {
@@ -190,7 +189,7 @@ public abstract class HbaseStore extends AbstractBackendStore<HbaseSessions.Sess
this.checkOpened();
HbaseSessions.Session session = this.sessions.session();
- for (Iterator<BackendAction> it = mutation.mutation(); it.hasNext();) {
+ for (Iterator<BackendAction> it = mutation.mutation(); it.hasNext(); ) {
this.mutate(session, it.next());
}
}
@@ -220,7 +219,7 @@ public abstract class HbaseStore extends AbstractBackendStore<HbaseSessions.Sess
break;
default:
throw new AssertionError(String.format(
- "Unsupported mutate action: %s", item.action()));
+ "Unsupported mutate action: %s", item.action()));
}
}
@@ -253,8 +252,8 @@ public abstract class HbaseStore extends AbstractBackendStore<HbaseSessions.Sess
// Ignore due to both schema & graph store would create namespace
} catch (IOException e) {
throw new BackendException(
- "Failed to create namespace '%s' for '%s' store",
- e, this.namespace, this.store);
+ "Failed to create namespace '%s' for '%s' store",
+ e, this.namespace, this.store);
}
// Create tables
@@ -262,10 +261,10 @@ public abstract class HbaseStore extends AbstractBackendStore<HbaseSessions.Sess
try {
if (table.equals("g_oe") || table.equals("g_ie")) {
this.sessions.createPreSplitTable(table, HbaseTable.cfs(),
- this.edgeLogicPartitions);
+ this.edgeLogicPartitions);
} else if (table.equals("g_v")) {
- this.sessions.createPreSplitTable(table, HbaseTable.cfs(),
- this.vertexLogicPartitions);
+ this.sessions.createPreSplitTable(table, HbaseTable.cfs(),
+ this.vertexLogicPartitions);
} else {
this.sessions.createTable(table, HbaseTable.cfs());
}
@@ -274,8 +273,8 @@ public abstract class HbaseStore extends AbstractBackendStore<HbaseSessions.Sess
continue;
} catch (IOException e) {
throw new BackendException(
- "Failed to create table '%s' for '%s' store",
- e, table, this.store);
+ "Failed to create table '%s' for '%s' store",
+ e, table, this.store);
}
}
@@ -293,8 +292,8 @@ public abstract class HbaseStore extends AbstractBackendStore<HbaseSessions.Sess
}
} catch (IOException e) {
throw new BackendException(
- "Exception when checking for the existence of '%s'",
- e, this.namespace);
+ "Exception when checking for the existence of '%s'",
+ e, this.namespace);
}
if (!clearSpace) {
@@ -307,8 +306,8 @@ public abstract class HbaseStore extends AbstractBackendStore<HbaseSessions.Sess
"when trying to drop", table, this.store);
} catch (IOException e) {
throw new BackendException(
- "Failed to drop table '%s' of '%s' store",
- e, table, this.store);
+ "Failed to drop table '%s' of '%s' store",
+ e, table, this.store);
}
}
} else {
@@ -322,8 +321,8 @@ public abstract class HbaseStore extends AbstractBackendStore<HbaseSessions.Sess
this.namespace, e);
} else {
throw new BackendException(
- "Failed to drop namespace '%s' of '%s' store",
- e, this.namespace, this.store);
+ "Failed to drop namespace '%s' of '%s' store",
+ e, this.namespace, this.store);
}
}
}
@@ -365,8 +364,8 @@ public abstract class HbaseStore extends AbstractBackendStore<HbaseSessions.Sess
return future.get(remainingTime, TimeUnit.SECONDS);
} catch (Exception e) {
throw new BackendException(
- "Error when truncating table '%s' of '%s' store: %s",
- table, this.store, e.toString());
+ "Error when truncating table '%s' of '%s' store: %s",
+ table, this.store, e.toString());
}
};
@@ -385,7 +384,7 @@ public abstract class HbaseStore extends AbstractBackendStore<HbaseSessions.Sess
} catch (Exception e) {
this.enableTables();
throw new BackendException(
- "Failed to disable table for '%s' store", e, this.store);
+ "Failed to disable table for '%s' store", e, this.store);
}
try {
@@ -399,7 +398,7 @@ public abstract class HbaseStore extends AbstractBackendStore<HbaseSessions.Sess
} catch (Exception e) {
this.enableTables();
throw new BackendException(
- "Failed to truncate table for '%s' store", e, this.store);
+ "Failed to truncate table for '%s' store", e, this.store);
}
LOG.debug("Store truncated: {}", this.store);
@@ -450,7 +449,7 @@ public abstract class HbaseStore extends AbstractBackendStore<HbaseSessions.Sess
public HbaseSchemaStore(HugeConfig config, BackendStoreProvider provider,
String namespace, String store) {
- super(provider, namespace, store,
+ super(provider, namespace, store,
config.get(HbaseOptions.HBASE_ENABLE_PARTITION).booleanValue());
this.counters = new HbaseTables.Counters();
@@ -495,10 +494,12 @@ public abstract class HbaseStore extends AbstractBackendStore<HbaseSessions.Sess
}
public static class HbaseGraphStore extends HbaseStore {
+
private boolean enablePartition;
+
public HbaseGraphStore(HugeConfig config, BackendStoreProvider provider,
String namespace, String store) {
- super(provider, namespace, store,
+ super(provider, namespace, store,
config.get(HbaseOptions.HBASE_ENABLE_PARTITION).booleanValue());
this.enablePartition = config.get(HbaseOptions.HBASE_ENABLE_PARTITION).booleanValue();
registerTableManager(HugeType.VERTEX,
@@ -539,19 +540,19 @@ public abstract class HbaseStore extends AbstractBackendStore<HbaseSessions.Sess
@Override
public Id nextId(HugeType type) {
throw new UnsupportedOperationException(
- "HbaseGraphStore.nextId()");
+ "HbaseGraphStore.nextId()");
}
@Override
public void increaseCounter(HugeType type, long num) {
throw new UnsupportedOperationException(
- "HbaseGraphStore.increaseCounter()");
+ "HbaseGraphStore.increaseCounter()");
}
@Override
public long getCounter(HugeType type) {
throw new UnsupportedOperationException(
- "HbaseGraphStore.getCounter()");
+ "HbaseGraphStore.getCounter()");
}
}
diff --git a/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseTable.java b/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseTable.java
index cb915452d..53a8d14f6 100644
--- a/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseTable.java
+++ b/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseTable.java
@@ -37,8 +37,6 @@ import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.client.RegionInfo;
import org.apache.hadoop.hbase.client.Result;
-import org.slf4j.Logger;
-
import org.apache.hugegraph.backend.BackendException;
import org.apache.hugegraph.backend.id.Id;
import org.apache.hugegraph.backend.page.PageState;
@@ -63,6 +61,8 @@ import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.InsertionOrderUtil;
import org.apache.hugegraph.util.Log;
import org.apache.hugegraph.util.StringEncoding;
+import org.slf4j.Logger;
+
import com.google.common.collect.ImmutableList;
public class HbaseTable extends BackendTable<HbaseSessions.Session, BackendEntry> {
@@ -287,7 +287,7 @@ public class HbaseTable extends BackendTable<HbaseSessions.Session, BackendEntry
protected void parseRowColumns(Result row, BackendEntry entry, Query query,
boolean enablePartition)
- throws IOException {
+ throws IOException {
CellScanner cellScanner = row.cellScanner();
while (cellScanner.advance()) {
Cell cell = cellScanner.current();
@@ -336,7 +336,7 @@ public class HbaseTable extends BackendTable<HbaseSessions.Session, BackendEntry
TableName tableName = TableName.valueOf(namespace, table);
for (ServerName serverName : admin.getRegionServers()) {
List<RegionMetrics> metrics = admin.getRegionMetrics(
- serverName, tableName);
+ serverName, tableName);
for (RegionMetrics metric : metrics) {
double size = metric.getStoreFileSize()
.get(Size.Unit.BYTE);
@@ -346,8 +346,8 @@ public class HbaseTable extends BackendTable<HbaseSessions.Session, BackendEntry
}
} catch (Throwable e) {
throw new BackendException(String.format(
- "Failed to get region sizes of %s(%s)",
- table, namespace), e);
+ "Failed to get region sizes of %s(%s)",
+ table, namespace), e);
}
return regionSizes;
}
@@ -366,8 +366,8 @@ public class HbaseTable extends BackendTable<HbaseSessions.Session, BackendEntry
}
} catch (Throwable e) {
throw new BackendException(String.format(
- "Failed to get region ranges of %s(%s)",
- table, namespace), e);
+ "Failed to get region ranges of %s(%s)",
+ table, namespace), e);
}
return regionRanges;
}
diff --git a/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseTables.java b/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseTables.java
index b6df03114..c3cda4031 100644
--- a/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseTables.java
+++ b/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseTables.java
@@ -20,16 +20,15 @@ package org.apache.hugegraph.backend.store.hbase;
import java.io.IOException;
import java.util.Arrays;
-import org.apache.hugegraph.backend.serializer.BytesBuffer;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellScanner;
import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.util.Bytes;
-
import org.apache.hugegraph.backend.query.Query;
import org.apache.hugegraph.backend.serializer.BinaryBackendEntry;
import org.apache.hugegraph.backend.serializer.BinaryEntryIterator;
+import org.apache.hugegraph.backend.serializer.BytesBuffer;
import org.apache.hugegraph.backend.store.BackendEntry;
import org.apache.hugegraph.backend.store.BackendEntry.BackendColumn;
import org.apache.hugegraph.backend.store.BackendEntryIterator;
diff --git a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlEntryIterator.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlEntryIterator.java
index 00732a965..f4857165c 100644
--- a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlEntryIterator.java
+++ b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlEntryIterator.java
@@ -45,7 +45,7 @@ public class MysqlEntryIterator extends BackendEntryIterator {
private boolean exceedLimit;
public MysqlEntryIterator(ResultSetWrapper rs, Query query,
- BiFunction<BackendEntry, BackendEntry, BackendEntry> merger) {
+ BiFunction<BackendEntry, BackendEntry, BackendEntry> merger) {
super(query);
this.results = rs;
this.merger = merger;
@@ -100,7 +100,7 @@ public class MysqlEntryIterator extends BackendEntryIterator {
byte[] position;
// There is no latest or no next page
if (this.lastest == null || !this.exceedLimit &&
- this.fetched() <= this.query.limit() && this.next == null) {
+ this.fetched() <= this.query.limit() && this.next == null) {
position = PageState.EMPTY_BYTES;
} else {
MysqlBackendEntry entry = (MysqlBackendEntry) this.lastest;
diff --git a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlMetrics.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlMetrics.java
index a4769d2c1..4d4019d9a 100644
--- a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlMetrics.java
+++ b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlMetrics.java
@@ -20,6 +20,7 @@ package org.apache.hugegraph.backend.store.mysql;
import java.util.Map;
import org.apache.hugegraph.backend.store.BackendMetrics;
+
import com.google.common.collect.ImmutableMap;
public class MysqlMetrics implements BackendMetrics {
diff --git a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlOptions.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlOptions.java
index d2449a54c..dd46fdb5d 100644
--- a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlOptions.java
+++ b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlOptions.java
@@ -108,9 +108,9 @@ public class MysqlOptions extends OptionHolder {
public static final ConfigOption<String> JDBC_STORAGE_ENGINE =
new ConfigOption<>(
- "jdbc.storage_engine",
- "The storage engine of backend store database, " +
- "like InnoDB/MyISAM/RocksDB for MySQL.",
+ "jdbc.storage_engine",
+ "The storage engine of backend store database, " +
+ "like InnoDB/MyISAM/RocksDB for MySQL.",
disallowEmpty(),
"InnoDB"
);
diff --git a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlSerializer.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlSerializer.java
index 3a47e7ada..1557902bd 100644
--- a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlSerializer.java
+++ b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlSerializer.java
@@ -22,15 +22,14 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Set;
-import org.apache.hugegraph.config.HugeConfig;
import org.apache.commons.lang.NotImplementedException;
-
import org.apache.hugegraph.backend.BackendException;
import org.apache.hugegraph.backend.id.Id;
import org.apache.hugegraph.backend.id.IdGenerator;
import org.apache.hugegraph.backend.serializer.TableBackendEntry;
import org.apache.hugegraph.backend.serializer.TableSerializer;
import org.apache.hugegraph.backend.store.BackendEntry;
+import org.apache.hugegraph.config.HugeConfig;
import org.apache.hugegraph.schema.SchemaElement;
import org.apache.hugegraph.structure.HugeElement;
import org.apache.hugegraph.structure.HugeProperty;
diff --git a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlSessions.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlSessions.java
index 8ea17e834..9124c3a4b 100644
--- a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlSessions.java
+++ b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlSessions.java
@@ -30,15 +30,14 @@ import java.util.Map;
import java.util.stream.IntStream;
import org.apache.http.client.utils.URIBuilder;
-import org.apache.logging.log4j.util.Strings;
-import org.slf4j.Logger;
-
import org.apache.hugegraph.backend.BackendException;
import org.apache.hugegraph.backend.store.BackendSession.AbstractBackendSession;
import org.apache.hugegraph.backend.store.BackendSessionPool;
import org.apache.hugegraph.config.HugeConfig;
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.Log;
+import org.apache.logging.log4j.util.Strings;
+import org.slf4j.Logger;
public class MysqlSessions extends BackendSessionPool {
@@ -74,6 +73,7 @@ public class MysqlSessions extends BackendSessionPool {
/**
* Try connect with specified database, will not reconnect if failed
+ *
* @throws SQLException if a database access error occurs
*/
@Override
@@ -220,7 +220,7 @@ public class MysqlSessions extends BackendSessionPool {
String url = this.buildUrlPrefix(withDB);
boolean forcedAutoReconnect = this.config.get(
- MysqlOptions.JDBC_FORCED_AUTO_RECONNECT);
+ MysqlOptions.JDBC_FORCED_AUTO_RECONNECT);
int maxTimes = this.config.get(MysqlOptions.JDBC_RECONNECT_MAX_TIMES);
int interval = this.config.get(MysqlOptions.JDBC_RECONNECT_INTERVAL);
String sslMode = this.config.get(MysqlOptions.JDBC_SSL_MODE);
@@ -253,7 +253,7 @@ public class MysqlSessions extends BackendSessionPool {
builder.setParameter("useSSL", sslMode);
- return JDBC_PREFIX + builder.toString();
+ return JDBC_PREFIX + builder;
}
protected String buildUrlPrefix(boolean withDB) {
@@ -270,7 +270,7 @@ public class MysqlSessions extends BackendSessionPool {
}
protected URIBuilder newConnectionURIBuilder(String url)
- throws URISyntaxException {
+ throws URISyntaxException {
return new URIBuilder(url);
}
@@ -283,8 +283,10 @@ public class MysqlSessions extends BackendSessionPool {
// Register JDBC driver
Class.forName(driverName);
} catch (ClassNotFoundException e) {
- throw new BackendException("Failed to register JDBC driver. Class '%s' not found. Please check if the MySQL driver package is available.",
- driverName);
+ throw new BackendException(
+ "Failed to register JDBC driver. Class '%s' not found. Please check if the " +
+ "MySQL driver package is available.",
+ driverName);
}
return DriverManager.getConnection(url, username, password);
}
@@ -532,7 +534,7 @@ public class MysqlSessions extends BackendSessionPool {
}
public PreparedStatement prepareStatement(String sqlTemplate)
- throws SQLException {
+ throws SQLException {
PreparedStatement statement = this.statements.get(sqlTemplate);
if (statement == null) {
statement = this.conn.prepareStatement(sqlTemplate);
diff --git a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlStore.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlStore.java
index 279a285f0..d898c2b76 100644
--- a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlStore.java
+++ b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlStore.java
@@ -25,8 +25,6 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-import org.slf4j.Logger;
-
import org.apache.hugegraph.backend.BackendException;
import org.apache.hugegraph.backend.id.Id;
import org.apache.hugegraph.backend.query.Query;
@@ -42,6 +40,7 @@ import org.apache.hugegraph.exception.ConnectionException;
import org.apache.hugegraph.type.HugeType;
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
public abstract class MysqlStore extends AbstractBackendStore<Session> {
@@ -236,7 +235,7 @@ public abstract class MysqlStore extends AbstractBackendStore<Session> {
this.checkOpened();
Session session = this.sessions.session();
- for (Iterator<BackendAction> it = mutation.mutation(); it.hasNext();) {
+ for (Iterator<BackendAction> it = mutation.mutation(); it.hasNext(); ) {
this.mutate(session, it.next());
}
}
@@ -266,7 +265,7 @@ public abstract class MysqlStore extends AbstractBackendStore<Session> {
break;
default:
throw new AssertionError(String.format(
- "Unsupported mutate action: %s", item.action()));
+ "Unsupported mutate action: %s", item.action()));
}
}
@@ -370,7 +369,7 @@ public abstract class MysqlStore extends AbstractBackendStore<Session> {
protected static MysqlBackendEntry castBackendEntry(BackendEntry entry) {
if (!(entry instanceof MysqlBackendEntry)) {
throw new BackendException(
- "MySQL store only supports MysqlBackendEntry");
+ "MySQL store only supports MysqlBackendEntry");
}
return (MysqlBackendEntry) entry;
}
@@ -467,13 +466,13 @@ public abstract class MysqlStore extends AbstractBackendStore<Session> {
@Override
public void increaseCounter(HugeType type, long num) {
throw new UnsupportedOperationException(
- "MysqlGraphStore.increaseCounter()");
+ "MysqlGraphStore.increaseCounter()");
}
@Override
public long getCounter(HugeType type) {
throw new UnsupportedOperationException(
- "MysqlGraphStore.getCounter()");
+ "MysqlGraphStore.getCounter()");
}
}
diff --git a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlTable.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlTable.java
index 2bc035e0b..c00003361 100644
--- a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlTable.java
+++ b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlTable.java
@@ -27,10 +27,6 @@ import java.util.List;
import java.util.Map;
import java.util.function.BiFunction;
-import org.apache.logging.log4j.util.Strings;
-import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
-import org.slf4j.Logger;
-
import org.apache.hugegraph.backend.BackendException;
import org.apache.hugegraph.backend.id.Id;
import org.apache.hugegraph.backend.page.PageState;
@@ -50,10 +46,14 @@ import org.apache.hugegraph.type.HugeType;
import org.apache.hugegraph.type.define.HugeKeys;
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.Log;
+import org.apache.logging.log4j.util.Strings;
+import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
+import org.slf4j.Logger;
+
import com.google.common.collect.ImmutableList;
public abstract class MysqlTable
- extends BackendTable<MysqlSessions.Session, MysqlBackendEntry.Row> {
+ extends BackendTable<MysqlSessions.Session, MysqlBackendEntry.Row> {
private static final Logger LOG = Log.logger(MysqlTable.class);
@@ -111,7 +111,7 @@ public abstract class MysqlTable
sql.append(this.table()).append(" (");
// Add columns
for (Map.Entry<HugeKeys, String> entry :
- tableDefine.columns().entrySet()) {
+ tableDefine.columns().entrySet()) {
sql.append(formatKey(entry.getKey()));
sql.append(" ");
sql.append(entry.getValue());
@@ -458,7 +458,7 @@ public abstract class MysqlTable
protected <R> Iterator<R> query(MysqlSessions.Session session, Query query,
BiFunction<Query, ResultSetWrapper,
- Iterator<R>> parser) {
+ Iterator<R>> parser) {
ExtendableIterator<R> rs = new ExtendableIterator<>();
if (query.limit() == 0L && !query.noLimit()) {
@@ -494,7 +494,7 @@ public abstract class MysqlTable
// Set aggregate
Aggregate aggregate = query.aggregate();
if (aggregate != null) {
- select.append(aggregate.toString());
+ select.append(aggregate);
} else {
select.append("*");
}
@@ -610,8 +610,8 @@ public abstract class MysqlTable
List<Object> idParts = this.idColumnValue(id);
if (nameParts.size() != idParts.size()) {
throw new NotFoundException(
- "Unsupported ID format: '%s' (should contain %s)",
- id, nameParts);
+ "Unsupported ID format: '%s' (should contain %s)",
+ id, nameParts);
}
ids.add(idParts);
}
@@ -714,7 +714,7 @@ public abstract class MysqlTable
// Set order-by
select.append(" ORDER BY ");
for (Map.Entry<HugeKeys, Query.Order> order :
- query.orders().entrySet()) {
+ query.orders().entrySet()) {
String key = formatKey(order.getKey());
Query.Order value = order.getValue();
select.append(key).append(" ");
@@ -736,7 +736,7 @@ public abstract class MysqlTable
if (!page.isEmpty()) {
byte[] position = PageState.fromString(page).position();
Map<HugeKeys, Object> columns = MysqlEntryIterator.PagePosition.fromBytes(position)
- .columns();
+ .columns();
List<HugeKeys> idColumnNames = this.idColumnName();
List<Object> values = new ArrayList<>(idColumnNames.size());
diff --git a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlTables.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlTables.java
index 2de6e95d5..dccbfedd4 100644
--- a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlTables.java
+++ b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlTables.java
@@ -38,6 +38,7 @@ import org.apache.hugegraph.type.HugeType;
import org.apache.hugegraph.type.define.Directions;
import org.apache.hugegraph.type.define.HugeKeys;
import org.apache.hugegraph.util.E;
+
import com.google.common.collect.ImmutableMap;
public class MysqlTables {
@@ -124,7 +125,7 @@ public class MysqlTables {
return rs.getString(formatKey(HugeKeys.VALUE));
} catch (SQLException e) {
throw new BackendException(
- "Failed to get stored version with '%s'", e, select);
+ "Failed to get stored version with '%s'", e, select);
}
}
}
@@ -161,17 +162,17 @@ public class MysqlTables {
}
} catch (SQLException e) {
throw new BackendException(
- "Failed to get id from counters with type '%s'",
- e, type);
+ "Failed to get id from counters with type '%s'",
+ e, type);
}
}
public void increaseCounter(MysqlSessions.Session session,
HugeType type, long increment) {
String update = String.format(
- "INSERT INTO %s VALUES ('%s', %s) " +
- "ON DUPLICATE KEY UPDATE ID = ID + %s;",
- this.table(), type.name(), increment, increment);
+ "INSERT INTO %s VALUES ('%s', %s) " +
+ "ON DUPLICATE KEY UPDATE ID = ID + %s;",
+ this.table(), type.name(), increment, increment);
try {
session.execute(update);
} catch (SQLException e) {
@@ -325,8 +326,8 @@ public class MysqlTables {
this.direction = direction;
this.delByLabelTemplate = String.format(
- "DELETE FROM %s WHERE %s = ?;",
- this.table(), formatKey(HugeKeys.LABEL));
+ "DELETE FROM %s WHERE %s = ?;",
+ this.table(), formatKey(HugeKeys.LABEL));
this.define = new TableDefine(typesMapping);
this.define.column(HugeKeys.OWNER_VERTEX, SMALL_TEXT);
@@ -350,7 +351,7 @@ public class MysqlTables {
String[] idParts = EdgeId.split(id);
if (idParts.length == 1) {
// Delete edge by label
- return Arrays.asList((Object[]) idParts);
+ return Arrays.asList(idParts);
}
id = IdUtil.readString(id.asString());
edgeId = EdgeId.parse(id.asString());
@@ -412,7 +413,7 @@ public class MysqlTables {
long maxSize = BackendEntryIterator.INLINE_BATCH_SIZE;
if (current != null && current.subRows().size() < maxSize) {
Id nextVertexId = IdGenerator.of(
- next.<String>column(HugeKeys.OWNER_VERTEX));
+ next.<String>column(HugeKeys.OWNER_VERTEX));
if (current.id().equals(nextVertexId)) {
current.subRow(next.row());
return current;
diff --git a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/WhereBuilder.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/WhereBuilder.java
index 4a559a67b..5eb0fb44a 100644
--- a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/WhereBuilder.java
+++ b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/WhereBuilder.java
@@ -81,6 +81,7 @@ public class WhereBuilder {
/**
* Concat as: cond1 and cond2...
+ *
* @return WhereBuilder
*/
public WhereBuilder and() {
@@ -90,7 +91,8 @@ public class WhereBuilder {
/**
* Concat as: key1 op ? and key2 op ?...
- * @param keys the keys to be concatted with value
+ *
+ * @param keys the keys to be concatted with value
* @param operator the operator to link every key and value pair
* @return WhereBuilder
*/
@@ -108,8 +110,9 @@ public class WhereBuilder {
/**
* Concat as: key1 = value1 and key2 = value2...
- * @param keys the keys to be concatted with values according to the
- * same index
+ *
+ * @param keys the keys to be concatted with values according to the
+ * same index
* @param values the values to be concatted with every keys according to
* the same index
* @return WhereBuilder
@@ -120,11 +123,12 @@ public class WhereBuilder {
/**
* Concat as: key1 op value1 and key2 op value2...
- * @param keys the keys to be concatted with values according to the
- * same index
+ *
+ * @param keys the keys to be concatted with values according to the
+ * same index
* @param operator the operator to link every key and value pair
- * @param values the values to be concatted with every keys according to
- * the same index
+ * @param values the values to be concatted with every keys according to
+ * the same index
* @return WhereBuilder
*/
public WhereBuilder and(List<String> keys,
@@ -148,12 +152,13 @@ public class WhereBuilder {
/**
* Concat as: key1 op1 value1 and key2 op2 value2...
- * @param keys the keys to be concatted with values according to the
- * same index
+ *
+ * @param keys the keys to be concatted with values according to the
+ * same index
* @param operators the operators to link every key and value pair
* according to the same index
- * @param values the values to be concatted with every keys according to
- * the same index
+ * @param values the values to be concatted with every keys according to
+ * the same index
* @return WhereBuilder
*/
public WhereBuilder and(List<String> keys,
@@ -181,6 +186,7 @@ public class WhereBuilder {
/**
* Concat as: clause1 and clause2...
+ *
* @param clauses the clauses to be concatted with 'AND' operator
* @return WhereBuilder
*/
@@ -201,7 +207,8 @@ public class WhereBuilder {
/**
* Concat as: key in (value1, value2...)
- * @param key the key to be concatted with 'IN' operator
+ *
+ * @param key the key to be concatted with 'IN' operator
* @param values the values to be concated with ',' and wrapped by '()'
* @return WhereBuilder
*/
@@ -219,7 +226,8 @@ public class WhereBuilder {
/**
* Concat as: (key1, key2...keyn) {@code >=} (val1, val2...valn)
- * @param keys the keys to be concatted with {@code >=} operator
+ *
+ * @param keys the keys to be concatted with {@code >=} operator
* @param values the values to be concatted with {@code >=} operator
* @return WhereBuilder
*/
diff --git a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloFile.java b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloFile.java
index e75a4074f..d9aed31c0 100644
--- a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloFile.java
+++ b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloFile.java
@@ -27,10 +27,10 @@ import java.util.List;
import java.util.Set;
import org.apache.commons.io.FileUtils;
-
import org.apache.hugegraph.backend.BackendException;
import org.apache.hugegraph.config.HugeConfig;
import org.apache.hugegraph.util.E;
+
import com.google.common.base.Charsets;
import com.google.common.collect.ImmutableList;
diff --git a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloSessions.java b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloSessions.java
index e13fbb919..735645eab 100644
--- a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloSessions.java
+++ b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloSessions.java
@@ -34,14 +34,14 @@ import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
-import org.apache.hugegraph.backend.store.mysql.ResultSetWrapper;
-import org.slf4j.Logger;
-
import org.apache.hugegraph.backend.BackendException;
import org.apache.hugegraph.backend.store.mysql.MysqlSessions;
+import org.apache.hugegraph.backend.store.mysql.ResultSetWrapper;
import org.apache.hugegraph.config.HugeConfig;
import org.apache.hugegraph.date.SafeDateFormat;
import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
+
import com.google.common.collect.LinkedListMultimap;
import com.google.common.collect.Multimap;
diff --git a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloStore.java b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloStore.java
index 20e95639d..344800868 100644
--- a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloStore.java
+++ b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloStore.java
@@ -20,13 +20,12 @@ package org.apache.hugegraph.backend.store.palo;
import java.util.List;
import java.util.stream.Collectors;
-import org.slf4j.Logger;
-
import org.apache.hugegraph.backend.store.BackendStoreProvider;
import org.apache.hugegraph.backend.store.BackendTable;
import org.apache.hugegraph.backend.store.mysql.MysqlStore;
import org.apache.hugegraph.config.HugeConfig;
import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
public abstract class PaloStore extends MysqlStore {
diff --git a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloStoreProvider.java b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloStoreProvider.java
index 76451100b..bde8d264e 100644
--- a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloStoreProvider.java
+++ b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloStoreProvider.java
@@ -163,13 +163,13 @@ public class PaloStoreProvider extends MysqlStoreProvider {
@Override
public void increaseCounter(HugeType type, long num) {
throw new UnsupportedOperationException(
- "PaloGraphStore.increaseCounter()");
+ "PaloGraphStore.increaseCounter()");
}
@Override
public long getCounter(HugeType type) {
throw new UnsupportedOperationException(
- "PaloGraphStore.getCounter()");
+ "PaloGraphStore.getCounter()");
}
}
}
diff --git a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloTable.java b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloTable.java
index 076865a3c..f40eef214 100644
--- a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloTable.java
+++ b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloTable.java
@@ -24,8 +24,6 @@ import java.util.Map;
import java.util.Set;
import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-
import org.apache.hugegraph.backend.BackendException;
import org.apache.hugegraph.backend.store.TableDefine;
import org.apache.hugegraph.backend.store.mysql.MysqlBackendEntry;
@@ -33,6 +31,7 @@ import org.apache.hugegraph.backend.store.mysql.MysqlSessions;
import org.apache.hugegraph.backend.store.mysql.MysqlTable;
import org.apache.hugegraph.type.define.HugeKeys;
import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
public abstract class PaloTable extends MysqlTable {
@@ -51,7 +50,7 @@ public abstract class PaloTable extends MysqlTable {
// Add columns
int i = 0;
for (Map.Entry<HugeKeys, String> entry :
- tableDefine.columns().entrySet()) {
+ tableDefine.columns().entrySet()) {
sql.append(formatKey(entry.getKey()));
sql.append(" ");
sql.append(entry.getValue());
diff --git a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloTables.java b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloTables.java
index e82436c10..51c3dcea9 100644
--- a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloTables.java
+++ b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloTables.java
@@ -188,9 +188,9 @@ public class PaloTables {
this.direction = direction;
this.delByLabelTemplate = String.format(
- "DELETE FROM %s PARTITION %s WHERE %s = ?;",
- this.table(), this.table(),
- formatKey(HugeKeys.LABEL));
+ "DELETE FROM %s PARTITION %s WHERE %s = ?;",
+ this.table(), this.table(),
+ formatKey(HugeKeys.LABEL));
this.define = new TableDefine();
this.define.column(HugeKeys.OWNER_VERTEX, VARCHAR, NOT_NULL);
@@ -214,7 +214,7 @@ public class PaloTables {
String[] idParts = EdgeId.split(id);
if (idParts.length == 1) {
// Delete edge by label
- return Arrays.asList((Object[]) idParts);
+ return Arrays.asList(idParts);
}
id = IdUtil.readString(id.asString());
edgeId = EdgeId.parse(id.asString());
@@ -280,7 +280,7 @@ public class PaloTables {
long maxSize = BackendEntryIterator.INLINE_BATCH_SIZE;
if (current != null && current.subRows().size() < maxSize) {
Id nextVertexId = IdGenerator.of(
- next.<String>column(HugeKeys.OWNER_VERTEX));
+ next.<String>column(HugeKeys.OWNER_VERTEX));
if (current.id().equals(nextVertexId)) {
current.subRow(next.row());
return current;
diff --git a/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlSerializer.java b/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlSerializer.java
index bdf3959a4..c0bd23a7e 100644
--- a/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlSerializer.java
+++ b/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlSerializer.java
@@ -17,15 +17,14 @@
package org.apache.hugegraph.backend.store.postgresql;
-import org.apache.hugegraph.config.HugeConfig;
-import org.apache.logging.log4j.util.Strings;
-
import org.apache.hugegraph.backend.id.IdUtil;
import org.apache.hugegraph.backend.serializer.TableBackendEntry;
import org.apache.hugegraph.backend.store.BackendEntry;
import org.apache.hugegraph.backend.store.mysql.MysqlSerializer;
+import org.apache.hugegraph.config.HugeConfig;
import org.apache.hugegraph.structure.HugeIndex;
import org.apache.hugegraph.type.define.HugeKeys;
+import org.apache.logging.log4j.util.Strings;
public class PostgresqlSerializer extends MysqlSerializer {
diff --git a/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlSessions.java b/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlSessions.java
index 0d1beff61..cccbb6945 100644
--- a/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlSessions.java
+++ b/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlSessions.java
@@ -23,15 +23,14 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import org.apache.http.client.utils.URIBuilder;
-import org.postgresql.core.Utils;
-import org.postgresql.util.PSQLException;
-import org.slf4j.Logger;
-
import org.apache.hugegraph.backend.BackendException;
import org.apache.hugegraph.backend.store.mysql.MysqlSessions;
import org.apache.hugegraph.backend.store.mysql.MysqlUtil;
import org.apache.hugegraph.config.HugeConfig;
import org.apache.hugegraph.util.Log;
+import org.postgresql.core.Utils;
+import org.postgresql.util.PSQLException;
+import org.slf4j.Logger;
public class PostgresqlSessions extends MysqlSessions {
@@ -40,7 +39,8 @@ public class PostgresqlSessions extends MysqlSessions {
private static final String COCKROACH_DB_CREATE =
"CREATE DATABASE %s ENCODING='UTF-8'";
private static final String POSTGRESQL_DB_CREATE = COCKROACH_DB_CREATE +
- " TEMPLATE=template0 LC_COLLATE='C' LC_CTYPE='C';";
+ " TEMPLATE=template0 LC_COLLATE='C' " +
+ "LC_CTYPE='C';";
public PostgresqlSessions(HugeConfig config, String database, String store) {
super(config, database, store);
@@ -49,8 +49,8 @@ public class PostgresqlSessions extends MysqlSessions {
@Override
public boolean existsDatabase() {
String statement = String.format(
- "SELECT datname FROM pg_catalog.pg_database " +
- "WHERE datname = '%s';", this.escapedDatabase());
+ "SELECT datname FROM pg_catalog.pg_database " +
+ "WHERE datname = '%s';", this.escapedDatabase());
try (Connection conn = this.openWithoutDB(0)) {
ResultSet result = conn.createStatement().executeQuery(statement);
return result.next();
@@ -93,25 +93,25 @@ public class PostgresqlSessions extends MysqlSessions {
@Override
protected String buildDropDatabase(String database) {
return String.format(
- "REVOKE CONNECT ON DATABASE %s FROM public;" +
- "SELECT pg_terminate_backend(pg_stat_activity.pid) " +
- " FROM pg_stat_activity " +
- " WHERE pg_stat_activity.datname = %s;" +
- "DROP DATABASE IF EXISTS %s;",
- database, escapeAndWrapString(database), database);
+ "REVOKE CONNECT ON DATABASE %s FROM public;" +
+ "SELECT pg_terminate_backend(pg_stat_activity.pid) " +
+ " FROM pg_stat_activity " +
+ " WHERE pg_stat_activity.datname = %s;" +
+ "DROP DATABASE IF EXISTS %s;",
+ database, escapeAndWrapString(database), database);
}
@Override
protected String buildExistsTable(String table) {
return String.format(
- "SELECT * FROM information_schema.tables " +
- "WHERE table_schema = 'public' AND table_name = '%s' LIMIT 1;",
- MysqlUtil.escapeString(table));
+ "SELECT * FROM information_schema.tables " +
+ "WHERE table_schema = 'public' AND table_name = '%s' LIMIT 1;",
+ MysqlUtil.escapeString(table));
}
@Override
protected URIBuilder newConnectionURIBuilder(String url)
- throws URISyntaxException {
+ throws URISyntaxException {
// Suppress error log when database does not exist
return new URIBuilder(url).addParameter("loggerLevel", "OFF");
}
diff --git a/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlStoreProvider.java b/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlStoreProvider.java
index a6124d817..65ed8e0fa 100644
--- a/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlStoreProvider.java
+++ b/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlStoreProvider.java
@@ -21,8 +21,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-import org.slf4j.Logger;
-
import org.apache.hugegraph.backend.id.Id;
import org.apache.hugegraph.backend.store.BackendStore;
import org.apache.hugegraph.backend.store.BackendStoreProvider;
@@ -33,6 +31,7 @@ import org.apache.hugegraph.config.HugeConfig;
import org.apache.hugegraph.type.HugeType;
import org.apache.hugegraph.type.define.Directions;
import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
public class PostgresqlStoreProvider extends MysqlStoreProvider {
@@ -167,19 +166,19 @@ public class PostgresqlStoreProvider extends MysqlStoreProvider {
@Override
public Id nextId(HugeType type) {
throw new UnsupportedOperationException(
- "PostgresqlGraphStore.nextId()");
+ "PostgresqlGraphStore.nextId()");
}
@Override
public void increaseCounter(HugeType type, long increment) {
throw new UnsupportedOperationException(
- "PostgresqlGraphStore.increaseCounter()");
+ "PostgresqlGraphStore.increaseCounter()");
}
@Override
public long getCounter(HugeType type) {
throw new UnsupportedOperationException(
- "PostgresqlGraphStore.getCounter()");
+ "PostgresqlGraphStore.getCounter()");
}
}
diff --git a/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlTable.java b/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlTable.java
index 40ffb22c6..555615fe7 100644
--- a/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlTable.java
+++ b/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlTable.java
@@ -20,14 +20,13 @@ package org.apache.hugegraph.backend.store.postgresql;
import java.util.ArrayList;
import java.util.List;
-import org.apache.logging.log4j.util.Strings;
-
import org.apache.hugegraph.backend.serializer.TableBackendEntry.Row;
import org.apache.hugegraph.backend.store.mysql.MysqlBackendEntry;
import org.apache.hugegraph.backend.store.mysql.MysqlSessions.Session;
import org.apache.hugegraph.backend.store.mysql.MysqlTable;
import org.apache.hugegraph.backend.store.mysql.WhereBuilder;
import org.apache.hugegraph.type.define.HugeKeys;
+import org.apache.logging.log4j.util.Strings;
public abstract class PostgresqlTable extends MysqlTable {
@@ -162,7 +161,8 @@ public abstract class PostgresqlTable extends MysqlTable {
@Override
protected String escapeAndWrapString(String value) {
if (value.equals("\u0000")) {
- return "\'\'";
+ /* PR-2439 return string of '' */
+ return "''";
}
return PostgresqlSessions.escapeAndWrapString(value);
}
diff --git a/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlTables.java b/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlTables.java
index 0cf6e604e..d57ad3c2d 100644
--- a/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlTables.java
+++ b/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlTables.java
@@ -48,15 +48,15 @@ public class PostgresqlTables {
private static final Map<String, String> TYPES_MAPPING =
ImmutableMap.<String, String>builder()
- .put(BOOLEAN, "BOOL")
- .put(TINYINT, "INT")
- .put(INT, "INT")
- .put(NUMERIC, "DECIMAL")
- .put(SMALL_TEXT, "VARCHAR(255)")
- .put(MID_TEXT, "VARCHAR(1024)")
- .put(LARGE_TEXT, "VARCHAR(65533)")
- .put(HUGE_TEXT, "TEXT")
- .build();
+ .put(BOOLEAN, "BOOL")
+ .put(TINYINT, "INT")
+ .put(INT, "INT")
+ .put(NUMERIC, "DECIMAL")
+ .put(SMALL_TEXT, "VARCHAR(255)")
+ .put(MID_TEXT, "VARCHAR(1024)")
+ .put(LARGE_TEXT, "VARCHAR(65533)")
+ .put(HUGE_TEXT, "TEXT")
+ .build();
public static class PostgresqlTableTemplate extends PostgresqlTable {
@@ -112,17 +112,17 @@ public class PostgresqlTables {
public void increaseCounter(Session session, HugeType type,
long increment) {
String update = String.format(
- "INSERT INTO %s (%s, %s) VALUES ('%s', %s) " +
- "ON CONFLICT (%s) DO UPDATE SET ID = %s.ID + %s;",
- this.table(), formatKey(HugeKeys.SCHEMA_TYPE),
- formatKey(HugeKeys.ID), type.name(), increment,
- formatKey(HugeKeys.SCHEMA_TYPE),
- this.table(), increment);
+ "INSERT INTO %s (%s, %s) VALUES ('%s', %s) " +
+ "ON CONFLICT (%s) DO UPDATE SET ID = %s.ID + %s;",
+ this.table(), formatKey(HugeKeys.SCHEMA_TYPE),
+ formatKey(HugeKeys.ID), type.name(), increment,
+ formatKey(HugeKeys.SCHEMA_TYPE),
+ this.table(), increment);
try {
session.execute(update);
} catch (SQLException e) {
throw new BackendException(
- "Failed to update counters with type '%s'", e, type);
+ "Failed to update counters with type '%s'", e, type);
}
}
}
@@ -274,7 +274,7 @@ public class PostgresqlTables {
protected final String entryId(MysqlBackendEntry entry) {
return ((MysqlTables.RangeDoubleIndex) this.template)
- .entryId(entry);
+ .entryId(entry);
}
}
diff --git a/hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBStdSessions.java b/hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBStdSessions.java
index d00991434..c1cc1c507 100644
--- a/hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBStdSessions.java
+++ b/hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBStdSessions.java
@@ -133,7 +133,7 @@ public class RocksDBStdSessions extends RocksDBSessions {
@Override
public synchronized void createTable(String... tables)
- throws RocksDBException {
+ throws RocksDBException {
this.checkValid();
List<ColumnFamilyDescriptor> cfds = new ArrayList<>();
@@ -142,7 +142,7 @@ public class RocksDBStdSessions extends RocksDBSessions {
continue;
}
ColumnFamilyDescriptor cfd = new ColumnFamilyDescriptor(
- encode(table));
+ encode(table));
ColumnFamilyOptions options = cfd.getOptions();
initOptions(this.config(), null, null, options, options);
cfds.add(cfd);
@@ -468,7 +468,7 @@ public class RocksDBStdSessions extends RocksDBSessions {
db.setEnableWriteThreadAdaptiveYield(true);
}
db.setInfoLogLevel(InfoLogLevel.valueOf(
- conf.get(RocksDBOptions.LOG_LEVEL) + "_LEVEL"));
+ conf.get(RocksDBOptions.LOG_LEVEL) + "_LEVEL"));
db.setMaxSubcompactions(conf.get(RocksDBOptions.MAX_SUB_COMPACTIONS));
@@ -477,7 +477,7 @@ public class RocksDBStdSessions extends RocksDBSessions {
db.setUseDirectReads(conf.get(RocksDBOptions.USE_DIRECT_READS));
db.setUseDirectIoForFlushAndCompaction(
- conf.get(RocksDBOptions.USE_DIRECT_READS_WRITES_FC));
+ conf.get(RocksDBOptions.USE_DIRECT_READS_WRITES_FC));
db.setUseFsync(conf.get(RocksDBOptions.USE_FSYNC));
@@ -487,7 +487,7 @@ public class RocksDBStdSessions extends RocksDBSessions {
db.setSkipStatsUpdateOnDbOpen(conf.get(RocksDBOptions.SKIP_STATS_UPDATE_ON_DB_OPEN));
db.setSkipCheckingSstFileSizesOnDbOpen(
- conf.get(RocksDBOptions.SKIP_CHECK_SIZE_ON_DB_OPEN));
+ conf.get(RocksDBOptions.SKIP_CHECK_SIZE_ON_DB_OPEN));
db.setMaxFileOpeningThreads(conf.get(RocksDBOptions.MAX_FILE_OPENING_THREADS));
@@ -523,7 +523,7 @@ public class RocksDBStdSessions extends RocksDBSessions {
mdb.setCompactionReadaheadSize(conf.get(RocksDBOptions.COMPACTION_READAHEAD_SIZE));
mdb.setDeleteObsoleteFilesPeriodMicros(
- 1000000 * conf.get(RocksDBOptions.DELETE_OBSOLETE_FILE_PERIOD));
+ 1000000 * conf.get(RocksDBOptions.DELETE_OBSOLETE_FILE_PERIOD));
}
if (cf != null) {
@@ -551,7 +551,7 @@ public class RocksDBStdSessions extends RocksDBSessions {
cf.setMinWriteBufferNumberToMerge(conf.get(RocksDBOptions.MIN_MEMTABLES_TO_MERGE));
cf.setMaxWriteBufferNumberToMaintain(
- conf.get(RocksDBOptions.MAX_MEMTABLES_TO_MAINTAIN));
+ conf.get(RocksDBOptions.MAX_MEMTABLES_TO_MAINTAIN));
cf.setInplaceUpdateSupport(conf.get(RocksDBOptions.MEMTABLE_INPLACE_UPDATE_SUPPORT));
@@ -584,15 +584,15 @@ public class RocksDBStdSessions extends RocksDBSessions {
mcf.setTargetFileSizeMultiplier(conf.get(RocksDBOptions.TARGET_FILE_SIZE_MULTIPLIER));
mcf.setLevel0FileNumCompactionTrigger(
- conf.get(RocksDBOptions.LEVEL0_COMPACTION_TRIGGER));
+ conf.get(RocksDBOptions.LEVEL0_COMPACTION_TRIGGER));
mcf.setLevel0SlowdownWritesTrigger(
- conf.get(RocksDBOptions.LEVEL0_SLOWDOWN_WRITES_TRIGGER));
+ conf.get(RocksDBOptions.LEVEL0_SLOWDOWN_WRITES_TRIGGER));
mcf.setLevel0StopWritesTrigger(conf.get(RocksDBOptions.LEVEL0_STOP_WRITES_TRIGGER));
mcf.setSoftPendingCompactionBytesLimit(
- conf.get(RocksDBOptions.SOFT_PENDING_COMPACTION_LIMIT));
+ conf.get(RocksDBOptions.SOFT_PENDING_COMPACTION_LIMIT));
mcf.setHardPendingCompactionBytesLimit(
- conf.get(RocksDBOptions.HARD_PENDING_COMPACTION_LIMIT));
+ conf.get(RocksDBOptions.HARD_PENDING_COMPACTION_LIMIT));
/*
* TODO: also set memtable options:
@@ -602,9 +602,9 @@ public class RocksDBStdSessions extends RocksDBSessions {
* #diff-cde52d1fcbcce2bc6aae27838f1d3e7e9e469ccad8aaf8f2695f939e279d7501R369
*/
mcf.setMemtablePrefixBloomSizeRatio(
- conf.get(RocksDBOptions.MEMTABLE_BLOOM_SIZE_RATIO));
+ conf.get(RocksDBOptions.MEMTABLE_BLOOM_SIZE_RATIO));
mcf.setMemtableWholeKeyFiltering(
- conf.get(RocksDBOptions.MEMTABLE_BLOOM_WHOLE_KEY_FILTERING));
+ conf.get(RocksDBOptions.MEMTABLE_BLOOM_WHOLE_KEY_FILTERING));
mcf.setMemtableHugePageSize(conf.get(RocksDBOptions.MEMTABL_BLOOM_HUGE_PAGE_SIZE));
boolean bulkload = conf.get(RocksDBOptions.BULKLOAD_MODE);
@@ -648,7 +648,7 @@ public class RocksDBStdSessions extends RocksDBSessions {
*/
tableConfig.setDataBlockIndexType(conf.get(RocksDBOptions.DATA_BLOCK_SEARCH_TYPE));
tableConfig.setDataBlockHashTableUtilRatio(
- conf.get(RocksDBOptions.DATA_BLOCK_HASH_TABLE_RATIO));
+ conf.get(RocksDBOptions.DATA_BLOCK_HASH_TABLE_RATIO));
long blockSize = conf.get(RocksDBOptions.BLOCK_SIZE);
tableConfig.setBlockSize(blockSize);
@@ -674,9 +674,9 @@ public class RocksDBStdSessions extends RocksDBSessions {
tableConfig.setWholeKeyFiltering(conf.get(RocksDBOptions.BLOOM_FILTER_WHOLE_KEY));
tableConfig.setCacheIndexAndFilterBlocks(
- conf.get(RocksDBOptions.CACHE_FILTER_AND_INDEX));
+ conf.get(RocksDBOptions.CACHE_FILTER_AND_INDEX));
tableConfig.setPinL0FilterAndIndexBlocksInCache(
- conf.get(RocksDBOptions.PIN_L0_INDEX_AND_FILTER));
+ conf.get(RocksDBOptions.PIN_L0_INDEX_AND_FILTER));
// https://github.com/facebook/rocksdb/wiki/Partitioned-Index-Filters
if (conf.get(RocksDBOptions.PARTITION_FILTERS_INDEXES)) {
@@ -686,7 +686,7 @@ public class RocksDBStdSessions extends RocksDBSessions {
.setMetadataBlockSize(blockSize)
.setCacheIndexAndFilterBlocksWithHighPriority(true);
tableConfig.setPinTopLevelIndexAndFilter(
- conf.get(RocksDBOptions.PIN_TOP_INDEX_AND_FILTER));
+ conf.get(RocksDBOptions.PIN_TOP_INDEX_AND_FILTER));
}
}
@@ -850,7 +850,7 @@ public class RocksDBStdSessions extends RocksDBSessions {
/**
* Merge a record to an existing key to a table
* For more details about merge-operator:
- * <a href="https://github.com/facebook/rocksdb/wiki/merge-operator">...</a>
+ * <a href="https://github.com/facebook/rocksdb/wiki/merge-operator">...</a>
*/
@Override
public void merge(String table, byte[] key, byte[] value) {
diff --git a/hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBStore.java b/hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBStore.java
index 11ab0b4ff..46315d018 100644
--- a/hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBStore.java
+++ b/hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBStore.java
@@ -182,7 +182,7 @@ public abstract class RocksDBStore extends AbstractBackendStore<RocksDBSessions.
protected List<String> tableNames(HugeType type) {
return type != HugeType.OLAP ? Collections.singletonList(this.table(type).table()) :
- this.olapTables();
+ this.olapTables();
}
@Override
@@ -758,7 +758,7 @@ public abstract class RocksDBStore extends AbstractBackendStore<RocksDBSessions.
}
for (Map.Entry<String, RocksDBSessions> entry :
- snapshotPaths.entrySet()) {
+ snapshotPaths.entrySet()) {
String snapshotPath = entry.getKey();
RocksDBSessions sessions = entry.getValue();
sessions.resumeSnapshot(snapshotPath);
diff --git a/hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBTable.java b/hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBTable.java
index 7f7bd451a..129af7ac7 100644
--- a/hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBTable.java
+++ b/hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBTable.java
@@ -201,7 +201,7 @@ public class RocksDBTable extends BackendTable<RocksDBSessions.Session, BackendE
// NOTE: this will lead to lazy create rocksdb iterator
return BackendColumnIterator.wrap(new FlatMapperIterator<>(
- ids.iterator(), id -> this.queryById(session, id)
+ ids.iterator(), id -> this.queryById(session, id)
));
}
diff --git a/hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdbsst/RocksDBSstSessions.java b/hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdbsst/RocksDBSstSessions.java
index 786d50570..70eec3cc5 100644
--- a/hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdbsst/RocksDBSstSessions.java
+++ b/hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdbsst/RocksDBSstSessions.java
@@ -126,7 +126,7 @@ public class RocksDBSstSessions extends RocksDBSessions {
}
}
- public void dropTable(String table) throws RocksDBException{
+ public void dropTable(String table) throws RocksDBException {
try (SstFileWriter sst = this.tables.remove(table)) {
assert sst == null || !sst.isOwningHandle() : "Please close table before drop to " +
"ensure call sst.finish()";
@@ -336,7 +336,7 @@ public class RocksDBSstSessions extends RocksDBSessions {
/**
* Merge a record to an existing key to a table
* For more details about merge-operator:
- * <a href="https://github.com/facebook/rocksdb/wiki/merge-operator">...</a>
+ * <a href="https://github.com/facebook/rocksdb/wiki/merge-operator">...</a>
*/
@Override
public void merge(String table, byte[] key, byte[] value) {
diff --git a/hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdbsst/RocksDBSstStore.java b/hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdbsst/RocksDBSstStore.java
index 230bf68a0..d7b75610f 100644
--- a/hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdbsst/RocksDBSstStore.java
+++ b/hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdbsst/RocksDBSstStore.java
@@ -39,7 +39,7 @@ public abstract class RocksDBSstStore extends RocksDBStore {
protected RocksDBSessions openSessionPool(HugeConfig config,
String dataPath, String walPath,
List<String> tableNames)
- throws RocksDBException {
+ throws RocksDBException {
if (tableNames == null) {
return new RocksDBSstSessions(config, this.database(), this.store(), dataPath);
} else {
diff --git a/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBMetrics.java b/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBMetrics.java
index ba0af3630..77585c73a 100644
--- a/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBMetrics.java
+++ b/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBMetrics.java
@@ -20,7 +20,6 @@ package org.apache.hugegraph.backend.store.scylladb;
import java.util.Map;
import org.apache.cassandra.tools.NodeProbe;
-
import org.apache.hugegraph.backend.store.cassandra.CassandraMetrics;
import org.apache.hugegraph.backend.store.cassandra.CassandraSessionPool;
import org.apache.hugegraph.config.HugeConfig;
diff --git a/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBStoreProvider.java b/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBStoreProvider.java
index 5ecccf2fe..015afb831 100644
--- a/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBStoreProvider.java
+++ b/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBStoreProvider.java
@@ -17,8 +17,6 @@
package org.apache.hugegraph.backend.store.scylladb;
-import org.slf4j.Logger;
-
import org.apache.hugegraph.backend.store.BackendFeatures;
import org.apache.hugegraph.backend.store.BackendStore;
import org.apache.hugegraph.backend.store.BackendStoreProvider;
@@ -30,6 +28,7 @@ import org.apache.hugegraph.config.HugeConfig;
import org.apache.hugegraph.type.HugeType;
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.Log;
+import org.slf4j.Logger;
public class ScyllaDBStoreProvider extends CassandraStoreProvider {
@@ -94,7 +93,7 @@ public class ScyllaDBStoreProvider extends CassandraStoreProvider {
}
public static class ScyllaDBSchemaStore
- extends CassandraStore.CassandraSchemaStore {
+ extends CassandraStore.CassandraSchemaStore {
public ScyllaDBSchemaStore(BackendStoreProvider provider,
String keyspace, String store) {
@@ -124,7 +123,7 @@ public class ScyllaDBStoreProvider extends CassandraStoreProvider {
}
public static class ScyllaDBGraphStore
- extends CassandraStore.CassandraGraphStore {
+ extends CassandraStore.CassandraGraphStore {
public ScyllaDBGraphStore(BackendStoreProvider provider,
String keyspace, String store) {
@@ -152,7 +151,7 @@ public class ScyllaDBStoreProvider extends CassandraStoreProvider {
}
public static class ScyllaDBSystemStore
- extends CassandraStore.CassandraSystemStore {
+ extends CassandraStore.CassandraSystemStore {
public ScyllaDBSystemStore(BackendStoreProvider provider,
String keyspace, String store) {
diff --git a/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBTablesWithMV.java b/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBTablesWithMV.java
index b4c30c764..61dfe88df 100644
--- a/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBTablesWithMV.java
+++ b/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBTablesWithMV.java
@@ -29,6 +29,7 @@ import org.apache.hugegraph.backend.store.cassandra.CassandraTable;
import org.apache.hugegraph.backend.store.cassandra.CassandraTables;
import org.apache.hugegraph.type.define.Directions;
import org.apache.hugegraph.type.define.HugeKeys;
+
import com.datastax.driver.core.querybuilder.Select;
public class ScyllaDBTablesWithMV {
@@ -62,17 +63,17 @@ public class ScyllaDBTablesWithMV {
}
private static void createSchemaIndexTable(
- CassandraSessionPool.Session session,
- String mvName, String table) {
+ CassandraSessionPool.Session session,
+ String mvName, String table) {
final String NAME = CassandraTable.formatKey(HugeKeys.NAME);
final String ID = CassandraTable.formatKey(HugeKeys.ID);
String cql = String.format(
- "CREATE MATERIALIZED VIEW IF NOT EXISTS %s AS " +
- " SELECT * FROM %s " +
- " WHERE %s IS NOT NULL " +
- " PRIMARY KEY(%s, %s)",
- mvName, table, NAME,
- NAME, ID);
+ "CREATE MATERIALIZED VIEW IF NOT EXISTS %s AS " +
+ " SELECT * FROM %s " +
+ " WHERE %s IS NOT NULL " +
+ " PRIMARY KEY(%s, %s)",
+ mvName, table, NAME,
+ NAME, ID);
session.execute(cql);
}
@@ -206,11 +207,11 @@ public class ScyllaDBTablesWithMV {
final String LABEL = CassandraTable.formatKey(HugeKeys.LABEL);
final String ID = CassandraTable.formatKey(HugeKeys.ID);
String cql = String.format(
- "CREATE MATERIALIZED VIEW IF NOT EXISTS %s AS " +
- " SELECT * FROM %s " +
- " WHERE %s IS NOT NULL " +
- " PRIMARY KEY(%s, %s)",
- mvLabel2Vertex, this.table(), LABEL, LABEL, ID);
+ "CREATE MATERIALIZED VIEW IF NOT EXISTS %s AS " +
+ " SELECT * FROM %s " +
+ " WHERE %s IS NOT NULL " +
+ " PRIMARY KEY(%s, %s)",
+ mvLabel2Vertex, this.table(), LABEL, LABEL, ID);
session.execute(cql);
}
@@ -240,13 +241,13 @@ public class ScyllaDBTablesWithMV {
private static final String LABEL = CassandraTable.formatKey(HugeKeys.LABEL);
private final List<String> keys = this.idColumnName().stream()
- .filter(k -> k != HugeKeys.LABEL)
- .map(k -> CassandraTable.formatKey(k))
- .collect(Collectors.toList());
+ .filter(k -> k != HugeKeys.LABEL)
+ .map(k -> CassandraTable.formatKey(k))
+ .collect(Collectors.toList());
private final String prKeys = this.keys.stream()
- .collect(Collectors.joining(","));
+ .collect(Collectors.joining(","));
private final String prkeysNn = this.keys.stream().collect(
- Collectors.joining(" IS NOT NULL AND "));
+ Collectors.joining(" IS NOT NULL AND "));
public Edge(String store, Directions direction) {
super(store, direction);
@@ -257,13 +258,13 @@ public class ScyllaDBTablesWithMV {
String indexLabel,
HugeKeys column) {
String cql = String.format(
- "CREATE MATERIALIZED VIEW IF NOT EXISTS %s AS " +
- " SELECT * FROM %s " +
- " WHERE %s IS NOT NULL AND %s IS NOT NULL " +
- " PRIMARY KEY(%s, %s)",
- mvLabel2Edge, this.table(),
- this.LABEL, this.prkeysNn,
- this.LABEL, this.prKeys);
+ "CREATE MATERIALIZED VIEW IF NOT EXISTS %s AS " +
+ " SELECT * FROM %s " +
+ " WHERE %s IS NOT NULL AND %s IS NOT NULL " +
+ " PRIMARY KEY(%s, %s)",
+ mvLabel2Edge, this.table(),
+ LABEL, this.prkeysNn,
+ LABEL, this.prKeys);
session.execute(cql);
}
diff --git a/hugegraph-server/hugegraph-test/pom.xml b/hugegraph-server/hugegraph-test/pom.xml
index 300518419..47e5e5fac 100644
--- a/hugegraph-server/hugegraph-test/pom.xml
+++ b/hugegraph-server/hugegraph-test/pom.xml
@@ -283,7 +283,7 @@
<finalName>microbenchmarks</finalName>
<transformers>
<transformer
- implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+ implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>org.openjdk.jmh.Main</mainClass>
</transformer>
</transformers>
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/ApiTestSuite.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/ApiTestSuite.java
index 0f9041c13..11d3e6409 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/ApiTestSuite.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/ApiTestSuite.java
@@ -25,22 +25,22 @@ import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({
- PropertyKeyApiTest.class,
- VertexLabelApiTest.class,
- EdgeLabelApiTest.class,
- IndexLabelApiTest.class,
- SchemaApiTest.class,
- VertexApiTest.class,
- EdgeApiTest.class,
- TaskApiTest.class,
- GremlinApiTest.class,
- MetricsApiTest.class,
- UserApiTest.class,
- LoginApiTest.class,
- ProjectApiTest.class,
- TraversersApiTestSuite.class,
- CypherApiTest.class,
- ArthasApiTest.class
+ PropertyKeyApiTest.class,
+ VertexLabelApiTest.class,
+ EdgeLabelApiTest.class,
+ IndexLabelApiTest.class,
+ SchemaApiTest.class,
+ VertexApiTest.class,
+ EdgeApiTest.class,
+ TaskApiTest.class,
+ GremlinApiTest.class,
+ MetricsApiTest.class,
+ UserApiTest.class,
+ LoginApiTest.class,
+ ProjectApiTest.class,
+ TraversersApiTestSuite.class,
+ CypherApiTest.class,
+ ArthasApiTest.class
})
public class ApiTestSuite {
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/BaseApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/BaseApiTest.java
index 9adf3bd7d..43b8cdbd1 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/BaseApiTest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/BaseApiTest.java
@@ -108,11 +108,11 @@ public class BaseApiTest {
this(url, true);
}
- public RestClient(String url,Boolean enableAuth) {
+ public RestClient(String url, Boolean enableAuth) {
this.client = ClientBuilder.newClient();
this.client.register(EncodingFilter.class);
this.client.register(GZipEncoder.class);
- if(enableAuth) {
+ if (enableAuth) {
this.client.register(HttpAuthenticationFeature.basic(USERNAME,
PASSWORD));
}
@@ -202,117 +202,117 @@ public class BaseApiTest {
String path = URL_PREFIX + SCHEMA_PKS;
createAndAssert(path, "{\n" +
- "\"name\": \"name\",\n" +
- "\"data_type\": \"TEXT\",\n" +
- "\"cardinality\": \"SINGLE\",\n" +
- "\"check_exist\": false,\n" +
- "\"properties\":[]\n" +
- "}", 202);
+ "\"name\": \"name\",\n" +
+ "\"data_type\": \"TEXT\",\n" +
+ "\"cardinality\": \"SINGLE\",\n" +
+ "\"check_exist\": false,\n" +
+ "\"properties\":[]\n" +
+ "}", 202);
createAndAssert(path, "{\n" +
- "\"name\": \"age\",\n" +
- "\"data_type\": \"INT\",\n" +
- "\"cardinality\": \"SINGLE\",\n" +
- "\"check_exist\": false,\n" +
- "\"properties\":[]\n" +
- "}", 202);
+ "\"name\": \"age\",\n" +
+ "\"data_type\": \"INT\",\n" +
+ "\"cardinality\": \"SINGLE\",\n" +
+ "\"check_exist\": false,\n" +
+ "\"properties\":[]\n" +
+ "}", 202);
createAndAssert(path, "{\n" +
- "\"name\": \"city\",\n" +
- "\"data_type\": \"TEXT\",\n" +
- "\"cardinality\": \"SINGLE\",\n" +
- "\"check_exist\": false,\n" +
- "\"properties\":[]\n" +
- "}", 202);
+ "\"name\": \"city\",\n" +
+ "\"data_type\": \"TEXT\",\n" +
+ "\"cardinality\": \"SINGLE\",\n" +
+ "\"check_exist\": false,\n" +
+ "\"properties\":[]\n" +
+ "}", 202);
createAndAssert(path, "{\n" +
- "\"name\": \"lang\",\n" +
- "\"data_type\": \"TEXT\",\n" +
- "\"cardinality\": \"SINGLE\",\n" +
- "\"check_exist\": false,\n" +
- "\"properties\":[]\n" +
- "}", 202);
+ "\"name\": \"lang\",\n" +
+ "\"data_type\": \"TEXT\",\n" +
+ "\"cardinality\": \"SINGLE\",\n" +
+ "\"check_exist\": false,\n" +
+ "\"properties\":[]\n" +
+ "}", 202);
createAndAssert(path, "{\n" +
- "\"name\": \"date\",\n" +
- "\"data_type\": \"TEXT\",\n" +
- "\"cardinality\": \"SINGLE\",\n" +
- "\"check_exist\": false,\n" +
- "\"properties\":[]\n" +
- "}", 202);
+ "\"name\": \"date\",\n" +
+ "\"data_type\": \"TEXT\",\n" +
+ "\"cardinality\": \"SINGLE\",\n" +
+ "\"check_exist\": false,\n" +
+ "\"properties\":[]\n" +
+ "}", 202);
createAndAssert(path, "{\n" +
- "\"name\": \"price\",\n" +
- "\"data_type\": \"INT\",\n" +
- "\"cardinality\": \"SINGLE\",\n" +
- "\"check_exist\": false,\n" +
- "\"properties\":[]\n" +
- "}", 202);
+ "\"name\": \"price\",\n" +
+ "\"data_type\": \"INT\",\n" +
+ "\"cardinality\": \"SINGLE\",\n" +
+ "\"check_exist\": false,\n" +
+ "\"properties\":[]\n" +
+ "}", 202);
createAndAssert(path, "{\n" +
- "\"name\": \"weight\",\n" +
- "\"data_type\": \"DOUBLE\",\n" +
- "\"cardinality\": \"SINGLE\",\n" +
- "\"check_exist\": false,\n" +
- "\"properties\":[]\n" +
- "}", 202);
+ "\"name\": \"weight\",\n" +
+ "\"data_type\": \"DOUBLE\",\n" +
+ "\"cardinality\": \"SINGLE\",\n" +
+ "\"check_exist\": false,\n" +
+ "\"properties\":[]\n" +
+ "}", 202);
}
protected static void initVertexLabel() {
String path = URL_PREFIX + SCHEMA_VLS;
createAndAssert(path, "{\n" +
- "\"primary_keys\":[\"name\"],\n" +
- "\"id_strategy\": \"PRIMARY_KEY\",\n" +
- "\"name\": \"person\",\n" +
- "\"properties\":[\"city\", \"name\", \"age\"],\n" +
- "\"check_exist\": false,\n" +
- "\"nullable_keys\":[]\n" +
- "}");
+ "\"primary_keys\":[\"name\"],\n" +
+ "\"id_strategy\": \"PRIMARY_KEY\",\n" +
+ "\"name\": \"person\",\n" +
+ "\"properties\":[\"city\", \"name\", \"age\"],\n" +
+ "\"check_exist\": false,\n" +
+ "\"nullable_keys\":[]\n" +
+ "}");
createAndAssert(path, "{\n" +
- "\"primary_keys\":[\"name\"],\n" +
- "\"id_strategy\": \"PRIMARY_KEY\",\n" +
- "\"name\": \"software\",\n" +
- "\"properties\":[\"price\", \"name\", \"lang\"],\n" +
- "\"check_exist\": false,\n" +
- "\"nullable_keys\":[]\n" +
- "}");
+ "\"primary_keys\":[\"name\"],\n" +
+ "\"id_strategy\": \"PRIMARY_KEY\",\n" +
+ "\"name\": \"software\",\n" +
+ "\"properties\":[\"price\", \"name\", \"lang\"],\n" +
+ "\"check_exist\": false,\n" +
+ "\"nullable_keys\":[]\n" +
+ "}");
}
protected static void initEdgeLabel() {
String path = URL_PREFIX + SCHEMA_ELS;
createAndAssert(path, "{\n" +
- "\"name\": \"created\",\n" +
- "\"source_label\": \"person\",\n" +
- "\"target_label\": \"software\",\n" +
- "\"frequency\": \"SINGLE\",\n" +
- "\"properties\":[\"date\", \"weight\"],\n" +
- "\"sort_keys\":[],\n" +
- "\"check_exist\": false,\n" +
- "\"nullable_keys\":[]\n" +
- "}");
+ "\"name\": \"created\",\n" +
+ "\"source_label\": \"person\",\n" +
+ "\"target_label\": \"software\",\n" +
+ "\"frequency\": \"SINGLE\",\n" +
+ "\"properties\":[\"date\", \"weight\"],\n" +
+ "\"sort_keys\":[],\n" +
+ "\"check_exist\": false,\n" +
+ "\"nullable_keys\":[]\n" +
+ "}");
createAndAssert(path, "{\n" +
- "\"name\": \"knows\",\n" +
- "\"source_label\": \"person\",\n" +
- "\"target_label\": \"person\",\n" +
- "\"frequency\": \"MULTIPLE\",\n" +
- "\"properties\":[\"date\", \"weight\"],\n" +
- "\"sort_keys\":[\"date\"],\n" +
- "\"check_exist\": false,\n" +
- "\"nullable_keys\":[]\n" +
- "}");
+ "\"name\": \"knows\",\n" +
+ "\"source_label\": \"person\",\n" +
+ "\"target_label\": \"person\",\n" +
+ "\"frequency\": \"MULTIPLE\",\n" +
+ "\"properties\":[\"date\", \"weight\"],\n" +
+ "\"sort_keys\":[\"date\"],\n" +
+ "\"check_exist\": false,\n" +
+ "\"nullable_keys\":[]\n" +
+ "}");
}
protected static int initIndexLabel() {
String path = URL_PREFIX + SCHEMA_ILS;
Response r = client.post(path, "{\n" +
- "\"name\": \"personByCity\",\n" +
- "\"base_type\": \"VERTEX_LABEL\",\n" +
- "\"base_value\": \"person\",\n" +
- "\"index_type\": \"SECONDARY\",\n" +
- "\"check_exist\": false,\n" +
- "\"rebuild\": false,\n" +
- "\"fields\": [\n" +
- "\"city\"\n" +
- "]\n" +
- "}");
+ "\"name\": \"personByCity\",\n" +
+ "\"base_type\": \"VERTEX_LABEL\",\n" +
+ "\"base_value\": \"person\",\n" +
+ "\"index_type\": \"SECONDARY\",\n" +
+ "\"check_exist\": false,\n" +
+ "\"rebuild\": false,\n" +
+ "\"fields\": [\n" +
+ "\"city\"\n" +
+ "]\n" +
+ "}");
String content = assertResponseStatus(202, r);
return assertJsonContains(content, "task_id");
}
@@ -378,59 +378,59 @@ public class BaseApiTest {
String path = URL_PREFIX + GRAPH_VERTEX;
createAndAssert(path, "{\n" +
- "\"label\": \"person\",\n" +
- "\"type\": \"vertex\",\n" +
- "\"properties\":{" +
- "\"name\": \"marko\"," +
- "\"age\": 29," +
- "\"city\": \"Beijing\"" +
- "}\n" +
- "}");
+ "\"label\": \"person\",\n" +
+ "\"type\": \"vertex\",\n" +
+ "\"properties\":{" +
+ "\"name\": \"marko\"," +
+ "\"age\": 29," +
+ "\"city\": \"Beijing\"" +
+ "}\n" +
+ "}");
createAndAssert(path, "{\n" +
- "\"label\": \"person\",\n" +
- "\"type\": \"vertex\",\n" +
- "\"properties\":{" +
- "\"name\": \"vadas\"," +
- "\"age\": 27," +
- "\"city\": \"HongKong\"" +
- "}\n" +
- "}");
+ "\"label\": \"person\",\n" +
+ "\"type\": \"vertex\",\n" +
+ "\"properties\":{" +
+ "\"name\": \"vadas\"," +
+ "\"age\": 27," +
+ "\"city\": \"HongKong\"" +
+ "}\n" +
+ "}");
createAndAssert(path, "{\n" +
- "\"label\": \"person\",\n" +
- "\"type\": \"vertex\",\n" +
- "\"properties\":{" +
- "\"name\": \"josh\"," +
- "\"age\": 32," +
- "\"city\": \"Beijing\"" +
- "}\n" +
- "}");
+ "\"label\": \"person\",\n" +
+ "\"type\": \"vertex\",\n" +
+ "\"properties\":{" +
+ "\"name\": \"josh\"," +
+ "\"age\": 32," +
+ "\"city\": \"Beijing\"" +
+ "}\n" +
+ "}");
createAndAssert(path, "{\n" +
- "\"label\": \"person\",\n" +
- "\"type\": \"vertex\",\n" +
- "\"properties\":{" +
- "\"name\": \"peter\"," +
- "\"age\": 35," +
- "\"city\": \"Shanghai\"" +
- "}\n" +
- "}");
+ "\"label\": \"person\",\n" +
+ "\"type\": \"vertex\",\n" +
+ "\"properties\":{" +
+ "\"name\": \"peter\"," +
+ "\"age\": 35," +
+ "\"city\": \"Shanghai\"" +
+ "}\n" +
+ "}");
createAndAssert(path, "{\n" +
- "\"label\": \"software\",\n" +
- "\"type\": \"vertex\",\n" +
- "\"properties\":{" +
- "\"name\": \"ripple\"," +
- "\"lang\": \"java\"," +
- "\"price\": 199" +
- "}\n" +
- "}");
+ "\"label\": \"software\",\n" +
+ "\"type\": \"vertex\",\n" +
+ "\"properties\":{" +
+ "\"name\": \"ripple\"," +
+ "\"lang\": \"java\"," +
+ "\"price\": 199" +
+ "}\n" +
+ "}");
createAndAssert(path, "{\n" +
- "\"label\": \"software\",\n" +
- "\"type\": \"vertex\",\n" +
- "\"properties\":{" +
- "\"name\": \"lop\"," +
- "\"lang\": \"java\"," +
- "\"price\": 328" +
- "}\n" +
- "}");
+ "\"label\": \"software\",\n" +
+ "\"type\": \"vertex\",\n" +
+ "\"properties\":{" +
+ "\"name\": \"lop\"," +
+ "\"lang\": \"java\"," +
+ "\"price\": 328" +
+ "}\n" +
+ "}");
}
protected static Response createAndAssert(String path, String body) {
@@ -480,7 +480,7 @@ public class BaseApiTest {
}
protected static String getVertexId(String label, String key, String value)
- throws IOException {
+ throws IOException {
String props = MAPPER.writeValueAsString(ImmutableMap.of(key, value));
Map<String, Object> params = ImmutableMap.of(
"label", label,
@@ -588,14 +588,14 @@ public class BaseApiTest {
JsonNode element = root.get(key);
if (element == null) {
throw new HugeException(String.format(
- "Can't find value of the key: %s in json.", key));
+ "Can't find value of the key: %s in json.", key));
}
JavaType type = MAPPER.getTypeFactory()
.constructParametricType(List.class, clazz);
return MAPPER.readValue(element.toString(), type);
} catch (IOException e) {
throw new HugeException(String.format(
- "Failed to deserialize %s", content), e);
+ "Failed to deserialize %s", content), e);
}
}
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/CypherApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/CypherApiTest.java
index 4edd6b62b..3c3e3049f 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/CypherApiTest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/CypherApiTest.java
@@ -47,7 +47,7 @@ public class CypherApiTest extends BaseApiTest {
@Test
public void testGet() {
Map<String, Object> params = ImmutableMap.of("cypher", QUERY);
- Response r = client().get(PATH, params);
+ Response r = client().get(PATH, params);
this.validStatusAndTextContains(QUERY_RESULT, r);
}
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/EdgeApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/EdgeApiTest.java
index 9295293f6..6d9c65fee 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/EdgeApiTest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/EdgeApiTest.java
@@ -45,15 +45,15 @@ public class EdgeApiTest extends BaseApiTest {
String inVId = getVertexId("software", "name", "lop");
String edge = String.format("{" +
- "\"label\": \"created\"," +
- "\"outVLabel\": \"person\"," +
- "\"inVLabel\": \"software\"," +
- "\"outV\": \"%s\"," +
- "\"inV\": \"%s\"," +
- "\"properties\":{" +
- "\"date\": \"20170324\"," +
- "\"weight\": 0.5}" +
- "}", outVId, inVId);
+ "\"label\": \"created\"," +
+ "\"outVLabel\": \"person\"," +
+ "\"inVLabel\": \"software\"," +
+ "\"outV\": \"%s\"," +
+ "\"inV\": \"%s\"," +
+ "\"properties\":{" +
+ "\"date\": \"20170324\"," +
+ "\"weight\": 0.5}" +
+ "}", outVId, inVId);
Response r = client().post(PATH, edge);
assertResponseStatus(201, r);
}
@@ -64,15 +64,15 @@ public class EdgeApiTest extends BaseApiTest {
String inVId = getVertexId("person", "name", "josh");
// Create
String edge = String.format("{" +
- "\"label\": \"knows\"," +
- "\"outVLabel\": \"person\"," +
- "\"inVLabel\": \"person\"," +
- "\"outV\": \"%s\"," +
- "\"inV\": \"%s\"," +
- "\"properties\":{" +
- "\"date\": \"2013-02-20\"," +
- "\"weight\": 1.0}" +
- "}", outVId, inVId);
+ "\"label\": \"knows\"," +
+ "\"outVLabel\": \"person\"," +
+ "\"inVLabel\": \"person\"," +
+ "\"outV\": \"%s\"," +
+ "\"inV\": \"%s\"," +
+ "\"properties\":{" +
+ "\"date\": \"2013-02-20\"," +
+ "\"weight\": 1.0}" +
+ "}", outVId, inVId);
Response r = client().post(PATH, edge);
// The edge id is 'S1:marko>1>7JooBil0>S1:josh'
String content = assertResponseStatus(201, r);
@@ -80,56 +80,56 @@ public class EdgeApiTest extends BaseApiTest {
// Update edge with edgeId
edge = String.format("{" +
- "\"edges\":[" +
- "{" +
- "\"id\":\"%s\"," +
- "\"label\":\"knows\"," +
- "\"outV\":\"%s\"," +
- "\"outVLabel\":\"person\"," +
- "\"inV\":\"%s\"," +
- "\"inVLabel\":\"person\"," +
- "\"properties\":{" +
- "\"weight\":0.2," +
- "\"date\":\"2014-02-20\"" +
- "}" +
- "}" +
- "]," +
- "\"update_strategies\":{" +
- "\"weight\":\"SUM\"," +
- "\"date\":\"BIGGER\"" +
- "}," +
- "\"check_vertex\":false," +
- "\"create_if_not_exist\":true" +
- "}", edgeId, outVId, inVId);
+ "\"edges\":[" +
+ "{" +
+ "\"id\":\"%s\"," +
+ "\"label\":\"knows\"," +
+ "\"outV\":\"%s\"," +
+ "\"outVLabel\":\"person\"," +
+ "\"inV\":\"%s\"," +
+ "\"inVLabel\":\"person\"," +
+ "\"properties\":{" +
+ "\"weight\":0.2," +
+ "\"date\":\"2014-02-20\"" +
+ "}" +
+ "}" +
+ "]," +
+ "\"update_strategies\":{" +
+ "\"weight\":\"SUM\"," +
+ "\"date\":\"BIGGER\"" +
+ "}," +
+ "\"check_vertex\":false," +
+ "\"create_if_not_exist\":true" +
+ "}", edgeId, outVId, inVId);
r = client().put(PATH, "batch", edge, ImmutableMap.of());
// Now allowed to modify sortkey values, the property 'date' has changed
content = assertResponseStatus(400, r);
Assert.assertTrue(content.contains(
- "either be null or equal to the origin value when " +
- "specified edge id"));
+ "either be null or equal to the origin value when " +
+ "specified edge id"));
// Update edge without edgeId
edge = String.format("{" +
- "\"edges\":[" +
- "{" +
- "\"label\":\"knows\"," +
- "\"outV\":\"%s\"," +
- "\"outVLabel\":\"person\"," +
- "\"inV\":\"%s\"," +
- "\"inVLabel\":\"person\"," +
- "\"properties\":{" +
- "\"weight\":0.2," +
- "\"date\":\"2014-02-20\"" +
- "}" +
- "}" +
- "]," +
- "\"update_strategies\":{" +
- "\"weight\":\"SUM\"," +
- "\"date\":\"BIGGER\"" +
- "}," +
- "\"check_vertex\":false," +
- "\"create_if_not_exist\":true" +
- "}", outVId, inVId);
+ "\"edges\":[" +
+ "{" +
+ "\"label\":\"knows\"," +
+ "\"outV\":\"%s\"," +
+ "\"outVLabel\":\"person\"," +
+ "\"inV\":\"%s\"," +
+ "\"inVLabel\":\"person\"," +
+ "\"properties\":{" +
+ "\"weight\":0.2," +
+ "\"date\":\"2014-02-20\"" +
+ "}" +
+ "}" +
+ "]," +
+ "\"update_strategies\":{" +
+ "\"weight\":\"SUM\"," +
+ "\"date\":\"BIGGER\"" +
+ "}," +
+ "\"check_vertex\":false," +
+ "\"create_if_not_exist\":true" +
+ "}", outVId, inVId);
r = client().put(PATH, "batch", edge, ImmutableMap.of());
// Add a new edge when sortkey value has changed
content = assertResponseStatus(200, r);
@@ -143,15 +143,15 @@ public class EdgeApiTest extends BaseApiTest {
String inVId = getVertexId("software", "name", "lop");
String edge = String.format("{" +
- "\"label\": \"created\"," +
- "\"outVLabel\": \"person\"," +
- "\"inVLabel\": \"software\"," +
- "\"outV\": \"%s\"," +
- "\"inV\": \"%s\"," +
- "\"properties\":{" +
- "\"date\": \"20170324\"," +
- "\"weight\": 0.5}" +
- "}", outVId, inVId);
+ "\"label\": \"created\"," +
+ "\"outVLabel\": \"person\"," +
+ "\"inVLabel\": \"software\"," +
+ "\"outV\": \"%s\"," +
+ "\"inV\": \"%s\"," +
+ "\"properties\":{" +
+ "\"date\": \"20170324\"," +
+ "\"weight\": 0.5}" +
+ "}", outVId, inVId);
Response r = client().post(PATH, edge);
String content = assertResponseStatus(201, r);
@@ -166,15 +166,15 @@ public class EdgeApiTest extends BaseApiTest {
String inVId = getVertexId("software", "name", "lop");
String edge = String.format("{" +
- "\"label\": \"created\"," +
- "\"outVLabel\": \"person\"," +
- "\"inVLabel\": \"software\"," +
- "\"outV\": \"%s\"," +
- "\"inV\": \"%s\"," +
- "\"properties\":{" +
- "\"date\": \"20170324\"," +
- "\"weight\": 0.5}" +
- "}", outVId, inVId);
+ "\"label\": \"created\"," +
+ "\"outVLabel\": \"person\"," +
+ "\"inVLabel\": \"software\"," +
+ "\"outV\": \"%s\"," +
+ "\"inV\": \"%s\"," +
+ "\"properties\":{" +
+ "\"date\": \"20170324\"," +
+ "\"weight\": 0.5}" +
+ "}", outVId, inVId);
Response r = client().post(PATH, edge);
assertResponseStatus(201, r);
@@ -188,15 +188,15 @@ public class EdgeApiTest extends BaseApiTest {
String inVId = getVertexId("software", "name", "lop");
String edge = String.format("{" +
- "\"label\": \"created\"," +
- "\"outVLabel\": \"person\"," +
- "\"inVLabel\": \"software\"," +
- "\"outV\": \"%s\"," +
- "\"inV\": \"%s\"," +
- "\"properties\":{" +
- "\"date\": \"20170324\"," +
- "\"weight\": 0.5}" +
- "}", outVId, inVId);
+ "\"label\": \"created\"," +
+ "\"outVLabel\": \"person\"," +
+ "\"inVLabel\": \"software\"," +
+ "\"outV\": \"%s\"," +
+ "\"inV\": \"%s\"," +
+ "\"properties\":{" +
+ "\"date\": \"20170324\"," +
+ "\"weight\": 0.5}" +
+ "}", outVId, inVId);
Response r = client().post(PATH, edge);
String content = assertResponseStatus(201, r);
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/EdgeLabelApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/EdgeLabelApiTest.java
index 434fae824..2a9e85b3a 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/EdgeLabelApiTest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/EdgeLabelApiTest.java
@@ -39,14 +39,14 @@ public class EdgeLabelApiTest extends BaseApiTest {
@Test
public void testCreate() {
String edgeLabel = "{" +
- "\"name\": \"created\"," +
- "\"source_label\": \"person\"," +
- "\"target_label\": \"software\"," +
- "\"frequency\": \"SINGLE\"," +
- "\"properties\":[\"date\", \"city\"]," +
- "\"nullable_keys\":[\"city\"]," +
- "\"sort_keys\":[]" +
- "}";
+ "\"name\": \"created\"," +
+ "\"source_label\": \"person\"," +
+ "\"target_label\": \"software\"," +
+ "\"frequency\": \"SINGLE\"," +
+ "\"properties\":[\"date\", \"city\"]," +
+ "\"nullable_keys\":[\"city\"]," +
+ "\"sort_keys\":[]" +
+ "}";
Response r = client().post(PATH, edgeLabel);
assertResponseStatus(201, r);
}
@@ -54,26 +54,26 @@ public class EdgeLabelApiTest extends BaseApiTest {
@Test
public void testAppend() {
String edgeLabel = "{" +
- "\"name\": \"created\"," +
- "\"source_label\": \"person\"," +
- "\"target_label\": \"software\"," +
- "\"frequency\": \"SINGLE\"," +
- "\"properties\":[\"date\", \"city\"]," +
- "\"nullable_keys\":[\"city\"]," +
- "\"sort_keys\":[]" +
- "}";
+ "\"name\": \"created\"," +
+ "\"source_label\": \"person\"," +
+ "\"target_label\": \"software\"," +
+ "\"frequency\": \"SINGLE\"," +
+ "\"properties\":[\"date\", \"city\"]," +
+ "\"nullable_keys\":[\"city\"]," +
+ "\"sort_keys\":[]" +
+ "}";
Response r = client().post(PATH, edgeLabel);
assertResponseStatus(201, r);
edgeLabel = "{" +
- "\"name\": \"created\"," +
- "\"source_label\": null," +
- "\"target_label\": null," +
- "\"frequency\": \"DEFAULT\"," +
- "\"properties\":[\"lang\"]," +
- "\"nullable_keys\":[\"lang\"]," +
- "\"sort_keys\":[]" +
- "}";
+ "\"name\": \"created\"," +
+ "\"source_label\": null," +
+ "\"target_label\": null," +
+ "\"frequency\": \"DEFAULT\"," +
+ "\"properties\":[\"lang\"]," +
+ "\"nullable_keys\":[\"lang\"]," +
+ "\"sort_keys\":[]" +
+ "}";
Map<String, Object> params = ImmutableMap.of("action", "append");
r = client().put(PATH, "created", edgeLabel, params);
assertResponseStatus(200, r);
@@ -82,14 +82,14 @@ public class EdgeLabelApiTest extends BaseApiTest {
@Test
public void testGet() {
String edgeLabel = "{" +
- "\"name\": \"created\"," +
- "\"source_label\": \"person\"," +
- "\"target_label\": \"software\"," +
- "\"frequency\": \"SINGLE\"," +
- "\"properties\":[\"date\", \"city\"]," +
- "\"nullable_keys\":[\"city\"]," +
- "\"sort_keys\":[]" +
- "}";
+ "\"name\": \"created\"," +
+ "\"source_label\": \"person\"," +
+ "\"target_label\": \"software\"," +
+ "\"frequency\": \"SINGLE\"," +
+ "\"properties\":[\"date\", \"city\"]," +
+ "\"nullable_keys\":[\"city\"]," +
+ "\"sort_keys\":[]" +
+ "}";
Response r = client().post(PATH, edgeLabel);
assertResponseStatus(201, r);
@@ -101,14 +101,14 @@ public class EdgeLabelApiTest extends BaseApiTest {
@Test
public void testList() {
String edgeLabel = "{" +
- "\"name\": \"created\"," +
- "\"source_label\": \"person\"," +
- "\"target_label\": \"software\"," +
- "\"frequency\": \"SINGLE\"," +
- "\"properties\":[\"date\", \"city\"]," +
- "\"nullable_keys\":[\"city\"]," +
- "\"sort_keys\":[]" +
- "}";
+ "\"name\": \"created\"," +
+ "\"source_label\": \"person\"," +
+ "\"target_label\": \"software\"," +
+ "\"frequency\": \"SINGLE\"," +
+ "\"properties\":[\"date\", \"city\"]," +
+ "\"nullable_keys\":[\"city\"]," +
+ "\"sort_keys\":[]" +
+ "}";
Response r = client().post(PATH, edgeLabel);
assertResponseStatus(201, r);
@@ -119,14 +119,14 @@ public class EdgeLabelApiTest extends BaseApiTest {
@Test
public void testDelete() {
String edgeLabel = "{" +
- "\"name\": \"created\"," +
- "\"source_label\": \"person\"," +
- "\"target_label\": \"software\"," +
- "\"frequency\": \"SINGLE\"," +
- "\"properties\":[\"date\", \"city\"]," +
- "\"nullable_keys\":[\"city\"]," +
- "\"sort_keys\":[]" +
- "}";
+ "\"name\": \"created\"," +
+ "\"source_label\": \"person\"," +
+ "\"target_label\": \"software\"," +
+ "\"frequency\": \"SINGLE\"," +
+ "\"properties\":[\"date\", \"city\"]," +
+ "\"nullable_keys\":[\"city\"]," +
+ "\"sort_keys\":[]" +
+ "}";
Response r = client().post(PATH, edgeLabel);
assertResponseStatus(201, r);
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/GremlinApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/GremlinApiTest.java
index e9f2c7388..612914177 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/GremlinApiTest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/GremlinApiTest.java
@@ -20,14 +20,14 @@ package org.apache.hugegraph.api;
import java.util.List;
import java.util.Map;
-import jakarta.ws.rs.core.Response;
-
+import org.apache.hugegraph.testutil.Assert;
import org.junit.Assume;
import org.junit.Test;
-import org.apache.hugegraph.testutil.Assert;
import com.google.common.collect.ImmutableMap;
+import jakarta.ws.rs.core.Response;
+
public class GremlinApiTest extends BaseApiTest {
private static String path = "/gremlin";
@@ -35,17 +35,17 @@ public class GremlinApiTest extends BaseApiTest {
@Test
public void testPost() {
String body = "{" +
- "\"gremlin\":\"g.V()\"," +
- "\"bindings\":{}," +
- "\"language\":\"gremlin-groovy\"," +
- "\"aliases\":{\"g\":\"__g_hugegraph\"}}";
+ "\"gremlin\":\"g.V()\"," +
+ "\"bindings\":{}," +
+ "\"language\":\"gremlin-groovy\"," +
+ "\"aliases\":{\"g\":\"__g_hugegraph\"}}";
assertResponseStatus(200, client().post(path, body));
}
@Test
public void testGet() {
Map<String, Object> params = ImmutableMap.of("gremlin",
- "hugegraph.traversal().V()");
+ "hugegraph.traversal().V()");
Response r = client().get(path, params);
Assert.assertEquals(r.readEntity(String.class), 200, r.getStatus());
}
@@ -53,29 +53,30 @@ public class GremlinApiTest extends BaseApiTest {
@Test
public void testScript() {
String bodyTemplate = "{" +
- "\"gremlin\":\"%s\"," +
- "\"bindings\":{}," +
- "\"language\":\"gremlin-groovy\"," +
- "\"aliases\":{\"g\":\"__g_hugegraph\"}}";
+ "\"gremlin\":\"%s\"," +
+ "\"bindings\":{}," +
+ "\"language\":\"gremlin-groovy\"," +
+ "\"aliases\":{\"g\":\"__g_hugegraph\"}}";
String script = "schema=hugegraph.schema();" +
- "schema.propertyKey('name').asText().ifNotExist().create();" +
- "schema.propertyKey('age').asInt().ifNotExist().create();" +
- "schema.propertyKey('city').asUUID().ifNotExist().create();" +
- "schema.propertyKey('lang').asText().ifNotExist().create();" +
- "schema.propertyKey('date').asText().ifNotExist().create();" +
- "schema.propertyKey('price').asInt().ifNotExist().create();" +
- "person=schema.vertexLabel('person').properties('name','age','city')." +
- "useCustomizeUuidId().ifNotExist().create();" +
- "knows=schema.edgeLabel('knows').sourceLabel('person').targetLabel('person')." +
- "properties('date').ifNotExist().create();" +
- "marko=hugegraph.addVertex(T.id,'835e1153928149578691cf79258e90eb'" +
- ",T.label,'person','name','marko','age',29," +
- "'city','135e1153928149578691cf79258e90eb');" +
- "vadas=hugegraph.addVertex(T.id,'935e1153928149578691cf79258e90eb'" +
- ",T.label,'person','name','vadas','age',27," +
- "'city','235e1153928149578691cf79258e90eb');" +
- "marko.addEdge('knows',vadas,'date','20160110');";
+ "schema.propertyKey('name').asText().ifNotExist().create();" +
+ "schema.propertyKey('age').asInt().ifNotExist().create();" +
+ "schema.propertyKey('city').asUUID().ifNotExist().create();" +
+ "schema.propertyKey('lang').asText().ifNotExist().create();" +
+ "schema.propertyKey('date').asText().ifNotExist().create();" +
+ "schema.propertyKey('price').asInt().ifNotExist().create();" +
+ "person=schema.vertexLabel('person').properties('name','age','city')." +
+ "useCustomizeUuidId().ifNotExist().create();" +
+ "knows=schema.edgeLabel('knows').sourceLabel('person').targetLabel" +
+ "('person')." +
+ "properties('date').ifNotExist().create();" +
+ "marko=hugegraph.addVertex(T.id,'835e1153928149578691cf79258e90eb'" +
+ ",T.label,'person','name','marko','age',29," +
+ "'city','135e1153928149578691cf79258e90eb');" +
+ "vadas=hugegraph.addVertex(T.id,'935e1153928149578691cf79258e90eb'" +
+ ",T.label,'person','name','vadas','age',27," +
+ "'city','235e1153928149578691cf79258e90eb');" +
+ "marko.addEdge('knows',vadas,'date','20160110');";
String body = String.format(bodyTemplate, script);
assertResponseStatus(200, client().post(path, body));
@@ -91,51 +92,51 @@ public class GremlinApiTest extends BaseApiTest {
@Test
public void testClearAndInit() {
String body = "{" +
- "\"gremlin\":\"hugegraph.backendStoreFeatures()" +
- " .supportsSharedStorage();\"," +
- "\"bindings\":{}," +
- "\"language\":\"gremlin-groovy\"," +
- "\"aliases\":{\"g\":\"__g_hugegraph\"}}";
+ "\"gremlin\":\"hugegraph.backendStoreFeatures()" +
+ " .supportsSharedStorage();\"," +
+ "\"bindings\":{}," +
+ "\"language\":\"gremlin-groovy\"," +
+ "\"aliases\":{\"g\":\"__g_hugegraph\"}}";
String content = assertResponseStatus(200, client().post(path, body));
Map<?, ?> result = assertJsonContains(content, "result");
- @SuppressWarnings({ "unchecked" })
+ @SuppressWarnings({"unchecked"})
Object data = ((List<Object>) assertMapContains(result, "data")).get(0);
boolean supportsSharedStorage = (boolean) data;
Assume.assumeTrue("Can't clear non-shared-storage backend",
supportsSharedStorage);
body = "{" +
- "\"gremlin\":\"" +
- " if (!hugegraph.backendStoreFeatures()" +
- " .supportsSharedStorage())" +
- " return;" +
- " def auth = hugegraph.hugegraph().authManager();" +
- " def admin = auth.findUser('admin');" +
- " hugegraph.clearBackend();" +
- " hugegraph.initBackend();" +
- " auth.createUser(admin);\"," +
- "\"bindings\":{}," +
- "\"language\":\"gremlin-groovy\"," +
- "\"aliases\":{\"g\":\"__g_hugegraph\"}}";
+ "\"gremlin\":\"" +
+ " if (!hugegraph.backendStoreFeatures()" +
+ " .supportsSharedStorage())" +
+ " return;" +
+ " def auth = hugegraph.hugegraph().authManager();" +
+ " def admin = auth.findUser('admin');" +
+ " hugegraph.clearBackend();" +
+ " hugegraph.initBackend();" +
+ " auth.createUser(admin);\"," +
+ "\"bindings\":{}," +
+ "\"language\":\"gremlin-groovy\"," +
+ "\"aliases\":{\"g\":\"__g_hugegraph\"}}";
assertResponseStatus(200, client().post(path, body));
body = "{" +
- "\"gremlin\":\"hugegraph.serverStarted(" +
- " GlobalMasterInfo.master('server1'))\"," +
- "\"bindings\":{}," +
- "\"language\":\"gremlin-groovy\"," +
- "\"aliases\":{\"g\":\"__g_hugegraph\"}}";
+ "\"gremlin\":\"hugegraph.serverStarted(" +
+ " GlobalMasterInfo.master('server1'))\"," +
+ "\"bindings\":{}," +
+ "\"language\":\"gremlin-groovy\"," +
+ "\"aliases\":{\"g\":\"__g_hugegraph\"}}";
assertResponseStatus(200, client().post(path, body));
}
@Test
public void testTruncate() {
String body = "{" +
- "\"gremlin\":\"try {hugegraph.truncateBackend()} " +
- "catch (UnsupportedOperationException e) {}\"," +
- "\"bindings\":{}," +
- "\"language\":\"gremlin-groovy\"," +
- "\"aliases\":{\"g\":\"__g_hugegraph\"}}";
+ "\"gremlin\":\"try {hugegraph.truncateBackend()} " +
+ "catch (UnsupportedOperationException e) {}\"," +
+ "\"bindings\":{}," +
+ "\"language\":\"gremlin-groovy\"," +
+ "\"aliases\":{\"g\":\"__g_hugegraph\"}}";
assertResponseStatus(200, client().post(path, body));
}
@@ -144,78 +145,78 @@ public class GremlinApiTest extends BaseApiTest {
String pkPath = "/graphs/hugegraph/schema/propertykeys/";
// Cardinality single
String foo = "{" +
- "\"name\": \"foo\"," +
- "\"data_type\": \"TEXT\"," +
- "\"cardinality\": \"SINGLE\"," +
- "\"properties\":[]" +
- "}";
+ "\"name\": \"foo\"," +
+ "\"data_type\": \"TEXT\"," +
+ "\"cardinality\": \"SINGLE\"," +
+ "\"properties\":[]" +
+ "}";
assertResponseStatus(202, client().post(pkPath, foo));
// Cardinality list
String bar = "{" +
- "\"name\": \"bar\"," +
- "\"data_type\": \"TEXT\"," +
- "\"cardinality\": \"LIST\"," +
- "\"properties\":[]" +
- "}";
+ "\"name\": \"bar\"," +
+ "\"data_type\": \"TEXT\"," +
+ "\"cardinality\": \"LIST\"," +
+ "\"properties\":[]" +
+ "}";
assertResponseStatus(202, client().post(pkPath, bar));
String vlPath = "/graphs/hugegraph/schema/vertexlabels/";
String vertexLabel = "{" +
- "\"name\": \"person\"," +
- "\"id_strategy\": \"CUSTOMIZE_STRING\"," +
- "\"properties\": [\"foo\", \"bar\"]" +
- "}";
+ "\"name\": \"person\"," +
+ "\"id_strategy\": \"CUSTOMIZE_STRING\"," +
+ "\"properties\": [\"foo\", \"bar\"]" +
+ "}";
assertResponseStatus(201, client().post(vlPath, vertexLabel));
// Not supply cardinality
String body = "{" +
- "\"gremlin\":\"g.addV('person').property(T.id, '1')" +
- ".property('foo', '123').property('bar', '123')\"," +
- "\"bindings\":{}," +
- "\"language\":\"gremlin-groovy\"," +
- "\"aliases\":{\"g\":\"__g_hugegraph\"}}";
+ "\"gremlin\":\"g.addV('person').property(T.id, '1')" +
+ ".property('foo', '123').property('bar', '123')\"," +
+ "\"bindings\":{}," +
+ "\"language\":\"gremlin-groovy\"," +
+ "\"aliases\":{\"g\":\"__g_hugegraph\"}}";
assertResponseStatus(200, client().post(path, body));
// Supply matched cardinality
body = "{\"gremlin\":\"g.addV('person').property(T.id, '1')" +
- ".property(single, 'foo', '123')" +
- ".property(list, 'bar', '123')\"," +
- "\"bindings\":{}," +
- "\"language\":\"gremlin-groovy\"," +
- "\"aliases\":{\"g\":\"__g_hugegraph\"}}";
+ ".property(single, 'foo', '123')" +
+ ".property(list, 'bar', '123')\"," +
+ "\"bindings\":{}," +
+ "\"language\":\"gremlin-groovy\"," +
+ "\"aliases\":{\"g\":\"__g_hugegraph\"}}";
assertResponseStatus(200, client().post(path, body));
// Supply unmatch cardinality
body = "{\"gremlin\":\"g.addV('person').property(T.id, '1')" +
- ".property(list, 'foo', '123')" +
- ".property(list, 'bar', '123')\"," +
- "\"bindings\":{}," +
- "\"language\":\"gremlin-groovy\"," +
- "\"aliases\":{\"g\":\"__g_hugegraph\"}}";
+ ".property(list, 'foo', '123')" +
+ ".property(list, 'bar', '123')\"," +
+ "\"bindings\":{}," +
+ "\"language\":\"gremlin-groovy\"," +
+ "\"aliases\":{\"g\":\"__g_hugegraph\"}}";
assertResponseStatus(400, client().post(path, body));
// NOTE: supply unmatch cardinality, but we give up the check
body = "{\"gremlin\":\"g.addV('person').property(T.id, '1')" +
- ".property(single, 'foo', '123')" +
- ".property(single, 'bar', '123')\"," +
- "\"bindings\":{}," +
- "\"language\":\"gremlin-groovy\"," +
- "\"aliases\":{\"g\":\"__g_hugegraph\"}}";
+ ".property(single, 'foo', '123')" +
+ ".property(single, 'bar', '123')\"," +
+ "\"bindings\":{}," +
+ "\"language\":\"gremlin-groovy\"," +
+ "\"aliases\":{\"g\":\"__g_hugegraph\"}}";
assertResponseStatus(200, client().post(path, body));
}
@Test
public void testFileSerialize() {
String body = "{" +
- "\"gremlin\":\"File file = new File('test.text')\"," +
- "\"bindings\":{}," +
- "\"language\":\"gremlin-groovy\"," +
- "\"aliases\":{\"g\":\"__g_hugegraph\"}}";
+ "\"gremlin\":\"File file = new File('test.text')\"," +
+ "\"bindings\":{}," +
+ "\"language\":\"gremlin-groovy\"," +
+ "\"aliases\":{\"g\":\"__g_hugegraph\"}}";
Response r = client().post(path, body);
String content = r.readEntity(String.class);
Assert.assertTrue(content, r.getStatus() == 200);
Map<?, ?> result = assertJsonContains(content, "result");
- @SuppressWarnings({ "unchecked", "rawtypes" })
+ @SuppressWarnings({"unchecked", "rawtypes"})
Map data = ((List<Map>) assertMapContains(result, "data")).get(0);
Assert.assertEquals("test.text", data.get("file"));
}
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/IndexLabelApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/IndexLabelApiTest.java
index 37a14bb91..5b232c5e1 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/IndexLabelApiTest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/IndexLabelApiTest.java
@@ -40,12 +40,12 @@ public class IndexLabelApiTest extends BaseApiTest {
@Test
public void testCreate() {
String indexLabel = "{" +
- "\"name\": \"personByAge\"," +
- "\"base_type\": \"VERTEX_LABEL\"," +
- "\"base_value\": \"person\"," +
- "\"index_type\": \"RANGE\"," +
- "\"fields\":[\"age\"]" +
- "}";
+ "\"name\": \"personByAge\"," +
+ "\"base_type\": \"VERTEX_LABEL\"," +
+ "\"base_value\": \"person\"," +
+ "\"index_type\": \"RANGE\"," +
+ "\"fields\":[\"age\"]" +
+ "}";
Response r = client().post(PATH, indexLabel);
assertResponseStatus(202, r);
}
@@ -53,23 +53,23 @@ public class IndexLabelApiTest extends BaseApiTest {
@Test
public void testAppend() {
String indexLabel = "{" +
- "\"name\": \"personByAge\"," +
- "\"base_type\": \"VERTEX_LABEL\"," +
- "\"base_value\": \"person\"," +
- "\"index_type\": \"RANGE\"," +
- "\"fields\":[\"age\"]" +
- "}";
+ "\"name\": \"personByAge\"," +
+ "\"base_type\": \"VERTEX_LABEL\"," +
+ "\"base_value\": \"person\"," +
+ "\"index_type\": \"RANGE\"," +
+ "\"fields\":[\"age\"]" +
+ "}";
Response r = client().post(PATH, indexLabel);
assertResponseStatus(202, r);
indexLabel = "{" +
- "\"name\": \"personByAge\"," +
- "\"user_data\": {" +
- "\"min\": 0," +
- "\"max\": 100" +
- "}" +
- "}";
+ "\"name\": \"personByAge\"," +
+ "\"user_data\": {" +
+ "\"min\": 0," +
+ "\"max\": 100" +
+ "}" +
+ "}";
Map<String, Object> params = ImmutableMap.of("action", "append");
r = client().put(PATH, "personByAge", indexLabel, params);
assertResponseStatus(200, r);
@@ -78,25 +78,25 @@ public class IndexLabelApiTest extends BaseApiTest {
@Test
public void testEliminate() {
String indexLabel = "{" +
- "\"name\": \"personByAge\"," +
- "\"base_type\": \"VERTEX_LABEL\"," +
- "\"base_value\": \"person\"," +
- "\"index_type\": \"RANGE\"," +
- "\"fields\":[\"age\"]," +
- "\"user_data\": {" +
- "\"min\": 0," +
- "\"max\": 100" +
- "}" +
- "}";
+ "\"name\": \"personByAge\"," +
+ "\"base_type\": \"VERTEX_LABEL\"," +
+ "\"base_value\": \"person\"," +
+ "\"index_type\": \"RANGE\"," +
+ "\"fields\":[\"age\"]," +
+ "\"user_data\": {" +
+ "\"min\": 0," +
+ "\"max\": 100" +
+ "}" +
+ "}";
Response r = client().post(PATH, indexLabel);
assertResponseStatus(202, r);
indexLabel = "{" +
- "\"name\": \"personByAge\"," +
- "\"user_data\": {" +
- "\"min\": 0" +
- "}" +
- "}";
+ "\"name\": \"personByAge\"," +
+ "\"user_data\": {" +
+ "\"min\": 0" +
+ "}" +
+ "}";
Map<String, Object> params = ImmutableMap.of("action", "eliminate");
r = client().put(PATH, "personByAge", indexLabel, params);
assertResponseStatus(200, r);
@@ -105,12 +105,12 @@ public class IndexLabelApiTest extends BaseApiTest {
@Test
public void testGet() {
String indexLabel = "{" +
- "\"name\": \"personByAge\"," +
- "\"base_type\": \"VERTEX_LABEL\"," +
- "\"base_value\": \"person\"," +
- "\"index_type\": \"RANGE\"," +
- "\"fields\":[\"age\"]" +
- "}";
+ "\"name\": \"personByAge\"," +
+ "\"base_type\": \"VERTEX_LABEL\"," +
+ "\"base_value\": \"person\"," +
+ "\"index_type\": \"RANGE\"," +
+ "\"fields\":[\"age\"]" +
+ "}";
Response r = client().post(PATH, indexLabel);
assertResponseStatus(202, r);
@@ -122,12 +122,12 @@ public class IndexLabelApiTest extends BaseApiTest {
@Test
public void testList() {
String indexLabel = "{" +
- "\"name\": \"personByAge\"," +
- "\"base_type\": \"VERTEX_LABEL\"," +
- "\"base_value\": \"person\"," +
- "\"index_type\": \"RANGE\"," +
- "\"fields\":[\"age\"]" +
- "}";
+ "\"name\": \"personByAge\"," +
+ "\"base_type\": \"VERTEX_LABEL\"," +
+ "\"base_value\": \"person\"," +
+ "\"index_type\": \"RANGE\"," +
+ "\"fields\":[\"age\"]" +
+ "}";
Response r = client().post(PATH, indexLabel);
assertResponseStatus(202, r);
@@ -138,12 +138,12 @@ public class IndexLabelApiTest extends BaseApiTest {
@Test
public void testDelete() {
String indexLabel = "{" +
- "\"name\": \"personByAge\"," +
- "\"base_type\": \"VERTEX_LABEL\"," +
- "\"base_value\": \"person\"," +
- "\"index_type\": \"RANGE\"," +
- "\"fields\":[\"age\"]" +
- "}";
+ "\"name\": \"personByAge\"," +
+ "\"base_type\": \"VERTEX_LABEL\"," +
+ "\"base_value\": \"person\"," +
+ "\"index_type\": \"RANGE\"," +
+ "\"fields\":[\"age\"]" +
+ "}";
Response r = client().post(PATH, indexLabel);
assertResponseStatus(202, r);
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/LoginApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/LoginApiTest.java
index 6b4563cd5..b323efa36 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/LoginApiTest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/LoginApiTest.java
@@ -42,7 +42,8 @@ public class LoginApiTest extends BaseApiTest {
@Before
public void setup() {
Response r = this.createUser("test", "test");
- Map<String, Object> user = r.readEntity(new GenericType<Map<String, Object>>(){});
+ Map<String, Object> user = r.readEntity(new GenericType<Map<String, Object>>() {
+ });
this.userId4Test = (String) user.get("id");
}
@@ -115,7 +116,8 @@ public class LoginApiTest extends BaseApiTest {
assertJsonContains(result, "user_name");
Map<String, Object> user = JsonUtil.fromJson(result,
- new TypeReference<Map<String, Object>>(){});
+ new TypeReference<Map<String, Object>>() {
+ });
Assert.assertEquals(this.userId4Test, user.get("user_id"));
Assert.assertEquals("test", user.get("user_name"));
@@ -157,7 +159,8 @@ public class LoginApiTest extends BaseApiTest {
private String tokenFromResponse(String content) {
Map<String, Object> data = JsonUtil.fromJson(content,
- new TypeReference<Map<String, Object>>(){});
+ new TypeReference<Map<String, Object>>() {
+ });
return (String) data.get("token");
}
}
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/ProjectApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/ProjectApiTest.java
index 8c2b1ad89..e48f9f50a 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/ProjectApiTest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/ProjectApiTest.java
@@ -206,11 +206,11 @@ public class ProjectApiTest extends BaseApiTest {
Assert.assertEquals(desc, description);
}
Assert.assertFalse(StringUtils.isEmpty(
- assertJsonContains(respBody, "project_target")));
+ assertJsonContains(respBody, "project_target")));
Assert.assertFalse(StringUtils.isEmpty(
- assertJsonContains(respBody, "project_admin_group")));
+ assertJsonContains(respBody, "project_admin_group")));
Assert.assertFalse(StringUtils.isEmpty(
- assertJsonContains(respBody, "project_op_group")));
+ assertJsonContains(respBody, "project_op_group")));
return respBody;
}
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/PropertyKeyApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/PropertyKeyApiTest.java
index 0b2531866..662a643b1 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/PropertyKeyApiTest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/PropertyKeyApiTest.java
@@ -29,11 +29,11 @@ public class PropertyKeyApiTest extends BaseApiTest {
@Test
public void testCreate() {
String propertyKey = "{" +
- "\"name\": \"id\"," +
- "\"data_type\": \"TEXT\"," +
- "\"cardinality\": \"SINGLE\"," +
- "\"properties\":[]" +
- "}";
+ "\"name\": \"id\"," +
+ "\"data_type\": \"TEXT\"," +
+ "\"cardinality\": \"SINGLE\"," +
+ "\"properties\":[]" +
+ "}";
Response r = client().post(PATH, propertyKey);
assertResponseStatus(202, r);
}
@@ -41,11 +41,11 @@ public class PropertyKeyApiTest extends BaseApiTest {
@Test
public void testGet() {
String propertyKey = "{" +
- "\"name\": \"id\"," +
- "\"data_type\": \"TEXT\"," +
- "\"cardinality\": \"SINGLE\"," +
- "\"properties\":[]" +
- "}";
+ "\"name\": \"id\"," +
+ "\"data_type\": \"TEXT\"," +
+ "\"cardinality\": \"SINGLE\"," +
+ "\"properties\":[]" +
+ "}";
Response r = client().post(PATH, propertyKey);
assertResponseStatus(202, r);
@@ -57,11 +57,11 @@ public class PropertyKeyApiTest extends BaseApiTest {
@Test
public void testList() {
String propertyKey = "{" +
- "\"name\": \"id\"," +
- "\"data_type\": \"TEXT\"," +
- "\"cardinality\": \"SINGLE\"," +
- "\"properties\":[]" +
- "}";
+ "\"name\": \"id\"," +
+ "\"data_type\": \"TEXT\"," +
+ "\"cardinality\": \"SINGLE\"," +
+ "\"properties\":[]" +
+ "}";
Response r = client().post(PATH, propertyKey);
assertResponseStatus(202, r);
@@ -72,11 +72,11 @@ public class PropertyKeyApiTest extends BaseApiTest {
@Test
public void testDelete() {
String propertyKey = "{" +
- "\"name\": \"id\"," +
- "\"data_type\": \"TEXT\"," +
- "\"cardinality\": \"SINGLE\"," +
- "\"properties\":[]" +
- "}";
+ "\"name\": \"id\"," +
+ "\"data_type\": \"TEXT\"," +
+ "\"cardinality\": \"SINGLE\"," +
+ "\"properties\":[]" +
+ "}";
Response r = client().post(PATH, propertyKey);
assertResponseStatus(202, r);
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/TaskApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/TaskApiTest.java
index 322adb4db..3800ebb30 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/TaskApiTest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/TaskApiTest.java
@@ -137,17 +137,17 @@ public class TaskApiTest extends BaseApiTest {
String rebuildPath = "/graphs/hugegraph/jobs/rebuild/indexlabels";
String personByCity = "personByCity";
Map<String, Object> params = ImmutableMap.of();
- Response r = client().put(rebuildPath, personByCity, "", params);
+ Response r = client().put(rebuildPath, personByCity, "", params);
String content = assertResponseStatus(202, r);
return assertJsonContains(content, "task_id");
}
private int gremlinJob() {
String body = "{" +
- "\"gremlin\":\"Thread.sleep(1000L)\"," +
- "\"bindings\":{}," +
- "\"language\":\"gremlin-groovy\"," +
- "\"aliases\":{}}";
+ "\"gremlin\":\"Thread.sleep(1000L)\"," +
+ "\"bindings\":{}," +
+ "\"language\":\"gremlin-groovy\"," +
+ "\"aliases\":{}}";
String path = "/graphs/hugegraph/jobs/gremlin";
String content = assertResponseStatus(201, client().post(path, body));
return assertJsonContains(content, "task_id");
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/UserApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/UserApiTest.java
index eef8395f9..da189cd1a 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/UserApiTest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/UserApiTest.java
@@ -43,8 +43,9 @@ public class UserApiTest extends BaseApiTest {
Response r = this.client().get(PATH, ImmutableMap.of("limit", NO_LIMIT));
String result = r.readEntity(String.class);
Map<String, List<Map<String, Object>>> resultMap =
- JsonUtil.fromJson(result,
- new TypeReference<Map<String, List<Map<String, Object>>>>() {});
+ JsonUtil.fromJson(result,
+ new TypeReference<Map<String, List<Map<String, Object>>>>() {
+ });
List<Map<String, Object>> users = resultMap.get("users");
for (Map<String, Object> user : users) {
if ("admin".equals(user.get("user_name"))) {
@@ -172,8 +173,9 @@ public class UserApiTest extends BaseApiTest {
String result = assertResponseStatus(200, r);
Map<String, List<Map<String, Object>>> resultMap =
- JsonUtil.fromJson(result,
- new TypeReference<Map<String, List<Map<String, Object>>>>() {});
+ JsonUtil.fromJson(result,
+ new TypeReference<Map<String, List<Map<String, Object>>>>() {
+ });
return resultMap.get("users");
}
}
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/VertexApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/VertexApiTest.java
index fe474c253..292fc0aa3 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/VertexApiTest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/VertexApiTest.java
@@ -37,12 +37,12 @@ public class VertexApiTest extends BaseApiTest {
@Test
public void testCreate() {
String vertex = "{" +
- "\"label\":\"person\"," +
- "\"properties\":{" +
- "\"name\":\"James\"," +
- "\"city\":\"Beijing\"," +
- "\"age\":19}" +
- "}";
+ "\"label\":\"person\"," +
+ "\"properties\":{" +
+ "\"name\":\"James\"," +
+ "\"city\":\"Beijing\"," +
+ "\"age\":19}" +
+ "}";
Response r = client().post(PATH, vertex);
assertResponseStatus(201, r);
}
@@ -50,12 +50,12 @@ public class VertexApiTest extends BaseApiTest {
@Test
public void testGet() throws IOException {
String vertex = "{" +
- "\"label\":\"person\"," +
- "\"properties\":{" +
- "\"name\":\"James\"," +
- "\"city\":\"Beijing\"," +
- "\"age\":19}" +
- "}";
+ "\"label\":\"person\"," +
+ "\"properties\":{" +
+ "\"name\":\"James\"," +
+ "\"city\":\"Beijing\"," +
+ "\"age\":19}" +
+ "}";
Response r = client().post(PATH, vertex);
String content = assertResponseStatus(201, r);
@@ -68,12 +68,12 @@ public class VertexApiTest extends BaseApiTest {
@Test
public void testList() {
String vertex = "{" +
- "\"label\":\"person\"," +
- "\"properties\":{" +
- "\"name\":\"James\"," +
- "\"city\":\"Beijing\"," +
- "\"age\":19}" +
- "}";
+ "\"label\":\"person\"," +
+ "\"properties\":{" +
+ "\"name\":\"James\"," +
+ "\"city\":\"Beijing\"," +
+ "\"age\":19}" +
+ "}";
Response r = client().post(PATH, vertex);
assertResponseStatus(201, r);
@@ -84,12 +84,12 @@ public class VertexApiTest extends BaseApiTest {
@Test
public void testDelete() throws IOException {
String vertex = "{" +
- "\"label\":\"person\"," +
- "\"properties\":{" +
- "\"name\":\"James\"," +
- "\"city\":\"Beijing\"," +
- "\"age\":19}" +
- "}";
+ "\"label\":\"person\"," +
+ "\"properties\":{" +
+ "\"name\":\"James\"," +
+ "\"city\":\"Beijing\"," +
+ "\"age\":19}" +
+ "}";
Response r = client().post(PATH, vertex);
String content = assertResponseStatus(201, r);
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/VertexLabelApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/VertexLabelApiTest.java
index d058f6c38..71c5f99d5 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/VertexLabelApiTest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/VertexLabelApiTest.java
@@ -38,12 +38,12 @@ public class VertexLabelApiTest extends BaseApiTest {
@Test
public void testCreate() {
String vertexLabel = "{" +
- "\"name\": \"person\"," +
- "\"id_strategy\": \"PRIMARY_KEY\"," +
- "\"properties\": [\"name\", \"age\", \"city\"]," +
- "\"primary_keys\":[\"name\"]," +
- "\"nullable_keys\":[\"city\"]" +
- "}";
+ "\"name\": \"person\"," +
+ "\"id_strategy\": \"PRIMARY_KEY\"," +
+ "\"properties\": [\"name\", \"age\", \"city\"]," +
+ "\"primary_keys\":[\"name\"]," +
+ "\"nullable_keys\":[\"city\"]" +
+ "}";
Response r = client().post(PATH, vertexLabel);
assertResponseStatus(201, r);
}
@@ -51,22 +51,22 @@ public class VertexLabelApiTest extends BaseApiTest {
@Test
public void testAppend() {
String vertexLabel = "{" +
- "\"name\": \"person\"," +
- "\"id_strategy\": \"PRIMARY_KEY\"," +
- "\"properties\": [\"name\", \"age\", \"city\"]," +
- "\"primary_keys\":[\"name\"]," +
- "\"nullable_keys\":[\"city\"]" +
- "}";
+ "\"name\": \"person\"," +
+ "\"id_strategy\": \"PRIMARY_KEY\"," +
+ "\"properties\": [\"name\", \"age\", \"city\"]," +
+ "\"primary_keys\":[\"name\"]," +
+ "\"nullable_keys\":[\"city\"]" +
+ "}";
Response r = client().post(PATH, vertexLabel);
assertResponseStatus(201, r);
vertexLabel = "{" +
- "\"name\": \"person\"," +
- "\"id_strategy\":\"DEFAULT\"," +
- "\"properties\":[\"lang\"]," +
- "\"primary_keys\":[]," +
- "\"nullable_keys\":[\"lang\"]" +
- "}";
+ "\"name\": \"person\"," +
+ "\"id_strategy\":\"DEFAULT\"," +
+ "\"properties\":[\"lang\"]," +
+ "\"primary_keys\":[]," +
+ "\"nullable_keys\":[\"lang\"]" +
+ "}";
Map<String, Object> params = ImmutableMap.of("action", "append");
r = client().put(PATH, "person", vertexLabel, params);
assertResponseStatus(200, r);
@@ -75,12 +75,12 @@ public class VertexLabelApiTest extends BaseApiTest {
@Test
public void testGet() {
String vertexLabel = "{" +
- "\"name\": \"person\"," +
- "\"id_strategy\": \"PRIMARY_KEY\"," +
- "\"properties\": [\"name\", \"age\", \"city\"]," +
- "\"primary_keys\":[\"name\"]," +
- "\"nullable_keys\":[\"city\"]" +
- "}";
+ "\"name\": \"person\"," +
+ "\"id_strategy\": \"PRIMARY_KEY\"," +
+ "\"properties\": [\"name\", \"age\", \"city\"]," +
+ "\"primary_keys\":[\"name\"]," +
+ "\"nullable_keys\":[\"city\"]" +
+ "}";
Response r = client().post(PATH, vertexLabel);
assertResponseStatus(201, r);
@@ -92,12 +92,12 @@ public class VertexLabelApiTest extends BaseApiTest {
@Test
public void testList() {
String vertexLabel = "{" +
- "\"name\": \"person\"," +
- "\"id_strategy\": \"PRIMARY_KEY\"," +
- "\"properties\": [\"name\", \"age\", \"city\"]," +
- "\"primary_keys\":[\"name\"]," +
- "\"nullable_keys\":[\"city\"]" +
- "}";
+ "\"name\": \"person\"," +
+ "\"id_strategy\": \"PRIMARY_KEY\"," +
+ "\"properties\": [\"name\", \"age\", \"city\"]," +
+ "\"primary_keys\":[\"name\"]," +
+ "\"nullable_keys\":[\"city\"]" +
+ "}";
Response r = client().post(PATH, vertexLabel);
assertResponseStatus(201, r);
@@ -108,12 +108,12 @@ public class VertexLabelApiTest extends BaseApiTest {
@Test
public void testDelete() {
String vertexLabel = "{" +
- "\"name\": \"person\"," +
- "\"id_strategy\": \"PRIMARY_KEY\"," +
- "\"properties\": [\"name\", \"age\", \"city\"]," +
- "\"primary_keys\":[\"name\"]," +
- "\"nullable_keys\":[\"city\"]" +
- "}";
+ "\"name\": \"person\"," +
+ "\"id_strategy\": \"PRIMARY_KEY\"," +
+ "\"properties\": [\"name\", \"age\", \"city\"]," +
+ "\"primary_keys\":[\"name\"]," +
+ "\"nullable_keys\":[\"city\"]" +
+ "}";
Response r = client().post(PATH, vertexLabel);
assertResponseStatus(201, r);
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/AdamicAdarAPITest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/AdamicAdarAPITest.java
index 51d3b0f05..8d93e8412 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/AdamicAdarAPITest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/AdamicAdarAPITest.java
@@ -19,14 +19,14 @@ package org.apache.hugegraph.api.traversers;
import java.util.Map;
-import jakarta.ws.rs.core.Response;
-
+import org.apache.hugegraph.api.BaseApiTest;
import org.junit.Before;
import org.junit.Test;
-import org.apache.hugegraph.api.BaseApiTest;
import com.google.common.collect.ImmutableMap;
+import jakarta.ws.rs.core.Response;
+
public class AdamicAdarAPITest extends BaseApiTest {
private static final String PATH = TRAVERSERS_API + "/adamicadar";
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/AllShortestPathsApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/AllShortestPathsApiTest.java
index e89728eb4..b17cd5f97 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/AllShortestPathsApiTest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/AllShortestPathsApiTest.java
@@ -20,11 +20,11 @@ package org.apache.hugegraph.api.traversers;
import java.util.List;
import java.util.Map;
+import org.apache.hugegraph.api.BaseApiTest;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import org.apache.hugegraph.api.BaseApiTest;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/CountApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/CountApiTest.java
index a42ecd465..cf75f51ee 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/CountApiTest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/CountApiTest.java
@@ -17,12 +17,12 @@
package org.apache.hugegraph.api.traversers;
-import jakarta.ws.rs.core.Response;
+import org.apache.hugegraph.api.BaseApiTest;
+import org.apache.hugegraph.testutil.Assert;
import org.junit.Before;
import org.junit.Test;
-import org.apache.hugegraph.api.BaseApiTest;
-import org.apache.hugegraph.testutil.Assert;
+import jakarta.ws.rs.core.Response;
public class CountApiTest extends BaseApiTest {
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/CrosspointsApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/CrosspointsApiTest.java
index 028f60e67..eb59c2d79 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/CrosspointsApiTest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/CrosspointsApiTest.java
@@ -20,14 +20,15 @@ package org.apache.hugegraph.api.traversers;
import java.util.List;
import java.util.Map;
-import jakarta.ws.rs.core.Response;
+import org.apache.hugegraph.api.BaseApiTest;
+import org.apache.hugegraph.testutil.Assert;
import org.junit.Before;
import org.junit.Test;
-import org.apache.hugegraph.api.BaseApiTest;
-import org.apache.hugegraph.testutil.Assert;
import com.google.common.collect.ImmutableMap;
+import jakarta.ws.rs.core.Response;
+
public class CrosspointsApiTest extends BaseApiTest {
public static String path = TRAVERSERS_API + "/crosspoints";
@@ -54,7 +55,7 @@ public class CrosspointsApiTest extends BaseApiTest {
Response r = client().get(path, params);
String content = assertResponseStatus(200, r);
List<Map<String, Object>> crosspoints = assertJsonContains(
- content, "crosspoints");
+ content, "crosspoints");
Assert.assertEquals(2, crosspoints.size());
}
}
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/CustomizedCrosspointsApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/CustomizedCrosspointsApiTest.java
index a53e9195b..076200880 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/CustomizedCrosspointsApiTest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/CustomizedCrosspointsApiTest.java
@@ -20,12 +20,12 @@ package org.apache.hugegraph.api.traversers;
import java.util.List;
import java.util.Map;
-import jakarta.ws.rs.core.Response;
+import org.apache.hugegraph.api.BaseApiTest;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import org.apache.hugegraph.api.BaseApiTest;
+import jakarta.ws.rs.core.Response;
public class CustomizedCrosspointsApiTest extends BaseApiTest {
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/EdgesApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/EdgesApiTest.java
index 4f6124f19..34915f040 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/EdgesApiTest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/EdgesApiTest.java
@@ -20,15 +20,16 @@ package org.apache.hugegraph.api.traversers;
import java.util.List;
import java.util.Map;
-import jakarta.ws.rs.core.Response;
+import org.apache.hugegraph.api.BaseApiTest;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import org.apache.hugegraph.api.BaseApiTest;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMultimap;
+import jakarta.ws.rs.core.Response;
+
public class EdgesApiTest extends BaseApiTest {
static final String EDGE_PATH = TRAVERSERS_API + "/edges";
@@ -50,8 +51,8 @@ public class EdgesApiTest extends BaseApiTest {
final String edgeGetPath = "graphs/hugegraph/graph/edges";
String vadasId = name2Ids.get("vadas");
Map<String, Object> params = ImmutableMap.of(
- "vertex_id", id2Json(vadasId),
- "direction", "IN");
+ "vertex_id", id2Json(vadasId),
+ "direction", "IN");
Response r = client().get(edgeGetPath, params);
String content = assertResponseStatus(200, r);
List<Map<?, ?>> edges = assertJsonContains(content, "edges");
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/FusiformSimilarityApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/FusiformSimilarityApiTest.java
index 602bc74b8..2ebee13ab 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/FusiformSimilarityApiTest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/FusiformSimilarityApiTest.java
@@ -20,12 +20,12 @@ package org.apache.hugegraph.api.traversers;
import java.util.List;
import java.util.Map;
-import jakarta.ws.rs.core.Response;
+import org.apache.hugegraph.api.BaseApiTest;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import org.apache.hugegraph.api.BaseApiTest;
+import jakarta.ws.rs.core.Response;
public class FusiformSimilarityApiTest extends BaseApiTest {
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/MultiNodeShortestPathApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/MultiNodeShortestPathApiTest.java
index aa1703f6f..f77debbd7 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/MultiNodeShortestPathApiTest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/MultiNodeShortestPathApiTest.java
@@ -20,12 +20,12 @@ package org.apache.hugegraph.api.traversers;
import java.util.List;
import java.util.Map;
-import jakarta.ws.rs.core.Response;
+import org.apache.hugegraph.api.BaseApiTest;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import org.apache.hugegraph.api.BaseApiTest;
+import jakarta.ws.rs.core.Response;
public class MultiNodeShortestPathApiTest extends BaseApiTest {
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/NeighborRankApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/NeighborRankApiTest.java
index f6d6f826d..3b79bb396 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/NeighborRankApiTest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/NeighborRankApiTest.java
@@ -20,12 +20,12 @@ package org.apache.hugegraph.api.traversers;
import java.util.List;
import java.util.Map;
-import jakarta.ws.rs.core.Response;
+import org.apache.hugegraph.api.BaseApiTest;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import org.apache.hugegraph.api.BaseApiTest;
+import jakarta.ws.rs.core.Response;
public class NeighborRankApiTest extends BaseApiTest {
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/PathsApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/PathsApiTest.java
index b332effdb..39cf23880 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/PathsApiTest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/PathsApiTest.java
@@ -20,15 +20,15 @@ package org.apache.hugegraph.api.traversers;
import java.util.List;
import java.util.Map;
-import jakarta.ws.rs.core.Response;
+import org.apache.hugegraph.api.BaseApiTest;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import org.apache.hugegraph.api.BaseApiTest;
-
import com.google.common.collect.ImmutableMap;
+import jakarta.ws.rs.core.Response;
+
public class PathsApiTest extends BaseApiTest {
static final String PATH = TRAVERSERS_API + "/paths";
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/PersonalRankApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/PersonalRankApiTest.java
index 71e1a7525..8ab44ad18 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/PersonalRankApiTest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/PersonalRankApiTest.java
@@ -19,11 +19,11 @@ package org.apache.hugegraph.api.traversers;
import java.util.Map;
-import jakarta.ws.rs.core.Response;
+import org.apache.hugegraph.api.BaseApiTest;
import org.junit.Before;
import org.junit.Test;
-import org.apache.hugegraph.api.BaseApiTest;
+import jakarta.ws.rs.core.Response;
public class PersonalRankApiTest extends BaseApiTest {
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/ResourceAllocationAPITest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/ResourceAllocationAPITest.java
index bdfd0462c..d603a0775 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/ResourceAllocationAPITest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/ResourceAllocationAPITest.java
@@ -19,14 +19,14 @@ package org.apache.hugegraph.api.traversers;
import java.util.Map;
-import jakarta.ws.rs.core.Response;
-
+import org.apache.hugegraph.api.BaseApiTest;
import org.junit.Before;
import org.junit.Test;
-import org.apache.hugegraph.api.BaseApiTest;
import com.google.common.collect.ImmutableMap;
+import jakarta.ws.rs.core.Response;
+
public class ResourceAllocationAPITest extends BaseApiTest {
private static final String PATH = TRAVERSERS_API + "/resourceallocation";
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/RingsApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/RingsApiTest.java
index 9cf02a309..154b1b019 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/RingsApiTest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/RingsApiTest.java
@@ -20,14 +20,15 @@ package org.apache.hugegraph.api.traversers;
import java.util.List;
import java.util.Map;
-import jakarta.ws.rs.core.Response;
+import org.apache.hugegraph.api.BaseApiTest;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import org.apache.hugegraph.api.BaseApiTest;
import com.google.common.collect.ImmutableMap;
+import jakarta.ws.rs.core.Response;
+
public class RingsApiTest extends BaseApiTest {
static final String PATH = TRAVERSERS_API + "/rings";
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/ShortestPathApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/ShortestPathApiTest.java
index 3bd70255b..9a613d1cb 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/ShortestPathApiTest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/ShortestPathApiTest.java
@@ -20,15 +20,16 @@ package org.apache.hugegraph.api.traversers;
import java.util.List;
import java.util.Map;
-import jakarta.ws.rs.core.Response;
+import org.apache.hugegraph.api.BaseApiTest;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import org.apache.hugegraph.api.BaseApiTest;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
+import jakarta.ws.rs.core.Response;
+
public class ShortestPathApiTest extends BaseApiTest {
static final String PATH = TRAVERSERS_API + "/shortestpath";
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/TemplatePathsApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/TemplatePathsApiTest.java
index a33b15478..887c7f9b6 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/TemplatePathsApiTest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/TemplatePathsApiTest.java
@@ -20,14 +20,15 @@ package org.apache.hugegraph.api.traversers;
import java.util.List;
import java.util.Map;
-import jakarta.ws.rs.core.Response;
+import org.apache.hugegraph.api.BaseApiTest;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import org.apache.hugegraph.api.BaseApiTest;
import com.google.common.collect.ImmutableList;
+import jakarta.ws.rs.core.Response;
+
public class TemplatePathsApiTest extends BaseApiTest {
static final String PATH = TRAVERSERS_API + "/templatepaths";
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/TraversersApiTestSuite.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/TraversersApiTestSuite.java
index 3c6c99278..8146375c1 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/TraversersApiTestSuite.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/TraversersApiTestSuite.java
@@ -22,28 +22,29 @@ import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({
- AllShortestPathsApiTest.class,
- CountApiTest.class,
- CrosspointsApiTest.class,
- CustomizedCrosspointsApiTest.class,
- EdgesApiTest.class,
- FusiformSimilarityApiTest.class,
- JaccardSimilarityApiTest.class,
- KneighborApiTest.class,
- KoutApiTest.class,
- MultiNodeShortestPathApiTest.class,
- NeighborRankApiTest.class,
- PathsApiTest.class,
- PersonalRankApiTest.class,
- RaysApiTest.class,
- RingsApiTest.class,
- SameNeighborsApiTest.class,
- ShortestPathApiTest.class,
- SingleSourceShortestPathApiTest.class,
- TemplatePathsApiTest.class,
- WeightedShortestPathApiTest.class,
- AdamicAdarAPITest.class,
- ResourceAllocationAPITest.class
+ AllShortestPathsApiTest.class,
+ CountApiTest.class,
+ CrosspointsApiTest.class,
+ CustomizedCrosspointsApiTest.class,
+ EdgesApiTest.class,
+ FusiformSimilarityApiTest.class,
+ JaccardSimilarityApiTest.class,
+ KneighborApiTest.class,
+ KoutApiTest.class,
+ MultiNodeShortestPathApiTest.class,
+ NeighborRankApiTest.class,
+ PathsApiTest.class,
+ PersonalRankApiTest.class,
+ RaysApiTest.class,
+ RingsApiTest.class,
+ SameNeighborsApiTest.class,
+ ShortestPathApiTest.class,
+ SingleSourceShortestPathApiTest.class,
+ TemplatePathsApiTest.class,
+ WeightedShortestPathApiTest.class,
+ AdamicAdarAPITest.class,
+ ResourceAllocationAPITest.class
})
public class TraversersApiTestSuite {
+
}
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/WeightedShortestPathApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/WeightedShortestPathApiTest.java
index 5ed76748c..7331f2320 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/WeightedShortestPathApiTest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/traversers/WeightedShortestPathApiTest.java
@@ -20,15 +20,16 @@ package org.apache.hugegraph.api.traversers;
import java.util.List;
import java.util.Map;
-import jakarta.ws.rs.core.Response;
+import org.apache.hugegraph.api.BaseApiTest;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import org.apache.hugegraph.api.BaseApiTest;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
+import jakarta.ws.rs.core.Response;
+
public class WeightedShortestPathApiTest extends BaseApiTest {
static final String PATH = TRAVERSERS_API + "/weightedshortestpath";
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/AuthTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/AuthTest.java
index 457e0ab06..1db7af924 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/AuthTest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/AuthTest.java
@@ -25,9 +25,6 @@ import java.util.Map;
import javax.security.sasl.AuthenticationException;
import org.apache.commons.collections.CollectionUtils;
-import org.junit.After;
-import org.junit.Test;
-
import org.apache.hugegraph.HugeException;
import org.apache.hugegraph.HugeGraph;
import org.apache.hugegraph.auth.AuthManager;
@@ -49,6 +46,9 @@ import org.apache.hugegraph.testutil.Assert;
import org.apache.hugegraph.testutil.Whitebox;
import org.apache.hugegraph.util.JsonUtil;
import org.apache.hugegraph.util.StringEncoding;
+import org.junit.After;
+import org.junit.Test;
+
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
@@ -352,7 +352,7 @@ public class AuthTest extends BaseCoreTest {
Assert.assertEquals("group2", groups.get(2).name());
groups = authManager.listGroups(ImmutableList.of(
- id1, id2, IdGenerator.of("fake")));
+ id1, id2, IdGenerator.of("fake")));
Assert.assertEquals(2, groups.size());
}
@@ -497,7 +497,7 @@ public class AuthTest extends BaseCoreTest {
"{\"type\":\"EDGE\",\"label\":\"transfer\"," +
"\"properties\":null}]";
Assert.assertEquals(expect, JsonUtil.toJson(target.asMap()
- .get("target_resources")));
+ .get("target_resources")));
}
@Test
@@ -509,7 +509,7 @@ public class AuthTest extends BaseCoreTest {
Id id2 = authManager.createTarget(makeTarget("target2", "url2"));
List<HugeTarget> targets = authManager.listTargets(ImmutableList.of(
- id1, id2));
+ id1, id2));
Assert.assertEquals(2, targets.size());
Assert.assertEquals("target1", targets.get(0).name());
Assert.assertEquals("target2", targets.get(1).name());
@@ -521,7 +521,7 @@ public class AuthTest extends BaseCoreTest {
Assert.assertEquals("target2", targets.get(2).name());
targets = authManager.listTargets(ImmutableList.of(
- id1, id2, IdGenerator.of("fake")));
+ id1, id2, IdGenerator.of("fake")));
Assert.assertEquals(2, targets.size());
}
@@ -710,7 +710,7 @@ public class AuthTest extends BaseCoreTest {
Id id2 = authManager.createBelong(makeBelong(user, group2));
List<HugeBelong> belongs = authManager.listBelong(ImmutableList.of(
- id1, id2));
+ id1, id2));
Assert.assertEquals(2, belongs.size());
Assert.assertEquals(user, belongs.get(0).source());
Assert.assertEquals(user, belongs.get(1).source());
@@ -721,7 +721,7 @@ public class AuthTest extends BaseCoreTest {
Assert.assertEquals(3, belongs.size());
belongs = authManager.listBelong(ImmutableList.of(
- id1, id2, IdGenerator.of("fake")));
+ id1, id2, IdGenerator.of("fake")));
Assert.assertEquals(2, belongs.size());
belongs = authManager.listBelongByUser(user, -1);
@@ -793,7 +793,7 @@ public class AuthTest extends BaseCoreTest {
Assert.assertThrows(IllegalArgumentException.class, () -> {
Id target = authManager.createTarget(makeTarget("graph1", ""));
Id access = authManager.createAccess(makeAccess(group1, target,
- HugePermission.READ));
+ HugePermission.READ));
authManager.getBelong(access);
});
}
@@ -865,7 +865,7 @@ public class AuthTest extends BaseCoreTest {
Assert.assertThrows(IllegalArgumentException.class, () -> {
Id target = authManager.createTarget(makeTarget("graph1", ""));
Id access = authManager.createAccess(makeAccess(group1, target,
- HugePermission.READ));
+ HugePermission.READ));
authManager.deleteBelong(access);
});
}
@@ -1016,7 +1016,7 @@ public class AuthTest extends BaseCoreTest {
HugePermission.READ));
List<HugeAccess> access = authManager.listAccess(ImmutableList.of(
- id1, id2));
+ id1, id2));
Assert.assertEquals(2, access.size());
Assert.assertEquals(group, access.get(0).source());
Assert.assertEquals(group, access.get(1).source());
@@ -1027,7 +1027,7 @@ public class AuthTest extends BaseCoreTest {
Assert.assertEquals(3, access.size());
access = authManager.listAccess(ImmutableList.of(
- id1, id2, IdGenerator.of("fake")));
+ id1, id2, IdGenerator.of("fake")));
Assert.assertEquals(2, access.size());
access = authManager.listAccessByGroup(group, -1);
@@ -1215,16 +1215,16 @@ public class AuthTest extends BaseCoreTest {
Id graph2 = authManager.createTarget(makeTarget("hugegraph1", "url2"));
List<HugeResource> rv = HugeResource.parseResources(
- "[{\"type\": \"VERTEX\", \"label\": \"person\", " +
- "\"properties\":{\"city\": \"Beijing\", \"age\": \"P.gte(20)\"}}," +
- " {\"type\": \"VERTEX_LABEL\", \"label\": \"*\"}," +
- " {\"type\": \"PROPERTY_KEY\", \"label\": \"*\"}]");
+ "[{\"type\": \"VERTEX\", \"label\": \"person\", " +
+ "\"properties\":{\"city\": \"Beijing\", \"age\": \"P.gte(20)\"}}," +
+ " {\"type\": \"VERTEX_LABEL\", \"label\": \"*\"}," +
+ " {\"type\": \"PROPERTY_KEY\", \"label\": \"*\"}]");
List<HugeResource> re = HugeResource.parseResources(
- "[{\"type\": \"EDGE\", \"label\": \"write\"}, " +
- " {\"type\": \"PROPERTY_KEY\"}, {\"type\": \"VERTEX_LABEL\"}, " +
- " {\"type\": \"EDGE_LABEL\"}, {\"type\": \"INDEX_LABEL\"}]");
+ "[{\"type\": \"EDGE\", \"label\": \"write\"}, " +
+ " {\"type\": \"PROPERTY_KEY\"}, {\"type\": \"VERTEX_LABEL\"}, " +
+ " {\"type\": \"EDGE_LABEL\"}, {\"type\": \"INDEX_LABEL\"}]");
List<HugeResource> rg = HugeResource.parseResources(
- "[{\"type\": \"GREMLIN\"}]");
+ "[{\"type\": \"GREMLIN\"}]");
Id graph1v = authManager.createTarget(makeTarget("hugegraph-v", "hugegraph",
"url1", rv));
Id graph1e = authManager.createTarget(makeTarget("hugegraph-e", "hugegraph",
@@ -1251,27 +1251,29 @@ public class AuthTest extends BaseCoreTest {
authManager.createAccess(makeAccess(group1, graph1e,
HugePermission.READ));
Id access1g = authManager.createAccess(makeAccess(group1, graph1gremlin,
- HugePermission.EXECUTE));
+ HugePermission.EXECUTE));
RolePermission role;
role = authManager.rolePermission(authManager.getUser(user0));
String expected = "{\"roles\":" +
- "{\"hugegraph\":{\"READ\":[" +
- "{\"type\":\"EDGE\",\"label\":\"write\",\"properties\":null}," +
- "{\"type\":\"PROPERTY_KEY\",\"label\":\"*\",\"properties\":null}," +
- "{\"type\":\"VERTEX_LABEL\",\"label\":\"*\",\"properties\":null}," +
- "{\"type\":\"EDGE_LABEL\",\"label\":\"*\",\"properties\":null}," +
- "{\"type\":\"INDEX_LABEL\",\"label\":\"*\",\"properties\":null}," +
- "{\"type\":\"VERTEX\",\"label\":\"person\",\"properties\":" +
- "{\"city\":\"Beijing\",\"age\":\"P.gte(20)\"}}," +
- "{\"type\":\"VERTEX_LABEL\",\"label\":\"*\",\"properties\":null}," +
- "{\"type\":\"PROPERTY_KEY\",\"label\":\"*\",\"properties\":null}],\"WRITE\":" +
- "[{\"type\":\"VERTEX\",\"label\":\"person\",\"properties\":" +
- "{\"city\":\"Beijing\",\"age\":\"P.gte(20)\"}}," +
- "{\"type\":\"VERTEX_LABEL\",\"label\":\"*\",\"properties\":null}," +
- "{\"type\":\"PROPERTY_KEY\",\"label\":\"*\",\"properties\":null}],\"EXECUTE\":" +
- "[{\"type\":\"GREMLIN\",\"label\":\"*\",\"properties\":null}]}," +
- "\"hugegraph1\":{\"READ\":[]}}}";
+ "{\"hugegraph\":{\"READ\":[" +
+ "{\"type\":\"EDGE\",\"label\":\"write\",\"properties\":null}," +
+ "{\"type\":\"PROPERTY_KEY\",\"label\":\"*\",\"properties\":null}," +
+ "{\"type\":\"VERTEX_LABEL\",\"label\":\"*\",\"properties\":null}," +
+ "{\"type\":\"EDGE_LABEL\",\"label\":\"*\",\"properties\":null}," +
+ "{\"type\":\"INDEX_LABEL\",\"label\":\"*\",\"properties\":null}," +
+ "{\"type\":\"VERTEX\",\"label\":\"person\",\"properties\":" +
+ "{\"city\":\"Beijing\",\"age\":\"P.gte(20)\"}}," +
+ "{\"type\":\"VERTEX_LABEL\",\"label\":\"*\",\"properties\":null}," +
+ "{\"type\":\"PROPERTY_KEY\",\"label\":\"*\",\"properties\":null}]," +
+ "\"WRITE\":" +
+ "[{\"type\":\"VERTEX\",\"label\":\"person\",\"properties\":" +
+ "{\"city\":\"Beijing\",\"age\":\"P.gte(20)\"}}," +
+ "{\"type\":\"VERTEX_LABEL\",\"label\":\"*\",\"properties\":null}," +
+ "{\"type\":\"PROPERTY_KEY\",\"label\":\"*\",\"properties\":null}]," +
+ "\"EXECUTE\":" +
+ "[{\"type\":\"GREMLIN\",\"label\":\"*\",\"properties\":null}]}," +
+ "\"hugegraph1\":{\"READ\":[]}}}";
Assert.assertEquals(expected, role.toJson());
role = authManager.rolePermission(authManager.getBelong(belong1));
@@ -1282,15 +1284,15 @@ public class AuthTest extends BaseCoreTest {
role = authManager.rolePermission(authManager.getAccess(access1v));
expected = "{\"roles\":" +
- "{\"hugegraph\":{\"READ\":[{\"type\":\"VERTEX\",\"label\":\"person\"," +
- "\"properties\":{\"city\":\"Beijing\",\"age\":\"P.gte(20)\"}}," +
- "{\"type\":\"VERTEX_LABEL\",\"label\":\"*\",\"properties\":null}," +
- "{\"type\":\"PROPERTY_KEY\",\"label\":\"*\",\"properties\":null}]}}}";
+ "{\"hugegraph\":{\"READ\":[{\"type\":\"VERTEX\",\"label\":\"person\"," +
+ "\"properties\":{\"city\":\"Beijing\",\"age\":\"P.gte(20)\"}}," +
+ "{\"type\":\"VERTEX_LABEL\",\"label\":\"*\",\"properties\":null}," +
+ "{\"type\":\"PROPERTY_KEY\",\"label\":\"*\",\"properties\":null}]}}}";
Assert.assertEquals(expected, role.toJson());
role = authManager.rolePermission(authManager.getAccess(access1g));
expected = "{\"roles\":{\"hugegraph\":{\"EXECUTE\":[" +
- "{\"type\":\"GREMLIN\",\"label\":\"*\",\"properties\":null}]}}}";
+ "{\"type\":\"GREMLIN\",\"label\":\"*\",\"properties\":null}]}}}";
Assert.assertEquals(expected, role.toJson());
role = authManager.rolePermission(authManager.getUser(user1));
@@ -1303,11 +1305,11 @@ public class AuthTest extends BaseCoreTest {
role = authManager.rolePermission(authManager.getTarget(graph1v));
expected = "{\"roles\":" +
- "{\"hugegraph\":" +
- "{\"READ\":[{\"type\":\"VERTEX\",\"label\":\"person\",\"properties\":" +
- "{\"city\":\"Beijing\",\"age\":\"P.gte(20)\"}}," +
- "{\"type\":\"VERTEX_LABEL\",\"label\":\"*\",\"properties\":null}," +
- "{\"type\":\"PROPERTY_KEY\",\"label\":\"*\",\"properties\":null}]}}}";
+ "{\"hugegraph\":" +
+ "{\"READ\":[{\"type\":\"VERTEX\",\"label\":\"person\",\"properties\":" +
+ "{\"city\":\"Beijing\",\"age\":\"P.gte(20)\"}}," +
+ "{\"type\":\"VERTEX_LABEL\",\"label\":\"*\",\"properties\":null}," +
+ "{\"type\":\"PROPERTY_KEY\",\"label\":\"*\",\"properties\":null}]}}}";
Assert.assertEquals(expected, role.toJson());
}
@@ -1483,7 +1485,7 @@ public class AuthTest extends BaseCoreTest {
Assert.assertNotNull(project);
Assert.assertFalse(project.graphs().isEmpty());
projectId = authManager.projectRemoveGraphs(
- project.id(), ImmutableSet.of("graph_test"));
+ project.id(), ImmutableSet.of("graph_test"));
project = authManager.getProject(projectId);
Assert.assertNotNull(project);
Assert.assertTrue(project.graphs().isEmpty());
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/CoreTestSuite.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/CoreTestSuite.java
index 686d7894b..17e01a4fa 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/CoreTestSuite.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/CoreTestSuite.java
@@ -24,19 +24,20 @@ import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({
- PropertyKeyCoreTest.class,
- VertexLabelCoreTest.class,
- EdgeLabelCoreTest.class,
- IndexLabelCoreTest.class,
- VertexCoreTest.class,
- EdgeCoreTest.class,
- VertexPropertyCoreTest.class,
- EdgePropertyCoreTest.class,
- RestoreCoreTest.class,
- TaskCoreTest.class,
- AuthTest.class,
- MultiGraphsTest.class,
- RamTableTest.class
+ PropertyKeyCoreTest.class,
+ VertexLabelCoreTest.class,
+ EdgeLabelCoreTest.class,
+ IndexLabelCoreTest.class,
+ VertexCoreTest.class,
+ EdgeCoreTest.class,
+ VertexPropertyCoreTest.class,
+ EdgePropertyCoreTest.class,
+ RestoreCoreTest.class,
+ TaskCoreTest.class,
+ AuthTest.class,
+ MultiGraphsTest.class,
+ RamTableTest.class
})
public class CoreTestSuite {
+
}
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/EdgeCoreTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/EdgeCoreTest.java
index e87289246..b1935488a 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/EdgeCoreTest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/EdgeCoreTest.java
@@ -219,9 +219,9 @@ public class EdgeCoreTest extends BaseCoreTest {
Vertex james = graph.addVertex(T.label, "author", "id", 1,
"name", "James Gosling", "age", 62,
"lived", "Canadian");
- Vertex guido = graph.addVertex(T.label, "author", "id", 2,
- "name", "Guido van Rossum", "age", 61,
- "lived", "California");
+ Vertex guido = graph.addVertex(T.label, "author", "id", 2,
+ "name", "Guido van Rossum", "age", 61,
+ "lived", "California");
Vertex java = graph.addVertex(T.label, "language", "name", "java");
Vertex python = graph.addVertex(T.label, "language", "name", "python",
@@ -254,9 +254,9 @@ public class EdgeCoreTest extends BaseCoreTest {
Vertex james = graph.addVertex(T.label, "author", "id", 1,
"name", "James Gosling", "age", 62,
"lived", "Canadian");
- Vertex guido = graph.addVertex(T.label, "author", "id", 2,
- "name", "Guido van Rossum", "age", 61,
- "lived", "California");
+ Vertex guido = graph.addVertex(T.label, "author", "id", 2,
+ "name", "Guido van Rossum", "age", 61,
+ "lived", "California");
Vertex java = graph.addVertex(T.label, "language", "name", "java");
Vertex python = graph.addVertex(T.label, "language", "name", "python",
@@ -297,8 +297,8 @@ public class EdgeCoreTest extends BaseCoreTest {
HugeGraph graph = graph();
Vertex james = graph.addVertex(T.label, "author", "id", 1,
- "name", "James Gosling", "age", 62,
- "lived", "Canadian");
+ "name", "James Gosling", "age", 62,
+ "lived", "Canadian");
Vertex book = graph.addVertex(T.label, "book", "name", "Test-Book-1");
@@ -539,9 +539,9 @@ public class EdgeCoreTest extends BaseCoreTest {
graph.tx().commit();
List<Edge> edges = graph.traversal().V(james.id())
- .outE("write")
- .has("time", "2017-5-27\u0000")
- .toList();
+ .outE("write")
+ .has("time", "2017-5-27\u0000")
+ .toList();
Assert.assertEquals(1, edges.size());
Assert.assertEquals("2017-5-27\u0000", edges.get(0).value("time"));
}
@@ -1138,7 +1138,7 @@ public class EdgeCoreTest extends BaseCoreTest {
"date", "2019-12-23 15:01:00");
Edge edge10 = baby.addEdge("read", java5,
"place", "library of school",
- "date", "2019-12-23 16:01:00");
+ "date", "2019-12-23 16:01:00");
graph().tx().commit();
// Due to overridden edges are expired, query will lead to async delete
edges = graph().traversal().E().has("date", "2019-12-23 14:00:00");
@@ -1274,12 +1274,12 @@ public class EdgeCoreTest extends BaseCoreTest {
@SuppressWarnings("unused")
Edge edge10 = baby.addEdge("read", java4,
"place", "library of school",
- "date", "2019-12-23 15:01:00");
+ "date", "2019-12-23 15:01:00");
Edge edge11 = baby.addEdge("read", java5,
"place", "library of school",
- "date", "2019-12-23 16:01:00");
+ "date", "2019-12-23 16:01:00");
Edge edge12 = baby.addEdge("read", java6, "place", "library",
- "date", "2019-12-23 14:01:00");
+ "date", "2019-12-23 14:01:00");
graph().tx().commit();
// Due to overridden edges are expired, query will lead to async delete
@@ -1416,11 +1416,11 @@ public class EdgeCoreTest extends BaseCoreTest {
Vertex java2 = graph().addVertex(T.label, "book",
"name", "Java2 in action");
Edge edge1 = baby.addEdge("read", java1, "place", "library of school",
- "date", "2019-12-23 12:00:00");
+ "date", "2019-12-23 12:00:00");
graph().tx().commit();
// Add edges in tx
Edge edge2 = baby.addEdge("read", java2, "place", "library of school",
- "date", "2019-12-23 12:00:00");
+ "date", "2019-12-23 12:00:00");
Iterator<Edge> edges = graph().edges(edge1);
Assert.assertTrue(edges.hasNext());
@@ -1777,9 +1777,9 @@ public class EdgeCoreTest extends BaseCoreTest {
init18Edges();
List<Edge> edges = graph.traversal().V()
- .hasLabel("person").has("name", "Louise")
- .outE("look").order().by("time")
- .toList();
+ .hasLabel("person").has("name", "Louise")
+ .outE("look").order().by("time")
+ .toList();
Assert.assertEquals(4, edges.size());
Assert.assertEquals("2017-5-1", edges.get(0).value("time"));
Assert.assertEquals("2017-5-1", edges.get(1).value("time"));
@@ -1998,23 +1998,23 @@ public class EdgeCoreTest extends BaseCoreTest {
Assert.assertEquals(1, edges.size());
edges = graph.traversal().E()
- .range(1, -1)
- .range(6, 8)
- .toList();
+ .range(1, -1)
+ .range(6, 8)
+ .toList();
// [7, 9)
Assert.assertEquals(2, edges.size());
edges = graph.traversal().E()
- .range(1, 6)
- .range(6, 8)
- .toList();
+ .range(1, 6)
+ .range(6, 8)
+ .toList();
// [7, 6) will be converted to NoneStep by EarlyLimitStrategy
Assert.assertEquals(0, edges.size());
edges = graph.traversal().E()
- .range(1, 6)
- .range(7, 8)
- .toList();
+ .range(1, 6)
+ .range(7, 8)
+ .toList();
// [8, 6) will be converted to NoneStep by EarlyLimitStrategy
Assert.assertEquals(0, edges.size());
}
@@ -2962,7 +2962,7 @@ public class EdgeCoreTest extends BaseCoreTest {
HugeVertex james = (HugeVertex) vertex("author", "id", 1);
List<Vertex> vertices = ImmutableList.copyOf(
- james.getVertices(Directions.BOTH));
+ james.getVertices(Directions.BOTH));
Assert.assertEquals(6, vertices.size());
vertices = ImmutableList.copyOf(james.getVertices(Directions.OUT));
@@ -3014,7 +3014,7 @@ public class EdgeCoreTest extends BaseCoreTest {
// Query edges of a vertex
Vertex james = vertex("author", "id", 1);
List<Edge> edges = ImmutableList.copyOf(
- graph.adjacentEdges((Id) james.id()));
+ graph.adjacentEdges((Id) james.id()));
Assert.assertEquals(6, edges.size());
List<Edge> edges2 = ImmutableList.copyOf(james.edges(Direction.BOTH));
@@ -3063,9 +3063,9 @@ public class EdgeCoreTest extends BaseCoreTest {
Vertex james = graph.addVertex(T.label, "author2", T.id, 13579,
"name", "James Gosling", "age", 62,
"lived", "Canadian");
- Vertex guido = graph.addVertex(T.label, "author2", T.id, 24680,
- "name", "Guido van Rossum", "age", 61,
- "lived", "California");
+ Vertex guido = graph.addVertex(T.label, "author2", T.id, 24680,
+ "name", "Guido van Rossum", "age", 61,
+ "lived", "California");
Vertex java = graph.addVertex(T.label, "language2", "name", "java",
T.id, UUID.randomUUID());
@@ -3131,7 +3131,7 @@ public class EdgeCoreTest extends BaseCoreTest {
Assert.assertEquals(2, vertices.size());
vertices = ImmutableList.copyOf(
- jeff.vertices(Direction.BOTH, "friend"));
+ jeff.vertices(Direction.BOTH, "friend"));
Assert.assertEquals(2, vertices.size());
// OUT
@@ -3193,7 +3193,7 @@ public class EdgeCoreTest extends BaseCoreTest {
@Test
public void testQueryAdjacentVerticesOfEdgesWithoutVertex()
- throws InterruptedException, ExecutionException {
+ throws InterruptedException, ExecutionException {
HugeGraph graph = graph();
Vertex james = graph.addVertex(T.label, "author", "id", 1,
@@ -3261,7 +3261,7 @@ public class EdgeCoreTest extends BaseCoreTest {
Assert.assertThrows(HugeException.class, () -> {
// read from cache
graph.traversal().V(james.id()).outE().has("score", 3)
- .otherV().values().toList();
+ .otherV().values().toList();
}, e -> {
Assert.assertContains("Vertex 'java' does not exist",
e.getMessage());
@@ -3286,7 +3286,7 @@ public class EdgeCoreTest extends BaseCoreTest {
Assert.assertThrows(HugeException.class, () -> {
graph.traversal().V(james.id()).outE().otherV()
- .values().toList();
+ .values().toList();
}, e -> {
Assert.assertContains("Vertex 'java' does not exist",
e.getMessage());
@@ -3326,7 +3326,7 @@ public class EdgeCoreTest extends BaseCoreTest {
@Test
public void testQueryAdjacentVerticesOfEdgesWithInvalidVertexLabel()
- throws InterruptedException, ExecutionException {
+ throws InterruptedException, ExecutionException {
HugeGraph graph = graph();
SchemaManager schema = graph.schema();
@@ -3400,7 +3400,7 @@ public class EdgeCoreTest extends BaseCoreTest {
@Test
public void testQueryAdjacentVerticesOfEdgesWithoutVertexAndNoLazyLoad()
- throws InterruptedException, ExecutionException {
+ throws InterruptedException, ExecutionException {
HugeGraph graph = graph();
Vertex james = graph.addVertex(T.label, "author", "id", 1,
@@ -3421,7 +3421,7 @@ public class EdgeCoreTest extends BaseCoreTest {
Assert.assertEquals(0, graph.traversal().V(java).toList().size());
List<Vertex> vertices = graph.traversal().V(james.id())
- .out().toList();
+ .out().toList();
Assert.assertEquals(1, vertices.size());
HugeVertex adjacent = (HugeVertex) vertices.get(0);
Assert.assertTrue("label: " + adjacent.schemaLabel(),
@@ -4604,23 +4604,23 @@ public class EdgeCoreTest extends BaseCoreTest {
long size;
size = graph.traversal().V().outE("created", "authored", "look")
- .hasLabel("authored", "created")
- .count().next();
+ .hasLabel("authored", "created")
+ .count().next();
Assert.assertEquals(5L, size);
size = graph.traversal().V().outE("created", "authored", "look")
- .hasLabel("authored", "friend")
- .count().next();
+ .hasLabel("authored", "friend")
+ .count().next();
Assert.assertEquals(3L, size);
size = graph.traversal().V().outE("created")
- .hasLabel("authored", "created")
- .count().next();
+ .hasLabel("authored", "created")
+ .count().next();
Assert.assertEquals(2L, size);
size = graph.traversal().V().inE("created", "authored", "look")
- .has("score", 3)
- .count().next();
+ .has("score", 3)
+ .count().next();
Assert.assertEquals(3L, size);
}
@@ -4812,11 +4812,11 @@ public class EdgeCoreTest extends BaseCoreTest {
schema.indexLabel("buyByDate").onE("buy").by("date").range().create();
Vertex louise = graph.addVertex(T.label, "person", "name", "Louise",
- "city", "Beijing", "age", 21);
+ "city", "Beijing", "age", 21);
Vertex jeff = graph.addVertex(T.label, "person", "name", "Jeff",
- "city", "Beijing", "age", 22);
+ "city", "Beijing", "age", 22);
Vertex sean = graph.addVertex(T.label, "person", "name", "Sean",
- "city", "Beijing", "age", 23);
+ "city", "Beijing", "age", 23);
Vertex java1 = graph.addVertex(T.label, "book", "name", "java-1");
Vertex java2 = graph.addVertex(T.label, "book", "name", "java-2");
@@ -4873,9 +4873,9 @@ public class EdgeCoreTest extends BaseCoreTest {
Vertex java3 = graph.addVertex(T.label, "book", "name", "java-3");
String[] dates = new String[]{
- "2012-01-01 00:00:00.000",
- "2013-01-01 00:00:00.000",
- "2014-01-01 00:00:00.000"
+ "2012-01-01 00:00:00.000",
+ "2013-01-01 00:00:00.000",
+ "2014-01-01 00:00:00.000"
};
louise.addEdge("buy", java1, "place", "haidian", "date", dates[0]);
@@ -4925,9 +4925,9 @@ public class EdgeCoreTest extends BaseCoreTest {
Vertex java3 = graph.addVertex(T.label, "book", "name", "java-3");
String[] dates = new String[]{
- "2012-01-01 00:00:00.000",
- "2013-01-01 00:00:00.000",
- "2014-01-01 00:00:00.000"
+ "2012-01-01 00:00:00.000",
+ "2013-01-01 00:00:00.000",
+ "2014-01-01 00:00:00.000"
};
louise.addEdge("buy", java1, "place", "haidian", "date", dates[0]);
@@ -4978,9 +4978,9 @@ public class EdgeCoreTest extends BaseCoreTest {
Vertex java3 = graph.addVertex(T.label, "book", "name", "java-3");
String[] dates = new String[]{
- "2012-01-01",
- "2013-01-01 00:00:00",
- "2014-01-01 00:00:00.000"
+ "2012-01-01",
+ "2013-01-01 00:00:00",
+ "2014-01-01 00:00:00.000"
};
louise.addEdge("buy", java1, "place", "haidian", "date", dates[0]);
@@ -5028,9 +5028,9 @@ public class EdgeCoreTest extends BaseCoreTest {
Vertex java3 = graph.addVertex(T.label, "book", "name", "java-3");
String[] dates = new String[]{
- "2012-01-01 00:00:00.000",
- "2013-01-01 00:00:00.000",
- "2014-01-01 00:00:00.000"
+ "2012-01-01 00:00:00.000",
+ "2013-01-01 00:00:00.000",
+ "2014-01-01 00:00:00.000"
};
louise.addEdge("buy", java1, "place", "haidian", "date", dates[0]);
@@ -5079,14 +5079,14 @@ public class EdgeCoreTest extends BaseCoreTest {
"contribution", "1992 2 2", "score", 4);
edges = graph.traversal().E().hasLabel("authored")
- .has("contribution", Text.contains("2"))
- .toList();
+ .has("contribution", Text.contains("2"))
+ .toList();
Assert.assertEquals(2, edges.size());
edges = graph.traversal().E().hasLabel("authored")
- .has("score", P.gt(3))
- .has("contribution", Text.contains("3"))
- .toList();
+ .has("score", P.gt(3))
+ .has("contribution", Text.contains("3"))
+ .toList();
Assert.assertEquals(1, edges.size());
assertContains(edges, "authored", james, book1,
"contribution", "1991 3 1", "score", 5);
@@ -5125,22 +5125,22 @@ public class EdgeCoreTest extends BaseCoreTest {
// Won't query by search index, just filter by property after outE()
edges = graph.traversal().V(james).outE("authored")
- .has("contribution", "1992 2 2")
- .toList();
+ .has("contribution", "1992 2 2")
+ .toList();
Assert.assertEquals(1, edges.size());
// Won't query by search index, just filter by property after outE()
edges = graph.traversal().V(james).outE("authored")
- .has("contribution", "1992 2 2")
- .has("score", P.gte(4))
- .toList();
+ .has("contribution", "1992 2 2")
+ .has("score", P.gte(4))
+ .toList();
Assert.assertEquals(1, edges.size());
// Won't query by search index, just filter by property after outE()
edges = graph.traversal().V(james).outE("authored")
- .has("contribution", "1992 2 2")
- .has("score", P.gt(4))
- .toList();
+ .has("contribution", "1992 2 2")
+ .has("score", P.gt(4))
+ .toList();
Assert.assertEquals(0, edges.size());
// Query by search index
@@ -5151,8 +5151,8 @@ public class EdgeCoreTest extends BaseCoreTest {
// Won't query by search index, just filter by property after outE()
edges = graph.traversal().V(james).outE("authored")
- .has("contribution", "1992")
- .toList();
+ .has("contribution", "1992")
+ .toList();
Assert.assertEquals(0, edges.size()); // be careful!
}
@@ -5313,53 +5313,53 @@ public class EdgeCoreTest extends BaseCoreTest {
Assert.assertEquals(4L, g.E().hasLabel("friend").count().next());
Assert.assertEquals(1L, g.E().hasLabel("follow").count().next());
Assert.assertEquals(11L, g.E().hasLabel("look", "friend")
- .count().next());
+ .count().next());
Assert.assertEquals(5L, g.E().hasLabel("look")
- .has("time", "2017-5-27").count().next());
+ .has("time", "2017-5-27").count().next());
Assert.assertEquals(2L, g.E().hasLabel("look")
- .has("score", 3).count().next());
+ .has("score", 3).count().next());
Assert.assertEquals(3L, g.E().hasLabel("look")
- .has("score", P.gte(3)).count().next());
+ .has("score", P.gte(3)).count().next());
Assert.assertEquals(1L, g.E().hasLabel("look")
- .has("score", P.lt(3)).count().next());
+ .has("score", P.lt(3)).count().next());
Assert.assertEquals(1L, g.E().hasLabel("look")
- .has("time", "2017-5-27")
- .has("score", 3)
- .count().next());
+ .has("time", "2017-5-27")
+ .has("score", 3)
+ .count().next());
Assert.assertEquals(2L, g.E().hasLabel("look")
- .has("time", "2017-5-27")
- .has("score", P.gte(3))
- .count().next());
+ .has("time", "2017-5-27")
+ .has("score", P.gte(3))
+ .count().next());
Assert.assertEquals(2L, g.E().hasLabel("look")
- .has("time", "2017-5-27")
- .has("score", P.gt(0))
- .count().next());
+ .has("time", "2017-5-27")
+ .has("score", P.gt(0))
+ .count().next());
Assert.assertEquals(3L, g.E().hasLabel("look")
- .has("time", "2017-5-27")
- .has("score", P.gte(0))
- .count().next());
+ .has("time", "2017-5-27")
+ .has("score", P.gte(0))
+ .count().next());
Assert.assertEquals(0L, g.E().hasLabel("look")
- .has("time", "2017-5-27")
- .has("score", P.lt(0))
- .count().next());
+ .has("time", "2017-5-27")
+ .has("score", P.lt(0))
+ .count().next());
Assert.assertEquals(1L, g.E().hasLabel("look")
- .has("time", "2017-5-27")
- .has("score", P.lte(0))
- .count().next());
+ .has("time", "2017-5-27")
+ .has("score", P.lte(0))
+ .count().next());
Assert.assertEquals(2L, g.E().hasLabel("look")
- .has("time", "2017-5-27")
- .has("score", P.lte(3))
- .count().next());
+ .has("time", "2017-5-27")
+ .has("score", P.lte(3))
+ .count().next());
Assert.assertEquals(18L, g.E().count().min().next());
Assert.assertEquals(7L, g.E().hasLabel("look").count().max().next());
Assert.assertEquals(4L, g.E().hasLabel("look")
- .values("score").count().next());
+ .values("score").count().next());
Assert.assertEquals(11L, g.E().hasLabel("look")
- .values().count().next());
+ .values().count().next());
}
@Test
@@ -5435,7 +5435,7 @@ public class EdgeCoreTest extends BaseCoreTest {
edges = graph.traversal().E().toList();
Assert.assertEquals(3, edges.size());
Assert.assertFalse(Utils.contains(edges,
- new FakeObjects.FakeEdge("authored", james, java1)));
+ new FakeObjects.FakeEdge("authored", james, java1)));
}
@Test
@@ -5499,9 +5499,9 @@ public class EdgeCoreTest extends BaseCoreTest {
Vertex james = graph.addVertex(T.label, "author", "id", 1,
"name", "James Gosling", "age", 62,
"lived", "Canadian");
- Vertex guido = graph.addVertex(T.label, "author", "id", 2,
- "name", "Guido van Rossum", "age", 61,
- "lived", "California");
+ Vertex guido = graph.addVertex(T.label, "author", "id", 2,
+ "name", "Guido van Rossum", "age", 61,
+ "lived", "California");
Vertex java = graph.addVertex(T.label, "language", "name", "java");
Vertex python = graph.addVertex(T.label, "language", "name", "python",
@@ -5534,9 +5534,9 @@ public class EdgeCoreTest extends BaseCoreTest {
Vertex james = graph.addVertex(T.label, "author", "id", 1,
"name", "James Gosling", "age", 62,
"lived", "Canadian");
- Vertex guido = graph.addVertex(T.label, "author", "id", 2,
- "name", "Guido van Rossum", "age", 61,
- "lived", "California");
+ Vertex guido = graph.addVertex(T.label, "author", "id", 2,
+ "name", "Guido van Rossum", "age", 61,
+ "lived", "California");
Vertex java = graph.addVertex(T.label, "language", "name", "java");
Vertex python = graph.addVertex(T.label, "language", "name", "python",
@@ -5584,9 +5584,9 @@ public class EdgeCoreTest extends BaseCoreTest {
Vertex james = graph.addVertex(T.label, "author", "id", 1,
"name", "James Gosling", "age", 62,
"lived", "Canadian");
- Vertex guido = graph.addVertex(T.label, "author", "id", 2,
- "name", "Guido van Rossum", "age", 61,
- "lived", "California");
+ Vertex guido = graph.addVertex(T.label, "author", "id", 2,
+ "name", "Guido van Rossum", "age", 61,
+ "lived", "California");
Vertex java = graph.addVertex(T.label, "language", "name", "java");
Vertex python = graph.addVertex(T.label, "language", "name", "python",
@@ -6506,14 +6506,14 @@ public class EdgeCoreTest extends BaseCoreTest {
.onE("attack").by("port").secondary().ifNotExist().create();
}, e -> {
Assert.assertTrue(e.getMessage(), e.getMessage().contains(
- "The aggregate type SET is not indexable"));
+ "The aggregate type SET is not indexable"));
});
Assert.assertThrows(IllegalArgumentException.class, () -> {
schema.indexLabel("attackByType")
.onE("attack").by("type").secondary().ifNotExist().create();
}, e -> {
Assert.assertTrue(e.getMessage(), e.getMessage().contains(
- "The aggregate type LIST is not indexable"));
+ "The aggregate type LIST is not indexable"));
});
Vertex ip1 = graph.addVertex(T.label, "ip", T.id, "10.0.0.1");
@@ -7020,7 +7020,7 @@ public class EdgeCoreTest extends BaseCoreTest {
"arrested", false);
List<Edge> el = graph.traversal().E().has("tool", "shovel")
- .toList();
+ .toList();
Assert.assertEquals(1, el.size());
Assert.assertEquals(1, (int) el.get(0).value("id"));
el = graph.traversal().E().has("tool", "knife").toList();
@@ -7051,7 +7051,7 @@ public class EdgeCoreTest extends BaseCoreTest {
"arrested", false);
List<Edge> el = graph.traversal().E().has("timestamp", current)
- .toList();
+ .toList();
Assert.assertEquals(1, el.size());
Assert.assertEquals(1, (int) el.get(0).value("id"));
el = graph.traversal().E().has("timestamp", 666L).toList();
@@ -7081,7 +7081,7 @@ public class EdgeCoreTest extends BaseCoreTest {
"tool", "shovel", "arrested", false);
List<Edge> el = graph.traversal().E().has("place", "park")
- .toList();
+ .toList();
Assert.assertEquals(1, el.size());
Assert.assertEquals(1, (int) el.get(0).value("id"));
el = graph.traversal().E().has("place", "park")
@@ -7331,23 +7331,23 @@ public class EdgeCoreTest extends BaseCoreTest {
HugeGraph graph = graph();
Vertex huge = graph.addVertex(
- T.label, "soft",
- "name", "hugegraph",
- "country", "china",
- "category", ImmutableList.of("graphdb", "db"),
- "tags", ImmutableList.of("graphdb", "gremlin"));
+ T.label, "soft",
+ "name", "hugegraph",
+ "country", "china",
+ "category", ImmutableList.of("graphdb", "db"),
+ "tags", ImmutableList.of("graphdb", "gremlin"));
Vertex neo4j = graph.addVertex(
- T.label, "soft", "name", "neo4j",
- "country", "usa",
- "category", ImmutableList.of("graphdb", "db"),
- "tags", ImmutableList.of("graphdb", "cypher"));
+ T.label, "soft", "name", "neo4j",
+ "country", "usa",
+ "category", ImmutableList.of("graphdb", "db"),
+ "tags", ImmutableList.of("graphdb", "cypher"));
Vertex janus = graph.addVertex(
- T.label, "soft", "name", "janusgraph",
- "country", "usa",
- "category", ImmutableList.of("graphdb", "db"),
- "tags", ImmutableList.of("graphdb", "gremlin"));
+ T.label, "soft", "name", "janusgraph",
+ "country", "usa",
+ "category", ImmutableList.of("graphdb", "db"),
+ "tags", ImmutableList.of("graphdb", "gremlin"));
huge.addEdge("related", neo4j, "tags", ImmutableList.of("graphdb"));
@@ -7361,17 +7361,17 @@ public class EdgeCoreTest extends BaseCoreTest {
"gremlin").toList();
});
- List<Edge> edges = graph.traversal().E()
- .has("related", "tags",
- ConditionP.contains("gremlin"))
- .toList();
+ List<Edge> edges = graph.traversal().E()
+ .has("related", "tags",
+ ConditionP.contains("gremlin"))
+ .toList();
Assert.assertEquals(1, edges.size());
- edges = graph.traversal().E()
- .has("related",
- "tags", ConditionP.contains("graphdb"))
- .toList();
+ edges = graph.traversal().E()
+ .has("related",
+ "tags", ConditionP.contains("graphdb"))
+ .toList();
Assert.assertEquals(2, edges.size());
@@ -7379,17 +7379,17 @@ public class EdgeCoreTest extends BaseCoreTest {
huge2janus.property("tags", ImmutableList.of("newTag"));
graph.tx().commit();
- edges = graph.traversal().E()
- .has("related",
- "tags", ConditionP.contains("newTag"))
- .toList();
+ edges = graph.traversal().E()
+ .has("related",
+ "tags", ConditionP.contains("newTag"))
+ .toList();
Assert.assertEquals(1, edges.size());
- edges = graph.traversal().E()
- .has("related",
- "tags", ConditionP.contains("graphdb"))
- .toList();
+ edges = graph.traversal().E()
+ .has("related",
+ "tags", ConditionP.contains("graphdb"))
+ .toList();
Assert.assertEquals(2, edges.size());
@@ -7397,10 +7397,10 @@ public class EdgeCoreTest extends BaseCoreTest {
edges.get(0).remove();
graph.tx().commit();
- edges = graph.traversal().E()
- .has("related",
- "tags", ConditionP.contains("graphdb"))
- .toList();
+ edges = graph.traversal().E()
+ .has("related",
+ "tags", ConditionP.contains("graphdb"))
+ .toList();
Assert.assertEquals(1, edges.size());
}
@@ -7414,9 +7414,9 @@ public class EdgeCoreTest extends BaseCoreTest {
Vertex james = graph.addVertex(T.label, "author", "id", 1,
"name", "James Gosling", "age", 62,
"lived", "Canadian");
- Vertex guido = graph.addVertex(T.label, "author", "id", 2,
- "name", "Guido van Rossum", "age", 61,
- "lived", "California");
+ Vertex guido = graph.addVertex(T.label, "author", "id", 2,
+ "name", "Guido van Rossum", "age", 61,
+ "lived", "California");
Vertex java = graph.addVertex(T.label, "language", "name", "java");
Vertex python = graph.addVertex(T.label, "language", "name", "python",
@@ -7516,7 +7516,8 @@ public class EdgeCoreTest extends BaseCoreTest {
Vertex inVertex,
Object... kvs) {
Assert.assertTrue(Utils.contains(edges,
- new FakeObjects.FakeEdge(label, outVertex, inVertex, kvs)));
+ new FakeObjects.FakeEdge(label, outVertex, inVertex,
+ kvs)));
}
private int traverseInPage(Function<String, GraphTraversal<?, ?>> fetcher) {
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/EdgeLabelCoreTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/EdgeLabelCoreTest.java
index f4494a5d1..3b81c2f16 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/EdgeLabelCoreTest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/EdgeLabelCoreTest.java
@@ -20,13 +20,6 @@ package org.apache.hugegraph.core;
import java.util.Date;
import java.util.List;
-import org.apache.tinkerpop.gremlin.process.traversal.P;
-import org.apache.tinkerpop.gremlin.structure.Edge;
-import org.apache.tinkerpop.gremlin.structure.T;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.junit.Assume;
-import org.junit.Test;
-
import org.apache.hugegraph.HugeException;
import org.apache.hugegraph.HugeGraph;
import org.apache.hugegraph.backend.id.IdGenerator;
@@ -40,6 +33,13 @@ import org.apache.hugegraph.testutil.Assert;
import org.apache.hugegraph.type.define.Frequency;
import org.apache.hugegraph.util.DateUtil;
import org.apache.hugegraph.util.Events;
+import org.apache.tinkerpop.gremlin.process.traversal.P;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.T;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.junit.Assume;
+import org.junit.Test;
+
import com.google.common.collect.ImmutableSet;
public class EdgeLabelCoreTest extends SchemaCoreTest {
@@ -164,9 +164,9 @@ public class EdgeLabelCoreTest extends SchemaCoreTest {
Assert.assertThrows(IllegalArgumentException.class, () -> {
schema.edgeLabel("look").multiTimes()
- .properties("time")
- .sortKeys("time")
- .create();
+ .properties("time")
+ .sortKeys("time")
+ .create();
});
}
@@ -296,10 +296,10 @@ public class EdgeLabelCoreTest extends SchemaCoreTest {
schema.vertexLabel("book").properties("id", "name")
.primaryKeys("id").create();
EdgeLabel look = schema.edgeLabel("look")
- .properties("time", "weight")
- .nullableKeys("weight")
- .link("person", "book")
- .create();
+ .properties("time", "weight")
+ .nullableKeys("weight")
+ .link("person", "book")
+ .create();
Assert.assertNotNull(look);
Assert.assertEquals("look", look.name());
@@ -437,7 +437,7 @@ public class EdgeLabelCoreTest extends SchemaCoreTest {
@Test
public void testAddEdgeLabelWithDisableLabelIndex() {
super.initPropertyKeys();
- HugeGraph graph = graph();
+ HugeGraph graph = graph();
SchemaManager schema = graph.schema();
schema.vertexLabel("person")
@@ -602,8 +602,8 @@ public class EdgeLabelCoreTest extends SchemaCoreTest {
.create();
EdgeLabel look = schema.edgeLabel("look")
- .nullableKeys("weight")
- .append();
+ .nullableKeys("weight")
+ .append();
Assert.assertNotNull(look);
Assert.assertEquals("look", look.name());
@@ -633,9 +633,9 @@ public class EdgeLabelCoreTest extends SchemaCoreTest {
.create();
EdgeLabel look = schema.edgeLabel("look")
- .properties("weight")
- .nullableKeys("weight")
- .append();
+ .properties("weight")
+ .nullableKeys("weight")
+ .append();
Assert.assertNotNull(look);
Assert.assertEquals("look", look.name());
@@ -993,8 +993,8 @@ public class EdgeLabelCoreTest extends SchemaCoreTest {
graph().traversal().E().hasLabel("read").toList();
}, e -> {
Assert.assertTrue(
- e.getMessage().startsWith("Don't accept query by label") &&
- e.getMessage().endsWith("label index is disabled"));
+ e.getMessage().startsWith("Don't accept query by label") &&
+ e.getMessage().endsWith("label index is disabled"));
});
// Query by property index is ok
@@ -1022,8 +1022,8 @@ public class EdgeLabelCoreTest extends SchemaCoreTest {
graph().traversal().E().hasLabel("read").toList();
}, e -> {
Assert.assertTrue(
- e.getMessage().startsWith("Don't accept query by label") &&
- e.getMessage().endsWith("label index is disabled"));
+ e.getMessage().startsWith("Don't accept query by label") &&
+ e.getMessage().endsWith("label index is disabled"));
});
// Query by property index is ok
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/IndexLabelCoreTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/IndexLabelCoreTest.java
index 07b450625..24a905427 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/IndexLabelCoreTest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/IndexLabelCoreTest.java
@@ -20,13 +20,6 @@ package org.apache.hugegraph.core;
import java.util.Date;
import java.util.List;
-import org.apache.tinkerpop.gremlin.process.traversal.P;
-import org.apache.tinkerpop.gremlin.structure.Edge;
-import org.apache.tinkerpop.gremlin.structure.T;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.junit.Assume;
-import org.junit.Test;
-
import org.apache.hugegraph.HugeException;
import org.apache.hugegraph.HugeGraph;
import org.apache.hugegraph.exception.ExistedException;
@@ -42,6 +35,13 @@ import org.apache.hugegraph.type.HugeType;
import org.apache.hugegraph.type.define.IndexType;
import org.apache.hugegraph.type.define.WriteType;
import org.apache.hugegraph.util.DateUtil;
+import org.apache.tinkerpop.gremlin.process.traversal.P;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.T;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.junit.Assume;
+import org.junit.Test;
+
import com.google.common.collect.ImmutableList;
public class IndexLabelCoreTest extends SchemaCoreTest {
@@ -113,7 +113,7 @@ public class IndexLabelCoreTest extends SchemaCoreTest {
Assert.assertEquals(11, person.indexLabels().size());
assertContainsIl(person.indexLabels(),
"personByName", "personByCity", "personByAge",
- "personByBorn", "personByFans","personByHeight",
+ "personByBorn", "personByFans", "personByHeight",
"personByWeight", "personByIdNo", "personByTags",
"personByCategory", "personByScore");
@@ -411,7 +411,7 @@ public class IndexLabelCoreTest extends SchemaCoreTest {
.by("age").search().create();
}, e -> {
Assert.assertTrue(e.getMessage(), e.getMessage().contains(
- "Search index can only build on text"));
+ "Search index can only build on text"));
});
Assert.assertThrows(IllegalArgumentException.class, () -> {
@@ -1257,10 +1257,10 @@ public class IndexLabelCoreTest extends SchemaCoreTest {
graph().tx().commit();
Vertex vertex = graph().traversal().V().hasLabel("person")
- .has("city", "Hongkong").next();
+ .has("city", "Hongkong").next();
Assert.assertNotNull(vertex);
vertex = graph().traversal().V().hasLabel("person")
- .has("age", P.inside(2, 4)).next();
+ .has("age", P.inside(2, 4)).next();
Assert.assertNotNull(vertex);
schema.indexLabel("personByCity").remove();
@@ -1279,7 +1279,7 @@ public class IndexLabelCoreTest extends SchemaCoreTest {
.has("city", "Hongkong").next();
});
vertex = graph().traversal().V().hasLabel("person")
- .has("age", P.inside(2, 4)).next();
+ .has("age", P.inside(2, 4)).next();
Assert.assertNotNull(vertex);
schema.indexLabel("personByAge").remove();
@@ -1322,11 +1322,11 @@ public class IndexLabelCoreTest extends SchemaCoreTest {
Assert.assertEquals(1, authored.indexLabels().size());
assertContainsIl(authored.indexLabels(), "authoredByContri");
- james.addEdge("authored", java1,"contribution", "test");
+ james.addEdge("authored", java1, "contribution", "test");
graph().tx().commit();
Edge edge = graph().traversal().E().hasLabel("authored")
- .has("contribution", "test").next();
+ .has("contribution", "test").next();
Assert.assertNotNull(edge);
schema.indexLabel("authoredByContri").remove();
@@ -1375,20 +1375,20 @@ public class IndexLabelCoreTest extends SchemaCoreTest {
graph().tx().commit();
Vertex vertex = graph().traversal().V().hasLabel("person")
- .has("city", "Hongkong").next();
+ .has("city", "Hongkong").next();
Assert.assertNotNull(vertex);
vertex = graph().traversal().V().hasLabel("person")
- .has("age", P.inside(2, 4)).next();
+ .has("age", P.inside(2, 4)).next();
Assert.assertNotNull(vertex);
schema.indexLabel("personByCity").rebuild();
vertex = graph().traversal().V().hasLabel("person")
- .has("city", "Hongkong").next();
+ .has("city", "Hongkong").next();
Assert.assertNotNull(vertex);
schema.indexLabel("personByAge").rebuild();
vertex = graph().traversal().V().hasLabel("person")
- .has("age", P.inside(2, 4)).next();
+ .has("age", P.inside(2, 4)).next();
Assert.assertNotNull(vertex);
}
@@ -1414,18 +1414,18 @@ public class IndexLabelCoreTest extends SchemaCoreTest {
graph().tx().commit();
Vertex vertex = graph().traversal().V().hasLabel("person")
- .has("city", "Hongkong").next();
+ .has("city", "Hongkong").next();
Assert.assertNotNull(vertex);
vertex = graph().traversal().V().hasLabel("person")
- .has("age", P.inside(2, 4)).next();
+ .has("age", P.inside(2, 4)).next();
Assert.assertNotNull(vertex);
schema.vertexLabel("person").rebuildIndex();
vertex = graph().traversal().V().hasLabel("person")
- .has("city", "Hongkong").next();
+ .has("city", "Hongkong").next();
Assert.assertNotNull(vertex);
vertex = graph().traversal().V().hasLabel("person")
- .has("age", P.inside(2, 4)).next();
+ .has("age", P.inside(2, 4)).next();
Assert.assertNotNull(vertex);
}
@@ -1454,11 +1454,11 @@ public class IndexLabelCoreTest extends SchemaCoreTest {
Assert.assertEquals(1, authored.indexLabels().size());
assertContainsIl(authored.indexLabels(), "authoredByContri");
- james.addEdge("authored", java1,"contribution", "test");
+ james.addEdge("authored", java1, "contribution", "test");
graph().tx().commit();
Edge edge = graph().traversal().E().hasLabel("authored")
- .has("contribution", "test").next();
+ .has("contribution", "test").next();
Assert.assertNotNull(edge);
schema.indexLabel("authoredByContri").rebuild();
@@ -1466,7 +1466,7 @@ public class IndexLabelCoreTest extends SchemaCoreTest {
assertContainsIl(authored.indexLabels(), "authoredByContri");
edge = graph().traversal().E().hasLabel("authored")
- .has("contribution", "test").next();
+ .has("contribution", "test").next();
Assert.assertNotNull(edge);
}
@@ -1495,18 +1495,18 @@ public class IndexLabelCoreTest extends SchemaCoreTest {
Assert.assertEquals(1, authored.indexLabels().size());
assertContainsIl(authored.indexLabels(), "authoredByContri");
- james.addEdge("authored", java1,"contribution", "test");
+ james.addEdge("authored", java1, "contribution", "test");
graph().tx().commit();
Edge edge = graph().traversal().E().hasLabel("authored")
- .has("contribution", "test").next();
+ .has("contribution", "test").next();
Assert.assertNotNull(edge);
schema.edgeLabel("authored").rebuildIndex();
Assert.assertEquals(1, authored.indexLabels().size());
assertContainsIl(authored.indexLabels(), "authoredByContri");
edge = graph().traversal().E().hasLabel("authored")
- .has("contribution", "test").next();
+ .has("contribution", "test").next();
Assert.assertNotNull(edge);
}
@@ -1522,8 +1522,8 @@ public class IndexLabelCoreTest extends SchemaCoreTest {
graph().traversal().V().hasLabel("reader").toList();
}, e -> {
Assert.assertTrue(
- e.getMessage().startsWith("Don't accept query by label") &&
- e.getMessage().endsWith("label index is disabled"));
+ e.getMessage().startsWith("Don't accept query by label") &&
+ e.getMessage().endsWith("label index is disabled"));
});
// Query by property index is ok
@@ -1550,8 +1550,8 @@ public class IndexLabelCoreTest extends SchemaCoreTest {
graph().traversal().E().hasLabel("read").toList();
}, e -> {
Assert.assertTrue(
- e.getMessage().startsWith("Don't accept query by label") &&
- e.getMessage().endsWith("label index is disabled"));
+ e.getMessage().startsWith("Don't accept query by label") &&
+ e.getMessage().endsWith("label index is disabled"));
});
// Query by property index is ok
@@ -1579,8 +1579,8 @@ public class IndexLabelCoreTest extends SchemaCoreTest {
graph().traversal().V().hasLabel("reader").toList();
}, e -> {
Assert.assertTrue(
- e.getMessage().startsWith("Don't accept query by label") &&
- e.getMessage().endsWith("label index is disabled"));
+ e.getMessage().startsWith("Don't accept query by label") &&
+ e.getMessage().endsWith("label index is disabled"));
});
// Query by property index is ok
@@ -1607,8 +1607,8 @@ public class IndexLabelCoreTest extends SchemaCoreTest {
graph().traversal().E().hasLabel("read").toList();
}, e -> {
Assert.assertTrue(
- e.getMessage().startsWith("Don't accept query by label") &&
- e.getMessage().endsWith("label index is disabled"));
+ e.getMessage().startsWith("Don't accept query by label") &&
+ e.getMessage().endsWith("label index is disabled"));
});
// Query by property index is ok
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/PropertyCoreTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/PropertyCoreTest.java
index 7ae47faa4..873efd5e8 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/PropertyCoreTest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/PropertyCoreTest.java
@@ -25,19 +25,19 @@ import java.util.List;
import java.util.Set;
import java.util.UUID;
-import org.apache.tinkerpop.gremlin.structure.Edge;
-import org.apache.tinkerpop.gremlin.structure.T;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.apache.hugegraph.testutil.Utils;
-import org.junit.Before;
-import org.junit.Test;
-
import org.apache.hugegraph.HugeGraph;
import org.apache.hugegraph.backend.serializer.BytesBuffer;
import org.apache.hugegraph.schema.SchemaManager;
import org.apache.hugegraph.testutil.Assert;
+import org.apache.hugegraph.testutil.Utils;
import org.apache.hugegraph.traversal.optimize.TraversalUtil;
import org.apache.hugegraph.util.Blob;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.T;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.junit.Before;
+import org.junit.Test;
+
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
@@ -171,9 +171,9 @@ public abstract class PropertyCoreTest extends BaseCoreTest {
vertex = graph.vertices(vertex.id()).next();
Assert.assertTrue(TraversalUtil.testProperty(vertex.property(key),
- ImmutableSet.copyOf(values)));
+ ImmutableSet.copyOf(values)));
Assert.assertFalse(TraversalUtil.testProperty(vertex.property(key),
- ImmutableList.copyOf(values)));
+ ImmutableList.copyOf(values)));
return vertex.value(key);
}
}
@@ -223,9 +223,9 @@ public abstract class PropertyCoreTest extends BaseCoreTest {
edge = graph.edges(edge.id()).next();
Assert.assertTrue(TraversalUtil.testProperty(edge.property(key),
- ImmutableSet.copyOf(values)));
+ ImmutableSet.copyOf(values)));
Assert.assertFalse(TraversalUtil.testProperty(edge.property(key),
- ImmutableList.copyOf(values)));
+ ImmutableList.copyOf(values)));
return edge.value(key);
}
}
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/PropertyKeyCoreTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/PropertyKeyCoreTest.java
index b7109646f..5cd1193fc 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/PropertyKeyCoreTest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/PropertyKeyCoreTest.java
@@ -19,9 +19,6 @@ package org.apache.hugegraph.core;
import java.util.Date;
-import org.junit.Assume;
-import org.junit.Test;
-
import org.apache.hugegraph.HugeException;
import org.apache.hugegraph.exception.ExistedException;
import org.apache.hugegraph.exception.NotAllowException;
@@ -35,6 +32,9 @@ import org.apache.hugegraph.type.define.Cardinality;
import org.apache.hugegraph.type.define.DataType;
import org.apache.hugegraph.type.define.WriteType;
import org.apache.hugegraph.util.DateUtil;
+import org.junit.Assume;
+import org.junit.Test;
+
import com.google.common.collect.ImmutableList;
public class PropertyKeyCoreTest extends SchemaCoreTest {
@@ -43,9 +43,9 @@ public class PropertyKeyCoreTest extends SchemaCoreTest {
public void testAddPropertyKey() {
SchemaManager schema = graph().schema();
PropertyKey id = schema.propertyKey("id")
- .asText()
- .valueSingle()
- .create();
+ .asText()
+ .valueSingle()
+ .create();
Assert.assertEquals("id", id.name());
Assert.assertEquals(DataType.TEXT, id.dataType());
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/RamTableTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/RamTableTest.java
index 201df527a..a47d5bdc9 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/RamTableTest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/RamTableTest.java
@@ -22,16 +22,6 @@ import java.nio.file.Paths;
import java.util.Iterator;
import org.apache.commons.io.FileUtils;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
-import org.apache.tinkerpop.gremlin.structure.Edge;
-import org.apache.tinkerpop.gremlin.structure.T;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.junit.After;
-import org.junit.Assume;
-import org.junit.Before;
-import org.junit.Test;
-
import org.apache.hugegraph.HugeGraph;
import org.apache.hugegraph.backend.id.Id;
import org.apache.hugegraph.backend.id.IdGenerator;
@@ -44,6 +34,15 @@ import org.apache.hugegraph.structure.HugeVertex;
import org.apache.hugegraph.testutil.Assert;
import org.apache.hugegraph.testutil.Whitebox;
import org.apache.hugegraph.type.define.Directions;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.T;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.junit.After;
+import org.junit.Assume;
+import org.junit.Before;
+import org.junit.Test;
public class RamTableTest extends BaseCoreTest {
@@ -67,13 +66,13 @@ public class RamTableTest extends BaseCoreTest {
graph.schema().vertexLabel("vl1").useCustomizeNumberId().create();
graph.schema().vertexLabel("vl2").useCustomizeNumberId().create();
graph.schema().edgeLabel("el1")
- .sourceLabel("vl1")
- .targetLabel("vl1")
- .create();
+ .sourceLabel("vl1")
+ .targetLabel("vl1")
+ .create();
graph.schema().edgeLabel("el2")
- .sourceLabel("vl2")
- .targetLabel("vl2")
- .create();
+ .sourceLabel("vl2")
+ .targetLabel("vl2")
+ .create();
}
@Override
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/RestoreCoreTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/RestoreCoreTest.java
index 23b3eb65f..0713fb022 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/RestoreCoreTest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/RestoreCoreTest.java
@@ -17,16 +17,15 @@
package org.apache.hugegraph.core;
-import org.apache.tinkerpop.gremlin.structure.T;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.junit.After;
-import org.junit.Test;
-
import org.apache.hugegraph.HugeGraph;
import org.apache.hugegraph.exception.ExistedException;
import org.apache.hugegraph.testutil.Assert;
import org.apache.hugegraph.type.define.GraphMode;
import org.apache.hugegraph.type.define.IdStrategy;
+import org.apache.tinkerpop.gremlin.structure.T;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.junit.After;
+import org.junit.Test;
public class RestoreCoreTest extends BaseCoreTest {
@@ -42,7 +41,7 @@ public class RestoreCoreTest extends BaseCoreTest {
HugeGraph graph = graph();
graph.mode(GraphMode.NONE);
Assert.assertThrows(IllegalArgumentException.class, () ->
- graph.schema().vertexLabel("person").id(0L).create()
+ graph.schema().vertexLabel("person").id(0L).create()
);
}
@@ -51,7 +50,7 @@ public class RestoreCoreTest extends BaseCoreTest {
HugeGraph graph = graph();
graph.mode(GraphMode.MERGING);
Assert.assertThrows(IllegalArgumentException.class, () ->
- graph.schema().vertexLabel("person").id(0L).create()
+ graph.schema().vertexLabel("person").id(0L).create()
);
}
@@ -60,7 +59,7 @@ public class RestoreCoreTest extends BaseCoreTest {
HugeGraph graph = graph();
graph.mode(GraphMode.RESTORING);
Assert.assertThrows(IllegalArgumentException.class, () ->
- graph.schema().vertexLabel("person").id(0L).create()
+ graph.schema().vertexLabel("person").id(0L).create()
);
}
@@ -69,7 +68,7 @@ public class RestoreCoreTest extends BaseCoreTest {
HugeGraph graph = graph();
graph.mode(GraphMode.NONE);
Assert.assertThrows(IllegalStateException.class, () ->
- graph.schema().vertexLabel("person").id(-100L).create()
+ graph.schema().vertexLabel("person").id(-100L).create()
);
}
@@ -78,7 +77,7 @@ public class RestoreCoreTest extends BaseCoreTest {
HugeGraph graph = graph();
graph.mode(GraphMode.MERGING);
Assert.assertThrows(IllegalStateException.class, () ->
- graph.schema().vertexLabel("person").id(-100L).create()
+ graph.schema().vertexLabel("person").id(-100L).create()
);
}
@@ -87,7 +86,7 @@ public class RestoreCoreTest extends BaseCoreTest {
HugeGraph graph = graph();
graph.mode(GraphMode.RESTORING);
Assert.assertThrows(IllegalStateException.class, () ->
- graph.schema().vertexLabel("person").id(-100L).create()
+ graph.schema().vertexLabel("person").id(-100L).create()
);
}
@@ -96,7 +95,7 @@ public class RestoreCoreTest extends BaseCoreTest {
HugeGraph graph = graph();
graph.mode(GraphMode.NONE);
Assert.assertThrows(IllegalStateException.class, () ->
- graph.schema().vertexLabel("person").id(100L).create()
+ graph.schema().vertexLabel("person").id(100L).create()
);
}
@@ -105,7 +104,7 @@ public class RestoreCoreTest extends BaseCoreTest {
HugeGraph graph = graph();
graph.mode(GraphMode.MERGING);
Assert.assertThrows(IllegalStateException.class, () ->
- graph.schema().vertexLabel("person").id(100L).create()
+ graph.schema().vertexLabel("person").id(100L).create()
);
}
@@ -129,7 +128,7 @@ public class RestoreCoreTest extends BaseCoreTest {
graph.mode(GraphMode.RESTORING);
graph.schema().vertexLabel("person").id(100L).create();
Assert.assertThrows(ExistedException.class, () ->
- graph.schema().vertexLabel("person").id(100L).create()
+ graph.schema().vertexLabel("person").id(100L).create()
);
}
@@ -139,7 +138,7 @@ public class RestoreCoreTest extends BaseCoreTest {
graph.mode(GraphMode.RESTORING);
graph.schema().vertexLabel("person").id(100L).create();
Assert.assertThrows(ExistedException.class, () ->
- graph.schema().vertexLabel("person1").id(100L).create()
+ graph.schema().vertexLabel("person1").id(100L).create()
);
}
@@ -148,7 +147,7 @@ public class RestoreCoreTest extends BaseCoreTest {
HugeGraph graph = graph();
graph.mode(GraphMode.RESTORING);
Assert.assertThrows(IllegalArgumentException.class, () ->
- graph.schema().vertexLabel("~person").id(0L).create()
+ graph.schema().vertexLabel("~person").id(0L).create()
);
}
@@ -157,7 +156,7 @@ public class RestoreCoreTest extends BaseCoreTest {
HugeGraph graph = graph();
graph.mode(GraphMode.RESTORING);
Assert.assertThrows(IllegalStateException.class, () ->
- graph.schema().vertexLabel("~person").id(100L).build()
+ graph.schema().vertexLabel("~person").id(100L).build()
);
}
@@ -175,7 +174,7 @@ public class RestoreCoreTest extends BaseCoreTest {
.idStrategy(IdStrategy.AUTOMATIC).create();
graph.mode(GraphMode.NONE);
Assert.assertThrows(IllegalArgumentException.class, () ->
- graph.addVertex(T.label, "person", T.id, 100L)
+ graph.addVertex(T.label, "person", T.id, 100L)
);
}
@@ -205,7 +204,7 @@ public class RestoreCoreTest extends BaseCoreTest {
.idStrategy(IdStrategy.PRIMARY_KEY).primaryKeys("name").create();
graph.mode(GraphMode.NONE);
Assert.assertThrows(IllegalArgumentException.class, () ->
- graph.addVertex(T.label, "person", T.id, 100L, "name", "Tom")
+ graph.addVertex(T.label, "person", T.id, 100L, "name", "Tom")
);
}
@@ -217,7 +216,7 @@ public class RestoreCoreTest extends BaseCoreTest {
.idStrategy(IdStrategy.PRIMARY_KEY).primaryKeys("name").create();
graph.mode(GraphMode.MERGING);
Assert.assertThrows(IllegalArgumentException.class, () ->
- graph.addVertex(T.label, "person", T.id, 100L, "name", "Tom")
+ graph.addVertex(T.label, "person", T.id, 100L, "name", "Tom")
);
}
@@ -229,7 +228,7 @@ public class RestoreCoreTest extends BaseCoreTest {
.idStrategy(IdStrategy.PRIMARY_KEY).primaryKeys("name").create();
graph.mode(GraphMode.RESTORING);
Assert.assertThrows(IllegalArgumentException.class, () ->
- graph.addVertex(T.label, "person", T.id, 100L, "name", "Tom")
+ graph.addVertex(T.label, "person", T.id, 100L, "name", "Tom")
);
}
@@ -419,17 +418,17 @@ public class RestoreCoreTest extends BaseCoreTest {
graph.mode(GraphMode.NONE);
Assert.assertThrows(UnsupportedOperationException.class, () ->
- v1.addEdge("knows", v2, T.id, "id")
+ v1.addEdge("knows", v2, T.id, "id")
);
graph.mode(GraphMode.MERGING);
Assert.assertThrows(UnsupportedOperationException.class, () ->
- v1.addEdge("knows", v2, T.id, "id")
+ v1.addEdge("knows", v2, T.id, "id")
);
graph.mode(GraphMode.RESTORING);
Assert.assertThrows(UnsupportedOperationException.class, () ->
- v1.addEdge("knows", v2, T.id, "id")
+ v1.addEdge("knows", v2, T.id, "id")
);
}
@@ -438,7 +437,7 @@ public class RestoreCoreTest extends BaseCoreTest {
HugeGraph graph = graph();
graph.mode(GraphMode.NONE);
Assert.assertThrows(IllegalArgumentException.class, () ->
- graph.schema().propertyKey("name").id(0L).create()
+ graph.schema().propertyKey("name").id(0L).create()
);
}
@@ -447,7 +446,7 @@ public class RestoreCoreTest extends BaseCoreTest {
HugeGraph graph = graph();
graph.mode(GraphMode.MERGING);
Assert.assertThrows(IllegalArgumentException.class, () ->
- graph.schema().propertyKey("name").id(0L).create()
+ graph.schema().propertyKey("name").id(0L).create()
);
}
@@ -456,7 +455,7 @@ public class RestoreCoreTest extends BaseCoreTest {
HugeGraph graph = graph();
graph.mode(GraphMode.RESTORING);
Assert.assertThrows(IllegalArgumentException.class, () ->
- graph.schema().propertyKey("name").id(0L).create()
+ graph.schema().propertyKey("name").id(0L).create()
);
}
@@ -465,7 +464,7 @@ public class RestoreCoreTest extends BaseCoreTest {
HugeGraph graph = graph();
graph.mode(GraphMode.NONE);
Assert.assertThrows(IllegalStateException.class, () ->
- graph.schema().propertyKey("name").id(-100L).create()
+ graph.schema().propertyKey("name").id(-100L).create()
);
}
@@ -474,7 +473,7 @@ public class RestoreCoreTest extends BaseCoreTest {
HugeGraph graph = graph();
graph.mode(GraphMode.MERGING);
Assert.assertThrows(IllegalStateException.class, () ->
- graph.schema().propertyKey("name").id(-100L).create()
+ graph.schema().propertyKey("name").id(-100L).create()
);
}
@@ -483,7 +482,7 @@ public class RestoreCoreTest extends BaseCoreTest {
HugeGraph graph = graph();
graph.mode(GraphMode.RESTORING);
Assert.assertThrows(IllegalStateException.class, () ->
- graph.schema().propertyKey("name").id(-100L).create()
+ graph.schema().propertyKey("name").id(-100L).create()
);
}
@@ -492,7 +491,7 @@ public class RestoreCoreTest extends BaseCoreTest {
HugeGraph graph = graph();
graph.mode(GraphMode.NONE);
Assert.assertThrows(IllegalStateException.class, () ->
- graph.schema().propertyKey("name").id(100L).create()
+ graph.schema().propertyKey("name").id(100L).create()
);
}
@@ -501,7 +500,7 @@ public class RestoreCoreTest extends BaseCoreTest {
HugeGraph graph = graph();
graph.mode(GraphMode.MERGING);
Assert.assertThrows(IllegalStateException.class, () ->
- graph.schema().propertyKey("name").id(100L).create()
+ graph.schema().propertyKey("name").id(100L).create()
);
}
@@ -527,7 +526,7 @@ public class RestoreCoreTest extends BaseCoreTest {
graph.mode(GraphMode.RESTORING);
graph.schema().propertyKey("name").id(100L).create();
Assert.assertThrows(ExistedException.class, () ->
- graph.schema().propertyKey("name").id(1000L).create()
+ graph.schema().propertyKey("name").id(1000L).create()
);
}
@@ -537,7 +536,7 @@ public class RestoreCoreTest extends BaseCoreTest {
graph.mode(GraphMode.RESTORING);
graph.schema().propertyKey("name").id(100L).create();
Assert.assertThrows(ExistedException.class, () ->
- graph.schema().propertyKey("name1").id(100L).create()
+ graph.schema().propertyKey("name1").id(100L).create()
);
}
@@ -550,9 +549,9 @@ public class RestoreCoreTest extends BaseCoreTest {
.primaryKeys("name").create();
graph.mode(GraphMode.NONE);
Assert.assertThrows(IllegalArgumentException.class, () ->
- graph.schema().indexLabel("personByCity")
- .onV("person").by("city").secondary().id(0L)
- .create()
+ graph.schema().indexLabel("personByCity")
+ .onV("person").by("city").secondary().id(0L)
+ .create()
);
}
@@ -565,9 +564,9 @@ public class RestoreCoreTest extends BaseCoreTest {
.primaryKeys("name").create();
graph.mode(GraphMode.MERGING);
Assert.assertThrows(IllegalArgumentException.class, () ->
- graph.schema().indexLabel("personByCity")
- .onV("person").by("city").secondary().id(0L)
- .create()
+ graph.schema().indexLabel("personByCity")
+ .onV("person").by("city").secondary().id(0L)
+ .create()
);
}
@@ -580,9 +579,9 @@ public class RestoreCoreTest extends BaseCoreTest {
.primaryKeys("name").create();
graph.mode(GraphMode.RESTORING);
Assert.assertThrows(IllegalArgumentException.class, () ->
- graph.schema().indexLabel("personByCity")
- .onV("person").by("city").secondary().id(0L)
- .create()
+ graph.schema().indexLabel("personByCity")
+ .onV("person").by("city").secondary().id(0L)
+ .create()
);
}
@@ -595,9 +594,9 @@ public class RestoreCoreTest extends BaseCoreTest {
.primaryKeys("name").create();
graph.mode(GraphMode.NONE);
Assert.assertThrows(IllegalStateException.class, () ->
- graph.schema().indexLabel("personByCity")
- .onV("person").by("city").secondary().id(-100L)
- .create()
+ graph.schema().indexLabel("personByCity")
+ .onV("person").by("city").secondary().id(-100L)
+ .create()
);
}
@@ -610,9 +609,9 @@ public class RestoreCoreTest extends BaseCoreTest {
.primaryKeys("name").create();
graph.mode(GraphMode.MERGING);
Assert.assertThrows(IllegalStateException.class, () ->
- graph.schema().indexLabel("personByCity")
- .onV("person").by("city").secondary().id(-100L)
- .create()
+ graph.schema().indexLabel("personByCity")
+ .onV("person").by("city").secondary().id(-100L)
+ .create()
);
}
@@ -625,9 +624,9 @@ public class RestoreCoreTest extends BaseCoreTest {
.primaryKeys("name").create();
graph.mode(GraphMode.RESTORING);
Assert.assertThrows(IllegalStateException.class, () ->
- graph.schema().indexLabel("personByCity")
- .onV("person").by("city").secondary().id(-100L)
- .create()
+ graph.schema().indexLabel("personByCity")
+ .onV("person").by("city").secondary().id(-100L)
+ .create()
);
}
@@ -640,9 +639,9 @@ public class RestoreCoreTest extends BaseCoreTest {
.primaryKeys("name").create();
graph.mode(GraphMode.NONE);
Assert.assertThrows(IllegalStateException.class, () ->
- graph.schema().indexLabel("personByCity")
- .onV("person").by("city").secondary().id(100L)
- .create()
+ graph.schema().indexLabel("personByCity")
+ .onV("person").by("city").secondary().id(100L)
+ .create()
);
}
@@ -655,9 +654,9 @@ public class RestoreCoreTest extends BaseCoreTest {
.primaryKeys("name").create();
graph.mode(GraphMode.MERGING);
Assert.assertThrows(IllegalStateException.class, () ->
- graph.schema().indexLabel("personByCity")
- .onV("person").by("city").secondary().id(100L)
- .create()
+ graph.schema().indexLabel("personByCity")
+ .onV("person").by("city").secondary().id(100L)
+ .create()
);
}
@@ -699,9 +698,9 @@ public class RestoreCoreTest extends BaseCoreTest {
.onV("person").by("city").secondary().id(100L)
.create();
Assert.assertThrows(ExistedException.class, () ->
- graph.schema().indexLabel("personByCity")
- .onV("person").by("city").secondary().id(100L)
- .create()
+ graph.schema().indexLabel("personByCity")
+ .onV("person").by("city").secondary().id(100L)
+ .create()
);
}
@@ -717,9 +716,9 @@ public class RestoreCoreTest extends BaseCoreTest {
.onV("person").by("city").secondary().id(100L)
.create();
Assert.assertThrows(ExistedException.class, () ->
- graph.schema().indexLabel("personByCity1")
- .onV("person").by("city").secondary().id(100L)
- .create()
+ graph.schema().indexLabel("personByCity1")
+ .onV("person").by("city").secondary().id(100L)
+ .create()
);
}
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/RoleElectionStateMachineTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/RoleElectionStateMachineTest.java
index e4a3c4f50..eab1e6b79 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/RoleElectionStateMachineTest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/RoleElectionStateMachineTest.java
@@ -206,7 +206,7 @@ public class RoleElectionStateMachineTest {
};
final List<ClusterRole> clusterRoleLogs = Collections.synchronizedList(
- new ArrayList<>(100));
+ new ArrayList<>(100));
final ClusterRoleStore clusterRoleStore = new ClusterRoleStore() {
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/SchemaCoreTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/SchemaCoreTest.java
index 45980b378..0d70bb203 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/SchemaCoreTest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/SchemaCoreTest.java
@@ -21,9 +21,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-import org.apache.tinkerpop.gremlin.structure.T;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-
import org.apache.hugegraph.HugeGraph;
import org.apache.hugegraph.backend.id.Id;
import org.apache.hugegraph.schema.EdgeLabel;
@@ -32,6 +29,8 @@ import org.apache.hugegraph.schema.PropertyKey;
import org.apache.hugegraph.schema.SchemaManager;
import org.apache.hugegraph.schema.VertexLabel;
import org.apache.hugegraph.testutil.Assert;
+import org.apache.tinkerpop.gremlin.structure.T;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
public class SchemaCoreTest extends BaseCoreTest {
diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/TaskCoreTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/TaskCoreTest.java
index d2f56c6cf..7d4e8a891 100644
--- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/TaskCoreTest.java
+++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/TaskCoreTest.java
@@ -22,9 +22,6 @@ import java.util.Iterator;
import java.util.Random;
import java.util.concurrent.TimeoutException;
-import org.junit.Before;
-import org.junit.Test;
-
import org.apache.hugegraph.HugeException;
import org.apache.hugegraph.HugeGraph;
import org.apache.hugegraph.api.job.GremlinAPI.GremlinRequest;
@@ -41,6 +38,9 @@ import org.apache.hugegraph.task.TaskScheduler;
import org.apache.hugegraph.task.TaskStatus;
import org.apache.hugegraph.testutil.Assert;
import org.apache.hugegraph.testutil.Whitebox;
+import org.junit.Before;
+import org.junit.Test;
+
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
@@ -249,20 +249,22 @@ public class TaskCoreTest extends BaseCoreTest {
TaskScheduler scheduler = graph.taskScheduler();
String script = "schema=graph.schema();" +
- "schema.propertyKey('name').asText().ifNotExist().create();" +
- "schema.propertyKey('age').asInt().ifNotExist().create();" +
- "schema.propertyKey('lang').asText().ifNotExist().create();" +
- "schema.propertyKey('date').asDate().ifNotExist().create();" +
- "schema.propertyKey('price').asInt().ifNotExist().create();" +
- "schema.vertexLabel('person1').properties('name','age').ifNotExist().create();" +
- "schema.vertexLabel('person2').properties('name','age').ifNotExist().create();" +
- "schema.edgeLabel('knows').sourceLabel('person1').targetLabel('person2')." +
- "properties('date').ifNotExist().create();" +
- "for(int i = 0; i < 1000; i++) {" +
- " p1=graph.addVertex(T.label,'person1','name','p1-'+i,'age',29);" +
- " p2=graph.addVertex(T.label,'person2','name','p2-'+i,'age',27);" +
- " p1.addEdge('knows',p2,'date','2016-01-10');" +
- "}";
+ "schema.propertyKey('name').asText().ifNotExist().create();" +
+ "schema.propertyKey('age').asInt().ifNotExist().create();" +
+ "schema.propertyKey('lang').asText().ifNotExist().create();" +
+ "schema.propertyKey('date').asDate().ifNotExist().create();" +
+ "schema.propertyKey('price').asInt().ifNotExist().create();" +
+ "schema.vertexLabel('person1').properties('name','age').ifNotExist()" +
+ ".create();" +
+ "schema.vertexLabel('person2').properties('name','age').ifNotExist()" +
+ ".create();" +
+ "schema.edgeLabel('knows').sourceLabel('person1').targetLabel('person2')." +
+ "properties('date').ifNotExist().create();" +
+ "for(int i = 0; i < 1000; i++) {" +
+ " p1=graph.addVertex(T.label,'person1','name','p1-'+i,'age',29);" +
+ " p2=graph.addVertex(T.label,'person2','name','p2-'+i,'age',27);" +
+ " p1.addEdge('knows',p2,'date','2016-01-10');" +
+ "}";
HugeTask<Object> task = runGremlinJob(script);
task = scheduler.waitUntilTaskCompleted(task.id(), 10);
@@ -308,27 +310,27 @@ public class TaskCoreTest extends BaseCoreTest {
TaskScheduler scheduler = graph.taskScheduler();
String script = "schema=graph.schema();" +
- "schema.propertyKey('name').asText().ifNotExist().create();" +
- "schema.vertexLabel('char').useCustomizeNumberId()" +
- " .properties('name').ifNotExist().create();" +
- "schema.edgeLabel('next').sourceLabel('char').targetLabel('char')" +
- " .properties('name').ifNotExist().create();" +
- "g.addV('char').property(id,1).property('name','A').as('a')" +
- " .addV('char').property(id,2).property('name','B').as('b')" +
- " .addV('char').property(id,3).property('name','C').as('c')" +
... 3745 lines suppressed ...