Skip to content

Commit

Permalink
fix label cypher
Browse files Browse the repository at this point in the history
  • Loading branch information
lipanpan03 authored and tugraph committed Aug 11, 2023
1 parent 94e0077 commit 2fa90fa
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ public static void importSchemaFromContent(TuGraphDbRpcClient client) throws Exc
jsonArray = JSONArray.parseArray(res);
assert (jsonArray.size() == 1);
JSONObject jsonObject = jsonArray.getJSONObject(0);
assert (jsonObject.containsKey("edgeLabels"));
assert ("PLAY_IN".equals(jsonObject.getString("edgeLabels")));
assert (jsonObject.containsKey("label"));
assert ("PLAY_IN".equals(jsonObject.getString("label")));
}

public static void importDataFromContent(TuGraphDbRpcClient client) throws Exception {
Expand Down Expand Up @@ -200,10 +200,10 @@ public static void importSchemaFromFile(TuGraphDbRpcClient client) throws Except
assert (array.size() == 6);
for (Object o : array) {
JSONObject obj = (JSONObject) o;
assert ("HAS_CHILD".equals(obj.getString("edgeLabels")) || "MARRIED".equals(obj.getString("edgeLabels"))
|| "BORN_IN".equals(obj.getString("edgeLabels")) || "DIRECTED".equals(obj.getString("edgeLabels"))
|| "WROTE_MUSIC_FOR".equals(obj.getString("edgeLabels"))
|| "ACTED_IN".equals(obj.getString("edgeLabels")));
assert ("HAS_CHILD".equals(obj.getString("label")) || "MARRIED".equals(obj.getString("label"))
|| "BORN_IN".equals(obj.getString("label")) || "DIRECTED".equals(obj.getString("label"))
|| "WROTE_MUSIC_FOR".equals(obj.getString("label"))
|| "ACTED_IN".equals(obj.getString("label")));
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ public static void importSchemaFromContent(TuGraphDbRpcClient client) throws Exc
res = client.callCypher("CALL db.edgeLabels()", "default", 10);
log.info("db.edgeLabels() : " + res);
JSONObject jsonObject = (JSONObject)JSONObject.parseArray(res).get(0);
assert (jsonObject.containsKey("edgeLabels"));
assert ("PLAY_IN".equals(jsonObject.getString("edgeLabels")));
assert (jsonObject.containsKey("label"));
assert ("PLAY_IN".equals(jsonObject.getString("label")));
}

public static void importDataFromContent(TuGraphDbRpcClient client) throws Exception {
Expand Down Expand Up @@ -149,10 +149,10 @@ public static void importSchemaFromFile(TuGraphDbRpcClient client) throws Except
assert (array.size() == 6);
for (Object o : array) {
JSONObject obj = (JSONObject) o;
assert ("HAS_CHILD".equals(obj.getString("edgeLabels")) || "MARRIED".equals(obj.getString("edgeLabels"))
|| "BORN_IN".equals(obj.getString("edgeLabels")) || "DIRECTED".equals(obj.getString("edgeLabels"))
|| "WROTE_MUSIC_FOR".equals(obj.getString("edgeLabels"))
|| "ACTED_IN".equals(obj.getString("edgeLabels")));
assert ("HAS_CHILD".equals(obj.getString("label")) || "MARRIED".equals(obj.getString("label"))
|| "BORN_IN".equals(obj.getString("label")) || "DIRECTED".equals(obj.getString("label"))
|| "WROTE_MUSIC_FOR".equals(obj.getString("label"))
|| "ACTED_IN".equals(obj.getString("label")));
}

}
Expand Down Expand Up @@ -358,8 +358,11 @@ public static void executeCypherAndAssert(TuGraphDbRpcClient client, String cyph
}

public static void haClientTest() throws Exception {
host = executiveWithValue("hostname -I");
host = host.substring(0, host.length() - 1);
host = executiveWithValue("hostname -I").trim();
int len = host.indexOf(' ');
if (len != -1) {
host = host.substring(0, len);
}

// start HA group
executive("mkdir ha1 && cp -r ../../src/server/lgraph_ha.json ./lgraph_server ./resource ha1 && cd ha1 && ./lgraph_server --host " + host + " --port 27072 --enable_rpc true --enable_ha true --ha_node_offline_ms 5000 --ha_node_remove_ms 10000 --rpc_port 29092 --directory ./db --log_dir ./log --ha_conf " + host + ":29092," + host + ":29093," + host + ":29094 -c lgraph_ha.json -d start");
Expand Down

0 comments on commit 2fa90fa

Please sign in to comment.