From cc5322dae1d7806984784514761728bb75ae4bb4 Mon Sep 17 00:00:00 2001 From: Stuart Douglas Date: Fri, 18 Jun 2021 08:53:56 +1000 Subject: [PATCH] Exclude JUnit 4 This adds a junit4-mock artifact which contains the one interface testcontainers depends on. --- bom/application/pom.xml | 5 +++++ build-parent/pom.xml | 2 ++ core/junit4-mock/pom.xml | 19 +++++++++++++++++++ .../org/junit/rules/ExternalResource.java | 7 +++++++ .../main/java/org/junit/rules/TestRule.java | 8 ++++++++ .../java/org/junit/runner/Description.java | 4 ++++ .../org/junit/runners/model/Statement.java | 8 ++++++++ core/pom.xml | 1 + core/runtime/pom.xml | 3 +++ .../apicurio-registry-avro/deployment/pom.xml | 10 ++++++++++ extensions/devservices/db2/pom.xml | 10 ++++++++++ extensions/devservices/mariadb/pom.xml | 10 ++++++++++ extensions/devservices/mssql/pom.xml | 10 ++++++++++ extensions/devservices/mysql/pom.xml | 10 ++++++++++ extensions/devservices/postgresql/pom.xml | 10 ++++++++++ .../jdbc/jdbc-postgresql/deployment/pom.xml | 4 ---- extensions/kafka-client/deployment/pom.xml | 10 ++++++++++ extensions/mongodb-client/deployment/pom.xml | 10 ++++++++++ extensions/redis-client/deployment/pom.xml | 10 ++++++++++ .../deployment/pom.xml | 10 ++++++++++ extensions/vault/deployment/pom.xml | 8 ++++++++ 21 files changed, 165 insertions(+), 4 deletions(-) create mode 100644 core/junit4-mock/pom.xml create mode 100644 core/junit4-mock/src/main/java/org/junit/rules/ExternalResource.java create mode 100644 core/junit4-mock/src/main/java/org/junit/rules/TestRule.java create mode 100644 core/junit4-mock/src/main/java/org/junit/runner/Description.java create mode 100644 core/junit4-mock/src/main/java/org/junit/runners/model/Statement.java diff --git a/bom/application/pom.xml b/bom/application/pom.xml index 6275726f078f2..73a3142ed3ace 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -369,6 +369,11 @@ quarkus-development-mode-spi ${project.version} + + io.quarkus + quarkus-junit4-mock + ${project.version} + io.quarkus quarkus-class-change-agent diff --git a/build-parent/pom.xml b/build-parent/pom.xml index b0dfea9fec2ea..6d529a618892d 100644 --- a/build-parent/pom.xml +++ b/build-parent/pom.xml @@ -494,11 +494,13 @@ io.quarkus:quarkus-test-* io.rest-assured:* org.assertj:* + junit:junit io.quarkus:quarkus-test-*:*:*:test io.rest-assured:*:*:*:test org.assertj:*:*:*:test + junit:junit:*:*:test Found test dependencies with wrong scope: diff --git a/core/junit4-mock/pom.xml b/core/junit4-mock/pom.xml new file mode 100644 index 0000000000000..4e94d0989ff92 --- /dev/null +++ b/core/junit4-mock/pom.xml @@ -0,0 +1,19 @@ + + + 4.0.0 + + + io.quarkus + quarkus-core-parent + 999-SNAPSHOT + + + quarkus-junit4-mock + Quarkus - JUnit 4 Mock + Module with some empty JUnit4 classes to allow Testcontainers + to run without needing to include JUnit4 on the class path + + + diff --git a/core/junit4-mock/src/main/java/org/junit/rules/ExternalResource.java b/core/junit4-mock/src/main/java/org/junit/rules/ExternalResource.java new file mode 100644 index 0000000000000..fde4eb436f3f9 --- /dev/null +++ b/core/junit4-mock/src/main/java/org/junit/rules/ExternalResource.java @@ -0,0 +1,7 @@ +package org.junit.rules; + +public class ExternalResource { + protected void after() { + + } +} diff --git a/core/junit4-mock/src/main/java/org/junit/rules/TestRule.java b/core/junit4-mock/src/main/java/org/junit/rules/TestRule.java new file mode 100644 index 0000000000000..ac06c7dcca136 --- /dev/null +++ b/core/junit4-mock/src/main/java/org/junit/rules/TestRule.java @@ -0,0 +1,8 @@ +package org.junit.rules; + +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +public interface TestRule { + Statement apply(Statement var1, Description var2); +} diff --git a/core/junit4-mock/src/main/java/org/junit/runner/Description.java b/core/junit4-mock/src/main/java/org/junit/runner/Description.java new file mode 100644 index 0000000000000..fcda478237136 --- /dev/null +++ b/core/junit4-mock/src/main/java/org/junit/runner/Description.java @@ -0,0 +1,4 @@ +package org.junit.runner; + +public class Description { +} diff --git a/core/junit4-mock/src/main/java/org/junit/runners/model/Statement.java b/core/junit4-mock/src/main/java/org/junit/runners/model/Statement.java new file mode 100644 index 0000000000000..09507a6991d67 --- /dev/null +++ b/core/junit4-mock/src/main/java/org/junit/runners/model/Statement.java @@ -0,0 +1,8 @@ +package org.junit.runners.model; + +public abstract class Statement { + public Statement() { + } + + public abstract void evaluate() throws Throwable; +} diff --git a/core/pom.xml b/core/pom.xml index 8bff7ca665180..30a09f8df404c 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -22,5 +22,6 @@ devmode-spi launcher class-change-agent + junit4-mock diff --git a/core/runtime/pom.xml b/core/runtime/pom.xml index 341f3519f7328..1bf0fc35c4569 100644 --- a/core/runtime/pom.xml +++ b/core/runtime/pom.xml @@ -122,6 +122,9 @@ io.quarkus quarkus-bootstrap-maven-plugin + + io.quarkus:quarkus-junit4-mock + io.quarkus:quarkus-bootstrap-runner io.smallrye.common:smallrye-common-io diff --git a/extensions/apicurio-registry-avro/deployment/pom.xml b/extensions/apicurio-registry-avro/deployment/pom.xml index ba504cdff01d8..9d8355ee0a2db 100644 --- a/extensions/apicurio-registry-avro/deployment/pom.xml +++ b/extensions/apicurio-registry-avro/deployment/pom.xml @@ -35,6 +35,16 @@ org.testcontainers testcontainers + + + junit + junit + + + + + io.quarkus + quarkus-junit4-mock diff --git a/extensions/devservices/db2/pom.xml b/extensions/devservices/db2/pom.xml index a618290b07f9a..59a41f048f99f 100644 --- a/extensions/devservices/db2/pom.xml +++ b/extensions/devservices/db2/pom.xml @@ -19,6 +19,16 @@ org.testcontainers db2 + + + junit + junit + + + + + io.quarkus + quarkus-junit4-mock com.ibm.db2 diff --git a/extensions/devservices/mariadb/pom.xml b/extensions/devservices/mariadb/pom.xml index 9af0b64e35714..6bfcaa09a35bb 100644 --- a/extensions/devservices/mariadb/pom.xml +++ b/extensions/devservices/mariadb/pom.xml @@ -19,6 +19,16 @@ org.testcontainers mariadb + + + junit + junit + + + + + io.quarkus + quarkus-junit4-mock org.mariadb.jdbc diff --git a/extensions/devservices/mssql/pom.xml b/extensions/devservices/mssql/pom.xml index 7cf81235367f4..565cd4235fcd4 100644 --- a/extensions/devservices/mssql/pom.xml +++ b/extensions/devservices/mssql/pom.xml @@ -19,6 +19,16 @@ org.testcontainers mssqlserver + + + junit + junit + + + + + io.quarkus + quarkus-junit4-mock com.microsoft.sqlserver diff --git a/extensions/devservices/mysql/pom.xml b/extensions/devservices/mysql/pom.xml index 04058995766ea..3a30b3526524b 100644 --- a/extensions/devservices/mysql/pom.xml +++ b/extensions/devservices/mysql/pom.xml @@ -19,6 +19,16 @@ org.testcontainers mysql + + + junit + junit + + + + + io.quarkus + quarkus-junit4-mock org.junit.jupiter diff --git a/extensions/devservices/postgresql/pom.xml b/extensions/devservices/postgresql/pom.xml index 079f81cd25b29..21250495ba8e8 100644 --- a/extensions/devservices/postgresql/pom.xml +++ b/extensions/devservices/postgresql/pom.xml @@ -19,6 +19,16 @@ org.testcontainers postgresql + + + junit + junit + + + + + io.quarkus + quarkus-junit4-mock org.postgresql diff --git a/extensions/jdbc/jdbc-postgresql/deployment/pom.xml b/extensions/jdbc/jdbc-postgresql/deployment/pom.xml index d89e7523e1aa3..cbfd96e78561d 100644 --- a/extensions/jdbc/jdbc-postgresql/deployment/pom.xml +++ b/extensions/jdbc/jdbc-postgresql/deployment/pom.xml @@ -13,10 +13,6 @@ Quarkus - JDBC - PostgreSQL - Deployment - - org.testcontainers - postgresql - io.quarkus quarkus-arc-deployment diff --git a/extensions/kafka-client/deployment/pom.xml b/extensions/kafka-client/deployment/pom.xml index b065abca2722c..0f7e820ce8c28 100644 --- a/extensions/kafka-client/deployment/pom.xml +++ b/extensions/kafka-client/deployment/pom.xml @@ -42,6 +42,16 @@ org.testcontainers testcontainers + + + junit + junit + + + + + io.quarkus + quarkus-junit4-mock diff --git a/extensions/mongodb-client/deployment/pom.xml b/extensions/mongodb-client/deployment/pom.xml index a86c26769124a..cdbb613cfc6d9 100644 --- a/extensions/mongodb-client/deployment/pom.xml +++ b/extensions/mongodb-client/deployment/pom.xml @@ -37,6 +37,16 @@ org.testcontainers mongodb + + + junit + junit + + + + + io.quarkus + quarkus-junit4-mock io.quarkus diff --git a/extensions/redis-client/deployment/pom.xml b/extensions/redis-client/deployment/pom.xml index c3f7594f0fdaf..93badcfd0a3bc 100644 --- a/extensions/redis-client/deployment/pom.xml +++ b/extensions/redis-client/deployment/pom.xml @@ -30,6 +30,16 @@ org.testcontainers testcontainers + + + junit + junit + + + + + io.quarkus + quarkus-junit4-mock diff --git a/extensions/smallrye-reactive-messaging-amqp/deployment/pom.xml b/extensions/smallrye-reactive-messaging-amqp/deployment/pom.xml index f1827a13eb94f..a7cebf7f0b622 100644 --- a/extensions/smallrye-reactive-messaging-amqp/deployment/pom.xml +++ b/extensions/smallrye-reactive-messaging-amqp/deployment/pom.xml @@ -61,6 +61,16 @@ org.testcontainers testcontainers + + + junit + junit + + + + + io.quarkus + quarkus-junit4-mock org.apache.activemq diff --git a/extensions/vault/deployment/pom.xml b/extensions/vault/deployment/pom.xml index 32e1fa58d0648..c34c42e900909 100644 --- a/extensions/vault/deployment/pom.xml +++ b/extensions/vault/deployment/pom.xml @@ -53,8 +53,16 @@ org.hamcrest hamcrest-core + + junit + junit + + + io.quarkus + quarkus-junit4-mock + io.quarkus quarkus-junit5