From 314e6be74c32a8fbc46d40c31f828c268f1ded04 Mon Sep 17 00:00:00 2001 From: Xiaoyu Yang Date: Wed, 7 Jun 2023 11:15:56 -0400 Subject: [PATCH] Fix issue with resolvePath to take multiple resolver items (#496) * Fix issue with resolvePath to take multiple resolver items * Fix issue with resolvePath to take multiple resolver items --- .../avroutil1/builder/SchemaBuilder.java | 4 ++-- .../avroutil1/builder/SchemaBuilderTest.java | 3 ++- .../resolverpath-project/avro_zip.zip | Bin 0 -> 1176 bytes 3 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 avro-builder/builder/src/test/resources/test-projects/resolverpath-project/avro_zip.zip diff --git a/avro-builder/builder/src/main/java/com/linkedin/avroutil1/builder/SchemaBuilder.java b/avro-builder/builder/src/main/java/com/linkedin/avroutil1/builder/SchemaBuilder.java index 886c5e68e..8840e7059 100644 --- a/avro-builder/builder/src/main/java/com/linkedin/avroutil1/builder/SchemaBuilder.java +++ b/avro-builder/builder/src/main/java/com/linkedin/avroutil1/builder/SchemaBuilder.java @@ -22,7 +22,6 @@ import java.util.List; import java.util.ServiceLoader; import java.util.Set; - import joptsimple.OptionException; import joptsimple.OptionParser; import joptsimple.OptionSet; @@ -56,7 +55,8 @@ public static void main(String[] args) throws Exception { .describedAs("dir"); OptionSpec resolverPathOpt = parser.accepts("resolverPath", "Resolver path for dependent schemas") .withOptionalArg() - .describedAs("file"); + .describedAs("file") + .withValuesSeparatedBy(File.pathSeparatorChar); OptionSpec expandedSchemas = parser.accepts("expandedSchemas", "Directory for dumping expanded schemas") .withOptionalArg() .describedAs("dir"); diff --git a/avro-builder/builder/src/test/java/com/linkedin/avroutil1/builder/SchemaBuilderTest.java b/avro-builder/builder/src/test/java/com/linkedin/avroutil1/builder/SchemaBuilderTest.java index a4abb8844..a7b5f5b1e 100644 --- a/avro-builder/builder/src/test/java/com/linkedin/avroutil1/builder/SchemaBuilderTest.java +++ b/avro-builder/builder/src/test/java/com/linkedin/avroutil1/builder/SchemaBuilderTest.java @@ -128,6 +128,7 @@ public void testWithImportsFromResolverPath() throws Exception { File simpleProjectRoot = new File(locateTestProjectsRoot(), "resolverpath-project"); File inputFolder = new File(simpleProjectRoot, "input"); File resolverFolder = new File(simpleProjectRoot, "resolverPath"); + File resolverZip = new File(simpleProjectRoot, "avro_zip.zip"); File outputFolder = new File(simpleProjectRoot, "output"); if (outputFolder.exists()) { //clear output FileUtils.deleteDirectory(outputFolder); @@ -137,7 +138,7 @@ public void testWithImportsFromResolverPath() throws Exception { "--input", inputFolder.getAbsolutePath(), "--output", outputFolder.getAbsolutePath(), "--generator", CodeGenerator.AVRO_UTIL.name(), - "--resolverPath", resolverFolder.getAbsolutePath() + "--resolverPath", String.join(File.pathSeparator, resolverFolder.getAbsolutePath(), resolverZip.getAbsolutePath()) }); //see output was generated List javaFiles = Files.find(outputFolder.toPath(), 5, diff --git a/avro-builder/builder/src/test/resources/test-projects/resolverpath-project/avro_zip.zip b/avro-builder/builder/src/test/resources/test-projects/resolverpath-project/avro_zip.zip new file mode 100644 index 0000000000000000000000000000000000000000..2757ddd73901fe3cdbfa8cf7a0d472c53d3d0b32 GIT binary patch literal 1176 zcmWIWW@Zs#U|`^2;BZ?LHff!MdKr+n4T#woWEhH46H{_iLqj+jnEOrRQYHd%X$3a} zBg+&U1_rRc&|XKb!wwv--z|^scc^Z7SJnRRv_Z1fp#_e)3v6qB6(;Dh{I$8izrS%N zyJdvHT-n~_sv~?Zk15$QR6@EF8==Z0dQA;3tba-aPFB)i-0c9Vq{{`aJ z1y`pXMq4SejE(j0ilC*;oQ^ZqRAILka?WzH4(lUnYNHv*Elw6(1685_X3wwJtkw(ByA< z(OfT4De+$~Y|z$|u)o#Kjf?e8C3BKqjWS>H%wzF(I8Gj$Z(ekILsi`=$C zL}K3Rrz<83uW`53_xfAXCXry2$LGjceECn4{pF~ROIerMB4XQ5zZQB~(`yuca_W(* z-}M$>c(>f}X5_m+{wL&vs<+1F$i6