javeme commented on code in PR #538:
URL: 
https://github.com/apache/incubator-hugegraph-toolchain/pull/538#discussion_r1405423208


##########
hugegraph-client/src/test/java/org/apache/hugegraph/BaseClientTest.java:
##########
@@ -303,6 +294,16 @@ protected static void initEdge() {
                         "date", "2017-01-10", "city", "Hongkong");
     }
 
+    @Before
+    public void setup() {
+        // this.clearData();
+    }
+
+    @After
+    public void teardown() throws Exception {
+        // pass
+    }

Review Comment:
   don't update it?



##########
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("[email protected]");
+        user.phone("16812345678");
+        user.avatar("image.jpg");
+        return api.create(user);
+    }

Review Comment:
   don't update it?



##########
hugegraph-client/src/test/java/org/apache/hugegraph/functional/EdgeTest.java:
##########
@@ -125,16 +140,16 @@ public void testAddEdgePropertyValueList() {
                                        "time", "2012-10-10");
 
         Map<String, Object> 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"),

Review Comment:
   ditto



##########
hugegraph-client/src/test/java/org/apache/hugegraph/functional/EdgeTest.java:
##########
@@ -649,19 +664,29 @@ public void 
testGetEdgesByLabelAndPropertiesWithRangeCondition()
 
     @Test
     public void testGetEdgesByLabelAndPropertiesWithKeepP()
-                throws ParseException {
+            throws ParseException {
         schema().indexLabel("createdByCity").secondary()
                 .onE("created").by("city").create();
         schema().indexLabel("createdByDate").secondary()
-                .onE("created").by("date").create();
+                .onE("created").by("date 2&@").create();
 
         BaseClientTest.initEdge();
 
+        {
+            //test special character
+            Map<String, Object> properties = ImmutableMap.of(
+                    "date 2&@", "P.eq(\"2014-1-10\")");

Review Comment:
   can we test more special chars like "test3 =%&?"



##########
hugegraph-client/src/test/java/org/apache/hugegraph/api/auth/UserApiTest.java:
##########
@@ -136,15 +146,19 @@ public void testGet() {
     public void testGetUserRole() {
         User user1 = createUser("test1", "psw1");
         User user2 = createUser("test2", "psw2");
+        User user3 = createUser("test3 aaa", "psw3");
 
         Assert.assertEquals("test1", user1.name());
         Assert.assertEquals("test2", user2.name());
+        Assert.assertContains("test3 aaa", user3.name());//test special 
character

Review Comment:
   `;//test `=>`; // test`
   



##########
hugegraph-client/src/test/java/org/apache/hugegraph/functional/EdgeTest.java:
##########
@@ -46,6 +46,21 @@
 
 public class EdgeTest extends BaseFuncTest {
 
+    private static void assertContains(List<Edge> edges, Object source,
+                                       String label, Object target,
+                                       Object... keyValues) {
+        Map<String, Object> 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));
+    }

Review Comment:
   don't update it?



##########
hugegraph-client/src/test/java/org/apache/hugegraph/functional/EdgeTest.java:
##########
@@ -80,7 +95,7 @@ public void testAddEdgeProperty() {
         Edge created = graph().addEdge(peterId, "created", lopId,
                                        "date", "2017-03-24");
         Map<String, Object> props = ImmutableMap.of(
-                                    "date", Utils.formatDate("2017-03-24"));
+                "date", Utils.formatDate("2017-03-24"));

Review Comment:
   don't update it



##########
hugegraph-client/src/test/java/org/apache/hugegraph/functional/EdgeTest.java:
##########
@@ -46,6 +46,21 @@
 
 public class EdgeTest extends BaseFuncTest {
 
+    private static void assertContains(List<Edge> edges, Object source,
+                                       String label, Object target,
+                                       Object... keyValues) {
+        Map<String, Object> 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));
+    }

Review Comment:
   don't update it?



##########
hugegraph-client/src/test/java/org/apache/hugegraph/functional/EdgeTest.java:
##########
@@ -125,16 +140,16 @@ public void testAddEdgePropertyValueList() {
                                        "time", "2012-10-10");
 
         Map<String, Object> 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"),

Review Comment:
   ditto



##########
hugegraph-client/src/test/java/org/apache/hugegraph/functional/EdgeTest.java:
##########
@@ -649,19 +664,29 @@ public void 
testGetEdgesByLabelAndPropertiesWithRangeCondition()
 
     @Test
     public void testGetEdgesByLabelAndPropertiesWithKeepP()
-                throws ParseException {
+            throws ParseException {
         schema().indexLabel("createdByCity").secondary()
                 .onE("created").by("city").create();
         schema().indexLabel("createdByDate").secondary()
-                .onE("created").by("date").create();
+                .onE("created").by("date 2&@").create();
 
         BaseClientTest.initEdge();
 
+        {
+            //test special character
+            Map<String, Object> properties = ImmutableMap.of(
+                    "date 2&@", "P.eq(\"2014-1-10\")");
+            List<Edge> edges = graph().listEdges("created", properties, false);
+            Assert.assertEquals(1, edges.size());
+        }

Review Comment:
   can we add a independent test case?



##########
hugegraph-client/src/test/java/org/apache/hugegraph/api/auth/UserApiTest.java:
##########
@@ -136,15 +146,19 @@ public void testGet() {
     public void testGetUserRole() {
         User user1 = createUser("test1", "psw1");
         User user2 = createUser("test2", "psw2");
+        User user3 = createUser("test3 aaa", "psw3");

Review Comment:
   can we test more special chars like "test3 =%&?"
   



##########
hugegraph-client/src/test/java/org/apache/hugegraph/functional/EdgeTest.java:
##########
@@ -649,19 +664,29 @@ public void 
testGetEdgesByLabelAndPropertiesWithRangeCondition()
 
     @Test
     public void testGetEdgesByLabelAndPropertiesWithKeepP()
-                throws ParseException {
+            throws ParseException {
         schema().indexLabel("createdByCity").secondary()
                 .onE("created").by("city").create();
         schema().indexLabel("createdByDate").secondary()
-                .onE("created").by("date").create();
+                .onE("created").by("date 2&@").create();
 
         BaseClientTest.initEdge();
 
+        {
+            //test special character
+            Map<String, Object> properties = ImmutableMap.of(
+                    "date 2&@", "P.eq(\"2014-1-10\")");

Review Comment:
   can we test more special chars like "test3 =%&?"



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to