From 4051b895de4621a32e6fb1910575e04f72a68e34 Mon Sep 17 00:00:00 2001 From: Ostrzyciel Date: Fri, 25 Apr 2025 17:49:58 +0200 Subject: [PATCH 1/3] rdf to-jelly: make sure name table has size >=8 --- build.sbt | 2 +- .../jelly/cli/command/rdf/RdfToJellySpec.scala | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index e145318..64ce478 100644 --- a/build.sbt +++ b/build.sbt @@ -6,7 +6,7 @@ resolvers += "Sonatype OSS Snapshots" at "https://s01.oss.sonatype.org/content/repositories/snapshots" lazy val jenaV = "5.3.0" -lazy val jellyV = "2.10.2" +lazy val jellyV = "2.10.3" addCommandAlias("fixAll", "scalafixAll; scalafmtAll") diff --git a/src/test/scala/eu/neverblink/jelly/cli/command/rdf/RdfToJellySpec.scala b/src/test/scala/eu/neverblink/jelly/cli/command/rdf/RdfToJellySpec.scala index 21de0b8..eb7a4f9 100644 --- a/src/test/scala/eu/neverblink/jelly/cli/command/rdf/RdfToJellySpec.scala +++ b/src/test/scala/eu/neverblink/jelly/cli/command/rdf/RdfToJellySpec.scala @@ -397,6 +397,7 @@ class RdfToJellySpec extends AnyWordSpec with TestFixtureHelper with Matchers: cause.validFormats should be(RdfToJellyPrint.validFormatsString) cause.format should be("invalid") } + "invalid format out of existing is specified" in withFullJenaFile { f => val e = intercept[ExitException] { @@ -408,6 +409,7 @@ class RdfToJellySpec extends AnyWordSpec with TestFixtureHelper with Matchers: cause.validFormats should be(RdfToJellyPrint.validFormatsString) cause.format should be("jelly") } + "invalid logical stream type is specified" in withFullJenaFile { f => val e = intercept[ExitException] { @@ -419,5 +421,17 @@ class RdfToJellySpec extends AnyWordSpec with TestFixtureHelper with Matchers: cause.argumentValue should be("test") e.code should be(1) } + + "name table with size < 8 specified" in withFullJenaFile { f => + val e = + intercept[ExitException] { + RdfToJelly.runTestCommand(List("rdf", "to-jelly", f, "--opt.max-name-table-size=5")) + } + e.cause.get shouldBe a[InvalidArgument] + val cause = e.cause.get.asInstanceOf[InvalidArgument] + cause.argument should be("--opt.logical-type") + cause.argumentValue should be("test") + e.code should be(1) + } } } From 06fd0c192f34f685b00dc0f6d8d827a9542ee403 Mon Sep 17 00:00:00 2001 From: Ostrzyciel Date: Fri, 25 Apr 2025 18:56:31 +0200 Subject: [PATCH 2/3] fix test --- .../cli/command/rdf/RdfToJellySpec.scala | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/test/scala/eu/neverblink/jelly/cli/command/rdf/RdfToJellySpec.scala b/src/test/scala/eu/neverblink/jelly/cli/command/rdf/RdfToJellySpec.scala index eb7a4f9..8e41943 100644 --- a/src/test/scala/eu/neverblink/jelly/cli/command/rdf/RdfToJellySpec.scala +++ b/src/test/scala/eu/neverblink/jelly/cli/command/rdf/RdfToJellySpec.scala @@ -2,7 +2,12 @@ package eu.neverblink.jelly.cli.command.rdf import eu.neverblink.jelly.cli.command.helpers.{DataGenHelper, TestFixtureHelper} import eu.neverblink.jelly.cli.command.rdf.util.RdfFormat -import eu.neverblink.jelly.cli.{ExitException, InvalidArgument, InvalidFormatSpecified} +import eu.neverblink.jelly.cli.{ + ExitException, + InvalidArgument, + InvalidFormatSpecified, + JellySerializationError, +} import eu.ostrzyciel.jelly.convert.jena.riot.JellyLanguage import eu.ostrzyciel.jelly.core.proto.v1.{LogicalStreamType, RdfStreamFrame} import eu.ostrzyciel.jelly.core.{IoUtils, JellyOptions} @@ -423,14 +428,12 @@ class RdfToJellySpec extends AnyWordSpec with TestFixtureHelper with Matchers: } "name table with size < 8 specified" in withFullJenaFile { f => - val e = - intercept[ExitException] { - RdfToJelly.runTestCommand(List("rdf", "to-jelly", f, "--opt.max-name-table-size=5")) - } - e.cause.get shouldBe a[InvalidArgument] - val cause = e.cause.get.asInstanceOf[InvalidArgument] - cause.argument should be("--opt.logical-type") - cause.argumentValue should be("test") + val e = intercept[ExitException] { + RdfToJelly.runTestCommand(List("rdf", "to-jelly", f, "--opt.max-name-table-size=5")) + } + e.cause.get shouldBe a[JellySerializationError] + val cause = e.cause.get.asInstanceOf[JellySerializationError] + cause.message should include("name table size of 5 ") e.code should be(1) } } From 532ce0750c9ef0b9f77036c50286d85c07cc9aba Mon Sep 17 00:00:00 2001 From: Ostrzyciel Date: Fri, 25 Apr 2025 19:02:00 +0200 Subject: [PATCH 3/3] fix review --- .../neverblink/jelly/cli/command/rdf/RdfToJellySpec.scala | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/test/scala/eu/neverblink/jelly/cli/command/rdf/RdfToJellySpec.scala b/src/test/scala/eu/neverblink/jelly/cli/command/rdf/RdfToJellySpec.scala index 8e41943..ba86faa 100644 --- a/src/test/scala/eu/neverblink/jelly/cli/command/rdf/RdfToJellySpec.scala +++ b/src/test/scala/eu/neverblink/jelly/cli/command/rdf/RdfToJellySpec.scala @@ -2,12 +2,7 @@ package eu.neverblink.jelly.cli.command.rdf import eu.neverblink.jelly.cli.command.helpers.{DataGenHelper, TestFixtureHelper} import eu.neverblink.jelly.cli.command.rdf.util.RdfFormat -import eu.neverblink.jelly.cli.{ - ExitException, - InvalidArgument, - InvalidFormatSpecified, - JellySerializationError, -} +import eu.neverblink.jelly.cli.* import eu.ostrzyciel.jelly.convert.jena.riot.JellyLanguage import eu.ostrzyciel.jelly.core.proto.v1.{LogicalStreamType, RdfStreamFrame} import eu.ostrzyciel.jelly.core.{IoUtils, JellyOptions}