Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ subprojects {
apply plugin: 'scala'
apply plugin: 'java-library'

configurations {
mockitoAgent
}

dependencies {
api libs.scala.library

Expand All @@ -49,15 +53,28 @@ subprojects {
testImplementation libs.log4j.core
testImplementation libs.testing.scala.scalatest
testImplementation libs.testing.scala.scalacheck
testImplementation libs.testing.junit
testImplementation libs.testing.mockito.all
testRuntimeOnly libs.testing.junit.platform.runner
testImplementation libs.testing.mockito.core
mockitoAgent(libs.testing.mockito.core) {
transitive = false
}
testImplementation libs.testing.scalatest.scalacheck
testImplementation libs.testing.scalatest.mockito
testImplementation libs.testing.junit.platform.launcher

testRuntimeOnly libs.testing.junit.platform.engine
testRuntimeOnly libs.testing.scalatest.junit
}

test {
maxHeapSize = "2g"
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
useJUnit()

useJUnitPlatform {
includeEngines 'scalatest'
testLogging {
events("failed", "standard_error")
}
}

// JVM args required by spark (see org.apache.spark.launcher.JavaModuleOptions)
jvmArgs(
Expand All @@ -81,6 +98,7 @@ subprojects {
'--add-opens=java.security.jgss/sun.security.krb5=ALL-UNNAMED',
'-Djdk.reflect.useDirectMethodHandle=false'
)
jvmArgs += "-javaagent:${configurations.mockitoAgent.asPath}"

def testTempDir = layout.buildDirectory.get().dir("tmp/test").asFile
testTempDir.mkdirs()
Expand Down
31 changes: 19 additions & 12 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,31 @@
apache-commons-text = "1.14.0"
bctls = "1.59"
cats = "2.13.0"
claimant = "0.0.2"
claimant = "0.2.0"
cypher-frontend = "9.0.20190305"
cypher-tck = "1.0.0-M14"
discipline = "0.11.0"
discipline-core = "1.7.0"
discipline-scalatest = "2.3.0"
eff = "7.0.6"
fastparse = "2.1.0"
h2 = "2.4.240"
# Note: has shared transitive dependencies with spark
hadoop = "3.3.4"
junit-main = "4.12"
junit-runner = "1.0.2"
junit-platform = "1.13.1"
log4j-main = "2.25.2"
log4j-scala = "13.1.0"
mockito = "1.10.19"
mockito = "5.18.0"
neo4j-driver = "1.7.2"
netty = "4.2.7.Final"
# @pin - let's prevent automatic updates for the moment
scala-full = "2.12.20"
# @pin - let's prevent automatic updates for the moment
scala-major = "2.12"
scalacheck = "1.14.0"
scalatest = "3.0.6"
scalacheck = "1.19.0"
scalatest = "3.2.19"
scalatest-mockito = "3.2.19.0" # Note, connected to scalatest version
scalatest-scalacheck = "3.2.19.0" # Note, connected to scalatest version
scalatest-junit = "3.2.19.0" # Note, connected to scalatest version
spark = "3.5.7"
testcontainers = "2.0.2"
upickle = "4.4.1"
Expand All @@ -47,7 +50,7 @@ opencypher-rewriting = { module = "org.opencypher:rewriting-9.0", version.ref =
opencypher-tck = { module = "org.opencypher:tck", version.ref = "cypher-tck" }
opencypher-tck-api = { module = "org.opencypher:tck-api_2.12", version.ref = "cypher-tck" }
opencypher-util = { module = "org.opencypher:util-9.0", version.ref = "cypher-frontend" }
scala-claimant = { module = "org.spire-math:claimant_2.12", version.ref = "claimant" }
scala-claimant = { module = "org.typelevel:claimant_2.12", version.ref = "claimant" }
scala-eff = { module = "org.atnos:eff_2.12", version.ref = "eff" }
scala-fastparse = { module = "com.lihaoyi:fastparse_2.12", version.ref = "fastparse" }
# Seems we need to lock this down, otherwise we get runtime errors on reflection
Expand All @@ -63,14 +66,18 @@ scala-spark-hive = { module = "org.apache.spark:spark-hive_2.12", version.ref =
scala-spark-sql = { module = "org.apache.spark:spark-sql_2.12", version.ref = "spark" }
scala-typelevel-cats-core = { module = "org.typelevel:cats-core_2.12", version.ref = "cats" }
scala-typelevel-cats-laws = { module = "org.typelevel:cats-laws_2.12", version.ref = "cats" }
scala-typelevel-discipline = { module = "org.typelevel:discipline_2.12", version.ref = "discipline" }
scala-typelevel-discipline-core = { module = "org.typelevel:discipline-core_2.12", version.ref = "discipline-core" }
scala-typelevel-discipline-scalatest = { module = "org.typelevel:discipline-scalatest_2.12", version.ref = "discipline-scalatest" }
scala-upickle = { module = "com.lihaoyi:upickle_2.12", version.ref = "upickle" }
testcontainers-neo4j = { module = "org.testcontainers:testcontainers-neo4j", version.ref = "testcontainers" }
testing-junit = { module = "junit:junit", version.ref = "junit-main" }
testing-junit-platform-runner = { module = "org.junit.platform:junit-platform-runner", version.ref = "junit-runner" }
testing-mockito-all = { module = "org.mockito:mockito-all", version.ref = "mockito" }
testing-junit-platform-engine = { module = "org.junit.platform:junit-platform-engine", version.ref = "junit-platform" }
testing-junit-platform-launcher = { module = "org.junit.platform:junit-platform-launcher", version.ref = "junit-platform" }
testing-mockito-core = { module = "org.mockito:mockito-core", version.ref = "mockito" }
testing-scala-scalacheck = { module = "org.scalacheck:scalacheck_2.12", version.ref = "scalacheck" }
testing-scala-scalatest = { module = "org.scalatest:scalatest_2.12", version.ref = "scalatest" }
testing-scalatest-mockito = { module = "org.scalatestplus:mockito-5-18_2.12", version.ref = "scalatest-mockito" }
testing-scalatest-scalacheck = { module = "org.scalatestplus:scalacheck-1-18_2.12", version.ref = "scalatest-scalacheck" }
testing-scalatest-junit = { module = "org.scalatestplus:junit-5-13_2.12", version.ref = "scalatest-junit" }

[plugins]
champeau-jmh = "me.champeau.jmh:0.7.3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,14 @@
*/
package org.opencypher.graphddl

import org.junit.runner.RunWith
import org.opencypher.graphddl.GraphDdlParser.parseDdl
import org.opencypher.okapi.api.graph.GraphName
import org.opencypher.okapi.api.types.{CTBoolean, CTFloat, CTInteger, CTString}
import org.opencypher.okapi.testing.MatchHelper.equalWithTracing
import org.scalatestplus.junit.JUnitRunner
import org.scalatest.{FunSpec, Matchers}
import org.scalatest.funspec.AnyFunSpec
import org.scalatest.matchers.should.Matchers

@RunWith(classOf[JUnitRunner])
class GraphDdlTest extends FunSpec with Matchers {
class GraphDdlTest extends AnyFunSpec with Matchers {

val ddlString: String =
s"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
package org.opencypher.morpheus.examples

class CaseClassExampleTest extends ExampleTest {
class CaseClassExampleTest extends ExampleTestBase {
it("should produce the correct output") {
validate(
CaseClassExample.main(Array.empty),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
package org.opencypher.morpheus.examples

class CatalogExampleTest extends ExampleTest {
class CatalogExampleTest extends ExampleTestBase {
it("should produce the correct output") {
validate(
CatalogExample.main(Array.empty),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
package org.opencypher.morpheus.examples

class CensusHiveExampleTest extends ExampleTest {
class CensusHiveExampleTest extends ExampleTestBase {
it("runs CensusHiveExampleTest") {
validate(
CensusHiveExample.main(Array.empty),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
package org.opencypher.morpheus.examples

class CensusJdbcExampleTest extends ExampleTest {
class CensusJdbcExampleTest extends ExampleTestBase {
it("runs CensusJdbcExample") {
validate(
CensusJdbcExample.main(Array.empty),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
package org.opencypher.morpheus.examples

class CustomDataFrameInputExampleTest extends ExampleTest {
class CustomDataFrameInputExampleTest extends ExampleTestBase {
it("should produce the correct output") {
validate(
CustomDataFrameInputExample.main(Array.empty),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ package org.opencypher.morpheus.examples

import org.opencypher.okapi.neo4j.io.testing.Neo4jServerFixture

class Customer360ExampleTest extends ExampleTest with Neo4jServerFixture {
class Customer360ExampleTest extends ExampleTestBase with Neo4jServerFixture {
override def dataFixture: String = ""

it("should produce the correct output") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
package org.opencypher.morpheus.examples

class CypherSQLRoundtripExampleTest extends ExampleTest {
class CypherSQLRoundtripExampleTest extends ExampleTestBase {
it("should produce the correct output") {
validate(
CypherSQLRoundtripExample.main(Array.empty),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
package org.opencypher.morpheus.examples

class DataFrameInputExampleTest extends ExampleTest {
class DataFrameInputExampleTest extends ExampleTestBase {
it("should produce the correct output") {
validate(DataFrameInputExample.main(Array.empty),
getClass.getResource("/example_outputs/DataFrameInputExample.out").toURI)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
package org.opencypher.morpheus.examples

class DataFrameOutputExampleTest extends ExampleTest {
class DataFrameOutputExampleTest extends ExampleTestBase {
it("should produce the correct output") {
validate(DataFrameOutputExample.main(Array.empty),
getClass.getResource("/example_outputs/DataFrameOutputExample.out").toURI)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
package org.opencypher.morpheus.examples

class DataSourceExampleTest extends ExampleTest {
class DataSourceExampleTest extends ExampleTestBase {
it("should produce the correct output") {
validate(DataSourceExample.main(Array.empty),
getClass.getResource("/example_outputs/DataSourceExample.out").toURI)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,14 @@ package org.opencypher.morpheus.examples

import java.io.{ByteArrayOutputStream, PrintStream}
import java.net.URI

import org.junit.runner.RunWith
import org.opencypher.okapi.testing.Bag._
import org.scalatest.{BeforeAndAfterAll, FunSpec, Matchers}
import org.scalatestplus.junit.JUnitRunner
import org.scalatest.funspec.AnyFunSpec
import org.scalatest.BeforeAndAfterAll
import org.scalatest.matchers.should.Matchers

import scala.io.Source

@RunWith(classOf[JUnitRunner])
abstract class ExampleTest extends FunSpec with Matchers with BeforeAndAfterAll {
abstract class ExampleTestBase extends AnyFunSpec with Matchers with BeforeAndAfterAll {

private val oldStdOut = System.out

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
package org.opencypher.morpheus.examples

class GraphXPageRankExampleTest extends ExampleTest {
class GraphXPageRankExampleTest extends ExampleTestBase {
it("should produce the correct output") {
validate(GraphXPageRankExample.main(Array.empty),
getClass.getResource("/example_outputs/GraphXPageRankExample.out").toURI)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
package org.opencypher.morpheus.examples

class HiveSupportExampleTest extends ExampleTest {
class HiveSupportExampleTest extends ExampleTestBase {

it("should produce the correct output") {
validate(HiveSupportExample.main(Array.empty),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
package org.opencypher.morpheus.examples

class LdbcHiveExampleTest extends ExampleTest {
class LdbcHiveExampleTest extends ExampleTestBase {
it("runs LdbcHiveExampleTest") {
validate(
LdbcHiveExample.main(Array.empty),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
package org.opencypher.morpheus.examples

class MultipleGraphExampleTest extends ExampleTest {
class MultipleGraphExampleTest extends ExampleTestBase {

it("should produce the correct output") {
validate(MultipleGraphExample.main(Array.empty),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ package org.opencypher.morpheus.examples

import org.opencypher.okapi.neo4j.io.testing.Neo4jServerFixture

class Neo4jCustomSchemaExampleTest extends ExampleTest with Neo4jServerFixture {
class Neo4jCustomSchemaExampleTest extends ExampleTestBase with Neo4jServerFixture {

override def dataFixture: String = ""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ package org.opencypher.morpheus.examples

import org.opencypher.okapi.neo4j.io.testing.Neo4jServerFixture

class Neo4jMergeExampleTest extends ExampleTest with Neo4jServerFixture {
class Neo4jMergeExampleTest extends ExampleTestBase with Neo4jServerFixture {

override def dataFixture: String = ""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ package org.opencypher.morpheus.examples

import org.opencypher.okapi.neo4j.io.testing.Neo4jServerFixture

class Neo4jReadWriteExampleTest extends ExampleTest with Neo4jServerFixture {
class Neo4jReadWriteExampleTest extends ExampleTestBase with Neo4jServerFixture {

override def dataFixture: String = ""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ package org.opencypher.morpheus.examples

import org.opencypher.okapi.neo4j.io.testing.Neo4jServerFixture

class Neo4jWorkflowExampleTest extends ExampleTest with Neo4jServerFixture {
class Neo4jWorkflowExampleTest extends ExampleTestBase with Neo4jServerFixture {

override def dataFixture: String = ""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import org.opencypher.okapi.impl.util.TablePrinter.toTable

import scala.io.Source

class NorthwindJdbcExampleTest extends ExampleTest {
class NorthwindJdbcExampleTest extends ExampleTestBase {
it("runs JdbcSqlGraphSourceExample") {
validate(
NorthwindJdbcExample.main(Array.empty),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
package org.opencypher.morpheus.examples

class RecommendationExampleTest extends ExampleTest {
class RecommendationExampleTest extends ExampleTestBase {
// TODO: enable when spark planning bug is fixed
ignore("should produce the correct output") {
validate(RecommendationExample.main(Array.empty),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
package org.opencypher.morpheus.examples

class UpdateExampleTest extends ExampleTest {
class UpdateExampleTest extends ExampleTestBase {
it("should produce the correct output") {
validate(UpdateExample.main(Array.empty),
getClass.getResource("/example_outputs/UpdateExample.out").toURI)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
package org.opencypher.morpheus.examples

class ViewsExampleTest extends ExampleTest {
class ViewsExampleTest extends ExampleTestBase {
it("should produce the correct output") {
validate(ViewsExample.main(Array.empty),
getClass.getResource("/example_outputs/ViewsExample.out").toURI)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
*/
package org.opencypher.morpheus.snippets

import org.opencypher.morpheus.examples.ExampleTest
import org.opencypher.morpheus.examples.ExampleTestBase

class SqlPGDSTest extends ExampleTest {
class SqlPGDSTest extends ExampleTestBase {

it("should produce the correct output") {
validate(
Expand Down
Loading