Skip to content

Commit

Permalink
Merge branch 'main' into update/scalameta-4.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Ostrzyciel authored Oct 22, 2024
2 parents beb2f2a + cc12b68 commit b3b4de3
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 33 deletions.
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ lazy val integrationTests = (project in file("integration-tests"))
),
commonSettings,
)
.dependsOn(stream, jena, rdf4j)
.dependsOn(stream, jena % "compile->compile;test->test", rdf4j)

lazy val examples = (project in file("examples"))
.settings(
Expand All @@ -220,4 +220,4 @@ lazy val examples = (project in file("examples"))
excludeDependencies ++= grpcExclusions,
commonSettings,
)
.dependsOn(grpc, stream, jena, rdf4j)
.dependsOn(grpc, stream, jena % "compile->compile;test->test", rdf4j)
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package eu.ostrzyciel.jelly.examples

import eu.ostrzyciel.jelly.convert.jena.traits.JenaTest
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec

class ExamplesSpec extends AnyWordSpec, Matchers:
class ExamplesSpec extends AnyWordSpec, Matchers, JenaTest:
val examples: Seq[shared.Example] = Seq(
JenaRiot,
JenaRiotStreaming,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
package eu.ostrzyciel.jelly.integration_tests

import eu.ostrzyciel.jelly.convert.jena.riot.JellyLanguage
import eu.ostrzyciel.jelly.convert.jena.traits.JenaTest
import org.apache.jena.riot.{Lang, RDFDataMgr}
import org.apache.jena.sparql.core.DatasetGraphFactory
import org.apache.jena.sys.JenaSystem
import org.scalatest.BeforeAndAfterAll
import org.scalatest.concurrent.ScalaFutures
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec

import scala.jdk.CollectionConverters.*

class BackCompatSpec extends AnyWordSpec, Matchers, ScalaFutures, BeforeAndAfterAll:
override def beforeAll(): Unit =
JenaSystem.init()

class BackCompatSpec extends AnyWordSpec, Matchers, ScalaFutures, JenaTest:
private val testCases = Seq(
("riverbench_main", "RiverBench main metadata", Seq("v1_0_0")),
("riverbench_nanopubs", "RiverBench nanopubs dataset metadata", Seq("v1_0_0")),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package eu.ostrzyciel.jelly.integration_tests

import eu.ostrzyciel.jelly.convert.jena.traits.JenaTest
import eu.ostrzyciel.jelly.core.*
import eu.ostrzyciel.jelly.core.proto.v1.RdfStreamOptions
import eu.ostrzyciel.jelly.stream.*
import org.apache.jena.graph.Graph
import org.apache.jena.riot.{Lang, RDFDataMgr, RDFParser}
import org.apache.jena.sparql.core.DatasetGraph
import org.apache.jena.sparql.util.IsoMatcher
import org.apache.jena.sys.JenaSystem
import org.apache.pekko.actor.ActorSystem
import org.apache.pekko.stream.scaladsl.*
import org.scalatest.BeforeAndAfterAll
import org.scalatest.concurrent.ScalaFutures
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec
Expand Down Expand Up @@ -46,16 +45,13 @@ object CrossStreamingSpec extends AnyWordSpec, Matchers:
}


class CrossStreamingSpec extends AnyWordSpec, Matchers, ScalaFutures, BeforeAndAfterAll:
class CrossStreamingSpec extends AnyWordSpec, Matchers, ScalaFutures, JenaTest:
import CrossStreamingSpec.*

given actorSystem: ActorSystem = ActorSystem()
given ExecutionContext = actorSystem.getDispatcher
given PatienceConfig = PatienceConfig(timeout = 5.seconds, interval = 50.millis)

override def beforeAll(): Unit =
JenaSystem.init()

private val implementations: Seq[(String, TestStream)] = Seq(
("Jena", JenaTestStream),
("RDF4J", Rdf4jTestStream),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package eu.ostrzyciel.jelly.integration_tests

import eu.ostrzyciel.jelly.convert.jena.JenaConverterFactory
import eu.ostrzyciel.jelly.convert.jena.traits.JenaTest
import eu.ostrzyciel.jelly.core.*
import eu.ostrzyciel.jelly.core.proto.v1
import eu.ostrzyciel.jelly.core.proto.future
import eu.ostrzyciel.jelly.core.proto.{future, v1}
import org.scalatest.concurrent.ScalaFutures
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec

/**
* Tests checking forward compatibility of Jelly with future versions of the protocol.
*/
class ForwardCompatSpec extends AnyWordSpec, Matchers, ScalaFutures:
class ForwardCompatSpec extends AnyWordSpec, Matchers, ScalaFutures, JenaTest:
private val futureFrame = future.RdfStreamFrame(Seq(
future.RdfStreamRow(future.RdfStreamRow.Row.Options(
future.RdfStreamOptions(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
package eu.ostrzyciel.jelly.integration_tests.io

import eu.ostrzyciel.jelly.convert.jena.traits.JenaTest
import eu.ostrzyciel.jelly.core.*
import eu.ostrzyciel.jelly.core.proto.v1.RdfStreamOptions
import eu.ostrzyciel.jelly.integration_tests.TestCases
import org.apache.jena.sys.JenaSystem
import org.apache.pekko.actor.ActorSystem
import org.scalatest.BeforeAndAfterAll
import org.scalatest.concurrent.ScalaFutures
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec

import java.io.{ByteArrayInputStream, ByteArrayOutputStream, File, FileInputStream}
import scala.concurrent.ExecutionException

/**
* Tests for IO ser/des (Jena RIOT, Jena RIOT streaming, RDF4J Rio, and semi-reactive IO over Pekko Streams).
*/
class IoSerDesSpec extends AnyWordSpec, Matchers, ScalaFutures, BeforeAndAfterAll:
class IoSerDesSpec extends AnyWordSpec, Matchers, ScalaFutures, JenaTest:
given ActorSystem = ActorSystem("test")

override def beforeAll(): Unit =
JenaSystem.init()

val presets: Seq[(RdfStreamOptions, Int, String)] = Seq(
(JellyOptions.smallGeneralized, 1, "small generalized"),
(JellyOptions.smallRdfStar, 1_000_000, "small RDF-star"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package eu.ostrzyciel.jelly.integration_tests.io

import eu.ostrzyciel.jelly.convert.jena.JenaConverterFactory
import eu.ostrzyciel.jelly.convert.jena.traits.JenaTest
import eu.ostrzyciel.jelly.core.JellyOptions
import eu.ostrzyciel.jelly.core.proto.v1.*
import eu.ostrzyciel.jelly.integration_tests.TestCases
Expand All @@ -17,8 +18,7 @@ import scala.jdk.CollectionConverters.*
* [[eu.ostrzyciel.jelly.integration_tests.io.IoSerDesSpec]].
* More fine-grained tests for delimited/non-delimited detection can be found in the jelly-core module.
*/
class NonDelimitedDesSpec extends AnyWordSpec, Matchers:

class NonDelimitedDesSpec extends AnyWordSpec, Matchers, JenaTest:
val presets: Seq[(RdfStreamOptions, String)] = Seq(
(JellyOptions.smallGeneralized, "small generalized"),
(JellyOptions.bigGeneralized, "big generalized"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package eu.ostrzyciel.jelly.convert.jena

import eu.ostrzyciel.jelly.convert.jena.traits.JenaTest
import org.apache.jena.sparql.core.Quad
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec

class JenaDecoderConverterSpec extends AnyWordSpec, Matchers:
class JenaDecoderConverterSpec extends AnyWordSpec, Matchers, JenaTest:
val instance = JenaDecoderConverter()

"JenaDecoderConverter" should {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package eu.ostrzyciel.jelly.convert.jena

import eu.ostrzyciel.jelly.convert.jena.traits.JenaTest
import org.apache.jena.graph.{NodeFactory, Triple}
import org.apache.jena.query.DatasetFactory
import org.apache.jena.rdf.model.impl.ModelCom
Expand All @@ -8,7 +9,7 @@ import org.apache.jena.sparql.graph.GraphFactory
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec

class JenaIterableAdapterSpec extends AnyWordSpec, Matchers:
class JenaIterableAdapterSpec extends AnyWordSpec, Matchers, JenaTest:
import JenaIterableAdapter.*

val triples = Set(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package eu.ostrzyciel.jelly.convert.jena

import eu.ostrzyciel.jelly.convert.jena.traits.JenaTest
import eu.ostrzyciel.jelly.core.*
import eu.ostrzyciel.jelly.core.proto.v1.*
import org.apache.jena.sparql.core.Quad
Expand All @@ -10,7 +11,7 @@ import org.scalatest.wordspec.AnyWordSpec
/**
* Test the handling of the many ways to represent the default graph in Jena.
*/
class JenaProtoEncoderSpec extends AnyWordSpec, Matchers:
class JenaProtoEncoderSpec extends AnyWordSpec, Matchers, JenaTest:
private val encodedDefaultGraph = RdfStreamRow(
RdfStreamRow.Row.GraphStart(
RdfGraphStart(RdfDefaultGraph())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package eu.ostrzyciel.jelly.convert.jena.fuseki

import eu.ostrzyciel.jelly.convert.jena.riot.JellySubsystemLifecycle
import eu.ostrzyciel.jelly.convert.jena.traits.JenaTest
import org.apache.jena.fuseki.DEF
import org.apache.jena.sys.JenaSystem
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec

import scala.jdk.CollectionConverters.*

class JellyFusekiLifecycleSpec extends AnyWordSpec, Matchers:
class JellyFusekiLifecycleSpec extends AnyWordSpec, Matchers, JenaTest:
"JellyFusekiLifecycle" should {
"initialize after JenaSubsystemLifecycle" in {
val jenaModule = JellySubsystemLifecycle()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package eu.ostrzyciel.jelly.convert.jena.traits

import org.apache.jena.sys.JenaSystem

object JenaTest:
JenaSystem.init()

/**
* Trait that should be included in all tests that use Jena.
* Guarantees that Jena is initialized before the tests are run and that we don't run into wonky issues like
* this one: https://github.com/apache/jena/issues/2787
*/
trait JenaTest:
// Touch the object to run the static initializer
JenaTest.toString
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
addSbtPlugin("com.thesamet" % "sbt-protoc" % "1.0.7")
addSbtPlugin("org.apache.pekko" % "pekko-grpc-sbt-plugin" % "1.1.0")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.8.0")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.9.0")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.3.0")
addDependencyTreePlugin

Expand Down

0 comments on commit b3b4de3

Please sign in to comment.