diff --git a/.github/workflows/client-ci.yml b/.github/workflows/client-ci.yml index f1448f807..b8c19c706 100644 --- a/.github/workflows/client-ci.yml +++ b/.github/workflows/client-ci.yml @@ -1,6 +1,7 @@ name: "hugegraph-client-ci" on: + workflow_dispatch: push: branches: - master @@ -23,11 +24,12 @@ jobs: env: USE_STAGE: 'true' # Whether to include the stage repository. TRAVIS_DIR: hugegraph-client/assembly/travis + # TODO: replace it with the (latest - n) commit id (n >= 15) COMMIT_ID: be6ee386b9939dc6bd6fcbdf2274b8acc3a0a314 strategy: fail-fast: false matrix: - JAVA_VERSION: ['8'] + JAVA_VERSION: [ '8' ] steps: - name: Install JDK 8 uses: actions/setup-java@v3 @@ -71,4 +73,5 @@ jobs: - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 with: + token: ${{ secrets.CODECOV_TOKEN }} file: target/jacoco.xml diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 838b4c5f6..9ee5a6539 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -12,6 +12,9 @@ name: "CodeQL" on: + workflow_dispatch: + push: + branches: [ master, release-* ] pull_request: # The branches below must be a subset of the branches above # branches: [ master ] # enable in all PR diff --git a/.github/workflows/hubble-ci.yml b/.github/workflows/hubble-ci.yml index c07078c1a..ea186d40a 100644 --- a/.github/workflows/hubble-ci.yml +++ b/.github/workflows/hubble-ci.yml @@ -1,6 +1,7 @@ name: "hugegraph-hubble-ci" on: + workflow_dispatch: push: branches: - master @@ -22,7 +23,7 @@ on: env: TRAVIS_DIR: hugegraph-hubble/hubble-dist/assembly/travis - # TODO: need update it later (eed6103359fe40d2f1476fb8c56d9388c3111a99) + # TODO: replace it with the (latest - n) commit id (n >= 15) COMMIT_ID: be6ee386b9939dc6bd6fcbdf2274b8acc3a0a314 jobs: @@ -113,6 +114,7 @@ jobs: hubble-dist/assembly/travis/run-api-test.sh - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3.0.0 + uses: codecov/codecov-action@v3 with: + token: ${{ secrets.CODECOV_TOKEN }} file: target/site/jacoco/*.xml diff --git a/.github/workflows/loader-ci.yml b/.github/workflows/loader-ci.yml index d3132a317..3c676302b 100644 --- a/.github/workflows/loader-ci.yml +++ b/.github/workflows/loader-ci.yml @@ -1,6 +1,7 @@ name: "hugegraph-loader-ci" on: + workflow_dispatch: push: branches: - master @@ -25,6 +26,7 @@ jobs: USE_STAGE: 'true' # Whether to include the stage repository. TRAVIS_DIR: hugegraph-loader/assembly/travis STATIC_DIR: hugegraph-loader/assembly/static + # TODO: replace it with the (latest - n) commit id (n >= 15) COMMIT_ID: be6ee386b9939dc6bd6fcbdf2274b8acc3a0a314 DB_USER: root DB_PASS: root @@ -74,6 +76,7 @@ jobs: mvn test -P kafka - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3.0.0 + uses: codecov/codecov-action@v3 with: + token: ${{ secrets.CODECOV_TOKEN }} file: target/jacoco.xml diff --git a/.github/workflows/tools-ci.yml b/.github/workflows/tools-ci.yml index f0e66625f..f00582b2e 100644 --- a/.github/workflows/tools-ci.yml +++ b/.github/workflows/tools-ci.yml @@ -1,5 +1,6 @@ name: "hugegraph-tools-ci" on: + workflow_dispatch: push: branches: - master @@ -56,6 +57,7 @@ jobs: run: | mvn test -Dtest=FuncTestSuite -pl hugegraph-tools -ntp - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3.0.0 + uses: codecov/codecov-action@v3 with: + token: ${{ secrets.CODECOV_TOKEN }} file: target/jacoco.xml diff --git a/.licenserc.yaml b/.licenserc.yaml index 789856df7..827be9c86 100644 --- a/.licenserc.yaml +++ b/.licenserc.yaml @@ -75,6 +75,7 @@ header: # `header` section is configurations for source codes license header. - 'assembly/**' - '.github/**/*' - '**/target/*' + - 'hugegraph-client/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker' # - 'hugegraph-hubble/hubble-fe/**' comment: on-failure # on what condition license-eye will comment on the pull request, `on-failure`, `always`, `never`. diff --git a/hugegraph-client/assembly/travis/install-hugegraph-from-source.sh b/hugegraph-client/assembly/travis/install-hugegraph-from-source.sh index df912fb0a..2c9ea319e 100755 --- a/hugegraph-client/assembly/travis/install-hugegraph-from-source.sh +++ b/hugegraph-client/assembly/travis/install-hugegraph-from-source.sh @@ -60,5 +60,5 @@ echo "gremlinserver.url=http://127.0.0.1:8282" >> ${REST_SERVER_CONFIG} # start HugeGraphServer with https protocol bin/init-store.sh -bin/start-hugegraph.sh +bin/start-hugegraph.sh || (cat logs/hugegraph-server.log && exit 1) cd ../ diff --git a/hugegraph-client/pom.xml b/hugegraph-client/pom.xml index ec867df2d..08b8d3ebe 100644 --- a/hugegraph-client/pom.xml +++ b/hugegraph-client/pom.xml @@ -15,8 +15,8 @@ License for the specific language governing permissions and limitations under the License. --> - 4.0.0 @@ -30,15 +30,12 @@ jar ${project.artifactId} - https://github.com/apache/incubator-hugegraph-toolchain/tree/master/hugegraph-client + https://github.com/apache/hugegraph-toolchain/tree/master/hugegraph-client hugegraph-client is a Java-written client of HugeGraph, providing operations of graph, schema, gremlin, variables and traversals etc. - - - org.apache.hugegraph @@ -48,15 +45,17 @@ org.lz4 lz4-java - - org.glassfish.jersey.containers - jersey-container-servlet - org.mockito mockito-core test + + org.projectlombok + lombok + ${lombok.version} + true + diff --git a/hugegraph-client/src/main/java/org/apache/hugegraph/api/auth/UserAPI.java b/hugegraph-client/src/main/java/org/apache/hugegraph/api/auth/UserAPI.java index 30fbb9edc..3c1c1d0c7 100644 --- a/hugegraph-client/src/main/java/org/apache/hugegraph/api/auth/UserAPI.java +++ b/hugegraph-client/src/main/java/org/apache/hugegraph/api/auth/UserAPI.java @@ -50,8 +50,8 @@ public User get(Object id) { } public UserRole getUserRole(Object id) { - String idEncoded = RestClient.encode(formatEntityId(id)); - String path = String.join("/", this.path(), idEncoded, "role"); + String formattedId = formatEntityId(id); + String path = String.join("/", this.path(), formattedId, "role"); RestResult result = this.client.get(path); return result.readObject(UserRole.class); } diff --git a/hugegraph-client/src/main/java/org/apache/hugegraph/api/graph/EdgeAPI.java b/hugegraph-client/src/main/java/org/apache/hugegraph/api/graph/EdgeAPI.java index f55f17043..36c3eb19b 100644 --- a/hugegraph-client/src/main/java/org/apache/hugegraph/api/graph/EdgeAPI.java +++ b/hugegraph-client/src/main/java/org/apache/hugegraph/api/graph/EdgeAPI.java @@ -23,6 +23,7 @@ import org.apache.hugegraph.client.RestClient; import org.apache.hugegraph.exception.NotAllCreatedException; +import org.apache.hugegraph.rest.RestHeaders; import org.apache.hugegraph.rest.RestResult; import org.apache.hugegraph.structure.constant.Direction; import org.apache.hugegraph.structure.constant.HugeType; @@ -32,8 +33,6 @@ import com.google.common.collect.ImmutableMap; -import jakarta.ws.rs.core.MultivaluedHashMap; - public class EdgeAPI extends GraphAPI { public EdgeAPI(RestClient client, String graph) { @@ -51,12 +50,9 @@ public Edge create(Edge edge) { } public List create(List edges, boolean checkVertex) { - MultivaluedHashMap headers = new MultivaluedHashMap<>(); - headers.putSingle("Content-Encoding", BATCH_ENCODING); - Map params = ImmutableMap.of("check_vertex", - checkVertex); - RestResult result = this.client.post(this.batchPath(), edges, - headers, params); + RestHeaders headers = new RestHeaders().add(RestHeaders.CONTENT_ENCODING, BATCH_ENCODING); + Map params = ImmutableMap.of("check_vertex", checkVertex); + RestResult result = this.client.post(this.batchPath(), edges, headers, params); List ids = result.readList(String.class); if (edges.size() != ids.size()) { throw new NotAllCreatedException("Not all edges are successfully created, " + @@ -68,10 +64,8 @@ public List create(List edges, boolean checkVertex) { public List update(BatchEdgeRequest request) { this.client.checkApiVersion("0.45", "batch property update"); - MultivaluedHashMap headers = new MultivaluedHashMap<>(); - headers.putSingle("Content-Encoding", BATCH_ENCODING); - RestResult result = this.client.put(this.batchPath(), null, - request, headers); + RestHeaders headers = new RestHeaders().add(RestHeaders.CONTENT_ENCODING, BATCH_ENCODING); + RestResult result = this.client.put(this.batchPath(), null, request, headers); return result.readList(this.type(), Edge.class); } @@ -98,11 +92,9 @@ public Edges list(int limit) { return this.list(null, null, null, null, 0, null, limit); } - public Edges list(Object vertexId, Direction direction, - String label, Map properties, - int offset, String page, int limit) { - return this.list(vertexId, direction, label, properties, false, - offset, page, limit); + public Edges list(Object vertexId, Direction direction, String label, + Map properties, int offset, String page, int limit) { + return this.list(vertexId, direction, label, properties, false, offset, page, limit); } public Edges list(Object vertexId, Direction direction, String label, diff --git a/hugegraph-client/src/main/java/org/apache/hugegraph/api/graph/GraphAPI.java b/hugegraph-client/src/main/java/org/apache/hugegraph/api/graph/GraphAPI.java index edea0d6c3..c2eb76819 100644 --- a/hugegraph-client/src/main/java/org/apache/hugegraph/api/graph/GraphAPI.java +++ b/hugegraph-client/src/main/java/org/apache/hugegraph/api/graph/GraphAPI.java @@ -20,9 +20,6 @@ import java.util.Map; import java.util.UUID; -import org.glassfish.jersey.uri.UriComponent; -import org.glassfish.jersey.uri.UriComponent.Type; - import org.apache.hugegraph.api.API; import org.apache.hugegraph.client.RestClient; import org.apache.hugegraph.util.E; @@ -61,8 +58,7 @@ public static String formatVertexId(Object id, boolean allowNull) { id = id.toString(); } E.checkArgument(id instanceof String || id instanceof Number, - "The vertex id must be either String or " + - "Number, but got '%s'", id); + "The vertex id must be either String or Number, but got '%s'", id); return (uuid ? "U" : "") + JsonUtil.toJson(id); } @@ -70,16 +66,6 @@ public static String formatProperties(Map properties) { if (properties == null) { return null; } - String json = JsonUtil.toJson(properties); - /* - * Don't use UrlEncoder.encode, it encoded the space as `+`, - * which will invalidate the jersey's automatic decoding - * because it considers the space to be encoded as `%2F` - */ - return encode(json); - } - - public static String encode(String raw) { - return UriComponent.encode(raw, Type.QUERY_PARAM_SPACE_ENCODED); + return JsonUtil.toJson(properties); } } diff --git a/hugegraph-client/src/main/java/org/apache/hugegraph/api/graph/VertexAPI.java b/hugegraph-client/src/main/java/org/apache/hugegraph/api/graph/VertexAPI.java index 6f2836837..70f4de78a 100644 --- a/hugegraph-client/src/main/java/org/apache/hugegraph/api/graph/VertexAPI.java +++ b/hugegraph-client/src/main/java/org/apache/hugegraph/api/graph/VertexAPI.java @@ -24,6 +24,8 @@ import org.apache.hugegraph.client.RestClient; import org.apache.hugegraph.exception.InvalidResponseException; import org.apache.hugegraph.exception.NotAllCreatedException; +import org.apache.hugegraph.rest.RestHeaders; +import org.apache.hugegraph.rest.RestResult; import org.apache.hugegraph.structure.constant.HugeType; import org.apache.hugegraph.structure.graph.BatchOlapPropertyRequest; import org.apache.hugegraph.structure.graph.BatchVertexRequest; @@ -32,10 +34,6 @@ import com.google.common.collect.ImmutableMap; -import jakarta.ws.rs.core.MultivaluedHashMap; - -import org.apache.hugegraph.rest.RestResult; - public class VertexAPI extends GraphAPI { public VertexAPI(RestClient client, String graph) { @@ -53,10 +51,8 @@ public Vertex create(Vertex vertex) { } public List create(List vertices) { - MultivaluedHashMap headers = new MultivaluedHashMap<>(); - headers.putSingle("Content-Encoding", BATCH_ENCODING); - RestResult result = this.client.post(this.batchPath(), vertices, - headers); + RestHeaders headers = new RestHeaders().add(RestHeaders.CONTENT_ENCODING, BATCH_ENCODING); + RestResult result = this.client.post(this.batchPath(), vertices, headers); List ids = result.readList(Object.class); if (vertices.size() != ids.size()) { throw new NotAllCreatedException("Not all vertices are successfully created, " + @@ -68,17 +64,14 @@ public List create(List vertices) { public List update(BatchVertexRequest request) { this.client.checkApiVersion("0.45", "batch property update"); - MultivaluedHashMap headers = new MultivaluedHashMap<>(); - headers.putSingle("Content-Encoding", BATCH_ENCODING); - RestResult result = this.client.put(this.batchPath(), null, - request, headers); + RestHeaders headers = new RestHeaders().add(RestHeaders.CONTENT_ENCODING, BATCH_ENCODING); + RestResult result = this.client.put(this.batchPath(), null, request, headers); return result.readList(this.type(), Vertex.class); } public int update(BatchOlapPropertyRequest request) { this.client.checkApiVersion("0.59", "olap property batch update"); - MultivaluedHashMap headers = new MultivaluedHashMap<>(); - headers.putSingle("Content-Encoding", BATCH_ENCODING); + RestHeaders headers = new RestHeaders().add(RestHeaders.CONTENT_ENCODING, BATCH_ENCODING); String path = String.join("/", this.path(), "olap/batch"); RestResult result = this.client.put(path, null, request, headers); Object size = result.readObject(Map.class).get("size"); diff --git a/hugegraph-client/src/main/java/org/apache/hugegraph/api/graphs/GraphsAPI.java b/hugegraph-client/src/main/java/org/apache/hugegraph/api/graphs/GraphsAPI.java index 16101b7ec..8310e44f1 100644 --- a/hugegraph-client/src/main/java/org/apache/hugegraph/api/graphs/GraphsAPI.java +++ b/hugegraph-client/src/main/java/org/apache/hugegraph/api/graphs/GraphsAPI.java @@ -20,15 +20,11 @@ import java.util.List; import java.util.Map; -import jakarta.ws.rs.core.HttpHeaders; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.MultivaluedHashMap; - import org.apache.commons.lang3.StringUtils; - import org.apache.hugegraph.api.API; import org.apache.hugegraph.client.RestClient; import org.apache.hugegraph.exception.InvalidResponseException; +import org.apache.hugegraph.rest.RestHeaders; import org.apache.hugegraph.rest.RestResult; import org.apache.hugegraph.structure.constant.GraphMode; import org.apache.hugegraph.structure.constant.GraphReadMode; @@ -42,7 +38,6 @@ public class GraphsAPI extends API { private static final String MODE = "mode"; private static final String GRAPH_READ_MODE = "graph_read_mode"; private static final String CLEAR = "clear"; - private static final String CONFIRM_MESSAGE = "confirm_message"; public GraphsAPI(RestClient client) { @@ -56,11 +51,9 @@ protected String type() { } @SuppressWarnings("unchecked") - public Map create(String name, String cloneGraphName, - String configText) { + public Map create(String name, String cloneGraphName, String configText) { this.client.checkApiVersion("0.67", "dynamic graph add"); - MultivaluedHashMap headers = new MultivaluedHashMap<>(); - headers.add(HttpHeaders.CONTENT_TYPE, MediaType.TEXT_PLAIN); + RestHeaders headers = new RestHeaders().add(RestHeaders.CONTENT_TYPE, "text/plain"); Map params = null; if (StringUtils.isNotEmpty(cloneGraphName)) { params = ImmutableMap.of("clone_graph_name", cloneGraphName); @@ -93,8 +86,8 @@ public void drop(String graph, String message) { } public void mode(String graph, GraphMode mode) { - // NOTE: Must provide id for PUT. If use "graph/mode", "/" will - // be encoded to "%2F". So use "mode" here although inaccurate. + // NOTE: Must provide id for PUT. If you use "graph/mode", "/" will + // be encoded to "%2F". So use "mode" here, although inaccurate. this.client.put(joinPath(this.path(), graph, MODE), null, mode); } @@ -115,17 +108,15 @@ public GraphMode mode(String graph) { public void readMode(String graph, GraphReadMode readMode) { this.client.checkApiVersion("0.59", "graph read mode"); - // NOTE: Must provide id for PUT. If use "graph/graph_read_mode", "/" - // will be encoded to "%2F". So use "graph_read_mode" here although + // NOTE: Must provide id for PUT. If you use "graph/graph_read_mode", "/" + // will be encoded to "%2F". So use "graph_read_mode" here, although // inaccurate. - this.client.put(joinPath(this.path(), graph, GRAPH_READ_MODE), - null, readMode); + this.client.put(joinPath(this.path(), graph, GRAPH_READ_MODE), null, readMode); } public GraphReadMode readMode(String graph) { this.client.checkApiVersion("0.59", "graph read mode"); - RestResult result = this.client.get(joinPath(this.path(), graph), - GRAPH_READ_MODE); + RestResult result = this.client.get(joinPath(this.path(), graph), GRAPH_READ_MODE); @SuppressWarnings("unchecked") Map readMode = result.readObject(Map.class); String value = readMode.get(GRAPH_READ_MODE); diff --git a/hugegraph-client/src/main/java/org/apache/hugegraph/client/RestClient.java b/hugegraph-client/src/main/java/org/apache/hugegraph/client/RestClient.java index 22650816f..a63e1f330 100644 --- a/hugegraph-client/src/main/java/org/apache/hugegraph/client/RestClient.java +++ b/hugegraph-client/src/main/java/org/apache/hugegraph/client/RestClient.java @@ -18,18 +18,17 @@ package org.apache.hugegraph.client; import org.apache.hugegraph.exception.ServerException; -import org.apache.hugegraph.serializer.PathDeserializer; -import org.apache.hugegraph.structure.graph.Path; import org.apache.hugegraph.rest.AbstractRestClient; import org.apache.hugegraph.rest.ClientException; import org.apache.hugegraph.rest.RestResult; +import org.apache.hugegraph.serializer.PathDeserializer; +import org.apache.hugegraph.structure.graph.Path; import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.VersionUtil; import org.apache.hugegraph.util.VersionUtil.Version; import com.fasterxml.jackson.databind.module.SimpleModule; -import jakarta.ws.rs.core.Response; public class RestClient extends AbstractRestClient { @@ -43,8 +42,7 @@ public class RestClient extends AbstractRestClient { RestResult.registerModule(module); } - public RestClient(String url, String username, String password, - int timeout) { + public RestClient(String url, String username, String password, int timeout) { super(url, username, password, timeout * SECOND); } @@ -73,16 +71,15 @@ public void checkApiVersion(String minVersion, String message) { } public boolean apiVersionLt(String minVersion) { - String apiVersion = this.apiVersion == null ? - null : this.apiVersion.get(); + String apiVersion = this.apiVersion == null ? null : this.apiVersion.get(); return apiVersion != null && !VersionUtil.gte(apiVersion, minVersion); } @Override - protected void checkStatus(Response response, Response.Status... statuses) { + protected void checkStatus(okhttp3.Response response, int... statuses) { boolean match = false; - for (Response.Status status : statuses) { - if (status.getStatusCode() == response.getStatus()) { + for (int status : statuses) { + if (status == response.code()) { match = true; break; } diff --git a/hugegraph-client/src/main/java/org/apache/hugegraph/driver/HugeClient.java b/hugegraph-client/src/main/java/org/apache/hugegraph/driver/HugeClient.java index caa48586d..56acc3376 100644 --- a/hugegraph-client/src/main/java/org/apache/hugegraph/driver/HugeClient.java +++ b/hugegraph-client/src/main/java/org/apache/hugegraph/driver/HugeClient.java @@ -19,16 +19,17 @@ import java.io.Closeable; -import org.apache.hugegraph.version.ClientVersion; import org.apache.hugegraph.client.RestClient; - import org.apache.hugegraph.rest.ClientException; import org.apache.hugegraph.util.VersionUtil; - -import jakarta.ws.rs.ProcessingException; +import org.apache.hugegraph.version.ClientVersion; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class HugeClient implements Closeable { + private static final Logger LOG = LoggerFactory.getLogger(RestClient.class); + static { ClientVersion.check(); } @@ -60,7 +61,8 @@ public HugeClient(HugeClientBuilder builder) { builder.maxConnsPerRoute(), builder.trustStoreFile(), builder.trustStorePassword()); - } catch (ProcessingException e) { + } catch (Exception e) { + LOG.warn("Failed to create RestClient instance", e); throw new ClientException("Failed to connect url '%s'", builder.url()); } try { @@ -110,7 +112,7 @@ private void initManagers(RestClient client, String graph) { private void checkServerApiVersion() { VersionUtil.Version apiVersion = VersionUtil.Version.of(this.version.getApiVersion()); // TODO: find a way to keep the range of api version correct automatically - // 0.81 equals to the {latest_api_version} +10 + // 0.81 equals to the {latest_api_version} +10 VersionUtil.check(apiVersion, "0.38", "0.81", "hugegraph-api in server"); this.client.apiVersion(apiVersion); } diff --git a/hugegraph-client/src/main/java/org/apache/hugegraph/exception/ServerException.java b/hugegraph-client/src/main/java/org/apache/hugegraph/exception/ServerException.java index e718181d3..aa9826320 100644 --- a/hugegraph-client/src/main/java/org/apache/hugegraph/exception/ServerException.java +++ b/hugegraph-client/src/main/java/org/apache/hugegraph/exception/ServerException.java @@ -23,31 +23,27 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import jakarta.ws.rs.core.Response; - public class ServerException extends RuntimeException { private static final Logger LOG = LoggerFactory.getLogger(ServerException.class); private static final long serialVersionUID = 6335623004322652358L; - private static final String[] EXCEPTION_KEYS = {"exception", - "Exception-Class"}; + private static final String[] EXCEPTION_KEYS = {"exception", "Exception-Class"}; private static final String[] MESSAGE_KEYS = {"message"}; private static final String[] CAUSE_KEYS = {"cause", "exceptions"}; private static final String[] TRACE_KEYS = {"trace", "stackTrace"}; - private int status = 0; private String exception; private String message; private String cause; private Object trace; - public static ServerException fromResponse(Response response) { + public static ServerException fromResponse(okhttp3.Response response) { RestResult rs = new RestResult(response); ServerException exception = new ServerException(rs.content()); - exception.status(response.getStatus()); + exception.status(response.code()); try { @SuppressWarnings("unchecked") Map json = rs.readObject(Map.class); @@ -56,7 +52,7 @@ public static ServerException fromResponse(Response response) { exception.cause = (String) getByKeys(json, CAUSE_KEYS); exception.trace = getByKeys(json, TRACE_KEYS); } catch (Exception ignored) { - LOG.error("ServerException fromResponse excepiton"); + LOG.error("ServerException fromResponse exception"); } return exception; diff --git a/hugegraph-client/src/test/java/org/apache/hugegraph/BaseClientTest.java b/hugegraph-client/src/test/java/org/apache/hugegraph/BaseClientTest.java index e195d12e8..471f135de 100644 --- a/hugegraph-client/src/test/java/org/apache/hugegraph/BaseClientTest.java +++ b/hugegraph-client/src/test/java/org/apache/hugegraph/BaseClientTest.java @@ -57,11 +57,8 @@ public class BaseClientTest { private static HugeClient client; - protected static HugeClient open() { - client = HugeClient.builder(BASE_URL, GRAPH) - .configUser(USERNAME, PASSWORD) - .build(); - return client; + protected static void open() { + client = HugeClient.builder(BASE_URL, GRAPH).configUser(USERNAME, PASSWORD).build(); } @BeforeClass @@ -125,18 +122,7 @@ public static MetricsManager metrics() { return client.metrics(); } - @Before - public void setup() { - // this.clearData(); - } - - @After - public void teardown() throws Exception { - // pass - } - - protected static Object getVertexId(String label, String key, - String value) { + protected static Object getVertexId(String label, String key, String value) { return getVertex(label, key, value).id(); } @@ -158,23 +144,19 @@ protected static Edge getEdge(String label, String key, String value) { return edges.get(0); } - protected static void assertContains(List propertyKeys, - PropertyKey propertyKey) { + protected static void assertContains(List propertyKeys, PropertyKey propertyKey) { Assert.assertTrue(Utils.contains(propertyKeys, propertyKey)); } - protected static void assertContains(List vertexLabels, - VertexLabel vertexLabel) { + protected static void assertContains(List vertexLabels, VertexLabel vertexLabel) { Assert.assertTrue(Utils.contains(vertexLabels, vertexLabel)); } - protected static void assertContains(List edgeLabels, - EdgeLabel edgeLabel) { + protected static void assertContains(List edgeLabels, EdgeLabel edgeLabel) { Assert.assertTrue(Utils.contains(edgeLabels, edgeLabel)); } - protected static void assertContains(List indexLabels, - IndexLabel indexLabel) { + protected static void assertContains(List indexLabels, IndexLabel indexLabel) { Assert.assertTrue(Utils.contains(indexLabels, indexLabel)); } @@ -185,6 +167,7 @@ protected static void initPropertyKey() { schema.propertyKey("city").asText().ifNotExist().create(); schema.propertyKey("lang").asText().ifNotExist().create(); schema.propertyKey("date").asDate().ifNotExist().create(); + schema.propertyKey("date @&$=*?").asDate().ifNotExist().create(); schema.propertyKey("price").asInt().ifNotExist().create(); schema.propertyKey("weight").asDouble().ifNotExist().create(); } @@ -230,8 +213,8 @@ protected static void initEdgeLabel() { schema.edgeLabel("created") .sourceLabel("person") .targetLabel("software") - .properties("date", "city") - .nullableKeys("city") + .properties("date", "date @&$=*?", "city") + .nullableKeys("city", "date @&$=*?") .ifNotExist() .create(); } @@ -303,6 +286,16 @@ protected static void initEdge() { "date", "2017-01-10", "city", "Hongkong"); } + @Before + public void setup() { + // this.clearData(); + } + + @After + public void teardown() throws Exception { + // pass + } + protected List create100PersonBatch() { List vertices = new ArrayList<>(100); for (int i = 0; i < 100; i++) { diff --git a/hugegraph-client/src/test/java/org/apache/hugegraph/api/SchemaApiTest.java b/hugegraph-client/src/test/java/org/apache/hugegraph/api/SchemaApiTest.java index a341e5ece..7e5cf611f 100644 --- a/hugegraph-client/src/test/java/org/apache/hugegraph/api/SchemaApiTest.java +++ b/hugegraph-client/src/test/java/org/apache/hugegraph/api/SchemaApiTest.java @@ -39,7 +39,7 @@ public void testList() { Assert.assertTrue(schemas.containsKey("vertexlabels")); Assert.assertTrue(schemas.containsKey("edgelabels")); Assert.assertTrue(schemas.containsKey("indexlabels")); - Assert.assertEquals(7, schemas.get("propertykeys").size()); + Assert.assertEquals(8, schemas.get("propertykeys").size()); Assert.assertEquals(3, schemas.get("vertexlabels").size()); Assert.assertEquals(2, schemas.get("edgelabels").size()); Assert.assertTrue(schemas.get("indexlabels").isEmpty()); diff --git a/hugegraph-client/src/test/java/org/apache/hugegraph/api/auth/UserApiTest.java b/hugegraph-client/src/test/java/org/apache/hugegraph/api/auth/UserApiTest.java index f2533ab80..826df0898 100644 --- a/hugegraph-client/src/test/java/org/apache/hugegraph/api/auth/UserApiTest.java +++ b/hugegraph-client/src/test/java/org/apache/hugegraph/api/auth/UserApiTest.java @@ -49,6 +49,16 @@ public static void clear() { } } + protected static User createUser(String name, String password) { + User user = new User(); + user.name(name); + user.password(password); + user.email("test@hugegraph.com"); + user.phone("16812345678"); + user.avatar("image.jpg"); + return api.create(user); + } + @Override @After public void teardown() { @@ -136,15 +146,19 @@ public void testGet() { public void testGetUserRole() { User user1 = createUser("test1", "psw1"); User user2 = createUser("test2", "psw2"); + User user3 = createUser("test3 @&$=*?", "psw3"); Assert.assertEquals("test1", user1.name()); Assert.assertEquals("test2", user2.name()); + Assert.assertContains("test3 @&$=*?", user3.name());// test special character UserRole role1 = api.getUserRole(user1.id()); UserRole role2 = api.getUserRole(user2.id()); + UserRole role3 = api.getUserRole(user3.id()); Assert.assertEquals("{\"roles\":{}}", role1.toString()); Assert.assertEquals("{\"roles\":{}}", role2.toString()); + Assert.assertEquals("{\"roles\":{}}", role3.toString()); } @Test @@ -256,14 +270,4 @@ public void testDelete() { Assert.assertContains("Invalid user id: fake-id", e.getMessage()); }); } - - protected static User createUser(String name, String password) { - User user = new User(); - user.name(name); - user.password(password); - user.email("test@hugegraph.com"); - user.phone("16812345678"); - user.avatar("image.jpg"); - return api.create(user); - } } diff --git a/hugegraph-client/src/test/java/org/apache/hugegraph/functional/EdgeTest.java b/hugegraph-client/src/test/java/org/apache/hugegraph/functional/EdgeTest.java index 4de5c3af4..eafb2fe1e 100644 --- a/hugegraph-client/src/test/java/org/apache/hugegraph/functional/EdgeTest.java +++ b/hugegraph-client/src/test/java/org/apache/hugegraph/functional/EdgeTest.java @@ -46,6 +46,20 @@ public class EdgeTest extends BaseFuncTest { + private static void assertContains(List edges, Object source, String label, + Object target, Object... keyValues) { + Map properties = Utils.asMap(keyValues); + + Edge edge = new Edge(label); + edge.sourceId(source); + edge.targetId(target); + for (String key : properties.keySet()) { + edge.property(key, properties.get(key)); + } + + Assert.assertTrue(Utils.contains(edges, edge)); + } + @Override @Before public void setup() { @@ -66,8 +80,7 @@ public void testLinkedVertex() { Object peterId = getVertexId("person", "name", "peter"); Object lopId = getVertexId("software", "name", "lop"); - Edge created = graph().addEdge(peterId, "created", lopId, - "date", "2017-03-24"); + Edge created = graph().addEdge(peterId, "created", lopId, "date", "2017-03-24"); Assert.assertTrue(created.linkedVertex(peterId)); Assert.assertTrue(created.linkedVertex(lopId)); } @@ -77,15 +90,12 @@ public void testAddEdgeProperty() { Object peterId = getVertexId("person", "name", "peter"); Object lopId = getVertexId("software", "name", "lop"); - Edge created = graph().addEdge(peterId, "created", lopId, - "date", "2017-03-24"); - Map props = ImmutableMap.of( - "date", Utils.formatDate("2017-03-24")); + Edge created = graph().addEdge(peterId, "created", lopId, "date", "2017-03-24"); + Map props = ImmutableMap.of("date", Utils.formatDate("2017-03-24")); Assert.assertEquals(props, created.properties()); created.property("city", "HongKong"); - props = ImmutableMap.of("date", Utils.formatDate("2017-03-24"), - "city", "HongKong"); + props = ImmutableMap.of("date", Utils.formatDate("2017-03-24"), "city", "HongKong"); Assert.assertEquals(props, created.properties()); } @@ -94,10 +104,8 @@ public void testUpdateEdgeProperty() { Object peterId = getVertexId("person", "name", "peter"); Object lopId = getVertexId("software", "name", "lop"); - Edge created = graph().addEdge(peterId, "created", lopId, - "date", "2017-03-24"); - Map props = ImmutableMap.of( - "date", Utils.formatDate("2017-03-24")); + Edge created = graph().addEdge(peterId, "created", lopId, "date", "2017-03-24"); + Map props = ImmutableMap.of("date", Utils.formatDate("2017-03-24")); Assert.assertEquals(props, created.properties()); created.property("date", "2017-08-08"); @@ -125,16 +133,16 @@ public void testAddEdgePropertyValueList() { "time", "2012-10-10"); Map props = ImmutableMap.of( - "date", Utils.formatDate("2017-03-24"), - "time", ImmutableList.of( - Utils.formatDate("2012-10-10"))); + "date", Utils.formatDate("2017-03-24"), + "time", ImmutableList.of( + Utils.formatDate("2012-10-10"))); Assert.assertEquals(props, created.properties()); created.property("time", "2014-02-14"); props = ImmutableMap.of("date", Utils.formatDate("2017-03-24"), "time", ImmutableList.of( - Utils.formatDate("2012-10-10"), - Utils.formatDate("2014-02-14"))); + Utils.formatDate("2012-10-10"), + Utils.formatDate("2014-02-14"))); Assert.assertEquals(props, created.properties()); } @@ -158,16 +166,16 @@ public void testAddEdgePropertyValueSet() { "time", "2012-10-10"); Map props = ImmutableMap.of( - "date", Utils.formatDate("2017-03-24"), - "time", ImmutableList.of( - Utils.formatDate("2012-10-10"))); + "date", Utils.formatDate("2017-03-24"), + "time", ImmutableList.of( + Utils.formatDate("2012-10-10"))); Assert.assertEquals(props, created.properties()); created.property("time", "2014-02-14"); props = ImmutableMap.of("date", Utils.formatDate("2017-03-24"), "time", ImmutableList.of( - Utils.formatDate("2012-10-10"), - Utils.formatDate("2014-02-14"))); + Utils.formatDate("2012-10-10"), + Utils.formatDate("2014-02-14"))); Assert.assertEquals(props, created.properties()); } @@ -191,16 +199,16 @@ public void testAddEdgePropertyValueListWithSameValue() { "time", "2012-10-10"); Map props = ImmutableMap.of( - "date", Utils.formatDate("2017-03-24"), - "time", ImmutableList.of( - Utils.formatDate("2012-10-10"))); + "date", Utils.formatDate("2017-03-24"), + "time", ImmutableList.of( + Utils.formatDate("2012-10-10"))); Assert.assertEquals(props, created.properties()); created.property("time", "2012-10-10"); props = ImmutableMap.of("date", Utils.formatDate("2017-03-24"), "time", ImmutableList.of( - Utils.formatDate("2012-10-10"), - Utils.formatDate("2012-10-10"))); + Utils.formatDate("2012-10-10"), + Utils.formatDate("2012-10-10"))); Assert.assertEquals(props, created.properties()); } @@ -224,15 +232,15 @@ public void testAddEdgePropertyValueSetWithSameValue() { "time", "2012-10-10"); Map props = ImmutableMap.of( - "date", Utils.formatDate("2017-03-24"), - "time", ImmutableList.of( - Utils.formatDate("2012-10-10"))); + "date", Utils.formatDate("2017-03-24"), + "time", ImmutableList.of( + Utils.formatDate("2012-10-10"))); Assert.assertEquals(props, created.properties()); created.property("time", "2012-10-10"); props = ImmutableMap.of("date", Utils.formatDate("2017-03-24"), "time", ImmutableList.of( - Utils.formatDate("2012-10-10"))); + Utils.formatDate("2012-10-10"))); Assert.assertEquals(props, created.properties()); } @@ -245,8 +253,8 @@ public void testAddEdgeWithMapProperties() { "city", "HongKong"); Edge created = graph().addEdge(peter, "created", lop, properties); Map props = ImmutableMap.of( - "date", Utils.formatDate("2017-03-24"), - "city", "HongKong"); + "date", Utils.formatDate("2017-03-24"), + "city", "HongKong"); Assert.assertEquals(props, created.properties()); } @@ -270,9 +278,9 @@ public void testRemoveEdgeProperty() { "time", "2012-10-10"); Map props = ImmutableMap.of( - "date", Utils.formatDate("2017-03-24"), - "time", ImmutableList.of( - Utils.formatDate("2012-10-10"))); + "date", Utils.formatDate("2017-03-24"), + "time", ImmutableList.of( + Utils.formatDate("2012-10-10"))); Assert.assertEquals(props, created.properties()); created.removeProperty("time"); @@ -288,7 +296,7 @@ public void testRemoveEdgePropertyNotExist() { Edge created = graph().addEdge(peterId, "created", lopId, "date", "2017-03-24"); Map props = ImmutableMap.of( - "date", Utils.formatDate("2017-03-24")); + "date", Utils.formatDate("2017-03-24")); Assert.assertEquals(props, created.properties()); Assert.assertThrows(InvalidOperationException.class, () -> { @@ -464,8 +472,7 @@ public void testGetEdgesByVertexIdDirectionLabel() { Object lopId = getVertexId("software", "name", "lop"); Object rippleId = getVertexId("software", "name", "ripple"); - List edges = graph().getEdges(joshId, Direction.OUT, - "created"); + List edges = graph().getEdges(joshId, Direction.OUT, "created"); Assert.assertEquals(2, edges.size()); assertContains(edges, joshId, "created", rippleId, "date", Utils.formatDate("2015-01-10"), @@ -486,8 +493,7 @@ public void testGetEdgesByVertexIdDirectionLabelWithLimit1() { Object joshId = getVertexId("person", "name", "josh"); - List edges = graph().getEdges(joshId, Direction.OUT, - "created", 1); + List edges = graph().getEdges(joshId, Direction.OUT, "created", 1); Assert.assertEquals(1, edges.size()); for (Edge edge : edges) { Assert.assertEquals(joshId, edge.sourceId()); @@ -510,11 +516,8 @@ public void testGetEdgesByVertexIdDirectionLabelProperties() { Object joshId = getVertexId("person", "name", "josh"); Object rippleId = getVertexId("software", "name", "ripple"); - Map properties = ImmutableMap.of( - "date", - Utils.formatDate("2015-01-10")); - List edges = graph().getEdges(joshId, Direction.OUT, - "created", properties); + Map properties = ImmutableMap.of("date", Utils.formatDate("2015-01-10")); + List edges = graph().getEdges(joshId, Direction.OUT, "created", properties); Assert.assertEquals(1, edges.size()); assertContains(edges, joshId, "created", rippleId, "date", Utils.formatDate("2015-01-10"), @@ -533,11 +536,8 @@ public void testGetEdgesByVertexIdDirectionLabelPropertiesWithLimit1() { Object joshId = getVertexId("person", "name", "josh"); - Map properties = ImmutableMap.of( - "date", - Utils.formatDate("2015-01-10")); - List edges = graph().getEdges(joshId, Direction.OUT, - "created", properties); + Map properties = ImmutableMap.of("date", Utils.formatDate("2015-01-10")); + List edges = graph().getEdges(joshId, Direction.OUT, "created", properties); Assert.assertEquals(1, edges.size()); for (Edge edge : edges) { Assert.assertEquals(joshId, edge.sourceId()); @@ -555,7 +555,7 @@ public void testGetEdgesByVertexIdDirectionLabelPropertiesWithLimit1() { @Test public void testGetEdgesByLabelAndPropertiesWithRangeCondition() - throws ParseException { + throws ParseException { schema().indexLabel("knowsByDate").range() .onE("knows").by("date").create(); schema().indexLabel("createdByDate").range() @@ -566,8 +566,7 @@ public void testGetEdgesByLabelAndPropertiesWithRangeCondition() Date expected = DateUtil.parse("2014-01-10"); Date expected2 = DateUtil.parse("2016-01-10"); - Map properties = ImmutableMap.of( - "date", "P.eq(\"2014-1-10\")"); + Map properties = ImmutableMap.of("date", "P.eq(\"2014-1-10\")"); List edges = graph().listEdges("created", properties); Date time; @@ -613,8 +612,7 @@ public void testGetEdgesByLabelAndPropertiesWithRangeCondition() Assert.assertLte(expected.getTime(), time.getTime()); } - properties = ImmutableMap.of("date", - "P.between(\"2014-1-10\",\"2016-1-10\")"); + properties = ImmutableMap.of("date", "P.between(\"2014-1-10\",\"2016-1-10\")"); edges = graph().listEdges(null, properties); Assert.assertEquals(2, edges.size()); for (Edge e : edges) { @@ -624,8 +622,7 @@ public void testGetEdgesByLabelAndPropertiesWithRangeCondition() Assert.assertLt(expected2.getTime(), time.getTime()); } - properties = ImmutableMap.of("date", - "P.inside(\"2014-1-10\",\"2016-1-10\")"); + properties = ImmutableMap.of("date", "P.inside(\"2014-1-10\",\"2016-1-10\")"); edges = graph().listEdges(null, properties); Assert.assertEquals(1, edges.size()); for (Edge e : edges) { @@ -635,8 +632,7 @@ public void testGetEdgesByLabelAndPropertiesWithRangeCondition() Assert.assertLt(expected2.getTime(), time.getTime()); } - properties = ImmutableMap.of("date", - "P.within(\"2014-1-10\",\"2016-1-10\")"); + properties = ImmutableMap.of("date", "P.within(\"2014-1-10\",\"2016-1-10\")"); edges = graph().listEdges(null, properties); Assert.assertEquals(2, edges.size()); for (Edge e : edges) { @@ -647,9 +643,37 @@ public void testGetEdgesByLabelAndPropertiesWithRangeCondition() } } + @Test + public void testGetEdgesWithSpecialChars() { + schema().indexLabel("createdByCity").secondary() + .onE("created").by("city").create(); + schema().indexLabel("createdByDate").secondary() + .onE("created").by("date @&$=*?").create(); + + Object markoId = getVertexId("person", "name", "marko"); + Object lopId = getVertexId("software", "name", "lop"); + Object rippleId = getVertexId("software", "name", "ripple"); + graph().addEdge(markoId, "created", lopId, + "date", "2014-01-10", "city", "Shanghai", "date @&$=*?", "2014-01-10"); + graph().addEdge(markoId, "created", rippleId, + "date", "2015-01-10", "city", "Shanghai @&$=*?"); + + Map properties = ImmutableMap.of("date @&$=*?", "P.eq(\"2014-1-10\")"); + List edges = graph().listEdges("created", properties, false); + Assert.assertEquals(1, edges.size()); + + Map properties2 = ImmutableMap.of("city", "Shanghai"); + edges = graph().listEdges("created", properties2, true); + Assert.assertEquals(1, edges.size()); + + Map properties3 = ImmutableMap.of("city", "Shanghai @&$=*?"); + edges = graph().listEdges("created", properties3, true); + Assert.assertEquals(1, edges.size()); + } + @Test public void testGetEdgesByLabelAndPropertiesWithKeepP() - throws ParseException { + throws ParseException { schema().indexLabel("createdByCity").secondary() .onE("created").by("city").create(); schema().indexLabel("createdByDate").secondary() @@ -657,11 +681,11 @@ public void testGetEdgesByLabelAndPropertiesWithKeepP() BaseClientTest.initEdge(); - Map properties = ImmutableMap.of( - "date", "P.eq(\"2014-1-10\")"); + Map properties = ImmutableMap.of("date", "P.eq(\"2014-1-10\")"); List edges = graph().listEdges("created", properties, false); Assert.assertEquals(1, edges.size()); + Assert.assertThrows(ServerException.class, () -> { graph().listEdges("created", properties, true); }, e -> { @@ -705,10 +729,8 @@ public void testIterateEdgesByVertexId() { edges = graph().iterateEdges(markoId, Direction.OUT, "created", 1); Assert.assertEquals(1, Iterators.size(edges)); - Map properties = ImmutableMap.of("date", - "P.gt(\"2012-1-1\")"); - Iterator iter = graph().iterateEdges(markoId, Direction.OUT, - "knows", properties, 1); + Map properties = ImmutableMap.of("date", "P.gt(\"2012-1-1\")"); + Iterator iter = graph().iterateEdges(markoId, Direction.OUT, "knows", properties, 1); Assert.assertEquals(2, Iterators.size(iter)); } @@ -775,23 +797,7 @@ public void testQueryByPagingAndFiltering() { .binding("vid", v1.id()) .execute(); }, e -> { - Assert.assertContains("Can't query by paging and filtering", - e.getMessage()); + Assert.assertContains("Can't query by paging and filtering", e.getMessage()); }); } - - private static void assertContains(List edges, Object source, - String label, Object target, - Object... keyValues) { - Map properties = Utils.asMap(keyValues); - - Edge edge = new Edge(label); - edge.sourceId(source); - edge.targetId(target); - for (String key : properties.keySet()) { - edge.property(key, properties.get(key)); - } - - Assert.assertTrue(Utils.contains(edges, edge)); - } } diff --git a/hugegraph-client/src/test/java/org/apache/hugegraph/functional/SchemaTest.java b/hugegraph-client/src/test/java/org/apache/hugegraph/functional/SchemaTest.java index 5407da2aa..7a93f1e82 100644 --- a/hugegraph-client/src/test/java/org/apache/hugegraph/functional/SchemaTest.java +++ b/hugegraph-client/src/test/java/org/apache/hugegraph/functional/SchemaTest.java @@ -40,7 +40,7 @@ public void testlist() { Assert.assertTrue(schemas.containsKey("vertexlabels")); Assert.assertTrue(schemas.containsKey("edgelabels")); Assert.assertTrue(schemas.containsKey("indexlabels")); - Assert.assertEquals(7, schemas.get("propertykeys").size()); + Assert.assertEquals(8, schemas.get("propertykeys").size()); Assert.assertEquals(3, schemas.get("vertexlabels").size()); Assert.assertEquals(2, schemas.get("edgelabels").size()); Assert.assertTrue(schemas.get("indexlabels").isEmpty()); diff --git a/hugegraph-client/src/test/java/org/apache/hugegraph/unit/RestResultTest.java b/hugegraph-client/src/test/java/org/apache/hugegraph/unit/RestResultTest.java index 360cdc5c9..518552d3f 100644 --- a/hugegraph-client/src/test/java/org/apache/hugegraph/unit/RestResultTest.java +++ b/hugegraph-client/src/test/java/org/apache/hugegraph/unit/RestResultTest.java @@ -23,6 +23,7 @@ import java.util.List; import org.apache.hugegraph.driver.GraphManager; +import org.apache.hugegraph.rest.RestHeaders; import org.apache.hugegraph.rest.RestResult; import org.apache.hugegraph.serializer.PathDeserializer; import org.apache.hugegraph.structure.constant.Cardinality; @@ -53,9 +54,11 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; +import lombok.SneakyThrows; + public class RestResultTest extends BaseUnitTest { - private jakarta.ws.rs.core.Response mockResponse; + private okhttp3.Response mockResponse; private static GraphManager graphManager; @BeforeClass @@ -74,7 +77,7 @@ public static GraphManager graph() { @Before public void setup() { // Mock caches - this.mockResponse = Mockito.mock(jakarta.ws.rs.core.Response.class); + this.mockResponse = Mockito.mock(okhttp3.Response.class, Mockito.RETURNS_DEEP_STUBS); } @After @@ -82,6 +85,7 @@ public void teardown() { // pass } + @SneakyThrows @Test public void testReadPropertyKey() { String json = "{" @@ -92,13 +96,12 @@ public void testReadPropertyKey() { + "\"properties\": []" + "}"; - Mockito.when(this.mockResponse.getStatus()).thenReturn(200); - Mockito.when(this.mockResponse.getHeaders()).thenReturn(null); - Mockito.when(this.mockResponse.readEntity(String.class)) - .thenReturn(json); + Mockito.when(this.mockResponse.code()).thenReturn(200); + Mockito.when(this.mockResponse.headers()).thenReturn(null); + Mockito.when(this.mockResponse.body().string()).thenReturn(json); RestResult result = new RestResult(this.mockResponse); Assert.assertEquals(200, result.status()); - Assert.assertNull(result.headers()); + Assert.assertEquals(result.headers(), new RestHeaders()); PropertyKey propertyKey = result.readObject(PropertyKey.class); @@ -108,6 +111,7 @@ public void testReadPropertyKey() { Assert.assertEquals(Collections.emptySet(), propertyKey.properties()); } + @SneakyThrows @Test public void testReadPropertyKeys() { String json = "{\"propertykeys\": [" @@ -126,16 +130,14 @@ public void testReadPropertyKeys() { + "}" + "]}"; - Mockito.when(this.mockResponse.getStatus()).thenReturn(200); - Mockito.when(this.mockResponse.getHeaders()).thenReturn(null); - Mockito.when(this.mockResponse.readEntity(String.class)) - .thenReturn(json); + Mockito.when(this.mockResponse.code()).thenReturn(200); + Mockito.when(this.mockResponse.headers()).thenReturn(null); + Mockito.when(this.mockResponse.body().string()).thenReturn(json); RestResult result = new RestResult(this.mockResponse); Assert.assertEquals(200, result.status()); - Assert.assertNull(result.headers()); + Assert.assertEquals(result.headers(), new RestHeaders()); - List propertyKeys = result.readList("propertykeys", - PropertyKey.class); + List propertyKeys = result.readList("propertykeys", PropertyKey.class); Assert.assertEquals(2, propertyKeys.size()); PropertyKey propertyKey1 = propertyKeys.get(0); PropertyKey propertyKey2 = propertyKeys.get(1); @@ -151,6 +153,7 @@ public void testReadPropertyKeys() { Assert.assertEquals(Collections.emptySet(), propertyKey2.properties()); } + @SneakyThrows @Test public void testReadVertexLabel() { String json = "{" @@ -162,24 +165,22 @@ public void testReadVertexLabel() { + "\"properties\": [\"price\", \"name\", \"lang\"]" + "}"; - Mockito.when(this.mockResponse.getStatus()).thenReturn(200); - Mockito.when(this.mockResponse.getHeaders()).thenReturn(null); - Mockito.when(this.mockResponse.readEntity(String.class)) - .thenReturn(json); + Mockito.when(this.mockResponse.code()).thenReturn(200); + Mockito.when(this.mockResponse.headers()).thenReturn(null); + Mockito.when(this.mockResponse.body().string()).thenReturn(json); RestResult result = new RestResult(this.mockResponse); Assert.assertEquals(200, result.status()); - Assert.assertNull(result.headers()); + Assert.assertEquals(result.headers(), new RestHeaders()); VertexLabel vertexLabel = result.readObject(VertexLabel.class); Assert.assertEquals("software", vertexLabel.name()); Assert.assertEquals(IdStrategy.PRIMARY_KEY, vertexLabel.idStrategy()); - Assert.assertEquals(ImmutableList.of("name"), - vertexLabel.primaryKeys()); - Assert.assertEquals(ImmutableSet.of("price", "name", "lang"), - vertexLabel.properties()); + Assert.assertEquals(ImmutableList.of("name"), vertexLabel.primaryKeys()); + Assert.assertEquals(ImmutableSet.of("price", "name", "lang"), vertexLabel.properties()); } + @SneakyThrows @Test public void testReadVertexLabels() { String json = "{\"vertexlabels\": [" @@ -201,35 +202,30 @@ public void testReadVertexLabels() { + "}" + "]}"; - Mockito.when(this.mockResponse.getStatus()).thenReturn(200); - Mockito.when(this.mockResponse.getHeaders()).thenReturn(null); - Mockito.when(this.mockResponse.readEntity(String.class)) - .thenReturn(json); + Mockito.when(this.mockResponse.code()).thenReturn(200); + Mockito.when(this.mockResponse.headers()).thenReturn(null); + Mockito.when(this.mockResponse.body().string()).thenReturn(json); RestResult result = new RestResult(this.mockResponse); Assert.assertEquals(200, result.status()); - Assert.assertNull(result.headers()); + Assert.assertEquals(result.headers(), new RestHeaders()); - List vertexLabels = result.readList("vertexlabels", - VertexLabel.class); + List vertexLabels = result.readList("vertexlabels", VertexLabel.class); Assert.assertEquals(2, vertexLabels.size()); VertexLabel vertexLabel1 = vertexLabels.get(0); VertexLabel vertexLabel2 = vertexLabels.get(1); Assert.assertEquals("software", vertexLabel1.name()); Assert.assertEquals(IdStrategy.PRIMARY_KEY, vertexLabel1.idStrategy()); - Assert.assertEquals(ImmutableList.of("name"), - vertexLabel1.primaryKeys()); - Assert.assertEquals(ImmutableSet.of("price", "name", "lang"), - vertexLabel1.properties()); + Assert.assertEquals(ImmutableList.of("name"), vertexLabel1.primaryKeys()); + Assert.assertEquals(ImmutableSet.of("price", "name", "lang"), vertexLabel1.properties()); Assert.assertEquals("person", vertexLabel2.name()); Assert.assertEquals(IdStrategy.CUSTOMIZE_STRING, vertexLabel2.idStrategy()); - Assert.assertEquals(Collections.emptyList(), - vertexLabel2.primaryKeys()); - Assert.assertEquals(ImmutableSet.of("city", "name", "age"), - vertexLabel2.properties()); + Assert.assertEquals(Collections.emptyList(), vertexLabel2.primaryKeys()); + Assert.assertEquals(ImmutableSet.of("city", "name", "age"), vertexLabel2.properties()); } + @SneakyThrows @Test public void testReadEdgeLabel() { String json = "{" @@ -243,13 +239,12 @@ public void testReadEdgeLabel() { + "\"frequency\": \"SINGLE\"" + "}"; - Mockito.when(this.mockResponse.getStatus()).thenReturn(200); - Mockito.when(this.mockResponse.getHeaders()).thenReturn(null); - Mockito.when(this.mockResponse.readEntity(String.class)) - .thenReturn(json); + Mockito.when(this.mockResponse.code()).thenReturn(200); + Mockito.when(this.mockResponse.headers()).thenReturn(null); + Mockito.when(this.mockResponse.body().string()).thenReturn(json); RestResult result = new RestResult(this.mockResponse); Assert.assertEquals(200, result.status()); - Assert.assertNull(result.headers()); + Assert.assertEquals(result.headers(), new RestHeaders()); EdgeLabel edgeLabel = result.readObject(EdgeLabel.class); @@ -261,6 +256,7 @@ public void testReadEdgeLabel() { Assert.assertEquals(ImmutableSet.of("date"), edgeLabel.properties()); } + @SneakyThrows @Test public void testReadEdgeLabels() { String json = "{\"edgelabels\": [" @@ -285,13 +281,13 @@ public void testReadEdgeLabels() { + "}" + "]}"; - Mockito.when(this.mockResponse.getStatus()).thenReturn(200); - Mockito.when(this.mockResponse.getHeaders()).thenReturn(null); - Mockito.when(this.mockResponse.readEntity(String.class)) + Mockito.when(this.mockResponse.code()).thenReturn(200); + Mockito.when(this.mockResponse.headers()).thenReturn(null); + Mockito.when(this.mockResponse.body().string()) .thenReturn(json); RestResult result = new RestResult(this.mockResponse); Assert.assertEquals(200, result.status()); - Assert.assertNull(result.headers()); + Assert.assertEquals(result.headers(), new RestHeaders()); List edgeLabels = result.readList("edgelabels", EdgeLabel.class); @@ -315,6 +311,7 @@ public void testReadEdgeLabels() { edgeLabel2.properties()); } + @SneakyThrows @Test public void testReadIndexLabel() { String json = "{" @@ -326,13 +323,13 @@ public void testReadIndexLabel() { + "\"base_type\": \"VERTEX_LABEL\"" + "}"; - Mockito.when(this.mockResponse.getStatus()).thenReturn(200); - Mockito.when(this.mockResponse.getHeaders()).thenReturn(null); - Mockito.when(this.mockResponse.readEntity(String.class)) + Mockito.when(this.mockResponse.code()).thenReturn(200); + Mockito.when(this.mockResponse.headers()).thenReturn(null); + Mockito.when(this.mockResponse.body().string()) .thenReturn(json); RestResult result = new RestResult(this.mockResponse); Assert.assertEquals(200, result.status()); - Assert.assertNull(result.headers()); + Assert.assertEquals(result.headers(), new RestHeaders()); IndexLabel indexLabel = result.readObject(IndexLabel.class); @@ -344,6 +341,7 @@ public void testReadIndexLabel() { indexLabel.indexFields()); } + @SneakyThrows @Test public void testReadIndexLabels() { String json = "{\"indexlabels\": [" @@ -365,13 +363,13 @@ public void testReadIndexLabels() { + "}" + "]}"; - Mockito.when(this.mockResponse.getStatus()).thenReturn(200); - Mockito.when(this.mockResponse.getHeaders()).thenReturn(null); - Mockito.when(this.mockResponse.readEntity(String.class)) + Mockito.when(this.mockResponse.code()).thenReturn(200); + Mockito.when(this.mockResponse.headers()).thenReturn(null); + Mockito.when(this.mockResponse.body().string()) .thenReturn(json); RestResult result = new RestResult(this.mockResponse); Assert.assertEquals(200, result.status()); - Assert.assertNull(result.headers()); + Assert.assertEquals(result.headers(), new RestHeaders()); List indexLabels = result.readList("indexlabels", IndexLabel.class); @@ -394,6 +392,7 @@ public void testReadIndexLabels() { indexLabel2.indexFields()); } + @SneakyThrows @Test public void testReadVertex() { String json = "{" @@ -405,13 +404,13 @@ public void testReadVertex() { + "}" + "}"; - Mockito.when(this.mockResponse.getStatus()).thenReturn(200); - Mockito.when(this.mockResponse.getHeaders()).thenReturn(null); - Mockito.when(this.mockResponse.readEntity(String.class)) + Mockito.when(this.mockResponse.code()).thenReturn(200); + Mockito.when(this.mockResponse.headers()).thenReturn(null); + Mockito.when(this.mockResponse.body().string()) .thenReturn(json); RestResult result = new RestResult(this.mockResponse); Assert.assertEquals(200, result.status()); - Assert.assertNull(result.headers()); + Assert.assertEquals(result.headers(), new RestHeaders()); Vertex vertex = result.readObject(Vertex.class); @@ -421,6 +420,7 @@ public void testReadVertex() { vertex.properties()); } + @SneakyThrows @Test public void testReadVertices() { String json = "{\"vertices\": [" @@ -456,13 +456,13 @@ public void testReadVertices() { + "}" + "]}"; - Mockito.when(this.mockResponse.getStatus()).thenReturn(200); - Mockito.when(this.mockResponse.getHeaders()).thenReturn(null); - Mockito.when(this.mockResponse.readEntity(String.class)) + Mockito.when(this.mockResponse.code()).thenReturn(200); + Mockito.when(this.mockResponse.headers()).thenReturn(null); + Mockito.when(this.mockResponse.body().string()) .thenReturn(json); RestResult result = new RestResult(this.mockResponse); Assert.assertEquals(200, result.status()); - Assert.assertNull(result.headers()); + Assert.assertEquals(result.headers(), new RestHeaders()); List vertices = result.readList("vertices", Vertex.class); Assert.assertEquals(3, vertices.size()); @@ -497,6 +497,7 @@ public void testReadVertices() { vertex3.properties()); } + @SneakyThrows @Test public void testReadEdge() { String json = "{" @@ -513,13 +514,13 @@ public void testReadEdge() { + "}" + "}"; - Mockito.when(this.mockResponse.getStatus()).thenReturn(200); - Mockito.when(this.mockResponse.getHeaders()).thenReturn(null); - Mockito.when(this.mockResponse.readEntity(String.class)) + Mockito.when(this.mockResponse.code()).thenReturn(200); + Mockito.when(this.mockResponse.headers()).thenReturn(null); + Mockito.when(this.mockResponse.body().string()) .thenReturn(json); RestResult result = new RestResult(this.mockResponse); Assert.assertEquals(200, result.status()); - Assert.assertNull(result.headers()); + Assert.assertEquals(result.headers(), new RestHeaders()); Edge edge = result.readObject(Edge.class); @@ -529,11 +530,11 @@ public void testReadEdge() { Assert.assertEquals("software:lop", edge.targetId()); Assert.assertEquals("person", edge.sourceLabel()); Assert.assertEquals("software", edge.targetLabel()); - Assert.assertEquals(ImmutableMap.of("city", "Hongkong", - "date", 1495036800000L), + Assert.assertEquals(ImmutableMap.of("city", "Hongkong", "date", 1495036800000L), edge.properties()); } + @SneakyThrows @Test public void testReadEdges() { String json = "{\"edges\": [" @@ -564,13 +565,13 @@ public void testReadEdges() { + "}" + "]}"; - Mockito.when(this.mockResponse.getStatus()).thenReturn(200); - Mockito.when(this.mockResponse.getHeaders()).thenReturn(null); - Mockito.when(this.mockResponse.readEntity(String.class)) + Mockito.when(this.mockResponse.code()).thenReturn(200); + Mockito.when(this.mockResponse.headers()).thenReturn(null); + Mockito.when(this.mockResponse.body().string()) .thenReturn(json); RestResult result = new RestResult(this.mockResponse); Assert.assertEquals(200, result.status()); - Assert.assertNull(result.headers()); + Assert.assertEquals(result.headers(), new RestHeaders()); List edges = result.readList("edges", Edge.class); Assert.assertEquals(2, edges.size()); @@ -597,6 +598,7 @@ public void testReadEdges() { edge2.properties()); } + @SneakyThrows @Test public void testReadGremlinVertices() { String json = "{" @@ -643,13 +645,13 @@ public void testReadGremlinVertices() { + "}" + "}"; - Mockito.when(this.mockResponse.getStatus()).thenReturn(200); - Mockito.when(this.mockResponse.getHeaders()).thenReturn(null); - Mockito.when(this.mockResponse.readEntity(String.class)) + Mockito.when(this.mockResponse.code()).thenReturn(200); + Mockito.when(this.mockResponse.headers()).thenReturn(null); + Mockito.when(this.mockResponse.body().string()) .thenReturn(json); RestResult restResult = new RestResult(this.mockResponse); Assert.assertEquals(200, restResult.status()); - Assert.assertNull(restResult.headers()); + Assert.assertEquals(restResult.headers(), new RestHeaders()); Response response = restResult.readObject(Response.class); response.graphManager(graph()); @@ -689,6 +691,7 @@ public void testReadGremlinVertices() { } } + @SneakyThrows @Test public void testReadGremlinEdges() { String json = "{" @@ -731,13 +734,13 @@ public void testReadGremlinEdges() { + "}" + "}"; - Mockito.when(this.mockResponse.getStatus()).thenReturn(200); - Mockito.when(this.mockResponse.getHeaders()).thenReturn(null); - Mockito.when(this.mockResponse.readEntity(String.class)) + Mockito.when(this.mockResponse.code()).thenReturn(200); + Mockito.when(this.mockResponse.headers()).thenReturn(null); + Mockito.when(this.mockResponse.body().string()) .thenReturn(json); RestResult restResult = new RestResult(this.mockResponse); Assert.assertEquals(200, restResult.status()); - Assert.assertNull(restResult.headers()); + Assert.assertEquals(restResult.headers(), new RestHeaders()); Response response = restResult.readObject(Response.class); response.graphManager(graph()); @@ -774,6 +777,7 @@ public void testReadGremlinEdges() { } } + @SneakyThrows @Test public void testReadGremlinPathWithVertexAndEdge() { String json = "{" @@ -819,13 +823,13 @@ public void testReadGremlinPathWithVertexAndEdge() { + "}" + "}"; - Mockito.when(this.mockResponse.getStatus()).thenReturn(200); - Mockito.when(this.mockResponse.getHeaders()).thenReturn(null); - Mockito.when(this.mockResponse.readEntity(String.class)) + Mockito.when(this.mockResponse.code()).thenReturn(200); + Mockito.when(this.mockResponse.headers()).thenReturn(null); + Mockito.when(this.mockResponse.body().string()) .thenReturn(json); RestResult restResult = new RestResult(this.mockResponse); Assert.assertEquals(200, restResult.status()); - Assert.assertNull(restResult.headers()); + Assert.assertEquals(restResult.headers(), new RestHeaders()); Response response = restResult.readObject(Response.class); response.graphManager(graph()); @@ -862,6 +866,7 @@ public void testReadGremlinPathWithVertexAndEdge() { path.objects()); } + @SneakyThrows @Test public void testReadGremlinNullData() { String json = "{" @@ -877,13 +882,13 @@ public void testReadGremlinNullData() { + "}" + "}"; - Mockito.when(this.mockResponse.getStatus()).thenReturn(200); - Mockito.when(this.mockResponse.getHeaders()).thenReturn(null); - Mockito.when(this.mockResponse.readEntity(String.class)) + Mockito.when(this.mockResponse.code()).thenReturn(200); + Mockito.when(this.mockResponse.headers()).thenReturn(null); + Mockito.when(this.mockResponse.body().string()) .thenReturn(json); RestResult restResult = new RestResult(this.mockResponse); Assert.assertEquals(200, restResult.status()); - Assert.assertNull(restResult.headers()); + Assert.assertEquals(restResult.headers(), new RestHeaders()); Response response = restResult.readObject(Response.class); response.graphManager(graph()); @@ -895,6 +900,7 @@ public void testReadGremlinNullData() { Assert.assertNull(object); } + @SneakyThrows @Test public void testReadGremlinNullAndVertex() { String json = "{" @@ -922,13 +928,13 @@ public void testReadGremlinNullAndVertex() { + "}" + "}"; - Mockito.when(this.mockResponse.getStatus()).thenReturn(200); - Mockito.when(this.mockResponse.getHeaders()).thenReturn(null); - Mockito.when(this.mockResponse.readEntity(String.class)) + Mockito.when(this.mockResponse.code()).thenReturn(200); + Mockito.when(this.mockResponse.headers()).thenReturn(null); + Mockito.when(this.mockResponse.body().string()) .thenReturn(json); RestResult restResult = new RestResult(this.mockResponse); Assert.assertEquals(200, restResult.status()); - Assert.assertNull(restResult.headers()); + Assert.assertEquals(restResult.headers(), new RestHeaders()); Response response = restResult.readObject(Response.class); response.graphManager(graph()); @@ -952,6 +958,7 @@ public void testReadGremlinNullAndVertex() { Assert.assertTrue(Utils.contains(ImmutableList.of(marko), vertex)); } + @SneakyThrows @Test public void testReadGremlinEdgeAndNull() { String json = "{" @@ -982,13 +989,13 @@ public void testReadGremlinEdgeAndNull() { + "}" + "}"; - Mockito.when(this.mockResponse.getStatus()).thenReturn(200); - Mockito.when(this.mockResponse.getHeaders()).thenReturn(null); - Mockito.when(this.mockResponse.readEntity(String.class)) + Mockito.when(this.mockResponse.code()).thenReturn(200); + Mockito.when(this.mockResponse.headers()).thenReturn(null); + Mockito.when(this.mockResponse.body().string()) .thenReturn(json); RestResult restResult = new RestResult(this.mockResponse); Assert.assertEquals(200, restResult.status()); - Assert.assertNull(restResult.headers()); + Assert.assertEquals(restResult.headers(), new RestHeaders()); Response response = restResult.readObject(Response.class); response.graphManager(graph()); @@ -1008,8 +1015,7 @@ public void testReadGremlinEdgeAndNull() { created.targetLabel("software"); created.property("date", 1490284800000L); created.property("weight", 0.2); - Assert.assertTrue(Utils.contains(ImmutableList.of(created), - result.getEdge())); + Assert.assertTrue(Utils.contains(ImmutableList.of(created), result.getEdge())); Assert.assertTrue(results.hasNext()); result = results.next(); diff --git a/hugegraph-client/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker b/hugegraph-client/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker new file mode 100644 index 000000000..a76010b24 --- /dev/null +++ b/hugegraph-client/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker @@ -0,0 +1,17 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with this +# work for additional information regarding copyright ownership. The ASF +# licenses this file to You under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +mock-maker-inline diff --git a/hugegraph-dist/scripts/dependency/known-dependencies.txt b/hugegraph-dist/scripts/dependency/known-dependencies.txt index bacffaedc..83add0d23 100644 --- a/hugegraph-dist/scripts/dependency/known-dependencies.txt +++ b/hugegraph-dist/scripts/dependency/known-dependencies.txt @@ -3,10 +3,10 @@ accessors-smart-2.4.2.jar aircompressor-0.10.jar aircompressor-0.21.jar annotations-17.0.0.jar +annotations-13.0.jar ant-1.9.1.jar ant-launcher-1.9.1.jar antlr-runtime-3.5.2.jar -aopalliance-repackaged-3.0.1.jar apache-curator-2.12.0.pom arrow-format-0.8.0.jar arrow-format-2.0.0.jar @@ -110,9 +110,6 @@ hive-storage-api-2.7.0.jar hive-storage-api-2.7.2.jar hive-upgrade-acid-3.1.3.jar hive-vector-code-gen-3.1.3.jar -hk2-api-3.0.1.jar -hk2-locator-3.0.1.jar -hk2-utils-3.0.1.jar hppc-0.7.2.jar htrace-core4-4.1.0-incubating.jar htrace-core4-4.2.0-incubating.jar @@ -136,12 +133,11 @@ jackson-module-jaxb-annotations-2.12.3.jar jackson-module-parameter-names-2.12.3.jar jakarta.activation-2.0.1.jar jakarta.activation-api-1.2.1.jar -jakarta.annotation-api-2.0.0.jar -jakarta.inject-api-2.0.0.jar -jakarta.validation-api-3.0.0.jar -jakarta.ws.rs-api-3.0.0.jar +jersey-container-servlet-core-2.25.1.jar +jersey-container-servlet-core-2.27.jar +javax.inject-2.5.0-b32.jar +javax.inject-2.5.0-b42.jar jakarta.xml.bind-api-2.3.2.jar -jakarta.xml.bind-api-4.0.0-RC2.jar jamon-runtime-2.4.1.jar javassist-3.24.0-GA.jar javassist-3.25.0-GA.jar @@ -165,15 +161,6 @@ jcip-annotations-1.0-1.jar jcodings-1.0.18.jar jcommander-1.72.jar jcommander-1.78.jar -jersey-apache-connector-3.0.3.jar -jersey-client-3.0.3.jar -jersey-common-3.0.3.jar -jersey-container-servlet-3.0.3.jar -jersey-container-servlet-core-3.0.3.jar -jersey-entity-filtering-3.0.3.jar -jersey-hk2-3.0.3.jar -jersey-media-json-jackson-3.0.3.jar -jersey-server-3.0.3.jar jetty-client-9.4.33.v20201020.jar jetty-client-9.4.40.v20210413.jar jetty-http-9.4.19.v20190610.jar @@ -267,13 +254,22 @@ netty-transport-native-epoll-4.1.65.Final.jar netty-transport-native-unix-common-4.1.65.Final.jar nimbus-jose-jwt-9.8.1.jar okhttp-2.7.5.jar +okhttp-4.10.0.jar +logging-interceptor-4.10.0.jar +kotlin-stdlib-1.2.71.jar +kotlin-stdlib-1.6.20.jar +kotlin-stdlib-common-1.5.31.jar +kotlin-stdlib-jdk7-1.2.71.jar +kotlin-stdlib-jdk7-1.6.10.jar +kotlin-stdlib-jdk8-1.2.71.jar +kotlin-stdlib-jdk8-1.6.10.jar okio-1.6.0.jar +okio-jvm-3.0.0.jar opencsv-2.3.jar orc-core-1.5.8.jar orc-core-1.6.14.jar orc-shims-1.5.8.jar orc-shims-1.6.14.jar -osgi-resource-locator-1.0.3.jar ow2-asm-6.2.jar paranamer-2.3.jar postgresql-42.2.6.jar diff --git a/hugegraph-hubble/hubble-be/pom.xml b/hugegraph-hubble/hubble-be/pom.xml index fe7b686d1..301c6c347 100644 --- a/hugegraph-hubble/hubble-be/pom.xml +++ b/hugegraph-hubble/hubble-be/pom.xml @@ -1,20 +1,22 @@ - 4.0.0 @@ -31,6 +33,7 @@ 36320 2.1.0 3.3.0 + 4.10.0 @@ -89,10 +92,6 @@ com.github.ben-manes.caffeine caffeine - - org.apache.hugegraph - hugegraph-common - org.apache.hugegraph @@ -127,10 +126,6 @@ com.oracle ojdbc8 - - org.apache.hugegraph - hugegraph-common - slf4j-log4j12 org.slf4j @@ -139,15 +134,51 @@ log4j log4j + + org.jetbrains.kotlin + kotlin-stdlib + + + com.squareup.okhttp + okhttp + + + + com.squareup.okhttp3 + okhttp + + + org.jetbrains.kotlin + kotlin-stdlib + 1.6.20 + + + org.jetbrains.kotlin + kotlin-stdlib-common + 1.5.31 + + commons-fileupload commons-fileupload + + + + com.squareup.okhttp3 + okhttp-bom + ${okhttp.version} + pom + import + + + + unit-test diff --git a/hugegraph-hubble/hubble-dist/assembly/travis/download-hugegraph.sh b/hugegraph-hubble/hubble-dist/assembly/travis/download-hugegraph.sh index 38a7032c0..1a08376dd 100755 --- a/hugegraph-hubble/hubble-dist/assembly/travis/download-hugegraph.sh +++ b/hugegraph-hubble/hubble-dist/assembly/travis/download-hugegraph.sh @@ -1,19 +1,19 @@ #!/bin/bash # # Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at +# contributor license agreements. See the NOTICE file distributed with this +# work for additional information regarding copyright ownership. The ASF +# licenses this file to You under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. # set -ev diff --git a/hugegraph-hubble/pom.xml b/hugegraph-hubble/pom.xml index e9f239b49..5af407abc 100644 --- a/hugegraph-hubble/pom.xml +++ b/hugegraph-hubble/pom.xml @@ -30,7 +30,7 @@ pom ${project.artifactId} - https://github.com/apache/incubator-hugegraph-toolchain/tree/master/hugegraph-hubble + https://github.com/apache/hugegraph-toolchain/tree/master/hugegraph-hubble hugegraph-hubble is a graph management and analysis platform that provides features: graph data load, schema management, graph relationship analysis and graphical display. @@ -47,13 +47,6 @@ - - org.glassfish.jersey - jersey-bom - ${jersey.version} - pom - import - com.fasterxml.jackson jackson-bom diff --git a/hugegraph-loader/pom.xml b/hugegraph-loader/pom.xml index e6d121bef..e4565f0f7 100644 --- a/hugegraph-loader/pom.xml +++ b/hugegraph-loader/pom.xml @@ -30,11 +30,11 @@ jar ${project.artifactId} - https://github.com/apache/incubator-hugegraph-toolchain/tree/master/hugegraph-loader + https://github.com/apache/hugegraph-toolchain/tree/master/hugegraph-loader hugegraph-loader is a customizable command line utility for loading small to medium size - graph datasets - into the HugeGraph database from multiple data sources with various input formats. + graph datasets into the HugeGraph database from multiple data sources with various + input formats. @@ -366,6 +366,7 @@ hadoop-hdfs-client ${hadoop.version} + org.apache.hadoop hadoop-mapred diff --git a/hugegraph-spark-connector/pom.xml b/hugegraph-spark-connector/pom.xml index 5f595f079..b5e249b07 100644 --- a/hugegraph-spark-connector/pom.xml +++ b/hugegraph-spark-connector/pom.xml @@ -36,10 +36,7 @@ UTF-8 3.2.2 provided - 1.0.0 2.12.3 - 3.0.3 - 2.34 2.18.0 1.7.25 2.12.11 @@ -91,36 +88,7 @@ org.apache.hugegraph hugegraph-client - ${hugegraph.client.version} - - - - - org.glassfish.jersey.core - jersey-client - ${jersey.version} - - - org.glassfish.jersey.core - jersey-common - ${jersey.version} - - - org.glassfish.jersey.inject - jersey-hk2 - ${jersey.version} - - - org.glassfish.jersey.core - jersey-server - ${jersey.version} - - - - org.glassfish.jersey.containers - jersey-container-servlet-core - ${jersey.container.servlet.core.version} - provided + ${revision} diff --git a/pom.xml b/pom.xml index 00d1ecd4f..ed3aa7c87 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,8 @@ ${project.artifactId} https://github.com/apache/incubator-hugegraph-toolchain - hugegraph-toolchain is the integration project of a series of utilities for HugeGraph, it includes 4 main modules (loader/hubble/tools/client) + hugegraph-toolchain is the integration project of a series of utilities for HugeGraph, + it includes 4 main modules (loader/hubble/tools/client) @@ -97,7 +98,8 @@ - 1.0.0 + 1.2.0 + 1.2.0 ${project.artifactId} apache-${release.name}-incubating-${project.version} ${project.basedir}/assembly @@ -120,12 +122,10 @@ hugegraph ${project.name} ${project.version} - 1.0.0 3.1.3 2.2.3 3.3.1 3.6.2 - 3.0.3 4.12 2.8.47 1.18.8 @@ -152,13 +152,6 @@ - - org.glassfish.jersey - jersey-bom - ${jersey.version} - pom - import - org.apache.hugegraph hugegraph-common