Skip to content

Commit

Permalink
compatible with hugegraph-common v2.1.0 for java11 (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
zyxxoo authored Feb 16, 2022
1 parent 0b11105 commit 7f3c885
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 23 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@ jobs:
env:
TRAVIS_DIR: assembly/travis
COMMIT_ID: 1d031c5905cbef008dd5fb468576b0e6a9445181
strategy:
fail-fast: false
matrix:
JAVA_VERSION: ['8']
steps:
- name: Install JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
java-version: ${{ matrix.JAVA_VERSION }}
distribution: 'zulu'

- name: Cache Maven packages
Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.baidu.hugegraph</groupId>
<artifactId>hugegraph-client</artifactId>
<version>2.0.1</version>
<version>2.1.0</version>

This comment has been minimized.

Copy link
@javeme
<packaging>jar</packaging>

<name>hugegraph-client</name>
Expand Down Expand Up @@ -53,8 +53,8 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<compiler.source>1.8</compiler.source>
<compiler.target>1.8</compiler.target>
<hugegraph.common.version>2.0.1</hugegraph.common.version>
<jersey.version>2.22</jersey.version>
<hugegraph.common.version>2.1.0</hugegraph.common.version>
<jersey.version>3.0.3</jersey.version>
<mockito.version>2.8.47</mockito.version>
</properties>

Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/baidu/hugegraph/api/graph/EdgeAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
import java.util.List;
import java.util.Map;

import javax.ws.rs.core.MultivaluedHashMap;

import com.baidu.hugegraph.client.RestClient;
import com.baidu.hugegraph.exception.NotAllCreatedException;
import com.baidu.hugegraph.rest.RestResult;
Expand All @@ -34,6 +32,7 @@
import com.baidu.hugegraph.structure.graph.Edge;
import com.baidu.hugegraph.structure.graph.Edges;
import com.google.common.collect.ImmutableMap;
import jakarta.ws.rs.core.MultivaluedHashMap;

public class EdgeAPI extends GraphAPI {

Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/baidu/hugegraph/api/graph/VertexAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
import java.util.List;
import java.util.Map;

import javax.ws.rs.core.MultivaluedHashMap;

import com.baidu.hugegraph.client.RestClient;
import com.baidu.hugegraph.exception.InvalidResponseException;
import com.baidu.hugegraph.exception.NotAllCreatedException;
Expand All @@ -35,6 +33,7 @@
import com.baidu.hugegraph.structure.graph.Vertex;
import com.baidu.hugegraph.structure.graph.Vertices;
import com.google.common.collect.ImmutableMap;
import jakarta.ws.rs.core.MultivaluedHashMap;

public class VertexAPI extends GraphAPI {

Expand Down
10 changes: 4 additions & 6 deletions src/main/java/com/baidu/hugegraph/api/graphs/GraphsAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@
import java.util.List;
import java.util.Map;

import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedHashMap;
import javax.ws.rs.core.MultivaluedMap;

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 com.baidu.hugegraph.api.API;
Expand Down Expand Up @@ -61,7 +59,7 @@ protected String type() {
public Map<String, String> create(String name, String cloneGraphName,
String configText) {
this.client.checkApiVersion("0.67", "dynamic graph add");
MultivaluedMap<String, Object> headers = new MultivaluedHashMap<>();
MultivaluedHashMap<String, Object> headers = new MultivaluedHashMap<>();
headers.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON);
Map<String, Object> params = null;
if (StringUtils.isNotEmpty(cloneGraphName)) {
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/baidu/hugegraph/client/RestClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

package com.baidu.hugegraph.client;

import javax.ws.rs.core.Response;

import com.baidu.hugegraph.exception.ServerException;
import com.baidu.hugegraph.rest.AbstractRestClient;
import com.baidu.hugegraph.rest.ClientException;
Expand All @@ -31,6 +29,7 @@
import com.baidu.hugegraph.util.VersionUtil;
import com.baidu.hugegraph.util.VersionUtil.Version;
import com.fasterxml.jackson.databind.module.SimpleModule;
import jakarta.ws.rs.core.Response;

public class RestClient extends AbstractRestClient {

Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/baidu/hugegraph/driver/HugeClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@

import java.io.Closeable;

import javax.ws.rs.ProcessingException;

import com.baidu.hugegraph.client.RestClient;
import com.baidu.hugegraph.rest.ClientException;
import com.baidu.hugegraph.util.VersionUtil;
import com.baidu.hugegraph.version.ClientVersion;
import jakarta.ws.rs.ProcessingException;

public class HugeClient implements Closeable {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@

import java.util.Map;

import javax.ws.rs.core.Response;

import com.baidu.hugegraph.rest.RestResult;
import jakarta.ws.rs.core.Response;

public class ServerException extends RuntimeException {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class ClientVersion {

public static void check() {
// Check version of hugegraph-common
VersionUtil.check(CommonVersion.VERSION, "1.8", "2.1",
VersionUtil.check(CommonVersion.VERSION, "2.1", "2.2",
CommonVersion.NAME);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ public void testAppendVertexLabelWithUserData() {
Assert.assertEquals(1, player.userdata().size());
String time = (String) player.userdata().get("~create_time");
Date createTime = DateUtil.parse(time);
try {
Thread.sleep(10);
} catch (InterruptedException e) {
Assert.fail(e.getMessage());
}
Assert.assertTrue(createTime.before(DateUtil.now()));

player = schema.vertexLabel("player")
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/com/baidu/hugegraph/unit/RestResultTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@

public class RestResultTest extends BaseUnitTest {

private javax.ws.rs.core.Response mockResponse;
private jakarta.ws.rs.core.Response mockResponse;
private static GraphManager graphManager;

@BeforeClass
Expand All @@ -76,7 +76,7 @@ public static GraphManager graph() {
@Before
public void setup() {
// Mock caches
this.mockResponse = Mockito.mock(javax.ws.rs.core.Response.class);
this.mockResponse = Mockito.mock(jakarta.ws.rs.core.Response.class);
}

@After
Expand Down

0 comments on commit 7f3c885

Please sign in to comment.