Skip to content

Commit fbe11bf

Browse files
authored
fix: build error with npm not exist & tiny improve (#558)
1 parent d707163 commit fbe11bf

File tree

11 files changed

+85
-118
lines changed

11 files changed

+85
-118
lines changed

README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,39 @@
77
[![Build Status](https://github.com/apache/hugegraph-toolchain/actions/workflows/tools-ci.yml/badge.svg)](https://github.com/apache/hugegraph-toolchain/actions/workflows/tools-ci.yml)
88
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.apache.hugegraph/hugegraph-client/badge.svg)](https://mvnrepository.com/artifact/org.apache.hugegraph/hugegraph-client)
99

10-
`hugegraph-toolchain` is the integration project of a series of utilities for [HugeGraph](https://github.com/apache/hugegraph), it includes 4 main modules.
10+
`hugegraph-toolchain` is the integration project contains a series of utilities for [HugeGraph](https://github.com/apache/hugegraph),
11+
it includes 5+ main modules.
1112

1213
## Modules
1314

1415
- [hugegraph-loader](./hugegraph-loader): Loading datasets into the HugeGraph from multiple data sources.
1516
- [hugegraph-hubble](./hugegraph-hubble): Online HugeGraph management and analysis dashboard (Include: data loading, schema management, graph traverser and display).
1617
- [hugegraph-tools](./hugegraph-tools): Command line tool for deploying, managing and backing-up/restoring graphs from HugeGraph.
1718
- [hugegraph-client](./hugegraph-client): A Java-written client for HugeGraph, providing `RESTful` APIs for accessing graph vertex/edge/schema/gremlin/variables and traversals etc.
19+
- [hugegraph-client-go](./hugegraph-client-go): A Go-written client for HugeGraph, providing `RESTful` APIs for accessing graph vertex/edge/schema/gremlin/variables and traversals etc. (WIP)
1820

1921
## Usage
2022

21-
- [hugegraph-loader](./hugegraph-loader): We can use `docker run -itd --name loader hugegraph/loader` to quickly start [loader](https://hub.docker.com/r/hugegraph/loader) or we can follow [this](./hugegraph-loader/README.md#212-docker-compose) to use docker-compose to start `loader` with `server`. And we can find more details in the [doc](https://hugegraph.apache.org/docs/quickstart/hugegraph-loader/).
22-
- [hugegraph-hubble](./hugegraph-hubble): We can use `docker run -itd --name=hubble -p 8088:8088 hugegraph/hubble` to quickly start [hubble](https://hub.docker.com/r/hugegraph/hubble) or we can follow [this](hugegraph-hubble/README.md#quick-start) to use docker-compose to start `hubble` with `server`. And we can find more details in the [doc](https://hugegraph.apache.org/docs/quickstart/hugegraph-hubble/).
23-
- [hugegraph-client](./hugegraph-client): We can follow the [doc](https://hugegraph.apache.org/docs/quickstart/hugegraph-client/) to learn how to quick start with `client`.
23+
- [hugegraph-loader](./hugegraph-loader): We can use `docker run -itd --name loader hugegraph/loader` to quickly start [loader,](https://hub.docker.com/r/hugegraph/loader) or we can follow [this](./hugegraph-loader/README.md#212-docker-compose) to use docker-compose to start `loader` with `server`. And we can find more details in the [doc](https://hugegraph.apache.org/docs/quickstart/hugegraph-loader/).
24+
- [hugegraph-hubble](./hugegraph-hubble): We can use `docker run -itd --name=hubble -p 8088:8088 hugegraph/hubble` to quickly start [hubble,](https://hub.docker.com/r/hugegraph/hubble) or we can follow [this](hugegraph-hubble/README.md#quick-start) to use docker-compose to start `hubble` with `server`. And we can find more details in the [doc](https://hugegraph.apache.org/docs/quickstart/hugegraph-hubble/).
25+
- [hugegraph-client](./hugegraph-client): We can follow the [doc](https://hugegraph.apache.org/docs/quickstart/hugegraph-client/) to learn how to quickly start with `client`.
2426

2527
## Maven Dependencies
2628

2729
You could use import the dependencies in `maven` like this:
2830

2931
```xml
32+
<!-- Note: use the latest release version in maven repo, here is just an example -->
3033
<dependency>
3134
<groupId>org.apache.hugegraph</groupId>
3235
<artifactId>hugegraph-client</artifactId>
33-
<version>1.0.0</version>
36+
<version>1.2.0</version>
3437
</dependency>
3538

3639
<dependency>
3740
<groupId>org.apache.hugegraph</groupId>
3841
<artifactId>hugegraph-loader</artifactId>
39-
<version>1.0.0</version>
42+
<version>1.2.0</version>
4043
</dependency>
4144
```
4245

hugegraph-hubble/Dockerfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,9 @@ WORKDIR /pkg
2525

2626
RUN set -x \
2727
&& apt-get -q update \
28-
&& apt-get install curl gnupg -yq \
29-
&& curl -sL https://deb.nodesource.com/setup_16.x | bash \
30-
&& apt-get install -y nodejs \
31-
&& apt-get clean
28+
&& apt-get install curl -yq \
29+
&& apt-get clean \
30+
&& rm -rf /var/lib/apt/lists/*
3231

3332
RUN set -x \
3433
&& mvn install $MAVEN_ARGS -pl hugegraph-client,hugegraph-loader -am -Dmaven.javadoc.skip=true -DskipTests -ntp \

hugegraph-hubble/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44
[![hugegraph-hubble-ci](https://github.com/apache/incubator-hugegraph-toolchain/actions/workflows/hubble-ci.yml/badge.svg?branch=master)](https://github.com/apache/incubator-hugegraph-toolchain/actions/workflows/hubble-ci.yml)
55
[![CodeQL](https://github.com/apache/incubator-hugegraph-toolchain/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/apache/incubator-hugegraph-toolchain/actions/workflows/codeql-analysis.yml)
66

7-
hugegraph-hubble is a graph management and analysis platform that provides features: graph data load, schema management, graph relationship analysis and graphical display.
7+
hugegraph-hubble is a graph management and analysis platform that provides features:
8+
graph data load, schema management, graph relationship analysis, and graphical display.
89

910
## Features
1011

1112
- Graph connection management, supporting to easily switch graph to operate
1213
- Graph data load, supporting to load large amounts of data from files into hugegraph-server
1314
- Schema management, supporting to easily perform schema manipulation and display
14-
- Graph analysis and graphical display, supporting to build query via the gremlin or algorithms with a little effort then will get cool graphical results
15+
- Graph analysis and graphical display, supporting to build a query via the gremlin or algorithms with a little effort then will get cool graphical results
1516

1617
## Quick Start
1718

@@ -29,7 +30,7 @@ We can quickly start `hubble` in two ways:
2930
#environment:
3031
# - PRELOAD=true
3132
ports:
32-
- 18080:8080
33+
- 8080:8080
3334

3435
hubble:
3536
image: hugegraph/hubble

hugegraph-hubble/hubble-dist/pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,11 @@
8282
<id>install node and yarn</id>
8383
<goals>
8484
<goal>install-node-and-yarn</goal>
85+
<goal>install-node-and-npm</goal>
8586
</goals>
8687
<configuration>
8788
<nodeVersion>v16.16.0</nodeVersion>
89+
<npmVersion>8.19.1</npmVersion>
8890
<yarnVersion>v1.22.15</yarnVersion>
8991
</configuration>
9092
</execution>

hugegraph-tools/src/main/java/org/apache/hugegraph/structure/JsonGraph.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class JsonGraph {
3232

3333
private static final int INIT_VERTEX_CAPACITY = 1_000_000;
3434

35-
private Map<String, Map<Object, JsonVertex>> tables;
35+
private final Map<String, Map<Object, JsonVertex>> tables;
3636

3737
public JsonGraph() {
3838
this.tables = new ConcurrentHashMap<>();

hugegraph-tools/src/main/java/org/apache/hugegraph/util/ToolUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public static void exitOrThrow(ExitException e, boolean throwMode) {
6262
}
6363

6464
public static String commandsCategory(JCommander jCommander) {
65-
StringBuffer sb = new StringBuffer();
65+
StringBuilder sb = new StringBuilder();
6666
sb.append("================================================");
6767
sb.append("\n");
6868
sb.append("Warning : must provide one sub-command");

hugegraph-tools/src/test/java/org/apache/hugegraph/test/functional/AuthBackupTest.java

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -34,53 +34,43 @@ public void init() {
3434

3535
@Test
3636
public void testAuthBackup() {
37-
String[] args = new String[]{
38-
"--throw-mode", "true",
39-
"--user", USER_NAME,
40-
"--password", USER_PASSWORD,
41-
"auth-backup"
37+
String[] args = new String[]{"--throw-mode", "true", "--user", USER_NAME,
38+
"--password", USER_PASSWORD, "auth-backup"
4239
};
4340

4441
HugeGraphCommand.main(args);
4542

4643
Assert.assertTrue(FileUtil.checkFileExists(DEFAULT_URL));
4744
List<String> fileNames = FileUtil.subdirectories(DEFAULT_URL);
48-
Assert.assertTrue(fileNames.size() == 5);
45+
Assert.assertEquals(5, fileNames.size());
4946
}
5047

5148
@Test
5249
public void testAuthBackupByTypes() {
53-
String[] args = new String[]{
54-
"--throw-mode", "true",
55-
"--user", USER_NAME,
56-
"--password", USER_PASSWORD,
57-
"auth-backup",
58-
"--types", "user,group"
50+
String[] args = new String[]{"--throw-mode", "true", "--user", USER_NAME,
51+
"--password", USER_PASSWORD, "auth-backup",
52+
"--types", "user,group"
5953
};
6054

6155
HugeGraphCommand.main(args);
6256

6357
Assert.assertTrue(FileUtil.checkFileExists(DEFAULT_URL));
6458
List<String> fileNames = FileUtil.subdirectories(DEFAULT_URL);
65-
Assert.assertTrue(fileNames.size() == 2);
59+
Assert.assertEquals(2, fileNames.size());
6660
}
6761

6862
@Test
6963
public void testAuthBackupWithWrongType() {
70-
String[] args = new String[]{
71-
"--throw-mode", "true",
72-
"--user", USER_NAME,
73-
"--password", USER_PASSWORD,
74-
"auth-backup",
75-
"--types", "user,group,test"
64+
String[] args = new String[]{"--throw-mode", "true", "--user", USER_NAME,
65+
"--password", USER_PASSWORD, "auth-backup",
66+
"--types", "user,group,test"
7667
};
7768

7869
Assert.assertThrows(IllegalArgumentException.class, () -> {
7970
HugeGraphCommand.main(args);
8071
}, e -> {
8172
Assert.assertContains("valid value is 'all' or combination of " +
82-
"[user,group,target,belong,access]",
83-
e.getMessage());
73+
"[user,group,target,belong,access]", e.getMessage());
8474
});
8575
}
8676

@@ -99,6 +89,6 @@ public void testAuthBackupByDirectory() {
9989

10090
Assert.assertTrue(FileUtil.checkFileExists(directory));
10191
List<String> fileNames = FileUtil.subdirectories(directory);
102-
Assert.assertTrue(fileNames.size() == 5);
92+
Assert.assertEquals(5, fileNames.size());
10393
}
10494
}

hugegraph-tools/src/test/java/org/apache/hugegraph/test/functional/AuthRestoreTest.java

Lines changed: 17 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,10 @@ public void testAuthRestoreForAllType() {
5858
this.loadData(HugeType.BELONG, "auth_belongs.txt");
5959
this.loadData(HugeType.ACCESS, "auth_accesses.txt");
6060

61-
String[] args = new String[]{
62-
"--throw-mode", "true",
63-
"--user", USER_NAME,
64-
"--password", USER_PASSWORD,
65-
"auth-restore",
66-
"--directory", DEFAULT_URL,
67-
"--init-password", "123456",
68-
"--strategy", "ignore"
61+
String[] args = new String[]{"--throw-mode", "true", "--user", USER_NAME,
62+
"--password", USER_PASSWORD, "auth-restore",
63+
"--directory", DEFAULT_URL, "--init-password", "123456",
64+
"--strategy", "ignore"
6965
};
7066

7167
HugeGraphCommand.main(args);
@@ -82,15 +78,15 @@ public void testAuthRestoreForAllType() {
8278
List<Group> groups = this.client.auth().listGroups();
8379
Map<String, Group> groupMap = Maps.newHashMap();
8480
for (Group group : groups) {
85-
groupMap.put(group.name(), group);
81+
groupMap.put(group.name(), group);
8682
}
8783
Assert.assertTrue(groupMap.containsKey("test_group6"));
8884
idList.add(groupMap.get("test_group6").id().toString());
8985

9086
List<Target> targets = this.client.auth().listTargets();
9187
Map<String, Target> targetMap = Maps.newHashMap();
9288
for (Target target : targets) {
93-
targetMap.put(target.name(), target);
89+
targetMap.put(target.name(), target);
9490
}
9591
Assert.assertTrue(targetMap.containsKey("test_target1"));
9692
idList.add(targetMap.get("test_target1").id().toString());
@@ -139,7 +135,7 @@ public void testAuthRestoreForUser() {
139135
List<User> userList = this.client.auth().listUsers();
140136
Map<String, User> userMap = Maps.newHashMap();
141137
for (User user1 : userList) {
142-
userMap.put(user1.name(), user1);
138+
userMap.put(user1.name(), user1);
143139
}
144140

145141
Assert.assertTrue(userMap.containsKey("test_user1"));
@@ -160,8 +156,7 @@ public void testRestoreWithoutInitPassword() {
160156
HugeGraphCommand.main(args);
161157
}, e -> {
162158
String msg = e.getMessage();
163-
Assert.assertTrue(msg.endsWith("The following option is " +
164-
"required: [--init-password]"));
159+
Assert.assertTrue(msg.endsWith("The following option is required: [--init-password]"));
165160
});
166161
}
167162

@@ -182,8 +177,7 @@ public void testAuthRestoreWithConflictAndStopStrategy() {
182177
Assert.assertThrows(IllegalStateException.class, () -> {
183178
HugeGraphCommand.main(args);
184179
}, e -> {
185-
Assert.assertContains("Restore conflict with STOP strategy",
186-
e.getMessage());
180+
Assert.assertContains("Restore conflict with STOP strategy", e.getMessage());
187181
});
188182
}
189183

@@ -206,7 +200,7 @@ public void testAuthRestoreWithIgnoreStrategy() {
206200
List<User> userList = this.client.auth().listUsers();
207201
Map<String, User> userMap = Maps.newHashMap();
208202
for (User user1 : userList) {
209-
userMap.put(user1.name(), user1);
203+
userMap.put(user1.name(), user1);
210204
}
211205

212206
Assert.assertTrue(userMap.containsKey("admin"));
@@ -230,8 +224,7 @@ public void testAuthRestoreWithWrongDirectory() {
230224
Assert.assertThrows(IllegalStateException.class, () -> {
231225
HugeGraphCommand.main(args);
232226
}, e -> {
233-
Assert.assertContains("The directory does not exist",
234-
e.getMessage());
227+
Assert.assertContains("The directory does not exist", e.getMessage());
235228
});
236229
}
237230

@@ -244,7 +237,7 @@ public void testAuthRestoreWithWrongType() {
244237
"--user", USER_NAME,
245238
"--password", USER_PASSWORD,
246239
"auth-restore",
247-
"--types", "usertest",
240+
"--types", "user, test",
248241
"--strategy", "stop",
249242
"--init-password", "123456",
250243
"--directory", filePath
@@ -254,8 +247,7 @@ public void testAuthRestoreWithWrongType() {
254247
HugeGraphCommand.main(args);
255248
}, e -> {
256249
Assert.assertContains("valid value is 'all' or combination of " +
257-
"[user,group,target,belong,access]",
258-
e.getMessage());
250+
"[user,group,target,belong,access]", e.getMessage());
259251
});
260252
}
261253

@@ -278,8 +270,7 @@ public void testAuthRestoreByBelongWithoutDependency() {
278270
HugeGraphCommand.main(args);
279271
}, e -> {
280272
Assert.assertContains("if type contains 'belong' then " +
281-
"'user' and 'group' are required.",
282-
e.getMessage());
273+
"'user' and 'group' are required.", e.getMessage());
283274
});
284275
}
285276

@@ -302,8 +293,7 @@ public void testAuthRestoreByAccessWithoutDependency() {
302293
HugeGraphCommand.main(args);
303294
}, e -> {
304295
Assert.assertContains("if type contains 'access' then " +
305-
"'group' and 'target' are required.",
306-
e.getMessage());
296+
"'group' and 'target' are required.", e.getMessage());
307297
});
308298
}
309299

@@ -326,17 +316,15 @@ public void testAuthRestoreWithWrongStrategy() {
326316
HugeGraphCommand.main(args);
327317
}, e -> {
328318
Assert.assertContains("Invalid --strategy 'test', valid " +
329-
"value is 'stop' or 'ignore",
330-
e.getMessage());
319+
"value is 'stop' or 'ignore", e.getMessage());
331320
});
332321
}
333322

334323
private void loadData(HugeType hugeType, String dataFilePath) {
335324
String restoreDataPath = DEFAULT_URL + hugeType.string();
336325
String testRestoreDataPath = DEFAULT_TEST_URL + dataFilePath;
337326

338-
List<String> list = FileUtil.readTestRestoreData(FileUtil.configPath(
339-
testRestoreDataPath));
327+
List<String> list = FileUtil.readTestRestoreData(FileUtil.configPath(testRestoreDataPath));
340328
FileUtil.writeTestRestoreData(restoreDataPath, list);
341329
}
342330
}

0 commit comments

Comments
 (0)