This is an automated email from the ASF dual-hosted git repository.
xiaokang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-graphar.git
The following commit(s) were added to refs/heads/main by this push:
new 6dba1d37 feat(Java,info): VertexInfo/EdgeInfo Version Info (#713)
6dba1d37 is described below
commit 6dba1d370310922102744a38f58ea65565ec03c7
Author: Selim Soufargi <[email protected]>
AuthorDate: Mon Aug 11 14:15:56 2025 +0200
feat(Java,info): VertexInfo/EdgeInfo Version Info (#713)
* parse and get graph version
* spotless apply on the added class only
* PropertyGroup filtering added
* adjust getVersion to return VersionInfo
* getVersion() for both vertex and graph returns VersionInfo
* added getVersion for edge + remove uncessary methods previosuly
implemented in this PR + checked syntax
* added test for graphVersion + bug fixed returning type of InfoVersion in
graph, edge and vertex classes
* run spotless apply cmd
* fixed import issues
* fixed issues related to static functions
* parser version test param corrected
* fixing CI error on version test
* fixing CI error on formatting
* fixing CI error on version if null
* fixing CI error on formatting
* test bug fix
* test bug fix format
* versionInfo version int is not string bug
* test expects version 68
* test bug
* test bug
* test bug
* fix: load version from yaml
* format
* dump version and add test case
---------
Co-authored-by: Selim Soufargi <[email protected]~>
Co-authored-by: yxk485490 <[email protected]>
---
.../java/org/apache/graphar/info/EdgeInfo.java | 8 +-
.../java/org/apache/graphar/info/GraphInfo.java | 13 +++-
.../java/org/apache/graphar/info/VersionInfo.java | 72 +++++++++++++++++
.../org/apache/graphar/info/VersionParser.java | 91 ++++++++++++++++++++++
.../java/org/apache/graphar/info/VertexInfo.java | 16 +++-
.../graphar/info/loader/LocalYamlGraphLoader.java | 3 +-
.../org/apache/graphar/info/yaml/EdgeYaml.java | 8 ++
.../org/apache/graphar/info/yaml/GraphYaml.java | 36 +++++++++
.../org/apache/graphar/info/yaml/VertexYaml.java | 10 ++-
.../org/apache/graphar/info/GraphInfoTest.java | 35 +++++++++
.../java/org/apache/graphar/info/TestUtil.java | 6 +-
testing | 2 +-
12 files changed, 289 insertions(+), 11 deletions(-)
diff --git
a/maven-projects/info/src/main/java/org/apache/graphar/info/EdgeInfo.java
b/maven-projects/info/src/main/java/org/apache/graphar/info/EdgeInfo.java
index 5bcd1937..141aeae1 100644
--- a/maven-projects/info/src/main/java/org/apache/graphar/info/EdgeInfo.java
+++ b/maven-projects/info/src/main/java/org/apache/graphar/info/EdgeInfo.java
@@ -46,6 +46,7 @@ public class EdgeInfo {
long dstChunkSize,
boolean directed,
String prefix,
+ String version,
List<AdjacentList> adjacentListsAsList,
List<PropertyGroup> propertyGroupsAsList) {
this.cachedAdjacentLists =
@@ -64,6 +65,7 @@ public class EdgeInfo {
.setDestinationVertexType(dstLabel)
.setIsDirected(directed)
.setPrefix(prefix)
+ .setVersion(version)
.addAllAdjacentList(
adjacentListsAsList.stream()
.map(AdjacentList::getProto)
@@ -206,7 +208,7 @@ public class EdgeInfo {
}
public String dump() {
- Yaml yaml = new Yaml(GraphYaml.getDumperOptions());
+ Yaml yaml = new Yaml(GraphYaml.getRepresenter(),
GraphYaml.getDumperOptions());
EdgeYaml edgeYaml = new EdgeYaml(this);
return yaml.dump(edgeYaml);
}
@@ -251,6 +253,10 @@ public class EdgeInfo {
return getPrefix() + getConcat() + ".edge.yaml";
}
+ public VersionInfo getVersion() {
+ return VersionParser.getVersion(protoEdgeInfo.getVersion());
+ }
+
public Map<AdjListType, AdjacentList> getAdjacentLists() {
return cachedAdjacentLists;
}
diff --git
a/maven-projects/info/src/main/java/org/apache/graphar/info/GraphInfo.java
b/maven-projects/info/src/main/java/org/apache/graphar/info/GraphInfo.java
index b2177080..0578d32e 100644
--- a/maven-projects/info/src/main/java/org/apache/graphar/info/GraphInfo.java
+++ b/maven-projects/info/src/main/java/org/apache/graphar/info/GraphInfo.java
@@ -37,7 +37,11 @@ public class GraphInfo {
private final Map<String, EdgeInfo> cachedEdgeInfoMap;
public GraphInfo(
- String name, List<VertexInfo> vertexInfos, List<EdgeInfo>
edgeInfos, String prefix) {
+ String name,
+ List<VertexInfo> vertexInfos,
+ List<EdgeInfo> edgeInfos,
+ String prefix,
+ String version) {
this.cachedVertexInfoList = List.copyOf(vertexInfos);
this.cachedEdgeInfoList = List.copyOf(edgeInfos);
this.cachedVertexInfoMap =
@@ -62,6 +66,7 @@ public class GraphInfo {
.map(EdgeInfo::getEdgePath)
.collect(Collectors.toList()))
.setPrefix(prefix)
+ .setVersion(version)
.build();
}
@@ -80,7 +85,7 @@ public class GraphInfo {
}
public String dump() {
- Yaml yaml = new Yaml(GraphYaml.getDumperOptions());
+ Yaml yaml = new Yaml(GraphYaml.getRepresenter(),
GraphYaml.getDumperOptions());
GraphYaml graphYaml = new GraphYaml(this);
return yaml.dump(graphYaml);
}
@@ -183,6 +188,10 @@ public class GraphInfo {
return protoGraphInfo.getPrefix();
}
+ public VersionInfo getVersion() {
+ return VersionParser.getVersion(protoGraphInfo.getVersion());
+ }
+
private void checkVertexExist(String label) {
if (!hasVertexInfo(label)) {
throw new IllegalArgumentException(
diff --git
a/maven-projects/info/src/main/java/org/apache/graphar/info/VersionInfo.java
b/maven-projects/info/src/main/java/org/apache/graphar/info/VersionInfo.java
new file mode 100644
index 00000000..4d9a184c
--- /dev/null
+++ b/maven-projects/info/src/main/java/org/apache/graphar/info/VersionInfo.java
@@ -0,0 +1,72 @@
+/*
+ * 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.util.List;
+import java.util.Map;
+import java.util.StringJoiner;
+
+public class VersionInfo {
+ private int version;
+ private List<String> userDefinedTypes;
+ private final Map<Integer, List<String>> version2types =
+ Map.of(1, List.of("bool", "int32", "int64", "float", "double",
"string"));
+
+ public VersionInfo(Integer version, List<String> userDefinedTypes) {
+ this.version = version;
+ this.userDefinedTypes = userDefinedTypes;
+ }
+
+ public int getVersion() {
+ return version;
+ }
+
+ public List<String> getUserDefinedTypes() {
+ return userDefinedTypes;
+ }
+
+ /** Dump version to string. */
+ public String toString() {
+ StringBuilder str = new StringBuilder("gar/v").append(version);
+
+ if (userDefinedTypes != null && !userDefinedTypes.isEmpty()) {
+ str.append(" (");
+ // 使用 StringJoiner 更优雅地拼接带分隔符的字符串
+ StringJoiner sj = new StringJoiner(",");
+ for (String type : userDefinedTypes) {
+ sj.add(type);
+ }
+ str.append(sj.toString()).append(")");
+ }
+ return str.toString();
+ }
+
+ /** Check if type is supported by version. */
+ public boolean checkType(final String typeStr) {
+ if (version2types == null || !version2types.containsKey(version)) {
+ return false;
+ }
+ List<String> types = version2types.get(version);
+ if (types.contains(typeStr)) {
+ return true;
+ }
+ return userDefinedTypes != null && userDefinedTypes.contains(typeStr);
+ }
+}
diff --git
a/maven-projects/info/src/main/java/org/apache/graphar/info/VersionParser.java
b/maven-projects/info/src/main/java/org/apache/graphar/info/VersionParser.java
new file mode 100644
index 00000000..6aa8dcd5
--- /dev/null
+++
b/maven-projects/info/src/main/java/org/apache/graphar/info/VersionParser.java
@@ -0,0 +1,91 @@
+/*
+ * 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.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class VersionParser {
+ public static VersionInfo getVersion(String versionStr) {
+ if (versionStr == null || versionStr.isEmpty()) {
+ return null;
+ }
+ try {
+ int parsedVersion = parserVersion(versionStr);
+ List<String> parsedTypes = parseUserDefineTypes(versionStr);
+ return new VersionInfo(parsedVersion, parsedTypes);
+ } catch (RuntimeException e) {
+ throw new RuntimeException(
+ "Invalid version string: '" + versionStr + "'. Details: "
+ e.getMessage(), e);
+ }
+ }
+
+ private static int parserVersion(String versionStr) {
+ if (versionStr == null || versionStr.isEmpty()) {
+ throw new RuntimeException("Invalid version string: input cannot
be null or empty.");
+ }
+
+ final Pattern versionRegex = Pattern.compile("gar/v(\\d+).*");
+ final Matcher match = versionRegex.matcher(versionStr);
+
+ if (match.matches()) {
+ if (match.groupCount() != 1) {
+ throw new RuntimeException("Invalid version string: " +
versionStr);
+ }
+ try {
+ return Integer.parseInt(match.group(1));
+ } catch (NumberFormatException e) {
+ throw new RuntimeException(
+ "Invalid version string: Could not parse version
number from " + versionStr,
+ e);
+ }
+ } else {
+ throw new RuntimeException(
+ "Invalid version string: Does not match 'gar/v(\\d+).*'
format for "
+ + versionStr);
+ }
+ }
+
+ private static List<String> parseUserDefineTypes(String versionStr) {
+
+ List<String> userDefineTypes = new ArrayList<>();
+ final Pattern userDefineTypesRegex = Pattern.compile("gar/v\\d+
*\\((.*)\\).*");
+ final Matcher match = userDefineTypesRegex.matcher(versionStr);
+
+ if (match.matches()) {
+ if (match.groupCount() != 1) {
+ throw new RuntimeException("Invalid version string: " +
versionStr);
+ }
+
+ String typesStr = match.group(1);
+ String[] typesArray = typesStr.split(",", -1);
+
+ for (String type : typesArray) {
+ String trimmedType = type.trim();
+ if (!trimmedType.isEmpty()) {
+ userDefineTypes.add(trimmedType);
+ }
+ }
+ }
+ return userDefineTypes;
+ }
+}
diff --git
a/maven-projects/info/src/main/java/org/apache/graphar/info/VertexInfo.java
b/maven-projects/info/src/main/java/org/apache/graphar/info/VertexInfo.java
index ba1e51a4..c7c2ef65 100644
--- a/maven-projects/info/src/main/java/org/apache/graphar/info/VertexInfo.java
+++ b/maven-projects/info/src/main/java/org/apache/graphar/info/VertexInfo.java
@@ -32,7 +32,11 @@ public class VertexInfo {
private final PropertyGroups cachedPropertyGroups;
public VertexInfo(
- String type, long chunkSize, List<PropertyGroup> propertyGroups,
String prefix) {
+ String type,
+ long chunkSize,
+ List<PropertyGroup> propertyGroups,
+ String prefix,
+ String version) {
this.cachedPropertyGroups = new PropertyGroups(propertyGroups);
this.protoVertexInfo =
org.apache.graphar.proto.VertexInfo.newBuilder()
@@ -43,6 +47,7 @@ public class VertexInfo {
.map(PropertyGroup::getProto)
.collect(Collectors.toList()))
.setPrefix(prefix)
+ .setVersion(version)
.build();
}
@@ -69,7 +74,8 @@ public class VertexInfo {
protoVertexInfo.getType(),
protoVertexInfo.getChunkSize(),
newPropertyGroups.getPropertyGroupList(),
- protoVertexInfo.getPrefix()));
+ protoVertexInfo.getPrefix(),
+ protoVertexInfo.getVersion()));
}
public int propertyGroupNum() {
@@ -111,7 +117,7 @@ public class VertexInfo {
}
public String dump() {
- Yaml yaml = new Yaml(GraphYaml.getDumperOptions());
+ Yaml yaml = new Yaml(GraphYaml.getRepresenter(),
GraphYaml.getDumperOptions());
VertexYaml vertexYaml = new VertexYaml(this);
return yaml.dump(vertexYaml);
}
@@ -136,6 +142,10 @@ public class VertexInfo {
return getPrefix() + getType() + ".vertex.yaml";
}
+ public VersionInfo getVersion() {
+ return VersionParser.getVersion(protoVertexInfo.getVersion());
+ }
+
private void checkPropertyGroupExist(PropertyGroup propertyGroup) {
if (propertyGroup == null) {
throw new IllegalArgumentException("Property group is null");
diff --git
a/maven-projects/info/src/main/java/org/apache/graphar/info/loader/LocalYamlGraphLoader.java
b/maven-projects/info/src/main/java/org/apache/graphar/info/loader/LocalYamlGraphLoader.java
index c8ee8d5c..936fa9ed 100644
---
a/maven-projects/info/src/main/java/org/apache/graphar/info/loader/LocalYamlGraphLoader.java
+++
b/maven-projects/info/src/main/java/org/apache/graphar/info/loader/LocalYamlGraphLoader.java
@@ -65,7 +65,8 @@ public class LocalYamlGraphLoader implements GraphLoader {
for (String edgeYamlName : graphYaml.getEdges()) {
edgeInfos.add(loadEdge(ABSOLUTE_PREFIX + "/" + edgeYamlName));
}
- return new GraphInfo(graphYaml.getName(), vertexInfos, edgeInfos,
prefix);
+ return new GraphInfo(
+ graphYaml.getName(), vertexInfos, edgeInfos, prefix,
graphYaml.getVersion());
}
private VertexInfo loadVertex(String path) throws IOException {
diff --git
a/maven-projects/info/src/main/java/org/apache/graphar/info/yaml/EdgeYaml.java
b/maven-projects/info/src/main/java/org/apache/graphar/info/yaml/EdgeYaml.java
index ff31aae4..1bc78f47 100644
---
a/maven-projects/info/src/main/java/org/apache/graphar/info/yaml/EdgeYaml.java
+++
b/maven-projects/info/src/main/java/org/apache/graphar/info/yaml/EdgeYaml.java
@@ -21,8 +21,10 @@ package org.apache.graphar.info.yaml;
import java.util.ArrayList;
import java.util.List;
+import java.util.Optional;
import java.util.stream.Collectors;
import org.apache.graphar.info.EdgeInfo;
+import org.apache.graphar.info.VersionInfo;
public class EdgeYaml {
private String src_type;
@@ -60,6 +62,11 @@ public class EdgeYaml {
this.dst_chunk_size = edgeInfo.getDstChunkSize();
this.directed = edgeInfo.isDirected();
this.prefix = edgeInfo.getPrefix();
+ this.version =
+ Optional.of(edgeInfo)
+ .map(EdgeInfo::getVersion)
+ .map(VersionInfo::toString)
+ .orElse(null);
this.adj_lists =
edgeInfo.getAdjacentLists().values().stream()
.map(AdjacentListYaml::new)
@@ -80,6 +87,7 @@ public class EdgeYaml {
dst_chunk_size,
directed,
prefix,
+ version,
adj_lists.stream()
.map(AdjacentListYaml::toAdjacentList)
.collect(Collectors.toUnmodifiableList()),
diff --git
a/maven-projects/info/src/main/java/org/apache/graphar/info/yaml/GraphYaml.java
b/maven-projects/info/src/main/java/org/apache/graphar/info/yaml/GraphYaml.java
index 4b52ea4e..0f57b8f2 100644
---
a/maven-projects/info/src/main/java/org/apache/graphar/info/yaml/GraphYaml.java
+++
b/maven-projects/info/src/main/java/org/apache/graphar/info/yaml/GraphYaml.java
@@ -21,9 +21,15 @@ package org.apache.graphar.info.yaml;
import java.util.ArrayList;
import java.util.List;
+import java.util.Optional;
import java.util.stream.Collectors;
import org.apache.graphar.info.GraphInfo;
+import org.apache.graphar.info.VersionInfo;
import org.yaml.snakeyaml.DumperOptions;
+import org.yaml.snakeyaml.introspector.Property;
+import org.yaml.snakeyaml.nodes.NodeTuple;
+import org.yaml.snakeyaml.nodes.Tag;
+import org.yaml.snakeyaml.representer.Representer;
public class GraphYaml {
private String name;
@@ -32,6 +38,7 @@ public class GraphYaml {
private List<String> edges;
private String version;
private static final DumperOptions dumperOption;
+ private static Representer representer;
static {
dumperOption = new DumperOptions();
@@ -39,6 +46,26 @@ public class GraphYaml {
dumperOption.setIndent(4);
dumperOption.setIndicatorIndent(2);
dumperOption.setPrettyFlow(true);
+ representer =
+ new Representer(dumperOption) {
+ @Override
+ protected NodeTuple representJavaBeanProperty(
+ Object javaBean,
+ Property property,
+ Object propertyValue,
+ Tag customTag) {
+ // if value of property is null, ignore it.
+ if (propertyValue == null) {
+ return null;
+ } else {
+ return super.representJavaBeanProperty(
+ javaBean, property, propertyValue,
customTag);
+ }
+ }
+ };
+ representer.addClassTag(GraphYaml.class, Tag.MAP);
+ representer.addClassTag(VertexYaml.class, Tag.MAP);
+ representer.addClassTag(EdgeYaml.class, Tag.MAP);
}
public GraphYaml() {
@@ -52,6 +79,11 @@ public class GraphYaml {
public GraphYaml(GraphInfo graphInfo) {
this.name = graphInfo.getName();
this.prefix = graphInfo.getPrefix();
+ this.version =
+ Optional.of(graphInfo)
+ .map(GraphInfo::getVersion)
+ .map(VersionInfo::toString)
+ .orElse(null);
this.vertices =
graphInfo.getVertexInfos().stream()
.map(vertexInfo -> vertexInfo.getType() +
".vertex.yaml")
@@ -66,6 +98,10 @@ public class GraphYaml {
return dumperOption;
}
+ public static Representer getRepresenter() {
+ return representer;
+ }
+
public String getName() {
return name;
}
diff --git
a/maven-projects/info/src/main/java/org/apache/graphar/info/yaml/VertexYaml.java
b/maven-projects/info/src/main/java/org/apache/graphar/info/yaml/VertexYaml.java
index 6449c716..512d8e8c 100644
---
a/maven-projects/info/src/main/java/org/apache/graphar/info/yaml/VertexYaml.java
+++
b/maven-projects/info/src/main/java/org/apache/graphar/info/yaml/VertexYaml.java
@@ -21,7 +21,9 @@ package org.apache.graphar.info.yaml;
import java.util.ArrayList;
import java.util.List;
+import java.util.Optional;
import java.util.stream.Collectors;
+import org.apache.graphar.info.VersionInfo;
import org.apache.graphar.info.VertexInfo;
public class VertexYaml {
@@ -47,6 +49,11 @@ public class VertexYaml {
.map(PropertyGroupYaml::new)
.collect(Collectors.toList());
this.prefix = vertexInfo.getPrefix();
+ this.version =
+ Optional.of(vertexInfo)
+ .map(VertexInfo::getVersion)
+ .map(VersionInfo::toString)
+ .orElse(null);
}
public VertexInfo toVertexInfo() {
@@ -56,7 +63,8 @@ public class VertexYaml {
property_groups.stream()
.map(PropertyGroupYaml::toPropertyGroup)
.collect(Collectors.toList()),
- prefix);
+ prefix,
+ version);
}
public String getType() {
diff --git
a/maven-projects/info/src/test/java/org/apache/graphar/info/GraphInfoTest.java
b/maven-projects/info/src/test/java/org/apache/graphar/info/GraphInfoTest.java
index 28bb69f1..8f873851 100644
---
a/maven-projects/info/src/test/java/org/apache/graphar/info/GraphInfoTest.java
+++
b/maven-projects/info/src/test/java/org/apache/graphar/info/GraphInfoTest.java
@@ -20,6 +20,8 @@
package org.apache.graphar.info;
import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
import org.apache.graphar.info.loader.GraphLoader;
import org.apache.graphar.info.loader.LocalYamlGraphLoader;
import org.apache.graphar.proto.AdjListType;
@@ -64,6 +66,8 @@ public class GraphInfoTest {
Assert.assertEquals(1, graphInfo.getEdgeInfos().size());
Assert.assertNotNull(graphInfo.getVertexInfos());
Assert.assertEquals(1, graphInfo.getVertexInfos().size());
+ // test version gar/v1
+ Assert.assertEquals(1, graphInfo.getVersion().getVersion());
}
@Test
@@ -77,6 +81,7 @@ public class GraphInfoTest {
Assert.assertEquals("vertex/person/person.vertex.yaml",
personVertexInfo.getVertexPath());
Assert.assertNotNull(personVertexInfo.getPropertyGroups());
Assert.assertEquals(2, personVertexInfo.getPropertyGroups().size());
+ Assert.assertEquals(1, personVertexInfo.getVersion().getVersion());
}
@Test
@@ -150,6 +155,7 @@ public class GraphInfoTest {
Assert.assertEquals(
"edge/person_knows_person/person_knows_person.edge.yaml",
knowsEdgeInfo.getEdgePath());
+ Assert.assertEquals(1, knowsEdgeInfo.getVersion().getVersion());
}
@Test
@@ -250,4 +256,33 @@ public class GraphInfoTest {
Assert.assertFalse(property.isPrimary());
Assert.assertTrue(property.isNullable());
}
+
+ @Test
+ public void testVersionParser() {
+ // parser
+ VersionInfo versionInfo = VersionParser.getVersion("gar/v1");
+ Assert.assertEquals(1, versionInfo.getVersion());
+ Assert.assertTrue(versionInfo.getUserDefinedTypes().isEmpty());
+ Assert.assertTrue((versionInfo.checkType("int32")));
+ Assert.assertFalse((versionInfo.checkType("date32")));
+
+ versionInfo = VersionParser.getVersion("gar/v1 (t1,t2)");
+ Assert.assertEquals(1, versionInfo.getVersion());
+ Assert.assertEquals(List.of("t1", "t2"),
versionInfo.getUserDefinedTypes());
+ Assert.assertTrue(versionInfo.checkType("t1"));
+ Assert.assertTrue(versionInfo.checkType("t2"));
+ Assert.assertTrue((versionInfo.checkType("int32")));
+ Assert.assertFalse((versionInfo.checkType("date32")));
+
+ // dump
+ versionInfo = new VersionInfo(1, new ArrayList<>());
+ Assert.assertEquals(1, versionInfo.getVersion());
+ Assert.assertTrue(versionInfo.getUserDefinedTypes().isEmpty());
+ Assert.assertEquals("gar/v1", versionInfo.toString());
+
+ versionInfo = new VersionInfo(2, List.of("t1", "t2"));
+ Assert.assertEquals(2, versionInfo.getVersion());
+ Assert.assertEquals(List.of("t1", "t2"),
versionInfo.getUserDefinedTypes());
+ Assert.assertEquals("gar/v2 (t1,t2)", versionInfo.toString());
+ }
}
diff --git
a/maven-projects/info/src/test/java/org/apache/graphar/info/TestUtil.java
b/maven-projects/info/src/test/java/org/apache/graphar/info/TestUtil.java
index 3660b905..d683f03b 100644
--- a/maven-projects/info/src/test/java/org/apache/graphar/info/TestUtil.java
+++ b/maven-projects/info/src/test/java/org/apache/graphar/info/TestUtil.java
@@ -76,7 +76,8 @@ public class TestUtil {
PropertyGroup pg2 =
new PropertyGroup(
List.of(firstName, lastName, gender), FileType.CSV,
"firstName_lastName");
- VertexInfo person = new VertexInfo("person", 100, List.of(pg1, pg2),
"vertex/person/");
+ VertexInfo person =
+ new VertexInfo("person", 100, List.of(pg1, pg2),
"vertex/person/", "gar/v1");
// create edge info of yaml:
// src_type: person
@@ -121,6 +122,7 @@ public class TestUtil {
100,
false,
"edge/person_knows_person/",
+ "gar/v1",
List.of(orderedBySource, orderedByDest),
List.of(pg3));
@@ -131,7 +133,7 @@ public class TestUtil {
// edges:
// - person_knows_person.edge.yml
// version: gar/v1
- return new GraphInfo("ldbc_sample", List.of(person), List.of(knows),
"");
+ return new GraphInfo("ldbc_sample", List.of(person), List.of(knows),
"", "gar/v1");
}
public static void checkTestData() {
diff --git a/testing b/testing
index 12b4b175..955596c3 160000
--- a/testing
+++ b/testing
@@ -1 +1 @@
-Subproject commit 12b4b17561ca3e414366b176a8760b7ee825f7d9
+Subproject commit 955596c325ceba7b607e285738e3dd0ce4ff424e
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]