Thespica commented on code in PR #683: URL: https://github.com/apache/incubator-graphar/pull/683#discussion_r2116199965
########## 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: For vertex info and edge info, prefix means the path that store vertex and edge data. But for Graph Info, I'm not sure what's the meaning of prefix. BTW, test data ldbc_sample doesn't have prefix: https://github.com/apache/incubator-graphar-testing/blob/955596c325ceba7b607e285738e3dd0ce4ff424e/ldbc_sample/csv/ldbc_sample.graph.yml#L1-L6 ########## .github/workflows/java-info.yml: ########## @@ -0,0 +1,71 @@ +# 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. + +name: GraphAr Java-Info CI + +on: + # Trigger the workflow on push or pull request, + # but only for the main branch + push: + branches: + - main + paths: + - 'maven-projects/info/**' + - '.github/workflows/java-info.yml' + pull_request: + branches: + - main + paths: + - 'maven-projects/info/**' + - '.github/workflows/java-info.yml' + +concurrency: + group: ${{ github.repository }}-${{ github.event.number || github.head_ref || github.sha }}-${{ github.workflow }} + cancel-in-progress: true + +jobs: + test: + runs-on: ubuntu-latest + if: ${{ !contains(github.event.pull_request.title, 'WIP') }} Review Comment: allow running CI for `WIP` or draft PR, don't need this judgment here. ########## 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: you can add a `TODO` to mark that. add related issue link will be better -- 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