yangxk1 commented on code in PR #773:
URL: https://github.com/apache/incubator-graphar/pull/773#discussion_r2612620187


##########
maven-projects/info/src/main/java/org/apache/graphar/info/GraphInfo.java:
##########
@@ -136,6 +136,45 @@ public Optional<GraphInfo> addVertexAsNew(VertexInfo 
vertexInfo) {
                         edgeConcat2EdgeInfo));
     }
 
+    public Optional<GraphInfo> removeVertex(VertexInfo vertexInfo) {
+
+        if (vertexInfo == null || !hasVertexInfo(vertexInfo.getType())) {
+            return Optional.empty();
+        }
+        List<EdgeInfo> newCachedEdgeInfoList =

Review Comment:
   As we discussed, we don't need this logic anymore



##########
maven-projects/info/src/test/java/org/apache/graphar/info/GraphInfoTest.java:
##########
@@ -109,6 +109,19 @@ public void testGraphInfoBasics() {
                 illegalArgumentException.getMessage());
         // test version gar/v1
         Assert.assertEquals(1, graphInfo.getVersion().getVersion());
+        // basic tests for addVertex and removeVertex (more advanced ones 
should include adjancency
+        // list checks)
+        VertexInfo testingVertexInfo =
+                new VertexInfo("", 100, Arrays.asList(TestUtil.pg1), 
"vertex/person/", "gar/v1");
+        GraphInfo testingGraphInfo =
+                new GraphInfo("graphTest", new ArrayList<>(), new 
ArrayList<>(), "", "");
+        // add the created vertex on an empty graph
+        Assert.assertEquals(
+                1,
+                
testingGraphInfo.addVertexAsNew(testingVertexInfo).get().getVertexInfos().size());
+        // remove the newly created vertex and check again the emptied graph
+        Assert.assertEquals(true, 
testingGraphInfo.removeVertex(testingVertexInfo).isEmpty());
+        // TODO (same tests as vertices for edges)

Review Comment:
   Please add a test for edge



##########
maven-projects/info/src/test/java/org/apache/graphar/info/GraphInfoTest.java:
##########
@@ -109,6 +109,19 @@ public void testGraphInfoBasics() {
                 illegalArgumentException.getMessage());
         // test version gar/v1
         Assert.assertEquals(1, graphInfo.getVersion().getVersion());
+        // basic tests for addVertex and removeVertex (more advanced ones 
should include adjancency
+        // list checks)
+        VertexInfo testingVertexInfo =
+                new VertexInfo("", 100, Arrays.asList(TestUtil.pg1), 
"vertex/person/", "gar/v1");
+        GraphInfo testingGraphInfo =
+                new GraphInfo("graphTest", new ArrayList<>(), new 
ArrayList<>(), "", "");
+        // add the created vertex on an empty graph
+        Assert.assertEquals(
+                1,
+                
testingGraphInfo.addVertexAsNew(testingVertexInfo).get().getVertexInfos().size());
+        // remove the newly created vertex and check again the emptied graph

Review Comment:
   Now only the new method is verified without EXCEPTIONS, the result of the 
method needs to be calibrated. For example verify the count of vertex/edge in 
graph. 



-- 
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