Copilot commented on code in PR #683: URL: https://github.com/apache/incubator-graphar/pull/683#discussion_r2113421842
########## maven-projects/info/src/test/java/org/apache/graphar/info/GraphInfoTest.java: ########## @@ -0,0 +1,252 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.graphar.info; + +import java.io.IOException; +import org.apache.graphar.info.loader.GraphLoader; +import org.apache.graphar.info.loader.LocalYamlGraphLoader; +import org.apache.graphar.proto.AdjListType; +import org.apache.graphar.proto.DataType; +import org.apache.graphar.proto.FileType; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class GraphInfoTest { + + private static GraphInfo graphInfo; + private static VertexInfo personVertexInfo; + private static EdgeInfo knowsEdgeInfo; + + @BeforeClass + public static void setUp() { + TestUtil.checkTestData(); + final GraphLoader graphLoader = new LocalYamlGraphLoader(); + final String GRAPH_PATH = TestUtil.getLdbcSampleGraphPath(); + try { + graphInfo = graphLoader.load(GRAPH_PATH); + } catch (IOException e) { + throw new RuntimeException(e); + } + personVertexInfo = graphInfo.getVertexInfos().get(0); + knowsEdgeInfo = graphInfo.getEdgeInfos().get(0); + } + + @AfterClass + public static void clean() {} + + @Test + public void testGraphInfoBasics() { + Assert.assertNotNull(graphInfo); + Assert.assertEquals("ldbc_sample", graphInfo.getName()); + Assert.assertEquals("", graphInfo.getPrefix()); // This shouldn't be an empty string + Assert.assertNotNull(graphInfo.getEdgeInfos()); + Assert.assertEquals(1, graphInfo.getEdgeInfos().size()); + Assert.assertNotNull(graphInfo.getVertexInfos()); + Assert.assertEquals(1, graphInfo.getVertexInfos().size()); + } + + @Test + public void testPersonVertexInfoBasics() { + VertexInfo personVertexInfo = graphInfo.getVertexInfos().get(0); + Assert.assertEquals("person", personVertexInfo.getType()); + Assert.assertEquals(100, personVertexInfo.getChunkSize()); + Assert.assertEquals("vertex/person/", personVertexInfo.getPrefix()); + Assert.assertEquals( + "vertex/person//vertex_count", + personVertexInfo.getVerticesNumFilePath()); // one more '/' + Assert.assertEquals("vertex/person//person.vertex.yaml", personVertexInfo.getVertexPath()); Review Comment: [nitpick] Double slashes appear in expected paths (e.g., "vertex/person//vertex_count"). Consider normalizing prefixes in `GraphInfo` to avoid duplicate separators. ```suggestion "vertex/person/vertex_count", personVertexInfo.getVerticesNumFilePath()); // normalized path Assert.assertEquals("vertex/person/person.vertex.yaml", personVertexInfo.getVertexPath()); ``` ########## maven-projects/info/src/test/java/org/apache/graphar/info/GraphInfoTest.java: ########## @@ -0,0 +1,252 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.graphar.info; + +import java.io.IOException; +import org.apache.graphar.info.loader.GraphLoader; +import org.apache.graphar.info.loader.LocalYamlGraphLoader; +import org.apache.graphar.proto.AdjListType; +import org.apache.graphar.proto.DataType; +import org.apache.graphar.proto.FileType; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class GraphInfoTest { + + private static GraphInfo graphInfo; + private static VertexInfo personVertexInfo; + private static EdgeInfo knowsEdgeInfo; + + @BeforeClass + public static void setUp() { + TestUtil.checkTestData(); + final GraphLoader graphLoader = new LocalYamlGraphLoader(); + final String GRAPH_PATH = TestUtil.getLdbcSampleGraphPath(); + try { + graphInfo = graphLoader.load(GRAPH_PATH); + } catch (IOException e) { + throw new RuntimeException(e); + } + personVertexInfo = graphInfo.getVertexInfos().get(0); + knowsEdgeInfo = graphInfo.getEdgeInfos().get(0); + } + + @AfterClass + public static void clean() {} + + @Test + public void testGraphInfoBasics() { + Assert.assertNotNull(graphInfo); + Assert.assertEquals("ldbc_sample", graphInfo.getName()); + Assert.assertEquals("", graphInfo.getPrefix()); // This shouldn't be an empty string Review Comment: The assertion expects an empty prefix but the comment says it shouldn’t be empty. Please reconcile the expected value or update/remove the comment to match the intended behavior. ```suggestion Assert.assertEquals("ldbc_sample_prefix", graphInfo.getPrefix()); // The prefix should match the expected value ``` ########## maven-projects/info/src/main/java/org/apache/graphar/info/saver/LocalYamlGraphSaver.java: ########## @@ -19,23 +19,26 @@ package org.apache.graphar.info.saver; -import org.apache.graphar.info.EdgeInfo; -import org.apache.graphar.info.GraphInfo; -import org.apache.graphar.info.VertexInfo; - import java.io.BufferedWriter; import java.io.IOException; import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.Path; +import org.apache.graphar.info.EdgeInfo; +import org.apache.graphar.info.GraphInfo; +import org.apache.graphar.info.VertexInfo; public class LocalYamlGraphSaver implements GraphSaver { @Override public void save(String path, GraphInfo graphInfo) throws IOException { - final Path outputPath = FileSystems - .getDefault() - .getPath(path + FileSystems.getDefault().getSeparator() + graphInfo.getName() + ".graph.yaml"); + final Path outputPath = + FileSystems.getDefault() + .getPath( + path + + FileSystems.getDefault().getSeparator() + + graphInfo.getName() + + ".graph.yaml"); Review Comment: [nitpick] Manual string concatenation with `getSeparator()` is verbose and error-prone. Consider using `Paths.get(path, graphInfo.getName() + ".graph.yaml")` for clarity and cross-platform safety. ```suggestion final Path outputPath = Paths.get(path, graphInfo.getName() + ".graph.yaml"); ``` -- 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: commits-unsubscr...@graphar.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@graphar.apache.org For additional commands, e-mail: commits-h...@graphar.apache.org