Skip to content

Commit cb68bea

Browse files
zhenyuTtianzyimbajin
authored
feat: update common version and remove jersey code (#538)
* Update client-ci.yml add on workflow_dispatch * replace jersey with okhttp * fix test error * fix the problem that mockito can't mock final class * fix error * Update BaseClientTest.java * https support && add licence header * fix licence check error * fix error * fix licence check error * fix error * rename rest class && remove jersey dependency * add workflow_dispatch * add workflow_dispatch * hubble error fix * update okhttp version of hubble * refactor class name * add workflow_dispatch * fix licence dependency check error * feat: merge request * chore(ci): add stage profile settings * update common version and fix code * fix * fix * update version * fix spark-connector-ci * fix spark-connector-ci * fix spark-connector-ci * update client version * update client version * fix license-checker * code optimize * remove useless dependency * remove useless code * fix licence check * fix import & update api version * remove redundant common import in hubble * remove redundant lombok version * remove useless code * add comment * rename id * add encode test case * add encode test case and fix code issue * fix test error * fix test error * fix code issue * fix code issue * fix code issue * update hg server commitId * debug ci error * revert commit ID & let it pass 100 * Update client-ci.yml * tiny fix --------- Co-authored-by: tianzy <[email protected]> Co-authored-by: imbajin <[email protected]>
1 parent b066b80 commit cb68bea

File tree

30 files changed

+410
-432
lines changed

30 files changed

+410
-432
lines changed

.github/workflows/client-ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: "hugegraph-client-ci"
22

33
on:
4+
workflow_dispatch:
45
push:
56
branches:
67
- master
@@ -23,11 +24,12 @@ jobs:
2324
env:
2425
USE_STAGE: 'true' # Whether to include the stage repository.
2526
TRAVIS_DIR: hugegraph-client/assembly/travis
27+
# TODO: replace it with the (latest - n) commit id (n >= 15)
2628
COMMIT_ID: be6ee386b9939dc6bd6fcbdf2274b8acc3a0a314
2729
strategy:
2830
fail-fast: false
2931
matrix:
30-
JAVA_VERSION: ['8']
32+
JAVA_VERSION: [ '8' ]
3133
steps:
3234
- name: Install JDK 8
3335
uses: actions/setup-java@v3
@@ -71,4 +73,5 @@ jobs:
7173
- name: Upload coverage to Codecov
7274
uses: codecov/codecov-action@v3
7375
with:
76+
token: ${{ secrets.CODECOV_TOKEN }}
7477
file: target/jacoco.xml

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
name: "CodeQL"
1313

1414
on:
15+
workflow_dispatch:
16+
push:
17+
branches: [ master, release-* ]
1518
pull_request:
1619
# The branches below must be a subset of the branches above
1720
# branches: [ master ] # enable in all PR

.github/workflows/hubble-ci.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: "hugegraph-hubble-ci"
22

33
on:
4+
workflow_dispatch:
45
push:
56
branches:
67
- master
@@ -22,7 +23,7 @@ on:
2223

2324
env:
2425
TRAVIS_DIR: hugegraph-hubble/hubble-dist/assembly/travis
25-
# TODO: need update it later (eed6103359fe40d2f1476fb8c56d9388c3111a99)
26+
# TODO: replace it with the (latest - n) commit id (n >= 15)
2627
COMMIT_ID: be6ee386b9939dc6bd6fcbdf2274b8acc3a0a314
2728

2829
jobs:
@@ -113,6 +114,7 @@ jobs:
113114
hubble-dist/assembly/travis/run-api-test.sh
114115
115116
- name: Upload coverage to Codecov
116-
uses: codecov/codecov-action@v3.0.0
117+
uses: codecov/codecov-action@v3
117118
with:
119+
token: ${{ secrets.CODECOV_TOKEN }}
118120
file: target/site/jacoco/*.xml

.github/workflows/loader-ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: "hugegraph-loader-ci"
22

33
on:
4+
workflow_dispatch:
45
push:
56
branches:
67
- master
@@ -25,6 +26,7 @@ jobs:
2526
USE_STAGE: 'true' # Whether to include the stage repository.
2627
TRAVIS_DIR: hugegraph-loader/assembly/travis
2728
STATIC_DIR: hugegraph-loader/assembly/static
29+
# TODO: replace it with the (latest - n) commit id (n >= 15)
2830
COMMIT_ID: be6ee386b9939dc6bd6fcbdf2274b8acc3a0a314
2931
DB_USER: root
3032
DB_PASS: root
@@ -74,6 +76,7 @@ jobs:
7476
mvn test -P kafka
7577
7678
- name: Upload coverage to Codecov
77-
uses: codecov/codecov-action@v3.0.0
79+
uses: codecov/codecov-action@v3
7880
with:
81+
token: ${{ secrets.CODECOV_TOKEN }}
7982
file: target/jacoco.xml

.github/workflows/tools-ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
name: "hugegraph-tools-ci"
22
on:
3+
workflow_dispatch:
34
push:
45
branches:
56
- master
@@ -56,6 +57,7 @@ jobs:
5657
run: |
5758
mvn test -Dtest=FuncTestSuite -pl hugegraph-tools -ntp
5859
- name: Upload coverage to Codecov
59-
uses: codecov/codecov-action@v3.0.0
60+
uses: codecov/codecov-action@v3
6061
with:
62+
token: ${{ secrets.CODECOV_TOKEN }}
6163
file: target/jacoco.xml

.licenserc.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ header: # `header` section is configurations for source codes license header.
7575
- 'assembly/**'
7676
- '.github/**/*'
7777
- '**/target/*'
78+
- 'hugegraph-client/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker'
7879
# - 'hugegraph-hubble/hubble-fe/**'
7980
comment: on-failure # on what condition license-eye will comment on the pull request, `on-failure`, `always`, `never`.
8081

hugegraph-client/assembly/travis/install-hugegraph-from-source.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,5 @@ echo "gremlinserver.url=http://127.0.0.1:8282" >> ${REST_SERVER_CONFIG}
6060

6161
# start HugeGraphServer with https protocol
6262
bin/init-store.sh
63-
bin/start-hugegraph.sh
63+
bin/start-hugegraph.sh || (cat logs/hugegraph-server.log && exit 1)
6464
cd ../

hugegraph-client/pom.xml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
License for the specific language governing permissions and limitations
1616
under the License.
1717
-->
18-
<project xmlns="http://maven.apache.org/POM/4.0.0"
19-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
18+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
19+
xmlns="http://maven.apache.org/POM/4.0.0"
2020
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2121
<modelVersion>4.0.0</modelVersion>
2222
<parent>
@@ -30,15 +30,12 @@
3030
<packaging>jar</packaging>
3131

3232
<name>${project.artifactId}</name>
33-
<url>https://github.com/apache/incubator-hugegraph-toolchain/tree/master/hugegraph-client</url>
33+
<url>https://github.com/apache/hugegraph-toolchain/tree/master/hugegraph-client</url>
3434
<description>
3535
hugegraph-client is a Java-written client of HugeGraph, providing
3636
operations of graph, schema, gremlin, variables and traversals etc.
3737
</description>
3838

39-
<properties>
40-
</properties>
41-
4239
<dependencies>
4340
<dependency>
4441
<groupId>org.apache.hugegraph</groupId>
@@ -48,15 +45,17 @@
4845
<groupId>org.lz4</groupId>
4946
<artifactId>lz4-java</artifactId>
5047
</dependency>
51-
<dependency>
52-
<groupId>org.glassfish.jersey.containers</groupId>
53-
<artifactId>jersey-container-servlet</artifactId>
54-
</dependency>
5548
<dependency>
5649
<groupId>org.mockito</groupId>
5750
<artifactId>mockito-core</artifactId>
5851
<scope>test</scope>
5952
</dependency>
53+
<dependency>
54+
<groupId>org.projectlombok</groupId>
55+
<artifactId>lombok</artifactId>
56+
<version>${lombok.version}</version>
57+
<optional>true</optional>
58+
</dependency>
6059
</dependencies>
6160

6261
<build>

hugegraph-client/src/main/java/org/apache/hugegraph/api/auth/UserAPI.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ public User get(Object id) {
5050
}
5151

5252
public UserRole getUserRole(Object id) {
53-
String idEncoded = RestClient.encode(formatEntityId(id));
54-
String path = String.join("/", this.path(), idEncoded, "role");
53+
String formattedId = formatEntityId(id);
54+
String path = String.join("/", this.path(), formattedId, "role");
5555
RestResult result = this.client.get(path);
5656
return result.readObject(UserRole.class);
5757
}

hugegraph-client/src/main/java/org/apache/hugegraph/api/graph/EdgeAPI.java

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
import org.apache.hugegraph.client.RestClient;
2525
import org.apache.hugegraph.exception.NotAllCreatedException;
26+
import org.apache.hugegraph.rest.RestHeaders;
2627
import org.apache.hugegraph.rest.RestResult;
2728
import org.apache.hugegraph.structure.constant.Direction;
2829
import org.apache.hugegraph.structure.constant.HugeType;
@@ -32,8 +33,6 @@
3233

3334
import com.google.common.collect.ImmutableMap;
3435

35-
import jakarta.ws.rs.core.MultivaluedHashMap;
36-
3736
public class EdgeAPI extends GraphAPI {
3837

3938
public EdgeAPI(RestClient client, String graph) {
@@ -51,12 +50,9 @@ public Edge create(Edge edge) {
5150
}
5251

5352
public List<String> create(List<Edge> edges, boolean checkVertex) {
54-
MultivaluedHashMap<String, Object> headers = new MultivaluedHashMap<>();
55-
headers.putSingle("Content-Encoding", BATCH_ENCODING);
56-
Map<String, Object> params = ImmutableMap.of("check_vertex",
57-
checkVertex);
58-
RestResult result = this.client.post(this.batchPath(), edges,
59-
headers, params);
53+
RestHeaders headers = new RestHeaders().add(RestHeaders.CONTENT_ENCODING, BATCH_ENCODING);
54+
Map<String, Object> params = ImmutableMap.of("check_vertex", checkVertex);
55+
RestResult result = this.client.post(this.batchPath(), edges, headers, params);
6056
List<String> ids = result.readList(String.class);
6157
if (edges.size() != ids.size()) {
6258
throw new NotAllCreatedException("Not all edges are successfully created, " +
@@ -68,10 +64,8 @@ public List<String> create(List<Edge> edges, boolean checkVertex) {
6864

6965
public List<Edge> update(BatchEdgeRequest request) {
7066
this.client.checkApiVersion("0.45", "batch property update");
71-
MultivaluedHashMap<String, Object> headers = new MultivaluedHashMap<>();
72-
headers.putSingle("Content-Encoding", BATCH_ENCODING);
73-
RestResult result = this.client.put(this.batchPath(), null,
74-
request, headers);
67+
RestHeaders headers = new RestHeaders().add(RestHeaders.CONTENT_ENCODING, BATCH_ENCODING);
68+
RestResult result = this.client.put(this.batchPath(), null, request, headers);
7569
return result.readList(this.type(), Edge.class);
7670
}
7771

@@ -98,11 +92,9 @@ public Edges list(int limit) {
9892
return this.list(null, null, null, null, 0, null, limit);
9993
}
10094

101-
public Edges list(Object vertexId, Direction direction,
102-
String label, Map<String, Object> properties,
103-
int offset, String page, int limit) {
104-
return this.list(vertexId, direction, label, properties, false,
105-
offset, page, limit);
95+
public Edges list(Object vertexId, Direction direction, String label,
96+
Map<String, Object> properties, int offset, String page, int limit) {
97+
return this.list(vertexId, direction, label, properties, false, offset, page, limit);
10698
}
10799

108100
public Edges list(Object vertexId, Direction direction, String label,

0 commit comments

Comments
 (0)