From bd23be2f209fb5434df140035114c1492a9b9ca7 Mon Sep 17 00:00:00 2001 From: Jose Date: Wed, 8 Sep 2021 13:40:01 +0200 Subject: [PATCH] Upgrade Test Framework to 0.0.9 --- external-applications/pom.xml | 7 ++++ .../OpenShiftWorkshopHeroesIT.java | 18 +++------- .../OpenShiftWorkshopVillainsIT.java | 18 +++------- .../src/main/resources/application.properties | 1 - pom.xml | 2 +- scheduling/quartz/pom.xml | 5 +++ .../AnnotationScheduledJobsMySqlQuartzIT.java | 6 ++-- .../scheduling/quartz/BaseMySqlQuartzIT.java | 14 ++------ .../scheduling/quartz/BasicMySqlQuartzIT.java | 2 +- spring/spring-data/pom.xml | 5 +++ .../quarkus/ts/spring/data/AbstractDbIT.java | 18 +++------- spring/spring-web/pom.xml | 5 +++ .../quarkus/ts/spring/web/AbstractDbIT.java | 20 ++++------- sql-db/multiple-pus/pom.xml | 5 +++ .../src/main/resources/application.properties | 4 +-- .../multiplepus/MultiplePersistenceIT.java | 36 ++++++------------- sql-db/panache-flyway/pom.xml | 5 +++ .../qe/sqldb/panacheflyway/BaseIT.java | 22 ++++-------- sql-db/sql-app/pom.xml | 5 +++ .../ts/sqldb/sqlapp/MariaDB102DatabaseIT.java | 18 +++------- .../ts/sqldb/sqlapp/MariaDB103DatabaseIT.java | 17 +++------ .../ts/sqldb/sqlapp/MySqlDatabaseIT.java | 17 +++------ .../sqlapp/OpenShiftMssqlDatabaseIT.java | 10 +++--- .../sqldb/sqlapp/Postgresql10DatabaseIT.java | 18 +++------- .../sqldb/sqlapp/Postgresql12DatabaseIT.java | 18 +++------- sql-db/vertx-sql/pom.xml | 5 +++ .../vertx/sql/handlers/CommonTestCases.java | 7 ---- .../qe/vertx/sql/handlers/Db2HandlerIT.java | 24 +++---------- .../qe/vertx/sql/handlers/MysqlHandlerIT.java | 22 +++--------- .../sql/handlers/PostgresqlHandlerIT.java | 21 +++-------- .../sql/handlers/spec/AirlineHandlerSpec.java | 4 +-- .../sql/handlers/spec/AirportHandlerSpec.java | 4 +-- .../sql/handlers/spec/BasketHandlerSpec.java | 6 ++-- .../sql/handlers/spec/FlightsHandlerSpec.java | 10 +++--- .../sql/handlers/spec/PricingRulesSpec.java | 4 +-- .../vertx/sql/handlers/spec/RestClient.java | 7 ---- 36 files changed, 148 insertions(+), 262 deletions(-) delete mode 100644 sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/spec/RestClient.java diff --git a/external-applications/pom.xml b/external-applications/pom.xml index 2dbe7dc18..5b93a31dc 100644 --- a/external-applications/pom.xml +++ b/external-applications/pom.xml @@ -1,6 +1,13 @@ 4.0.0 + + + io.quarkus.qe + quarkus-test-service-database + test + + io.quarkus.ts.qe parent diff --git a/external-applications/src/test/java/io/quarkus/ts/external/applications/OpenShiftWorkshopHeroesIT.java b/external-applications/src/test/java/io/quarkus/ts/external/applications/OpenShiftWorkshopHeroesIT.java index 3993b9bdc..2a15685cc 100644 --- a/external-applications/src/test/java/io/quarkus/ts/external/applications/OpenShiftWorkshopHeroesIT.java +++ b/external-applications/src/test/java/io/quarkus/ts/external/applications/OpenShiftWorkshopHeroesIT.java @@ -11,7 +11,7 @@ import org.junit.jupiter.api.TestMethodOrder; import org.junit.jupiter.api.condition.EnabledIfSystemProperty; -import io.quarkus.test.bootstrap.DefaultService; +import io.quarkus.test.bootstrap.PostgresqlService; import io.quarkus.test.bootstrap.RestService; import io.quarkus.test.scenarios.OpenShiftScenario; import io.quarkus.test.scenarios.annotations.DisabledOnQuarkusSnapshot; @@ -37,25 +37,17 @@ public class OpenShiftWorkshopHeroesIT { private static final int DEFAULT_LEVEL = 42; private static final int UPDATED_LEVEL = 43; - private static final String POSTGRESQL_USER = "superman"; - private static final String POSTGRESQL_PASSWORD = "superman"; - private static final String POSTGRESQL_DATABASE = "heroes-database"; private static final int POSTGRESQL_PORT = 5432; @Container(image = "${postgresql.12.image}", port = POSTGRESQL_PORT, expectedLog = "listening on IPv4 address") - static DefaultService database = new DefaultService() - .withProperty("POSTGRESQL_USER", POSTGRESQL_USER) - .withProperty("POSTGRESQL_PASSWORD", POSTGRESQL_PASSWORD) - .withProperty("POSTGRESQL_DATABASE", POSTGRESQL_DATABASE); + static PostgresqlService database = new PostgresqlService(); @GitRepositoryQuarkusApplication(repo = "https://github.com/quarkusio/quarkus-workshops.git", contextDir = "quarkus-workshop-super-heroes/super-heroes/rest-hero", mavenArgs = "-Dquarkus.package.type=uber-jar -DskipTests") static final RestService app = new RestService() .withProperty("quarkus.http.port", "8080") - .withProperty("quarkus.datasource.username", POSTGRESQL_USER) - .withProperty("quarkus.datasource.password", POSTGRESQL_PASSWORD) - .withProperty("quarkus.datasource.jdbc.url", - () -> database.getHost().replace("http", "jdbc:postgresql") + ":" + database.getPort() + "/" - + POSTGRESQL_DATABASE); + .withProperty("quarkus.datasource.username", database.getUser()) + .withProperty("quarkus.datasource.password", database.getPassword()) + .withProperty("quarkus.datasource.jdbc.url", database::getJdbcUrl); @Test public void testHello() { diff --git a/external-applications/src/test/java/io/quarkus/ts/external/applications/OpenShiftWorkshopVillainsIT.java b/external-applications/src/test/java/io/quarkus/ts/external/applications/OpenShiftWorkshopVillainsIT.java index aa5af8ea5..df033e696 100644 --- a/external-applications/src/test/java/io/quarkus/ts/external/applications/OpenShiftWorkshopVillainsIT.java +++ b/external-applications/src/test/java/io/quarkus/ts/external/applications/OpenShiftWorkshopVillainsIT.java @@ -12,7 +12,7 @@ import org.junit.jupiter.api.TestMethodOrder; import org.junit.jupiter.api.condition.EnabledIfSystemProperty; -import io.quarkus.test.bootstrap.DefaultService; +import io.quarkus.test.bootstrap.PostgresqlService; import io.quarkus.test.bootstrap.RestService; import io.quarkus.test.scenarios.OpenShiftScenario; import io.quarkus.test.scenarios.annotations.DisabledOnQuarkusSnapshot; @@ -38,25 +38,17 @@ public class OpenShiftWorkshopVillainsIT { private static final int DEFAULT_LEVEL = 42; private static final int UPDATED_LEVEL = 43; - private static final String POSTGRESQL_USER = "superbad"; - private static final String POSTGRESQL_PASSWORD = "superbad"; - private static final String POSTGRESQL_DATABASE = "villains-database"; private static final int POSTGRESQL_PORT = 5432; @Container(image = "${postgresql.12.image}", port = POSTGRESQL_PORT, expectedLog = "listening on IPv4 address") - static DefaultService database = new DefaultService() - .withProperty("POSTGRESQL_USER", POSTGRESQL_USER) - .withProperty("POSTGRESQL_PASSWORD", POSTGRESQL_PASSWORD) - .withProperty("POSTGRESQL_DATABASE", POSTGRESQL_DATABASE); + static PostgresqlService database = new PostgresqlService(); @GitRepositoryQuarkusApplication(repo = "https://github.com/quarkusio/quarkus-workshops.git", contextDir = "quarkus-workshop-super-heroes/super-heroes/rest-villain", mavenArgs = "-Dquarkus.package.type=uber-jar -DskipTests") static final RestService app = new RestService() .withProperty("quarkus.http.port", "8080") - .withProperty("quarkus.datasource.username", POSTGRESQL_USER) - .withProperty("quarkus.datasource.password", POSTGRESQL_PASSWORD) - .withProperty("quarkus.datasource.jdbc.url", - () -> database.getHost().replace("http", "jdbc:postgresql") + ":" + database.getPort() + "/" - + POSTGRESQL_DATABASE); + .withProperty("quarkus.datasource.username", database.getUser()) + .withProperty("quarkus.datasource.password", database.getPassword()) + .withProperty("quarkus.datasource.jdbc.url", database::getJdbcUrl); @Test public void testHello() { diff --git a/http/jaxrs-reactive/src/main/resources/application.properties b/http/jaxrs-reactive/src/main/resources/application.properties index 7e3524310..ed255c199 100644 --- a/http/jaxrs-reactive/src/main/resources/application.properties +++ b/http/jaxrs-reactive/src/main/resources/application.properties @@ -1,4 +1,3 @@ -quarkus.openshift.route.expose=true # Disable sticky session in order to be able to test HTTP cache features in OpenShiftHttpCachingResourceIT # See https://access.redhat.comsolutions/4820731. quarkus.openshift.route.annotations."haproxy.router.openshift.io/disable_cookies"=true diff --git a/pom.xml b/pom.xml index 53bdb29d7..d0745c0f8 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ io.quarkus 2.2.2.Final ${quarkus.platform.version} - 0.0.8 + 0.0.9 0.27.0 2.2.2.Final 4.5.13 diff --git a/scheduling/quartz/pom.xml b/scheduling/quartz/pom.xml index f58c6a40c..442e819eb 100644 --- a/scheduling/quartz/pom.xml +++ b/scheduling/quartz/pom.xml @@ -30,6 +30,11 @@ io.quarkus quarkus-jdbc-mysql + + io.quarkus.qe + quarkus-test-service-database + test + diff --git a/scheduling/quartz/src/test/java/io/quarkus/qe/scheduling/quartz/AnnotationScheduledJobsMySqlQuartzIT.java b/scheduling/quartz/src/test/java/io/quarkus/qe/scheduling/quartz/AnnotationScheduledJobsMySqlQuartzIT.java index 8978d52ba..ba09d021c 100644 --- a/scheduling/quartz/src/test/java/io/quarkus/qe/scheduling/quartz/AnnotationScheduledJobsMySqlQuartzIT.java +++ b/scheduling/quartz/src/test/java/io/quarkus/qe/scheduling/quartz/AnnotationScheduledJobsMySqlQuartzIT.java @@ -22,16 +22,16 @@ public class AnnotationScheduledJobsMySqlQuartzIT extends BaseMySqlQuartzIT { @QuarkusApplication static RestService one = new RestService().withProperties(MYSQL_PROPERTIES) .withProperty("owner.name", NODE_ONE_NAME) - .withProperty("quarkus.datasource.jdbc.url", BaseMySqlQuartzIT::mysqlJdbcUrl); + .withProperty("quarkus.datasource.jdbc.url", database::getJdbcUrl); @QuarkusApplication static RestService two = new RestService().withProperties(MYSQL_PROPERTIES) .withProperty("owner.name", NODE_TWO_NAME) - .withProperty("quarkus.datasource.jdbc.url", BaseMySqlQuartzIT::mysqlJdbcUrl); + .withProperty("quarkus.datasource.jdbc.url", database::getJdbcUrl); @QuarkusApplication static RestService app = new RestService().withProperties(MYSQL_PROPERTIES) - .withProperty("quarkus.datasource.jdbc.url", BaseMySqlQuartzIT::mysqlJdbcUrl) + .withProperty("quarkus.datasource.jdbc.url", database::getJdbcUrl) // Disable scheduler, so this app behaves as viewer of the two nodes. .withProperty("quarkus.scheduler.enabled", "false"); diff --git a/scheduling/quartz/src/test/java/io/quarkus/qe/scheduling/quartz/BaseMySqlQuartzIT.java b/scheduling/quartz/src/test/java/io/quarkus/qe/scheduling/quartz/BaseMySqlQuartzIT.java index d1eeba21d..16adef8d8 100644 --- a/scheduling/quartz/src/test/java/io/quarkus/qe/scheduling/quartz/BaseMySqlQuartzIT.java +++ b/scheduling/quartz/src/test/java/io/quarkus/qe/scheduling/quartz/BaseMySqlQuartzIT.java @@ -1,22 +1,12 @@ package io.quarkus.qe.scheduling.quartz; -import io.quarkus.test.bootstrap.DefaultService; +import io.quarkus.test.bootstrap.MySqlService; import io.quarkus.test.services.Container; public abstract class BaseMySqlQuartzIT { static final String MYSQL_PROPERTIES = "mysql.properties"; - static final String MYSQL_USER = "user"; - static final String MYSQL_PASSWORD = "user"; - static final String MYSQL_DATABASE = "mydb"; static final int MYSQL_PORT = 3306; @Container(image = "${mysql.80.image}", port = MYSQL_PORT, expectedLog = "Only MySQL server logs after this point") - static DefaultService database = new DefaultService() - .withProperty("MYSQL_USER", MYSQL_USER) - .withProperty("MYSQL_PASSWORD", MYSQL_PASSWORD) - .withProperty("MYSQL_DATABASE", MYSQL_DATABASE); - - protected static String mysqlJdbcUrl() { - return database.getHost().replace("http", "jdbc:mysql") + ":" + database.getPort() + "/" + MYSQL_DATABASE; - } + static MySqlService database = new MySqlService(); } diff --git a/scheduling/quartz/src/test/java/io/quarkus/qe/scheduling/quartz/BasicMySqlQuartzIT.java b/scheduling/quartz/src/test/java/io/quarkus/qe/scheduling/quartz/BasicMySqlQuartzIT.java index c8798dabe..4de894e67 100644 --- a/scheduling/quartz/src/test/java/io/quarkus/qe/scheduling/quartz/BasicMySqlQuartzIT.java +++ b/scheduling/quartz/src/test/java/io/quarkus/qe/scheduling/quartz/BasicMySqlQuartzIT.java @@ -14,7 +14,7 @@ public class BasicMySqlQuartzIT extends BaseMySqlQuartzIT { @QuarkusApplication static RestService app = new RestService().withProperties(MYSQL_PROPERTIES) - .withProperty("quarkus.datasource.jdbc.url", BaseMySqlQuartzIT::mysqlJdbcUrl); + .withProperty("quarkus.datasource.jdbc.url", database::getJdbcUrl); @Test public void testAnnotationScheduledCounter() throws InterruptedException { diff --git a/spring/spring-data/pom.xml b/spring/spring-data/pom.xml index 001e18b2d..e6ecb0893 100644 --- a/spring/spring-data/pom.xml +++ b/spring/spring-data/pom.xml @@ -39,6 +39,11 @@ io.quarkus quarkus-hibernate-validator + + io.quarkus.qe + quarkus-test-service-database + test + diff --git a/spring/spring-data/src/test/java/io/quarkus/ts/spring/data/AbstractDbIT.java b/spring/spring-data/src/test/java/io/quarkus/ts/spring/data/AbstractDbIT.java index 85ce14ce8..dc365cfa2 100644 --- a/spring/spring-data/src/test/java/io/quarkus/ts/spring/data/AbstractDbIT.java +++ b/spring/spring-data/src/test/java/io/quarkus/ts/spring/data/AbstractDbIT.java @@ -1,28 +1,20 @@ package io.quarkus.ts.spring.data; -import io.quarkus.test.bootstrap.DefaultService; +import io.quarkus.test.bootstrap.PostgresqlService; import io.quarkus.test.bootstrap.RestService; import io.quarkus.test.services.Container; import io.quarkus.test.services.QuarkusApplication; public class AbstractDbIT { - static final String POSTGRESQL_USER = "user"; - static final String POSTGRESQL_PASSWORD = "user"; - static final String POSTGRESQL_DATABASE = "mydb"; static final int POSTGRESQL_PORT = 5432; @Container(image = "${postgresql.10.image}", port = POSTGRESQL_PORT, expectedLog = "listening on IPv4 address") - static final DefaultService database = new DefaultService() - .withProperty("POSTGRESQL_USER", POSTGRESQL_USER) - .withProperty("POSTGRESQL_PASSWORD", POSTGRESQL_PASSWORD) - .withProperty("POSTGRESQL_DATABASE", POSTGRESQL_DATABASE); + static final PostgresqlService database = new PostgresqlService(); @QuarkusApplication public static final RestService app = new RestService() - .withProperty("quarkus.datasource.username", POSTGRESQL_USER) - .withProperty("quarkus.datasource.password", POSTGRESQL_PASSWORD) - .withProperty("quarkus.datasource.jdbc.url", - () -> database.getHost().replace("http", "jdbc:postgresql") + ":" + database.getPort() + "/" - + POSTGRESQL_DATABASE); + .withProperty("quarkus.datasource.username", database.getUser()) + .withProperty("quarkus.datasource.password", database.getPassword()) + .withProperty("quarkus.datasource.jdbc.url", database::getJdbcUrl); } diff --git a/spring/spring-web/pom.xml b/spring/spring-web/pom.xml index 927b82484..6c77a8e0e 100644 --- a/spring/spring-web/pom.xml +++ b/spring/spring-web/pom.xml @@ -31,6 +31,11 @@ io.quarkus quarkus-resteasy-qute + + io.quarkus.qe + quarkus-test-service-database + test + diff --git a/spring/spring-web/src/test/java/io/quarkus/ts/spring/web/AbstractDbIT.java b/spring/spring-web/src/test/java/io/quarkus/ts/spring/web/AbstractDbIT.java index a5ea31d99..15fd9c405 100644 --- a/spring/spring-web/src/test/java/io/quarkus/ts/spring/web/AbstractDbIT.java +++ b/spring/spring-web/src/test/java/io/quarkus/ts/spring/web/AbstractDbIT.java @@ -1,28 +1,20 @@ package io.quarkus.ts.spring.web; -import io.quarkus.test.bootstrap.DefaultService; +import io.quarkus.test.bootstrap.MariaDbService; import io.quarkus.test.bootstrap.RestService; import io.quarkus.test.services.Container; import io.quarkus.test.services.QuarkusApplication; public class AbstractDbIT { - static final String MARIADB_USER = "user"; - static final String MARIADB_PASSWORD = "user"; - static final String MARIADB_DATABASE = "mydb"; static final int MARIADB_PORT = 3306; - @Container(image = "registry.access.redhat.com/rhscl/mariadb-102-rhel7", port = MARIADB_PORT, expectedLog = "Only MySQL server logs after this point") - static final DefaultService database = new DefaultService() - .withProperty("MYSQL_USER", MARIADB_USER) - .withProperty("MYSQL_PASSWORD", MARIADB_PASSWORD) - .withProperty("MYSQL_DATABASE", MARIADB_DATABASE); + @Container(image = "${mariadb.102.image}", port = MARIADB_PORT, expectedLog = "Only MySQL server logs after this point") + static final MariaDbService database = new MariaDbService(); @QuarkusApplication public static final RestService app = new RestService() - .withProperty("quarkus.datasource.username", MARIADB_USER) - .withProperty("quarkus.datasource.password", MARIADB_PASSWORD) - .withProperty("quarkus.datasource.jdbc.url", - () -> database.getHost().replace("http", "jdbc:mariadb") + ":" + database.getPort() + "/" - + MARIADB_DATABASE); + .withProperty("quarkus.datasource.username", database.getUser()) + .withProperty("quarkus.datasource.password", database.getPassword()) + .withProperty("quarkus.datasource.jdbc.url", database::getJdbcUrl); } diff --git a/sql-db/multiple-pus/pom.xml b/sql-db/multiple-pus/pom.xml index e1dcff407..90697a441 100644 --- a/sql-db/multiple-pus/pom.xml +++ b/sql-db/multiple-pus/pom.xml @@ -40,6 +40,11 @@ quarkus-jdbc-h2 test + + io.quarkus.qe + quarkus-test-service-database + test + diff --git a/sql-db/multiple-pus/src/main/resources/application.properties b/sql-db/multiple-pus/src/main/resources/application.properties index 453258552..7e9125d1c 100644 --- a/sql-db/multiple-pus/src/main/resources/application.properties +++ b/sql-db/multiple-pus/src/main/resources/application.properties @@ -1,6 +1,6 @@ # Fruits using MariaDB quarkus.datasource."fruits".db-kind=mariadb -quarkus.datasource."fruits".jdbc.url=${MARIA_DB_JDBC_URL}/${MARIA_DB_DATABASE} +quarkus.datasource."fruits".jdbc.url=${MARIA_DB_JDBC_URL} quarkus.datasource."fruits".username=${MARIA_DB_USERNAME} quarkus.datasource."fruits".password=${MARIA_DB_PASSWORD} quarkus.hibernate-orm."fruits".database.charset=utf-8 @@ -11,7 +11,7 @@ quarkus.hibernate-orm."fruits".packages=io.quarkus.ts.sqldb.multiplepus.model.fr quarkus.hibernate-orm."fruits".dialect=org.hibernate.dialect.MariaDB102Dialect # Vegetables using PostgresSQL quarkus.datasource."vegetables".db-kind=postgresql -quarkus.datasource."vegetables".jdbc.url=${POSTGRESQL_JDBC_URL}/${POSTGRESQL_DATABASE} +quarkus.datasource."vegetables".jdbc.url=${POSTGRESQL_JDBC_URL} quarkus.datasource."vegetables".username=${POSTGRESQL_USERNAME} quarkus.datasource."vegetables".password=${POSTGRESQL_PASSWORD} quarkus.hibernate-orm."vegetables".database.charset=utf-8 diff --git a/sql-db/multiple-pus/src/test/java/io/quarkus/ts/sqldb/multiplepus/MultiplePersistenceIT.java b/sql-db/multiple-pus/src/test/java/io/quarkus/ts/sqldb/multiplepus/MultiplePersistenceIT.java index 82b58d20e..88ae7535c 100644 --- a/sql-db/multiple-pus/src/test/java/io/quarkus/ts/sqldb/multiplepus/MultiplePersistenceIT.java +++ b/sql-db/multiple-pus/src/test/java/io/quarkus/ts/sqldb/multiplepus/MultiplePersistenceIT.java @@ -9,7 +9,8 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import io.quarkus.test.bootstrap.DefaultService; +import io.quarkus.test.bootstrap.MariaDbService; +import io.quarkus.test.bootstrap.PostgresqlService; import io.quarkus.test.bootstrap.RestService; import io.quarkus.test.scenarios.QuarkusScenario; import io.quarkus.test.services.Container; @@ -21,13 +22,7 @@ @QuarkusScenario public class MultiplePersistenceIT { - static final String MARIADB_USER = "user"; - static final String MARIADB_PASSWORD = "user"; - static final String MARIADB_DATABASE = "mydb"; static final int MARIADB_PORT = 3306; - static final String POSTGRESQL_USER = "user"; - static final String POSTGRESQL_PASSWORD = "user"; - static final String POSTGRESQL_DATABASE = "mydb"; static final int POSTGRESQL_PORT = 5432; static final int EXPECTED_FRUITS_SIZE = 7; @@ -35,30 +30,19 @@ public class MultiplePersistenceIT { static final long INVALID_ID = 999L; @Container(image = "${mariadb.102.image}", port = MARIADB_PORT, expectedLog = "Only MySQL server logs after this point") - static DefaultService mariadb = new DefaultService() - .withProperty("MYSQL_USER", MARIADB_USER) - .withProperty("MYSQL_PASSWORD", MARIADB_PASSWORD) - .withProperty("MYSQL_DATABASE", MARIADB_DATABASE) - .withProperty("MARIADB_ROOT_PASSWORD", MARIADB_PASSWORD); + static MariaDbService mariadb = new MariaDbService(); @Container(image = "${postgresql.10.image}", port = POSTGRESQL_PORT, expectedLog = "listening on IPv4 address") - static DefaultService postgresql = new DefaultService() - .withProperty("POSTGRESQL_USER", POSTGRESQL_USER) - .withProperty("POSTGRESQL_PASSWORD", POSTGRESQL_PASSWORD) - .withProperty("POSTGRESQL_DATABASE", POSTGRESQL_DATABASE); + static PostgresqlService postgresql = new PostgresqlService(); @QuarkusApplication static RestService app = new RestService() - .withProperty("MARIA_DB_USERNAME", MARIADB_USER) - .withProperty("MARIA_DB_PASSWORD", MARIADB_PASSWORD) - .withProperty("MARIA_DB_DATABASE", MARIADB_DATABASE) - .withProperty("MARIA_DB_JDBC_URL", - () -> mariadb.getHost().replace("http", "jdbc:mariadb") + ":" + mariadb.getPort()) - .withProperty("POSTGRESQL_USERNAME", POSTGRESQL_USER) - .withProperty("POSTGRESQL_PASSWORD", POSTGRESQL_PASSWORD) - .withProperty("POSTGRESQL_DATABASE", POSTGRESQL_DATABASE) - .withProperty("POSTGRESQL_JDBC_URL", - () -> postgresql.getHost().replace("http", "jdbc:postgresql") + ":" + postgresql.getPort()); + .withProperty("MARIA_DB_USERNAME", mariadb.getUser()) + .withProperty("MARIA_DB_PASSWORD", mariadb.getPassword()) + .withProperty("MARIA_DB_JDBC_URL", mariadb::getJdbcUrl) + .withProperty("POSTGRESQL_USERNAME", postgresql.getUser()) + .withProperty("POSTGRESQL_PASSWORD", postgresql.getPassword()) + .withProperty("POSTGRESQL_JDBC_URL", postgresql::getJdbcUrl); private static Integer latestFruitId; private static Integer latestVegetableId; diff --git a/sql-db/panache-flyway/pom.xml b/sql-db/panache-flyway/pom.xml index 872eb395e..6af23b4e5 100644 --- a/sql-db/panache-flyway/pom.xml +++ b/sql-db/panache-flyway/pom.xml @@ -36,6 +36,11 @@ mysql test + + io.quarkus.qe + quarkus-test-service-database + test + diff --git a/sql-db/panache-flyway/src/test/java/io/quarkus/qe/sqldb/panacheflyway/BaseIT.java b/sql-db/panache-flyway/src/test/java/io/quarkus/qe/sqldb/panacheflyway/BaseIT.java index bc8da5fe9..813c2e3be 100644 --- a/sql-db/panache-flyway/src/test/java/io/quarkus/qe/sqldb/panacheflyway/BaseIT.java +++ b/sql-db/panache-flyway/src/test/java/io/quarkus/qe/sqldb/panacheflyway/BaseIT.java @@ -1,28 +1,20 @@ package io.quarkus.qe.sqldb.panacheflyway; -import io.quarkus.test.bootstrap.DefaultService; +import io.quarkus.test.bootstrap.MySqlService; import io.quarkus.test.bootstrap.RestService; import io.quarkus.test.services.Container; import io.quarkus.test.services.QuarkusApplication; -public class BaseIT { - static final String MYSQL_USER = "user"; - static final String MYSQL_PASSWORD = "user"; - static final String MYSQL_DATABASE = "test"; +public abstract class BaseIT { static final int MYSQL_PORT = 3306; @Container(image = "${mysql.57.image}", port = MYSQL_PORT, expectedLog = "ready for connections") - static DefaultService database = new DefaultService() - .withProperty("MYSQL_USER", MYSQL_USER) - .withProperty("MYSQL_PASSWORD", MYSQL_PASSWORD) - .withProperty("MYSQL_ROOT_PASSWORD", MYSQL_PASSWORD) - .withProperty("MYSQL_DATABASE", MYSQL_DATABASE); + static MySqlService database = new MySqlService(); @QuarkusApplication static RestService app = new RestService() - .withProperty("quarkus.datasource.username", MYSQL_USER) - .withProperty("quarkus.datasource.password", MYSQL_PASSWORD) - .withProperty("quarkus.datasource.jdbc.url", - () -> database.getHost().replace("http", "jdbc:mysql") + ":" + database.getPort() + "/" - + MYSQL_DATABASE); + .withProperty("quarkus.datasource.username", database.getUser()) + .withProperty("quarkus.datasource.password", database.getPassword()) + .withProperty("quarkus.datasource.jdbc.url", database::getJdbcUrl) + .withProperty("quarkus.flyway.schemas", database.getDatabase()); } diff --git a/sql-db/sql-app/pom.xml b/sql-db/sql-app/pom.xml index 131f5ed75..262b3b3b4 100644 --- a/sql-db/sql-app/pom.xml +++ b/sql-db/sql-app/pom.xml @@ -47,6 +47,11 @@ io.quarkus quarkus-jdbc-postgresql + + io.quarkus.qe + quarkus-test-service-database + test + diff --git a/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/MariaDB102DatabaseIT.java b/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/MariaDB102DatabaseIT.java index 55820c881..05796690d 100644 --- a/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/MariaDB102DatabaseIT.java +++ b/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/MariaDB102DatabaseIT.java @@ -1,6 +1,6 @@ package io.quarkus.ts.sqldb.sqlapp; -import io.quarkus.test.bootstrap.DefaultService; +import io.quarkus.test.bootstrap.MariaDbService; import io.quarkus.test.bootstrap.RestService; import io.quarkus.test.scenarios.QuarkusScenario; import io.quarkus.test.services.Container; @@ -9,22 +9,14 @@ @QuarkusScenario public class MariaDB102DatabaseIT extends AbstractSqlDatabaseIT { - static final String MARIADB_USER = "user"; - static final String MARIADB_PASSWORD = "user"; - static final String MARIADB_DATABASE = "mydb"; static final int MARIADB_PORT = 3306; @Container(image = "${mariadb.102.image}", port = MARIADB_PORT, expectedLog = "Only MySQL server logs after this point") - static DefaultService database = new DefaultService() - .withProperty("MYSQL_USER", MARIADB_USER) - .withProperty("MYSQL_DATABASE", MARIADB_DATABASE) - .withProperty("MYSQL_PASSWORD", MARIADB_PASSWORD); + static MariaDbService database = new MariaDbService(); @QuarkusApplication static RestService app = new RestService().withProperties("mariadb_app.properties") - .withProperty("quarkus.datasource.username", MARIADB_USER) - .withProperty("quarkus.datasource.password", MARIADB_PASSWORD) - .withProperty("quarkus.datasource.jdbc.url", - () -> database.getHost().replace("http", "jdbc:mariadb") + ":" + database.getPort() + "/" - + MARIADB_DATABASE); + .withProperty("quarkus.datasource.username", database.getUser()) + .withProperty("quarkus.datasource.password", database.getPassword()) + .withProperty("quarkus.datasource.jdbc.url", database::getJdbcUrl); } diff --git a/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/MariaDB103DatabaseIT.java b/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/MariaDB103DatabaseIT.java index 2781f2eca..2575dec16 100644 --- a/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/MariaDB103DatabaseIT.java +++ b/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/MariaDB103DatabaseIT.java @@ -2,7 +2,7 @@ import org.junit.jupiter.api.condition.EnabledIfSystemProperty; -import io.quarkus.test.bootstrap.DefaultService; +import io.quarkus.test.bootstrap.MariaDbService; import io.quarkus.test.bootstrap.RestService; import io.quarkus.test.scenarios.QuarkusScenario; import io.quarkus.test.services.Container; @@ -12,21 +12,14 @@ @EnabledIfSystemProperty(named = "ts.redhat.registry.enabled", matches = "true") public class MariaDB103DatabaseIT extends AbstractSqlDatabaseIT { - static final String MYSQL_USER = "user"; - static final String MYSQL_PASSWORD = "user"; - static final String MYSQL_DATABASE = "mydb"; static final int MYSQL_PORT = 3306; @Container(image = "${mariadb.103.image}", port = MYSQL_PORT, expectedLog = "Only MySQL server logs after this point") - static DefaultService database = new DefaultService() - .withProperty("MYSQL_USER", MYSQL_USER) - .withProperty("MYSQL_PASSWORD", MYSQL_PASSWORD) - .withProperty("MYSQL_DATABASE", MYSQL_DATABASE); + static MariaDbService database = new MariaDbService(); @QuarkusApplication static RestService app = new RestService().withProperties("mariadb_app.properties") - .withProperty("quarkus.datasource.username", MYSQL_USER) - .withProperty("quarkus.datasource.password", MYSQL_PASSWORD) - .withProperty("quarkus.datasource.jdbc.url", - () -> database.getHost().replace("http", "jdbc:mariadb") + ":" + database.getPort() + "/" + MYSQL_DATABASE); + .withProperty("quarkus.datasource.username", database.getUser()) + .withProperty("quarkus.datasource.password", database.getPassword()) + .withProperty("quarkus.datasource.jdbc.url", database::getJdbcUrl); } diff --git a/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/MySqlDatabaseIT.java b/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/MySqlDatabaseIT.java index 3bd7109be..6e0f92175 100644 --- a/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/MySqlDatabaseIT.java +++ b/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/MySqlDatabaseIT.java @@ -1,6 +1,6 @@ package io.quarkus.ts.sqldb.sqlapp; -import io.quarkus.test.bootstrap.DefaultService; +import io.quarkus.test.bootstrap.MySqlService; import io.quarkus.test.bootstrap.RestService; import io.quarkus.test.scenarios.QuarkusScenario; import io.quarkus.test.services.Container; @@ -9,21 +9,14 @@ @QuarkusScenario public class MySqlDatabaseIT extends AbstractSqlDatabaseIT { - static final String MYSQL_USER = "user"; - static final String MYSQL_PASSWORD = "user"; - static final String MYSQL_DATABASE = "mydb"; static final int MYSQL_PORT = 3306; @Container(image = "${mysql.80.image}", port = MYSQL_PORT, expectedLog = "Only MySQL server logs after this point") - static DefaultService database = new DefaultService() - .withProperty("MYSQL_USER", MYSQL_USER) - .withProperty("MYSQL_PASSWORD", MYSQL_PASSWORD) - .withProperty("MYSQL_DATABASE", MYSQL_DATABASE); + static MySqlService database = new MySqlService(); @QuarkusApplication static RestService app = new RestService().withProperties("mysql.properties") - .withProperty("quarkus.datasource.username", MYSQL_USER) - .withProperty("quarkus.datasource.password", MYSQL_PASSWORD) - .withProperty("quarkus.datasource.jdbc.url", - () -> database.getHost().replace("http", "jdbc:mysql") + ":" + database.getPort() + "/" + MYSQL_DATABASE); + .withProperty("quarkus.datasource.username", database.getUser()) + .withProperty("quarkus.datasource.password", database.getPassword()) + .withProperty("quarkus.datasource.jdbc.url", database::getJdbcUrl); } diff --git a/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/OpenShiftMssqlDatabaseIT.java b/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/OpenShiftMssqlDatabaseIT.java index 53f139a90..758c40419 100644 --- a/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/OpenShiftMssqlDatabaseIT.java +++ b/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/OpenShiftMssqlDatabaseIT.java @@ -1,7 +1,7 @@ package io.quarkus.ts.sqldb.sqlapp; -import io.quarkus.test.bootstrap.DefaultService; import io.quarkus.test.bootstrap.RestService; +import io.quarkus.test.bootstrap.SqlServerService; import io.quarkus.test.scenarios.OpenShiftScenario; import io.quarkus.test.services.Container; import io.quarkus.test.services.QuarkusApplication; @@ -12,12 +12,12 @@ public class OpenShiftMssqlDatabaseIT extends AbstractSqlDatabaseIT { static final int MSSQL_PORT = 1433; @Container(image = "${mssql.image}", port = MSSQL_PORT, expectedLog = "Service Broker manager has started") - static DefaultService mssql = new DefaultService(); + static SqlServerService mssql = new SqlServerService(); @QuarkusApplication static RestService app = new RestService() .withProperties("mssql.properties") - .withProperty("quarkus.datasource.username", "sa") - .withProperty("quarkus.datasource.password", "My1337p@ssworD") - .withProperty("quarkus.datasource.jdbc.url", "jdbc:sqlserver://mssql:1433;databaseName=mydb"); + .withProperty("quarkus.datasource.username", mssql.getUser()) + .withProperty("quarkus.datasource.password", mssql.getPassword()) + .withProperty("quarkus.datasource.jdbc.url", mssql::getJdbcUrl); } diff --git a/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/Postgresql10DatabaseIT.java b/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/Postgresql10DatabaseIT.java index f9492a7e5..ec38ed9ef 100644 --- a/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/Postgresql10DatabaseIT.java +++ b/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/Postgresql10DatabaseIT.java @@ -1,6 +1,6 @@ package io.quarkus.ts.sqldb.sqlapp; -import io.quarkus.test.bootstrap.DefaultService; +import io.quarkus.test.bootstrap.PostgresqlService; import io.quarkus.test.bootstrap.RestService; import io.quarkus.test.scenarios.QuarkusScenario; import io.quarkus.test.services.Container; @@ -9,22 +9,14 @@ @QuarkusScenario public class Postgresql10DatabaseIT extends AbstractSqlDatabaseIT { - static final String POSTGRESQL_USER = "user"; - static final String POSTGRESQL_PASSWORD = "user"; - static final String POSTGRESQL_DATABASE = "mydb"; static final int POSTGRESQL_PORT = 5432; @Container(image = "${postgresql.10.image}", port = POSTGRESQL_PORT, expectedLog = "listening on IPv4 address") - static DefaultService database = new DefaultService() - .withProperty("POSTGRESQL_USER", POSTGRESQL_USER) - .withProperty("POSTGRESQL_PASSWORD", POSTGRESQL_PASSWORD) - .withProperty("POSTGRESQL_DATABASE", POSTGRESQL_DATABASE); + static PostgresqlService database = new PostgresqlService(); @QuarkusApplication static RestService app = new RestService().withProperties("postgresql.properties") - .withProperty("quarkus.datasource.username", POSTGRESQL_USER) - .withProperty("quarkus.datasource.password", POSTGRESQL_PASSWORD) - .withProperty("quarkus.datasource.jdbc.url", - () -> database.getHost().replace("http", "jdbc:postgresql") + ":" + database.getPort() + "/" - + POSTGRESQL_DATABASE); + .withProperty("quarkus.datasource.username", database.getUser()) + .withProperty("quarkus.datasource.password", database.getPassword()) + .withProperty("quarkus.datasource.jdbc.url", database::getJdbcUrl); } diff --git a/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/Postgresql12DatabaseIT.java b/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/Postgresql12DatabaseIT.java index 2a7f44e1c..713d2cc05 100644 --- a/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/Postgresql12DatabaseIT.java +++ b/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/Postgresql12DatabaseIT.java @@ -2,7 +2,7 @@ import org.junit.jupiter.api.condition.EnabledIfSystemProperty; -import io.quarkus.test.bootstrap.DefaultService; +import io.quarkus.test.bootstrap.PostgresqlService; import io.quarkus.test.bootstrap.RestService; import io.quarkus.test.scenarios.QuarkusScenario; import io.quarkus.test.services.Container; @@ -12,22 +12,14 @@ @EnabledIfSystemProperty(named = "ts.redhat.registry.enabled", matches = "true") public class Postgresql12DatabaseIT extends AbstractSqlDatabaseIT { - static final String POSTGRESQL_USER = "user"; - static final String POSTGRESQL_PASSWORD = "user"; - static final String POSTGRESQL_DATABASE = "mydb"; static final int POSTGRESQL_PORT = 5432; @Container(image = "${postgresql.12.image}", port = POSTGRESQL_PORT, expectedLog = "listening on IPv4 address") - static DefaultService database = new DefaultService() - .withProperty("POSTGRESQL_USER", POSTGRESQL_USER) - .withProperty("POSTGRESQL_PASSWORD", POSTGRESQL_PASSWORD) - .withProperty("POSTGRESQL_DATABASE", POSTGRESQL_DATABASE); + static PostgresqlService database = new PostgresqlService(); @QuarkusApplication static RestService app = new RestService().withProperties("postgresql.properties") - .withProperty("quarkus.datasource.username", POSTGRESQL_USER) - .withProperty("quarkus.datasource.password", POSTGRESQL_PASSWORD) - .withProperty("quarkus.datasource.jdbc.url", - () -> database.getHost().replace("http", "jdbc:postgresql") + ":" + database.getPort() + "/" - + POSTGRESQL_DATABASE); + .withProperty("quarkus.datasource.username", database.getUser()) + .withProperty("quarkus.datasource.password", database.getPassword()) + .withProperty("quarkus.datasource.jdbc.url", database::getJdbcUrl); } diff --git a/sql-db/vertx-sql/pom.xml b/sql-db/vertx-sql/pom.xml index 971c3ac23..241b74263 100644 --- a/sql-db/vertx-sql/pom.xml +++ b/sql-db/vertx-sql/pom.xml @@ -51,6 +51,11 @@ io.quarkus quarkus-hibernate-validator + + io.quarkus.qe + quarkus-test-service-database + test + io.smallrye.reactive smallrye-mutiny-vertx-web-client diff --git a/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/CommonTestCases.java b/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/CommonTestCases.java index c9e85f3c9..bface649a 100644 --- a/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/CommonTestCases.java +++ b/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/CommonTestCases.java @@ -1,6 +1,5 @@ package io.quarkus.qe.vertx.sql.handlers; -import org.apache.commons.lang3.NotImplementedException; import org.junit.jupiter.api.Test; import io.quarkus.qe.vertx.sql.handlers.spec.AirlineHandlerSpec; @@ -8,7 +7,6 @@ import io.quarkus.qe.vertx.sql.handlers.spec.BasketHandlerSpec; import io.quarkus.qe.vertx.sql.handlers.spec.FlightsHandlerSpec; import io.quarkus.qe.vertx.sql.handlers.spec.PricingRulesSpec; -import io.quarkus.test.bootstrap.RestService; public abstract class CommonTestCases implements PricingRulesSpec, FlightsHandlerSpec, BasketHandlerSpec, AirportHandlerSpec, AirlineHandlerSpec { @@ -45,9 +43,4 @@ public void airportScenario() { public void airlineScenario() { retrieveAllAirlines(); } - - @Override - public RestService app() { - throw new NotImplementedException(this.getClass().getName()); - } } diff --git a/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/Db2HandlerIT.java b/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/Db2HandlerIT.java index 34c038fd9..59add8a34 100644 --- a/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/Db2HandlerIT.java +++ b/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/Db2HandlerIT.java @@ -1,6 +1,6 @@ package io.quarkus.qe.vertx.sql.handlers; -import io.quarkus.test.bootstrap.DefaultService; +import io.quarkus.test.bootstrap.Db2Service; import io.quarkus.test.bootstrap.RestService; import io.quarkus.test.scenarios.QuarkusScenario; import io.quarkus.test.services.Container; @@ -11,22 +11,13 @@ public class Db2HandlerIT extends CommonTestCases { private static final String DATABASE = "amadeus"; @Container(image = "${db2.image}", port = 50000, expectedLog = "Setup has completed") - static DefaultService db2 = new DefaultService() - .withProperty("LICENSE", "accept") - .withProperty("DB2INST1_PASSWORD", "test") - .withProperty("DB2INSTANCE", "test") - .withProperty("AUTOCONFIG", "false") - .withProperty("ARCHIVE_LOGS", "false") - .withProperty("DBNAME", DATABASE); + static Db2Service db2 = new Db2Service() + .with("test", "test", DATABASE); @QuarkusApplication static final RestService app = new RestService() - .withProperty("quarkus.datasource.db2.jdbc.url", - () -> db2.getHost().replace("http", "jdbc:db2") + ":" + - db2.getPort() + "/" + DATABASE) - .withProperty("quarkus.datasource.db2.reactive.url", - () -> db2.getHost().replace("http", "db2") + ":" + - db2.getPort() + "/" + DATABASE) + .withProperty("quarkus.datasource.db2.jdbc.url", db2::getJdbcUrl) + .withProperty("quarkus.datasource.db2.reactive.url", db2::getReactiveUrl) .withProperty("app.selected.db", "db2") // Enable Flyway for DB2 .withProperty("quarkus.flyway.db2.migrate-at-start", "true") @@ -34,9 +25,4 @@ public class Db2HandlerIT extends CommonTestCases { .withProperty("quarkus.flyway.mysql.migrate-at-start", "false") // Disable Flyway for Postgresql .withProperty("quarkus.flyway.migrate-at-start", "false"); - - @Override - public RestService app() { - return app; - } } diff --git a/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/MysqlHandlerIT.java b/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/MysqlHandlerIT.java index 6b958842b..e8e6cb86c 100644 --- a/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/MysqlHandlerIT.java +++ b/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/MysqlHandlerIT.java @@ -1,6 +1,6 @@ package io.quarkus.qe.vertx.sql.handlers; -import io.quarkus.test.bootstrap.DefaultService; +import io.quarkus.test.bootstrap.MySqlService; import io.quarkus.test.bootstrap.RestService; import io.quarkus.test.scenarios.QuarkusScenario; import io.quarkus.test.services.Container; @@ -11,20 +11,13 @@ public class MysqlHandlerIT extends CommonTestCases { private static final String DATABASE = "amadeus"; @Container(image = "${mysql.57.image}", port = 3306, expectedLog = "ready for connections") - static DefaultService mysql = new DefaultService() - .withProperty("MYSQL_ROOT_PASSWORD", "test") - .withProperty("MYSQL_USER", "test") - .withProperty("MYSQL_PASSWORD", "test") - .withProperty("MYSQL_DATABASE", DATABASE); + static MySqlService mysql = new MySqlService() + .with("test", "test", DATABASE); @QuarkusApplication static final RestService app = new RestService() - .withProperty("quarkus.datasource.mysql.jdbc.url", - () -> mysql.getHost().replace("http", "jdbc:mysql") + ":" + - mysql.getPort() + "/" + DATABASE) - .withProperty("quarkus.datasource.mysql.reactive.url", - () -> mysql.getHost().replace("http", "mysql") + ":" + - mysql.getPort() + "/" + DATABASE) + .withProperty("quarkus.datasource.mysql.jdbc.url", mysql::getJdbcUrl) + .withProperty("quarkus.datasource.mysql.reactive.url", mysql::getReactiveUrl) .withProperty("app.selected.db", "mysql") // Enable Flyway for MySQL .withProperty("quarkus.flyway.mysql.migrate-at-start", "true") @@ -32,9 +25,4 @@ public class MysqlHandlerIT extends CommonTestCases { .withProperty("quarkus.flyway.migrate-at-start", "false") // Disable Flyway for DB2 .withProperty("quarkus.flyway.db2.migrate-at-start", "false"); - - @Override - public RestService app() { - return app; - } } diff --git a/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/PostgresqlHandlerIT.java b/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/PostgresqlHandlerIT.java index 9301cd4db..558d719c2 100644 --- a/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/PostgresqlHandlerIT.java +++ b/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/PostgresqlHandlerIT.java @@ -1,6 +1,6 @@ package io.quarkus.qe.vertx.sql.handlers; -import io.quarkus.test.bootstrap.DefaultService; +import io.quarkus.test.bootstrap.PostgresqlService; import io.quarkus.test.bootstrap.RestService; import io.quarkus.test.scenarios.QuarkusScenario; import io.quarkus.test.services.Container; @@ -11,19 +11,13 @@ public class PostgresqlHandlerIT extends CommonTestCases { private static final String POSTGRESQL_DATABASE = "amadeus"; @Container(image = "${postgresql.10.image}", port = 5432, expectedLog = "listening on IPv4 address") - static DefaultService postgres = new DefaultService() - .withProperty("POSTGRESQL_USER", "test") - .withProperty("POSTGRESQL_PASSWORD", "test") - .withProperty("POSTGRESQL_DATABASE", POSTGRESQL_DATABASE); + static PostgresqlService postgres = new PostgresqlService() + .with("test", "test", POSTGRESQL_DATABASE); @QuarkusApplication static final RestService app = new RestService() - .withProperty("quarkus.datasource.jdbc.url", - () -> postgres.getHost().replace("http", "jdbc:postgresql") + ":" + - postgres.getPort() + "/" + POSTGRESQL_DATABASE) - .withProperty("quarkus.datasource.reactive.url", - () -> postgres.getHost().replace("http", "postgresql") + ":" + - postgres.getPort() + "/" + POSTGRESQL_DATABASE) + .withProperty("quarkus.datasource.jdbc.url", postgres::getJdbcUrl) + .withProperty("quarkus.datasource.reactive.url", postgres::getReactiveUrl) .withProperty("app.selected.db", "postgresql") // Enable Flyway for Postgresql .withProperty("quarkus.flyway.migrate-at-start", "true") @@ -31,9 +25,4 @@ public class PostgresqlHandlerIT extends CommonTestCases { .withProperty("quarkus.flyway.mysql.migrate-at-start", "false") // Disable Flyway for DB2 .withProperty("quarkus.flyway.db2.migrate-at-start", "false"); - - @Override - public RestService app() { - return app; - } } diff --git a/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/spec/AirlineHandlerSpec.java b/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/spec/AirlineHandlerSpec.java index bd5595481..742296454 100644 --- a/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/spec/AirlineHandlerSpec.java +++ b/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/spec/AirlineHandlerSpec.java @@ -6,9 +6,9 @@ import io.netty.handler.codec.http.HttpResponseStatus; import io.restassured.http.ContentType; -public interface AirlineHandlerSpec extends RestClient { +public interface AirlineHandlerSpec { default void retrieveAllAirlines() { - app().given().accept(ContentType.JSON) + given().accept(ContentType.JSON) .when() .get("/airlines/") .then() diff --git a/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/spec/AirportHandlerSpec.java b/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/spec/AirportHandlerSpec.java index 178f2d156..cba5b4746 100644 --- a/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/spec/AirportHandlerSpec.java +++ b/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/spec/AirportHandlerSpec.java @@ -6,9 +6,9 @@ import io.netty.handler.codec.http.HttpResponseStatus; import io.restassured.http.ContentType; -public interface AirportHandlerSpec extends RestClient { +public interface AirportHandlerSpec { default void retrieveAllAirports() { - app().given().accept(ContentType.JSON) + given().accept(ContentType.JSON) .when() .get("/airports/") .then() diff --git a/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/spec/BasketHandlerSpec.java b/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/spec/BasketHandlerSpec.java index 63ff33f93..de8ae6ada 100644 --- a/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/spec/BasketHandlerSpec.java +++ b/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/spec/BasketHandlerSpec.java @@ -9,14 +9,14 @@ import io.quarkus.qe.vertx.sql.domain.Passenger; import io.restassured.http.ContentType; -public interface BasketHandlerSpec extends RestClient { +public interface BasketHandlerSpec { default void basketCheckout() { Basket basket = new Basket(); basket.setBillingPassenger(defaultPassenger()); basket.setFlight("IB9961"); basket.setPrice(437.52); - app().given().accept(ContentType.JSON).body(basket) + given().accept(ContentType.JSON).body(basket) .when() .post("/basket/checkout") .then() @@ -32,7 +32,7 @@ default void wrongBasketFormatCheckout() { basket.getBillingPassenger().setNif(null); - app().given().accept(ContentType.JSON).body(basket) + given().accept(ContentType.JSON).body(basket) .when() .post("/basket/checkout") .then() diff --git a/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/spec/FlightsHandlerSpec.java b/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/spec/FlightsHandlerSpec.java index c89e53bec..542287b20 100644 --- a/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/spec/FlightsHandlerSpec.java +++ b/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/spec/FlightsHandlerSpec.java @@ -16,9 +16,9 @@ import io.quarkus.qe.vertx.sql.domain.QueryFlightSearch; import io.restassured.http.ContentType; -public interface FlightsHandlerSpec extends RestClient { +public interface FlightsHandlerSpec { default void retrieveAllFlights() { - app().given().accept(ContentType.JSON) + given().accept(ContentType.JSON) .when() .get("/flights/") .then() @@ -27,7 +27,7 @@ default void retrieveAllFlights() { } default void retrieveFlightByOriginDestination() { - Flight[] flights = app().given().accept(ContentType.JSON) + Flight[] flights = given().accept(ContentType.JSON) .when() .get("/flights/origin/MAD/destination/CDG") .then() @@ -129,7 +129,7 @@ default void wrongFlightSearchFormat() { .withTo("BCN") .build(); - app().given().accept(ContentType.JSON) + given().accept(ContentType.JSON) .body(query.toJsonStringify()) .when() .put("/flights/search") @@ -138,7 +138,7 @@ default void wrongFlightSearchFormat() { } default List thenMakeFlightSearchQuery(QueryFlightSearch query, int expectedStatus, int expectedAmount) { - return Arrays.asList(app().given().accept(ContentType.JSON) + return Arrays.asList(given().accept(ContentType.JSON) .body(query.toJsonStringify()) .when() .put("/flights/search") diff --git a/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/spec/PricingRulesSpec.java b/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/spec/PricingRulesSpec.java index ad070b4f9..284811ae9 100644 --- a/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/spec/PricingRulesSpec.java +++ b/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/spec/PricingRulesSpec.java @@ -6,9 +6,9 @@ import io.netty.handler.codec.http.HttpResponseStatus; import io.restassured.http.ContentType; -public interface PricingRulesSpec extends RestClient { +public interface PricingRulesSpec { default void retrieveAllPricingRules() { - app().given().accept(ContentType.JSON) + given().accept(ContentType.JSON) .when() .get("/pricingRules/") .then() diff --git a/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/spec/RestClient.java b/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/spec/RestClient.java deleted file mode 100644 index 47f207545..000000000 --- a/sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/spec/RestClient.java +++ /dev/null @@ -1,7 +0,0 @@ -package io.quarkus.qe.vertx.sql.handlers.spec; - -import io.quarkus.test.bootstrap.RestService; - -public interface RestClient { - RestService app(); -}