From 829620d8c6cf9fc8df9af24788d683d5689c5387 Mon Sep 17 00:00:00 2001 From: Jarvx200 Date: Mon, 15 Sep 2025 22:25:55 +0300 Subject: [PATCH 01/15] refactor: created basic builder for `VertexInfo` class --- .../org/apache/graphar/info/VertexInfo.java | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) 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 2ebfb0d06..97d0cea8c 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 @@ -34,6 +34,80 @@ public class VertexInfo { private final URI baseUri; private final VersionInfo version; + public static VertexInfoBuilder builder() { + return new VertexInfoBuilder(); + } + + public static class VertexInfoBuilder{ + private String type; + private long chunkSize; + private PropertyGroups propertyGroups; + private URI baseUri; + private VersionInfo version; + + private VertexInfoBuilder(){} + + public VertexInfoBuilder type(String type){ + this.type = type; + return this; + } + + public VertexInfoBuilder chunkSize(long chunkSize){ + this.chunkSize = chunkSize; + return this; + } + + public VertexInfoBuilder propertyGroups(PropertyGroups propertyGroups){ + this.propertyGroups = propertyGroups; + return this; + } + + public VertexInfoBuilder baseUri(URI baseUri){ + if(this.baseUri == null) { + this.baseUri = baseUri; + } + return this; + } + + public VertexInfoBuilder baseUri(String baseUri){ + if(this.baseUri == null) { + this.baseUri = URI.create(baseUri); + } + return this; + } + + public VertexInfoBuilder version(VersionInfo version){ + if(this.version == null) { + this.version = version; + } + return this; + } + + public VertexInfoBuilder version(String version){ + if(this.version == null) { + this.version = VersionParser.getVersion(version); + } + return this; + } + + public VertexInfo build(){ + if (chunkSize < 0) { + throw new IllegalArgumentException("Chunk size cannot be negative: " + chunkSize); + } + return new VertexInfo(this); + } + + + } + + private VertexInfo(VertexInfoBuilder builder){ + this.type = builder.type; + this.chunkSize = builder.chunkSize; + this.propertyGroups = builder.propertyGroups; + this.baseUri = builder.baseUri; + this.version = builder.version; + } + public VertexInfo( String type, long chunkSize, From 129613ae1ff15388b3f5c4b9553f6e091cb45798 Mon Sep 17 00:00:00 2001 From: Jarvx200 Date: Mon, 15 Sep 2025 22:32:08 +0300 Subject: [PATCH 02/15] test: Added basic testing for new `VertexInfoBuilder` and null checking --- .../apache/graphar/info/VertexInfoTest.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java diff --git a/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java b/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java new file mode 100644 index 000000000..3e0fabcfa --- /dev/null +++ b/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java @@ -0,0 +1,32 @@ +package org.apache.graphar.info; + +import org.junit.Assert; +import org.junit.Test; + +import java.net.URI; +import java.net.URISyntaxException; +import java.util.List; + +public class VertexInfoTest { + + private VertexInfo.VertexInfoBuilder b = VertexInfo.builder() + .baseUri("test") + .type("test") + .chunkSize(24) + .version("gar/v1") + .propertyGroups(new PropertyGroups(List.of(TestUtil.pg3))); + + @Test + public void testVertexInfoBasicBuilder(){ + VertexInfo v = b.build(); + } + + @Test + public void testVertexInfoBuilderDoubleDeclaration() throws URISyntaxException { + VertexInfo v = + b.baseUri(new URI("world")) + .build(); + + Assert.assertEquals(new URI("test"), v.getBaseUri()); + } +} From 77967a0caf24cfdc6a29e597b2e1558f86fa4720 Mon Sep 17 00:00:00 2001 From: Jarvx200 Date: Mon, 15 Sep 2025 22:32:59 +0300 Subject: [PATCH 03/15] style: applied spotless formatting --- .../org/apache/graphar/info/VertexInfo.java | 34 +++++++++---------- .../apache/graphar/info/VertexInfoTest.java | 26 +++++++------- 2 files changed, 28 insertions(+), 32 deletions(-) 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 97d0cea8c..ab11dc6b0 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 @@ -38,69 +38,67 @@ public static VertexInfoBuilder builder() { return new VertexInfoBuilder(); } - public static class VertexInfoBuilder{ + public static class VertexInfoBuilder { private String type; private long chunkSize; private PropertyGroups propertyGroups; private URI baseUri; private VersionInfo version; - private VertexInfoBuilder(){} + private VertexInfoBuilder() {} - public VertexInfoBuilder type(String type){ + public VertexInfoBuilder type(String type) { this.type = type; return this; } - public VertexInfoBuilder chunkSize(long chunkSize){ + public VertexInfoBuilder chunkSize(long chunkSize) { this.chunkSize = chunkSize; return this; } - public VertexInfoBuilder propertyGroups(PropertyGroups propertyGroups){ + public VertexInfoBuilder propertyGroups(PropertyGroups propertyGroups) { this.propertyGroups = propertyGroups; return this; } - public VertexInfoBuilder baseUri(URI baseUri){ - if(this.baseUri == null) { + public VertexInfoBuilder baseUri(URI baseUri) { + if (this.baseUri == null) { this.baseUri = baseUri; } return this; } - public VertexInfoBuilder baseUri(String baseUri){ - if(this.baseUri == null) { + public VertexInfoBuilder baseUri(String baseUri) { + if (this.baseUri == null) { this.baseUri = URI.create(baseUri); } return this; } - public VertexInfoBuilder version(VersionInfo version){ - if(this.version == null) { + public VertexInfoBuilder version(VersionInfo version) { + if (this.version == null) { this.version = version; } return this; } - public VertexInfoBuilder version(String version){ - if(this.version == null) { + public VertexInfoBuilder version(String version) { + if (this.version == null) { this.version = VersionParser.getVersion(version); } return this; } - public VertexInfo build(){ + public VertexInfo build() { if (chunkSize < 0) { throw new IllegalArgumentException("Chunk size cannot be negative: " + chunkSize); } - return new VertexInfo(this); + return new VertexInfo(this); } - - } - private VertexInfo(VertexInfoBuilder builder){ + private VertexInfo(VertexInfoBuilder builder) { this.type = builder.type; this.chunkSize = builder.chunkSize; this.propertyGroups = builder.propertyGroups; diff --git a/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java b/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java index 3e0fabcfa..2bc75dc17 100644 --- a/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java +++ b/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java @@ -1,32 +1,30 @@ package org.apache.graphar.info; -import org.junit.Assert; -import org.junit.Test; - import java.net.URI; import java.net.URISyntaxException; import java.util.List; +import org.junit.Assert; +import org.junit.Test; public class VertexInfoTest { - private VertexInfo.VertexInfoBuilder b = VertexInfo.builder() - .baseUri("test") - .type("test") - .chunkSize(24) - .version("gar/v1") - .propertyGroups(new PropertyGroups(List.of(TestUtil.pg3))); + private VertexInfo.VertexInfoBuilder b = + VertexInfo.builder() + .baseUri("test") + .type("test") + .chunkSize(24) + .version("gar/v1") + .propertyGroups(new PropertyGroups(List.of(TestUtil.pg3))); @Test - public void testVertexInfoBasicBuilder(){ + public void testVertexInfoBasicBuilder() { VertexInfo v = b.build(); } @Test public void testVertexInfoBuilderDoubleDeclaration() throws URISyntaxException { - VertexInfo v = - b.baseUri(new URI("world")) - .build(); + VertexInfo v = b.baseUri(new URI("world")).build(); - Assert.assertEquals(new URI("test"), v.getBaseUri()); + Assert.assertEquals(new URI("test"), v.getBaseUri()); } } From 835a5f3e6a944daab7644007b6918aff2020c38f Mon Sep 17 00:00:00 2001 From: Jarvx200 Date: Mon, 15 Sep 2025 22:40:12 +0300 Subject: [PATCH 04/15] chore: added license --- .../apache/graphar/info/VertexInfoTest.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java b/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java index 2bc75dc17..3ed51db18 100644 --- a/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java +++ b/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java @@ -1,3 +1,22 @@ +/* + * 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.net.URI; From 0ae0f1b7ab1747a30661d02cb740d81ad2a4aa41 Mon Sep 17 00:00:00 2001 From: Jarvx200 Date: Thu, 18 Sep 2025 21:27:56 +0300 Subject: [PATCH 05/15] test: Removed redundant checks and added test cases for exceptions --- .../org/apache/graphar/info/GraphInfo.java | 1 + .../org/apache/graphar/info/VertexInfo.java | 17 ++++++++--------- .../apache/graphar/info/VertexInfoTest.java | 18 +++++++++++++++++- 3 files changed, 26 insertions(+), 10 deletions(-) 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 85322cd0c..0cbcaf711 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 @@ -38,6 +38,7 @@ public class GraphInfo { private final Map edgeConcat2EdgeInfo; private final VersionInfo version; + public GraphInfo( String name, List vertexInfos, 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 ab11dc6b0..d806675a7 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 @@ -63,30 +63,26 @@ public VertexInfoBuilder propertyGroups(PropertyGroups propertyGroups) { } public VertexInfoBuilder baseUri(URI baseUri) { - if (this.baseUri == null) { - this.baseUri = baseUri; - } + this.baseUri = baseUri; + return this; } public VertexInfoBuilder baseUri(String baseUri) { - if (this.baseUri == null) { this.baseUri = URI.create(baseUri); - } + return this; } public VertexInfoBuilder version(VersionInfo version) { - if (this.version == null) { this.version = version; - } + return this; } public VertexInfoBuilder version(String version) { - if (this.version == null) { this.version = VersionParser.getVersion(version); - } + return this; } @@ -94,6 +90,9 @@ public VertexInfo build() { if (chunkSize < 0) { throw new IllegalArgumentException("Chunk size cannot be negative: " + chunkSize); } + if(baseUri == null) { + throw new IllegalArgumentException("Base URI cannot be null"); + } return new VertexInfo(this); } } diff --git a/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java b/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java index 3ed51db18..b296fd2e6 100644 --- a/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java +++ b/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java @@ -44,6 +44,22 @@ public void testVertexInfoBasicBuilder() { public void testVertexInfoBuilderDoubleDeclaration() throws URISyntaxException { VertexInfo v = b.baseUri(new URI("world")).build(); - Assert.assertEquals(new URI("test"), v.getBaseUri()); + Assert.assertEquals(new URI("world"), v.getBaseUri()); + } + + @Test + public void URInullTest(){ + VertexInfo b2 = VertexInfo.builder() + .type("test") + .chunkSize(24) + .version("gar/v1") + .propertyGroups(new PropertyGroups(List.of(TestUtil.pg3))) + .build(); + } + + @Test + public void invalidChunkSizeTest(){ + b.chunkSize(-1); + b.build(); } } From a387e0f6f255e87c59672327d9f24effe48dfeeb Mon Sep 17 00:00:00 2001 From: Jarvx200 Date: Thu, 18 Sep 2025 21:29:12 +0300 Subject: [PATCH 06/15] style: applied spotless --- .../java/org/apache/graphar/info/GraphInfo.java | 1 - .../org/apache/graphar/info/VertexInfo.java | 8 ++++---- .../org/apache/graphar/info/VertexInfoTest.java | 17 +++++++++-------- 3 files changed, 13 insertions(+), 13 deletions(-) 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 0cbcaf711..85322cd0c 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 @@ -38,7 +38,6 @@ public class GraphInfo { private final Map edgeConcat2EdgeInfo; private final VersionInfo version; - public GraphInfo( String name, List vertexInfos, 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 d806675a7..c1517fcdc 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 @@ -69,19 +69,19 @@ public VertexInfoBuilder baseUri(URI baseUri) { } public VertexInfoBuilder baseUri(String baseUri) { - this.baseUri = URI.create(baseUri); + this.baseUri = URI.create(baseUri); return this; } public VertexInfoBuilder version(VersionInfo version) { - this.version = version; + this.version = version; return this; } public VertexInfoBuilder version(String version) { - this.version = VersionParser.getVersion(version); + this.version = VersionParser.getVersion(version); return this; } @@ -90,7 +90,7 @@ public VertexInfo build() { if (chunkSize < 0) { throw new IllegalArgumentException("Chunk size cannot be negative: " + chunkSize); } - if(baseUri == null) { + if (baseUri == null) { throw new IllegalArgumentException("Base URI cannot be null"); } return new VertexInfo(this); diff --git a/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java b/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java index b296fd2e6..5b14bcd4e 100644 --- a/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java +++ b/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java @@ -48,17 +48,18 @@ public void testVertexInfoBuilderDoubleDeclaration() throws URISyntaxException { } @Test - public void URInullTest(){ - VertexInfo b2 = VertexInfo.builder() - .type("test") - .chunkSize(24) - .version("gar/v1") - .propertyGroups(new PropertyGroups(List.of(TestUtil.pg3))) - .build(); + public void URInullTest() { + VertexInfo b2 = + VertexInfo.builder() + .type("test") + .chunkSize(24) + .version("gar/v1") + .propertyGroups(new PropertyGroups(List.of(TestUtil.pg3))) + .build(); } @Test - public void invalidChunkSizeTest(){ + public void invalidChunkSizeTest() { b.chunkSize(-1); b.build(); } From c834801d9a88aa696e38c5532742738e68828690 Mon Sep 17 00:00:00 2001 From: Jarvx200 Date: Thu, 18 Sep 2025 21:37:16 +0300 Subject: [PATCH 07/15] fix: added exception expected for null tests --- .../src/test/java/org/apache/graphar/info/VertexInfoTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java b/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java index 5b14bcd4e..c5a883438 100644 --- a/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java +++ b/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java @@ -47,7 +47,7 @@ public void testVertexInfoBuilderDoubleDeclaration() throws URISyntaxException { Assert.assertEquals(new URI("world"), v.getBaseUri()); } - @Test + @Test(expected=RuntimeException.class) public void URInullTest() { VertexInfo b2 = VertexInfo.builder() @@ -58,7 +58,7 @@ public void URInullTest() { .build(); } - @Test + @Test(expected=RuntimeException.class) public void invalidChunkSizeTest() { b.chunkSize(-1); b.build(); From 0a674001384e16f3bc8974ef3c0785f95e0d3df0 Mon Sep 17 00:00:00 2001 From: Jarvx200 Date: Thu, 18 Sep 2025 21:38:43 +0300 Subject: [PATCH 08/15] style: re-applied spotless --- .../src/test/java/org/apache/graphar/info/VertexInfoTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java b/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java index c5a883438..e16e8dd25 100644 --- a/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java +++ b/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java @@ -47,7 +47,7 @@ public void testVertexInfoBuilderDoubleDeclaration() throws URISyntaxException { Assert.assertEquals(new URI("world"), v.getBaseUri()); } - @Test(expected=RuntimeException.class) + @Test(expected = RuntimeException.class) public void URInullTest() { VertexInfo b2 = VertexInfo.builder() @@ -58,7 +58,7 @@ public void URInullTest() { .build(); } - @Test(expected=RuntimeException.class) + @Test(expected = RuntimeException.class) public void invalidChunkSizeTest() { b.chunkSize(-1); b.build(); From ac68f80a253d45a3bdadefe55ac3b4bd67945034 Mon Sep 17 00:00:00 2001 From: Jarvx200 Date: Sun, 12 Oct 2025 16:14:02 +0300 Subject: [PATCH 09/15] refactor: added builder methods for propertyGroups --- .../org/apache/graphar/info/VertexInfo.java | 35 ++++++++++++++++--- 1 file changed, 31 insertions(+), 4 deletions(-) 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 c1517fcdc..4cd9b0852 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 @@ -20,6 +20,7 @@ package org.apache.graphar.info; import java.net.URI; +import java.util.ArrayList; import java.util.List; import java.util.Optional; import org.apache.graphar.info.type.DataType; @@ -44,6 +45,7 @@ public static class VertexInfoBuilder { private PropertyGroups propertyGroups; private URI baseUri; private VersionInfo version; + private List propertyGroupsAsListTemp; private VertexInfoBuilder() {} @@ -57,10 +59,6 @@ public VertexInfoBuilder chunkSize(long chunkSize) { return this; } - public VertexInfoBuilder propertyGroups(PropertyGroups propertyGroups) { - this.propertyGroups = propertyGroups; - return this; - } public VertexInfoBuilder baseUri(URI baseUri) { this.baseUri = baseUri; @@ -86,7 +84,36 @@ public VertexInfoBuilder version(String version) { return this; } + public VertexInfoBuilder addPropertyGroup(PropertyGroup propertyGroup) { + if (propertyGroupsAsListTemp == null) propertyGroupsAsListTemp = new ArrayList<>(); + propertyGroupsAsListTemp.add(propertyGroup); + return this; + } + + public VertexInfoBuilder addPropertyGroups(List propertyGroups) { + if (propertyGroupsAsListTemp == null) propertyGroupsAsListTemp = new ArrayList<>(); + propertyGroupsAsListTemp.addAll(propertyGroups); + return this; + } + + public VertexInfoBuilder propertyGroups(PropertyGroups propertyGroups) { + this.propertyGroups = propertyGroups; + return this; + } + public VertexInfo build() { + if (propertyGroups == null && propertyGroupsAsListTemp != null) { + propertyGroups = new PropertyGroups(propertyGroupsAsListTemp); + } else if (propertyGroupsAsListTemp != null) { + propertyGroups = + propertyGroupsAsListTemp.stream() + .map(propertyGroups::addPropertyGroupAsNew) + .filter(Optional::isPresent) + .map(Optional::get) + .reduce((first, second) -> second) + .orElse(new PropertyGroups(new ArrayList<>())); + } + if (chunkSize < 0) { throw new IllegalArgumentException("Chunk size cannot be negative: " + chunkSize); } From 14007edb98c2e9d141d3ae85d18c1196c641424c Mon Sep 17 00:00:00 2001 From: Jarvx200 Date: Sun, 12 Oct 2025 16:20:41 +0300 Subject: [PATCH 10/15] test: added tests for new property group methods --- .../apache/graphar/info/VertexInfoTest.java | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java b/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java index e16e8dd25..c02c7d420 100644 --- a/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java +++ b/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java @@ -49,7 +49,7 @@ public void testVertexInfoBuilderDoubleDeclaration() throws URISyntaxException { @Test(expected = RuntimeException.class) public void URInullTest() { - VertexInfo b2 = + VertexInfo v = VertexInfo.builder() .type("test") .chunkSize(24) @@ -58,6 +58,26 @@ public void URInullTest() { .build(); } + @Test + public void propertyGroupAppendTest(){ + VertexInfo v = b + .addPropertyGroup(TestUtil.pg2) + .build(); + + Assert.assertEquals(2, v.getPropertyGroups().size()); + + } + + @Test + public void propertyGroupAddOnlyTest(){ + VertexInfo v = b + .propertyGroups(null) + .addPropertyGroup(TestUtil.pg2) + .build(); + + Assert.assertEquals(1, v.getPropertyGroups().size()); + } + @Test(expected = RuntimeException.class) public void invalidChunkSizeTest() { b.chunkSize(-1); From ea28027f65a1dcc2c1c85aa283b9e6ddbcda4037 Mon Sep 17 00:00:00 2001 From: Jarvx200 Date: Sun, 12 Oct 2025 16:21:17 +0300 Subject: [PATCH 11/15] style: applied spottless --- .../java/org/apache/graphar/info/VertexInfo.java | 1 - .../org/apache/graphar/info/VertexInfoTest.java | 14 ++++---------- 2 files changed, 4 insertions(+), 11 deletions(-) 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 4cd9b0852..4059df178 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 @@ -59,7 +59,6 @@ public VertexInfoBuilder chunkSize(long chunkSize) { return this; } - public VertexInfoBuilder baseUri(URI baseUri) { this.baseUri = baseUri; diff --git a/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java b/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java index c02c7d420..c17235984 100644 --- a/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java +++ b/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java @@ -59,21 +59,15 @@ public void URInullTest() { } @Test - public void propertyGroupAppendTest(){ - VertexInfo v = b - .addPropertyGroup(TestUtil.pg2) - .build(); + public void propertyGroupAppendTest() { + VertexInfo v = b.addPropertyGroup(TestUtil.pg2).build(); Assert.assertEquals(2, v.getPropertyGroups().size()); - } @Test - public void propertyGroupAddOnlyTest(){ - VertexInfo v = b - .propertyGroups(null) - .addPropertyGroup(TestUtil.pg2) - .build(); + public void propertyGroupAddOnlyTest() { + VertexInfo v = b.propertyGroups(null).addPropertyGroup(TestUtil.pg2).build(); Assert.assertEquals(1, v.getPropertyGroups().size()); } From 2a2b75db540132df2fe1c3af0e0269233a7b361c Mon Sep 17 00:00:00 2001 From: Jarvx200 Date: Sun, 12 Oct 2025 16:25:55 +0300 Subject: [PATCH 12/15] fix: fixed merge problems --- .../src/test/java/org/apache/graphar/info/VertexInfoTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java b/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java index af1a2edeb..e41513b2e 100644 --- a/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java +++ b/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java @@ -79,6 +79,8 @@ public void propertyGroupAddOnlyTest() { public void invalidChunkSizeTest() { b.chunkSize(-1); b.build(); + } + @Test public void testBuildWithPrefix() { try { From 4d69c33429c7d202d1c38c6dfc2363663f1cdec3 Mon Sep 17 00:00:00 2001 From: Jarvx200 Date: Sun, 12 Oct 2025 16:26:11 +0300 Subject: [PATCH 13/15] style: re-applied spottless --- .../src/test/java/org/apache/graphar/info/VertexInfoTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java b/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java index e41513b2e..addd4687f 100644 --- a/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java +++ b/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java @@ -21,8 +21,8 @@ import java.net.URI; import java.net.URISyntaxException; -import java.util.List; import java.util.Arrays; +import java.util.List; import org.apache.graphar.info.type.DataType; import org.apache.graphar.info.type.FileType; import org.junit.Assert; From e1cb9f95f6456f2f72d366d3c7c24fa1eab83610 Mon Sep 17 00:00:00 2001 From: Jarvx200 Date: Mon, 13 Oct 2025 16:29:44 +0300 Subject: [PATCH 14/15] test: Changed to `Assert.assertThrows` --- .../main/java/org/apache/graphar/info/VertexInfo.java | 5 +++-- .../java/org/apache/graphar/info/VertexInfoTest.java | 11 ++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) 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 e0e15ef87..78c7f6021 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 @@ -87,13 +87,14 @@ public VertexInfoBuilder version(String version) { } public VertexInfoBuilder addPropertyGroup(PropertyGroup propertyGroup) { - if (propertyGroupsAsListTemp == null) propertyGroupsAsListTemp = new ArrayList<>(); + if (propertyGroupsAsListTemp == null) + {propertyGroupsAsListTemp = new ArrayList<>();} propertyGroupsAsListTemp.add(propertyGroup); return this; } public VertexInfoBuilder addPropertyGroups(List propertyGroups) { - if (propertyGroupsAsListTemp == null) propertyGroupsAsListTemp = new ArrayList<>(); + if (propertyGroupsAsListTemp == null) {propertyGroupsAsListTemp = new ArrayList<>();} propertyGroupsAsListTemp.addAll(propertyGroups); return this; } diff --git a/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java b/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java index addd4687f..f199bf2fd 100644 --- a/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java +++ b/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java @@ -75,10 +75,15 @@ public void propertyGroupAddOnlyTest() { Assert.assertEquals(1, v.getPropertyGroups().size()); } - @Test(expected = RuntimeException.class) + @Test public void invalidChunkSizeTest() { - b.chunkSize(-1); - b.build(); + try{ + b.chunkSize(-1); + b.build(); + Assert.assertThrows(IllegalArgumentException.class, () -> b.chunkSize(-1)); + } catch (IllegalArgumentException ignored) { + } + } @Test From e4fbd4d75ccb3976bab5a3fe5ba8ed69b42cb7ef Mon Sep 17 00:00:00 2001 From: Jarvx200 Date: Mon, 13 Oct 2025 16:30:21 +0300 Subject: [PATCH 15/15] style: applied spottless --- .../main/java/org/apache/graphar/info/VertexInfo.java | 9 ++++++--- .../java/org/apache/graphar/info/VertexInfoTest.java | 3 +-- 2 files changed, 7 insertions(+), 5 deletions(-) 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 78c7f6021..3a56ffb3a 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 @@ -87,14 +87,17 @@ public VertexInfoBuilder version(String version) { } public VertexInfoBuilder addPropertyGroup(PropertyGroup propertyGroup) { - if (propertyGroupsAsListTemp == null) - {propertyGroupsAsListTemp = new ArrayList<>();} + if (propertyGroupsAsListTemp == null) { + propertyGroupsAsListTemp = new ArrayList<>(); + } propertyGroupsAsListTemp.add(propertyGroup); return this; } public VertexInfoBuilder addPropertyGroups(List propertyGroups) { - if (propertyGroupsAsListTemp == null) {propertyGroupsAsListTemp = new ArrayList<>();} + if (propertyGroupsAsListTemp == null) { + propertyGroupsAsListTemp = new ArrayList<>(); + } propertyGroupsAsListTemp.addAll(propertyGroups); return this; } diff --git a/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java b/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java index f199bf2fd..5a4ddae7c 100644 --- a/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java +++ b/maven-projects/info/src/test/java/org/apache/graphar/info/VertexInfoTest.java @@ -77,13 +77,12 @@ public void propertyGroupAddOnlyTest() { @Test public void invalidChunkSizeTest() { - try{ + try { b.chunkSize(-1); b.build(); Assert.assertThrows(IllegalArgumentException.class, () -> b.chunkSize(-1)); } catch (IllegalArgumentException ignored) { } - } @Test