From 8cb13a5a35b83b7fbc718aa59c3cd394fb4ceab9 Mon Sep 17 00:00:00 2001 From: Georgii Troitskii Date: Fri, 17 Nov 2023 09:27:14 +0100 Subject: [PATCH] Migrate hardcoded images to Maven properties --- .../io/quarkus/ts/docker/DockerBuildIT.java | 1 + .../reactive/ReactiveRestClientProxyIT.java | 2 +- ...DevModeAmqpDevServiceUserExperienceIT.java | 9 ++-- ...odeRedPandaDevServiceUserExperienceIT.java | 11 +++-- .../resources/docker-compose-strimzi.yaml | 44 ------------------- ...odeApicurioDevServiceUserExperienceIT.java | 6 ++- pom.xml | 8 +++- ...odeKeycloakDevServiceUserExperienceIT.java | 9 ++-- .../src/test/resources/pg-cluster.yml | 2 + .../dbpool/MySqlDatabaseTestResource.java | 4 +- .../ts/reactive/db/clients/DbUtil.java | 36 --------------- ...activeMssqlDevServiceUserExperienceIT.java | 4 +- ...activeMysqlDevServiceUserExperienceIT.java | 4 +- ...ePostgresqlDevServiceUserExperienceIT.java | 4 +- .../ts/sqldb/compatibility/DbUtil.java | 36 --------------- .../io/quarkus/ts/sqldb/sqlapp/DbUtil.java | 36 --------------- ...odeMariadbDevServicesUserExperienceIT.java | 7 ++- ...vModeMssqlDevServicesUserExperienceIT.java | 7 ++- ...evModeMysqlDevServiceUserExperienceIT.java | 4 +- ...vModeOracleDevServiceUserExperienceIT.java | 4 +- ...ePostgresqlDevServiceUserExperienceIT.java | 4 +- sql-db/vertx-sql/README.md | 1 - .../src/test/resources/docker-compose.yaml | 25 ----------- 23 files changed, 59 insertions(+), 209 deletions(-) delete mode 100644 messaging/kafka-strimzi-avro-reactive-messaging/src/main/resources/docker-compose-strimzi.yaml delete mode 100644 sql-db/reactive-vanilla/src/test/java/io/quarkus/ts/reactive/db/clients/DbUtil.java delete mode 100644 sql-db/sql-app-compatibility/src/test/java/io/quarkus/ts/sqldb/compatibility/DbUtil.java delete mode 100644 sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/DbUtil.java delete mode 100644 sql-db/vertx-sql/src/test/resources/docker-compose.yaml diff --git a/docker-build/src/test/java/io/quarkus/ts/docker/DockerBuildIT.java b/docker-build/src/test/java/io/quarkus/ts/docker/DockerBuildIT.java index 7a1051760..beb71dbfc 100644 --- a/docker-build/src/test/java/io/quarkus/ts/docker/DockerBuildIT.java +++ b/docker-build/src/test/java/io/quarkus/ts/docker/DockerBuildIT.java @@ -17,6 +17,7 @@ @Tag("podman-incompatible") //TODO: https://github.com/quarkusio/quarkus/issues/28721 public class DockerBuildIT { + // Local container build, no need in tracking image in properties private static final String DOCKER_IMG_NAME = "hello-world-app"; private static final String DOCKER_IMG_VERSION = "1.0.0"; diff --git a/http/rest-client-reactive/src/test/java/io/quarkus/ts/http/restclient/reactive/ReactiveRestClientProxyIT.java b/http/rest-client-reactive/src/test/java/io/quarkus/ts/http/restclient/reactive/ReactiveRestClientProxyIT.java index f66ce42ab..562520075 100644 --- a/http/rest-client-reactive/src/test/java/io/quarkus/ts/http/restclient/reactive/ReactiveRestClientProxyIT.java +++ b/http/rest-client-reactive/src/test/java/io/quarkus/ts/http/restclient/reactive/ReactiveRestClientProxyIT.java @@ -17,7 +17,7 @@ public class ReactiveRestClientProxyIT { private static final String USER = "proxyuser"; private static final String PASSWORD = "proxypassword"; - @Container(image = "docker.io/library/nginx:1-alpine", port = 8090, expectedLog = "Configuration complete; ready for start up") + @Container(image = "${nginx.image}", port = 8090, expectedLog = "Configuration complete; ready for start up") static RestService proxy = new RestService() .withProperty("_whatever", "resource_with_destination::/etc/nginx/|nginx.conf"); diff --git a/messaging/amqp-reactive/src/test/java/io/quarkus/ts/messaging/amqpreactive/DevModeAmqpDevServiceUserExperienceIT.java b/messaging/amqp-reactive/src/test/java/io/quarkus/ts/messaging/amqpreactive/DevModeAmqpDevServiceUserExperienceIT.java index 5fa2860b8..b0458e01e 100644 --- a/messaging/amqp-reactive/src/test/java/io/quarkus/ts/messaging/amqpreactive/DevModeAmqpDevServiceUserExperienceIT.java +++ b/messaging/amqp-reactive/src/test/java/io/quarkus/ts/messaging/amqpreactive/DevModeAmqpDevServiceUserExperienceIT.java @@ -1,5 +1,8 @@ package io.quarkus.ts.messaging.amqpreactive; +import static io.quarkus.test.utils.ImageUtil.getImageName; +import static io.quarkus.test.utils.ImageUtil.getImageVersion; + import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -15,15 +18,15 @@ @QuarkusScenario public class DevModeAmqpDevServiceUserExperienceIT { - private static final String AMQP_VERSION = "0.1.3"; - private static final String AMQP_IMAGE = "quay.io/artemiscloud/activemq-artemis-broker"; + private static final String AMQP_VERSION = getImageVersion("amqbroker.1.0x.image"); + private static final String AMQP_IMAGE = getImageName("amqbroker.1.0x.image"); /** * AMQP must be started using DEV services when running in DEV mode */ @DevModeQuarkusApplication static RestService app = new RestService() - .withProperty("quarkus.amqp.devservices.image-name", String.format("%s:%s", AMQP_IMAGE, AMQP_VERSION)) + .withProperty("quarkus.amqp.devservices.image-name", "${amqbroker.1.0x.image}") .onPreStart(s -> DockerUtils.removeImage(AMQP_IMAGE, AMQP_VERSION)); @Test diff --git a/messaging/kafka-streams-reactive-messaging/src/test/java/io/quarkus/ts/messaging/kafka/reactive/streams/DevModeRedPandaDevServiceUserExperienceIT.java b/messaging/kafka-streams-reactive-messaging/src/test/java/io/quarkus/ts/messaging/kafka/reactive/streams/DevModeRedPandaDevServiceUserExperienceIT.java index 593c37fcb..464b2d4a1 100644 --- a/messaging/kafka-streams-reactive-messaging/src/test/java/io/quarkus/ts/messaging/kafka/reactive/streams/DevModeRedPandaDevServiceUserExperienceIT.java +++ b/messaging/kafka-streams-reactive-messaging/src/test/java/io/quarkus/ts/messaging/kafka/reactive/streams/DevModeRedPandaDevServiceUserExperienceIT.java @@ -1,5 +1,8 @@ package io.quarkus.ts.messaging.kafka.reactive.streams; +import static io.quarkus.test.utils.ImageUtil.getImageName; +import static io.quarkus.test.utils.ImageUtil.getImageVersion; + import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -15,18 +18,18 @@ @QuarkusScenario public class DevModeRedPandaDevServiceUserExperienceIT { - private static final String RED_PANDA_VERSION = "v22.3.4"; - private static final String RED_PANDA_IMAGE = "vectorized/redpanda"; + private static final String RED_PANDA_VERSION = getImageVersion("redpanda.image");; + private static final String RED_PANDA_IMAGE = getImageName("redpanda.image"); @DevModeQuarkusApplication static RestService app = new RestService() .withProperty("quarkus.kafka.devservices.enabled", Boolean.TRUE.toString()) - .withProperty("quarkus.kafka.devservices.image-name", String.format("%s:%s", RED_PANDA_IMAGE, RED_PANDA_VERSION)) + .withProperty("quarkus.kafka.devservices.image-name", "${redpanda.image}") .onPreStart(s -> DockerUtils.removeImage(RED_PANDA_IMAGE, RED_PANDA_VERSION)); @Test public void verifyIfUserIsInformedAboutRedPandaDevServicePulling() { - app.logs().assertContains("Pulling docker image: vectorized/redpanda"); + app.logs().assertContains("Pulling docker image: redpandadata/redpanda"); app.logs().assertContains("Please be patient; this may take some time but only needs to be done once"); app.logs().assertContains("Starting to pull image"); app.logs().assertContains("Dev Services for Kafka started"); diff --git a/messaging/kafka-strimzi-avro-reactive-messaging/src/main/resources/docker-compose-strimzi.yaml b/messaging/kafka-strimzi-avro-reactive-messaging/src/main/resources/docker-compose-strimzi.yaml deleted file mode 100644 index c097a8f22..000000000 --- a/messaging/kafka-strimzi-avro-reactive-messaging/src/main/resources/docker-compose-strimzi.yaml +++ /dev/null @@ -1,44 +0,0 @@ -version: '2' - -services: - - zookeeper: - image: strimzi/kafka:0.34.0-kafka-3.4.0 - command: [ - "sh", "-c", - "bin/zookeeper-server-start.sh config/zookeeper.properties" - ] - ports: - - "2181:2181" - environment: - LOG_DIR: /tmp/logs - - kafka: - image: strimzi/kafka:0.34.0-kafka-3.4.0 - command: [ - "sh", "-c", - "bin/kafka-server-start.sh config/server.properties --override listeners=$${KAFKA_LISTENERS} --override advertised.listeners=$${KAFKA_ADVERTISED_LISTENERS} --override zookeeper.connect=$${KAFKA_ZOOKEEPER_CONNECT}" - ] - depends_on: - - zookeeper - links: - - "zookeeper:zookeeper" - ports: - - "9092:9092" - environment: - LOG_DIR: "/tmp/logs" - KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092 - KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9092 - KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 - - schema-registry: - image: apicurio/apicurio-registry-mem:2.2.5.Final - ports: - - 8081:8080 - depends_on: - - kafka - environment: - QUARKUS_PROFILE: prod - KAFKA_BOOTSTRAP_SERVERS: localhost:9092 - APPLICATION_ID: registry_id - APPLICATION_SERVER: localhost:9000 diff --git a/messaging/kafka-strimzi-avro-reactive-messaging/src/test/java/io/quarkus/ts/messaging/strimzi/kafka/reactive/DevModeApicurioDevServiceUserExperienceIT.java b/messaging/kafka-strimzi-avro-reactive-messaging/src/test/java/io/quarkus/ts/messaging/strimzi/kafka/reactive/DevModeApicurioDevServiceUserExperienceIT.java index 79c91458f..d65b116b2 100644 --- a/messaging/kafka-strimzi-avro-reactive-messaging/src/test/java/io/quarkus/ts/messaging/strimzi/kafka/reactive/DevModeApicurioDevServiceUserExperienceIT.java +++ b/messaging/kafka-strimzi-avro-reactive-messaging/src/test/java/io/quarkus/ts/messaging/strimzi/kafka/reactive/DevModeApicurioDevServiceUserExperienceIT.java @@ -16,8 +16,10 @@ @Tag("QUARKUS-1087") @QuarkusScenario public class DevModeApicurioDevServiceUserExperienceIT { + + // Use container image and version defined in KafkaRegistry private static final String APICURIO_VERSION = KafkaRegistry.APICURIO.getDefaultVersion(); - private static final String APICURIO_IMAGE = "apicurio/apicurio-registry-mem"; + private static final String APICURIO_IMAGE = KafkaRegistry.APICURIO.getImage(); @DevModeQuarkusApplication static RestService appDevServices = new RestService() @@ -28,7 +30,7 @@ public class DevModeApicurioDevServiceUserExperienceIT { @Test public void verifyIfUserIsInformedAboutApicurioServicePulling() { - appDevServices.logs().assertContains("Pulling docker image: apicurio/apicurio-registry-mem"); + appDevServices.logs().assertContains("Pulling docker image: quay.io/apicurio/apicurio-registry-mem"); appDevServices.logs().assertContains("Please be patient; this may take some time but only needs to be done once"); appDevServices.logs().assertContains("Starting to pull image"); appDevServices.logs().assertContains("Dev Services for Apicurio Registry started"); diff --git a/pom.xml b/pom.xml index d4ae1000b..b9a2aa18a 100644 --- a/pom.xml +++ b/pom.xml @@ -57,6 +57,7 @@ no docker.io/library/postgres:15 + registry.access.redhat.com/rhscl/mysql-80-rhel7 registry.redhat.io/rhbk/keycloak-rhel9:22-6 2.35.1 3.3.1 @@ -229,6 +230,7 @@ org.jboss.logmanager.LogManager ${postgresql.latest.image} + ${mysql.80.image} @@ -258,12 +260,15 @@ ${quarkus.s2i.base-jvm-image} ${quarkus.s2i.base-native-image} + docker.io/library/nginx:1-alpine registry.access.redhat.com/amq-broker-7/amq-broker-72-openshift:latest + quay.io/artemiscloud/activemq-artemis-broker:1.0.23 + redpandadata/redpanda:v23.2.16 ${postgresql.latest.image} docker.io/library/elasticsearch:7.17.12 docker.io/library/mysql:5.7.42 docker.io/library/mysql:8.0 - registry.access.redhat.com/rhscl/mysql-80-rhel7 + ${mysql.80.image} docker.io/library/mariadb:10.10 mcr.microsoft.com/mssql/rhel/server:2022-latest @@ -277,6 +282,7 @@ quay.io/infinispan/server:14.0 Infinispan Server.*started in quay.io/quarkusqeteam/spring-cloud-config-server:3.0 + quay.io/keycloak/keycloak:22.0.5 1.0.12.2 diff --git a/security/keycloak/src/test/java/io/quarkus/ts/security/keycloak/DevModeKeycloakDevServiceUserExperienceIT.java b/security/keycloak/src/test/java/io/quarkus/ts/security/keycloak/DevModeKeycloakDevServiceUserExperienceIT.java index 98e108aec..4d0862ba3 100644 --- a/security/keycloak/src/test/java/io/quarkus/ts/security/keycloak/DevModeKeycloakDevServiceUserExperienceIT.java +++ b/security/keycloak/src/test/java/io/quarkus/ts/security/keycloak/DevModeKeycloakDevServiceUserExperienceIT.java @@ -1,5 +1,8 @@ package io.quarkus.ts.security.keycloak; +import static io.quarkus.test.utils.ImageUtil.getImageName; +import static io.quarkus.test.utils.ImageUtil.getImageVersion; + import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -15,8 +18,8 @@ @QuarkusScenario public class DevModeKeycloakDevServiceUserExperienceIT { - private static final String KEYCLOAK_VERSION = "19.0.0"; - private static final String KEYCLOAK_IMAGE = "quay.io/keycloak/keycloak"; + private static final String KEYCLOAK_VERSION = getImageVersion("keycloak.image"); + private static final String KEYCLOAK_IMAGE = getImageName("keycloak.image"); private static final String SECRET_KEYS_MISSING = "Secret key for encrypting tokens in a session cookie is missing, auto-generating it"; /** @@ -24,7 +27,7 @@ public class DevModeKeycloakDevServiceUserExperienceIT { */ @DevModeQuarkusApplication static RestService app = new RestService() - .withProperty("quarkus.keycloak.devservices.image-name", String.format("%s:%s", KEYCLOAK_IMAGE, KEYCLOAK_VERSION)) + .withProperty("quarkus.keycloak.devservices.image-name", "${keycloak.image}") .withProperty("quarkus.oidc.credentials.secret", "") // we don't want to use client secret for encryption secret .onPreStart(s -> DockerUtils.removeImage(KEYCLOAK_IMAGE, KEYCLOAK_VERSION)); diff --git a/service-binding/postgresql-crunchy-classic/src/test/resources/pg-cluster.yml b/service-binding/postgresql-crunchy-classic/src/test/resources/pg-cluster.yml index b4cf24331..e0c80fcf8 100644 --- a/service-binding/postgresql-crunchy-classic/src/test/resources/pg-cluster.yml +++ b/service-binding/postgresql-crunchy-classic/src/test/resources/pg-cluster.yml @@ -4,6 +4,7 @@ metadata: name: hippo spec: openshift: true + # Image is used only in this configuration, no need in tracking the image in Maven properties image: registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-14.2-1 postgresVersion: 14 instances: @@ -16,6 +17,7 @@ spec: storage: 150Mi backups: pgbackrest: + # Image is used only in this configuration, no need in tracking the image in Maven properties image: registry.developers.crunchydata.com/crunchydata/crunchy-pgbackrest:ubi8-2.38-0 repos: - name: repo1 diff --git a/sql-db/panache-flyway/src/test/java/io/quarkus/ts/sqldb/panacheflyway/dbpool/MySqlDatabaseTestResource.java b/sql-db/panache-flyway/src/test/java/io/quarkus/ts/sqldb/panacheflyway/dbpool/MySqlDatabaseTestResource.java index 9a914c5ba..f1f90afe5 100644 --- a/sql-db/panache-flyway/src/test/java/io/quarkus/ts/sqldb/panacheflyway/dbpool/MySqlDatabaseTestResource.java +++ b/sql-db/panache-flyway/src/test/java/io/quarkus/ts/sqldb/panacheflyway/dbpool/MySqlDatabaseTestResource.java @@ -25,8 +25,10 @@ public class MySqlDatabaseTestResource implements QuarkusTestResourceLifecycleMa @Override public Map start() { + String image = System.getProperty("mysql.80.image"); + container = new MySQLContainer<>( - DockerImageName.parse("registry.access.redhat.com/rhscl/mysql-80-rhel7").asCompatibleSubstituteFor(MYSQL)); + DockerImageName.parse(image).asCompatibleSubstituteFor(MYSQL)); container.withUrlParam("currentSchema", DEFAULT_SCHEMA); container.start(); diff --git a/sql-db/reactive-vanilla/src/test/java/io/quarkus/ts/reactive/db/clients/DbUtil.java b/sql-db/reactive-vanilla/src/test/java/io/quarkus/ts/reactive/db/clients/DbUtil.java deleted file mode 100644 index 313dc21c5..000000000 --- a/sql-db/reactive-vanilla/src/test/java/io/quarkus/ts/reactive/db/clients/DbUtil.java +++ /dev/null @@ -1,36 +0,0 @@ -package io.quarkus.ts.reactive.db.clients; - -import java.util.HashMap; -import java.util.Map; - -public class DbUtil { - - private static final String COMMA = ":"; - private static final Map PROPERTY_TO_IMAGE = new HashMap<>(); - - private DbUtil() { - // util class - } - - public static String getImageVersion(String imageProperty) { - return getImage(imageProperty)[1]; - } - - public static String getImageName(String imageProperty) { - return getImage(imageProperty)[0]; - } - - private static String[] getImage(String imageProperty) { - return PROPERTY_TO_IMAGE.computeIfAbsent(imageProperty, ip -> { - final String image = System.getProperty(imageProperty); - if (image == null) { - throw new IllegalStateException(String.format("System property '%s' is missing.", imageProperty)); - } - if (!image.contains(COMMA)) { - throw new IllegalStateException(String.format("'%s' is not valid Docker image", image)); - } - return image.split(COMMA); - }); - } - -} diff --git a/sql-db/reactive-vanilla/src/test/java/io/quarkus/ts/reactive/db/clients/DevModeReactiveMssqlDevServiceUserExperienceIT.java b/sql-db/reactive-vanilla/src/test/java/io/quarkus/ts/reactive/db/clients/DevModeReactiveMssqlDevServiceUserExperienceIT.java index ef03c8185..6748b5003 100644 --- a/sql-db/reactive-vanilla/src/test/java/io/quarkus/ts/reactive/db/clients/DevModeReactiveMssqlDevServiceUserExperienceIT.java +++ b/sql-db/reactive-vanilla/src/test/java/io/quarkus/ts/reactive/db/clients/DevModeReactiveMssqlDevServiceUserExperienceIT.java @@ -1,7 +1,7 @@ package io.quarkus.ts.reactive.db.clients; -import static io.quarkus.ts.reactive.db.clients.DbUtil.getImageName; -import static io.quarkus.ts.reactive.db.clients.DbUtil.getImageVersion; +import static io.quarkus.test.utils.ImageUtil.getImageName; +import static io.quarkus.test.utils.ImageUtil.getImageVersion; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Tag; diff --git a/sql-db/reactive-vanilla/src/test/java/io/quarkus/ts/reactive/db/clients/DevModeReactiveMysqlDevServiceUserExperienceIT.java b/sql-db/reactive-vanilla/src/test/java/io/quarkus/ts/reactive/db/clients/DevModeReactiveMysqlDevServiceUserExperienceIT.java index b60e3f4f1..bfb018461 100644 --- a/sql-db/reactive-vanilla/src/test/java/io/quarkus/ts/reactive/db/clients/DevModeReactiveMysqlDevServiceUserExperienceIT.java +++ b/sql-db/reactive-vanilla/src/test/java/io/quarkus/ts/reactive/db/clients/DevModeReactiveMysqlDevServiceUserExperienceIT.java @@ -1,7 +1,7 @@ package io.quarkus.ts.reactive.db.clients; -import static io.quarkus.ts.reactive.db.clients.DbUtil.getImageName; -import static io.quarkus.ts.reactive.db.clients.DbUtil.getImageVersion; +import static io.quarkus.test.utils.ImageUtil.getImageName; +import static io.quarkus.test.utils.ImageUtil.getImageVersion; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Tag; diff --git a/sql-db/reactive-vanilla/src/test/java/io/quarkus/ts/reactive/db/clients/DevModeReactivePostgresqlDevServiceUserExperienceIT.java b/sql-db/reactive-vanilla/src/test/java/io/quarkus/ts/reactive/db/clients/DevModeReactivePostgresqlDevServiceUserExperienceIT.java index 25a1fee4a..8bfa46ec6 100644 --- a/sql-db/reactive-vanilla/src/test/java/io/quarkus/ts/reactive/db/clients/DevModeReactivePostgresqlDevServiceUserExperienceIT.java +++ b/sql-db/reactive-vanilla/src/test/java/io/quarkus/ts/reactive/db/clients/DevModeReactivePostgresqlDevServiceUserExperienceIT.java @@ -1,7 +1,7 @@ package io.quarkus.ts.reactive.db.clients; -import static io.quarkus.ts.reactive.db.clients.DbUtil.getImageName; -import static io.quarkus.ts.reactive.db.clients.DbUtil.getImageVersion; +import static io.quarkus.test.utils.ImageUtil.getImageName; +import static io.quarkus.test.utils.ImageUtil.getImageVersion; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Tag; diff --git a/sql-db/sql-app-compatibility/src/test/java/io/quarkus/ts/sqldb/compatibility/DbUtil.java b/sql-db/sql-app-compatibility/src/test/java/io/quarkus/ts/sqldb/compatibility/DbUtil.java deleted file mode 100644 index 96af88c77..000000000 --- a/sql-db/sql-app-compatibility/src/test/java/io/quarkus/ts/sqldb/compatibility/DbUtil.java +++ /dev/null @@ -1,36 +0,0 @@ -package io.quarkus.ts.sqldb.compatibility; - -import java.util.HashMap; -import java.util.Map; - -public class DbUtil { - - private static final String COMMA = ":"; - private static final Map PROPERTY_TO_IMAGE = new HashMap<>(); - - private DbUtil() { - // util class - } - - public static String getImageVersion(String imageProperty) { - return getImage(imageProperty)[1]; - } - - public static String getImageName(String imageProperty) { - return getImage(imageProperty)[0]; - } - - private static String[] getImage(String imageProperty) { - return PROPERTY_TO_IMAGE.computeIfAbsent(imageProperty, ip -> { - final String image = System.getProperty(imageProperty); - if (image == null) { - throw new IllegalStateException(String.format("System property '%s' is missing.", imageProperty)); - } - if (!image.contains(COMMA)) { - throw new IllegalStateException(String.format("'%s' is not valid Docker image", image)); - } - return image.split(COMMA); - }); - } - -} diff --git a/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/DbUtil.java b/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/DbUtil.java deleted file mode 100644 index 3cc7717c4..000000000 --- a/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/DbUtil.java +++ /dev/null @@ -1,36 +0,0 @@ -package io.quarkus.ts.sqldb.sqlapp; - -import java.util.HashMap; -import java.util.Map; - -public class DbUtil { - - private static final String COMMA = ":"; - private static final Map PROPERTY_TO_IMAGE = new HashMap<>(); - - private DbUtil() { - // util class - } - - public static String getImageVersion(String imageProperty) { - return getImage(imageProperty)[1]; - } - - public static String getImageName(String imageProperty) { - return getImage(imageProperty)[0]; - } - - private static String[] getImage(String imageProperty) { - return PROPERTY_TO_IMAGE.computeIfAbsent(imageProperty, ip -> { - final String image = System.getProperty(imageProperty); - if (image == null) { - throw new IllegalStateException(String.format("System property '%s' is missing.", imageProperty)); - } - if (!image.contains(COMMA)) { - throw new IllegalStateException(String.format("'%s' is not valid Docker image", image)); - } - return image.split(COMMA); - }); - } - -} diff --git a/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/DevModeMariadbDevServicesUserExperienceIT.java b/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/DevModeMariadbDevServicesUserExperienceIT.java index e05b799e2..296470631 100644 --- a/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/DevModeMariadbDevServicesUserExperienceIT.java +++ b/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/DevModeMariadbDevServicesUserExperienceIT.java @@ -1,5 +1,8 @@ package io.quarkus.ts.sqldb.sqlapp; +import static io.quarkus.test.utils.ImageUtil.getImageName; +import static io.quarkus.test.utils.ImageUtil.getImageVersion; + import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Tag; @@ -17,8 +20,8 @@ @QuarkusScenario public class DevModeMariadbDevServicesUserExperienceIT { - private static final String MARIA_DB_NAME = DbUtil.getImageName("mariadb.10.image"); - private static final String MARIA_DB_VERSION = DbUtil.getImageVersion("mariadb.10.image"); + private static final String MARIA_DB_NAME = getImageName("mariadb.10.image"); + private static final String MARIA_DB_VERSION = getImageVersion("mariadb.10.image"); @DevModeQuarkusApplication static RestService app = new RestService() diff --git a/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/DevModeMssqlDevServicesUserExperienceIT.java b/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/DevModeMssqlDevServicesUserExperienceIT.java index 67efb8aff..640d0e1c0 100644 --- a/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/DevModeMssqlDevServicesUserExperienceIT.java +++ b/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/DevModeMssqlDevServicesUserExperienceIT.java @@ -1,5 +1,8 @@ package io.quarkus.ts.sqldb.sqlapp; +import static io.quarkus.test.utils.ImageUtil.getImageName; +import static io.quarkus.test.utils.ImageUtil.getImageVersion; + import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Tag; @@ -17,8 +20,8 @@ @QuarkusScenario public class DevModeMssqlDevServicesUserExperienceIT { - private static final String MSSQL_NAME = DbUtil.getImageName("mssql.image"); - private static final String MSSQL_VERSION = DbUtil.getImageVersion("mssql.image"); + private static final String MSSQL_NAME = getImageName("mssql.image"); + private static final String MSSQL_VERSION = getImageVersion("mssql.image"); @DevModeQuarkusApplication static RestService app = new RestService() diff --git a/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/DevModeMysqlDevServiceUserExperienceIT.java b/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/DevModeMysqlDevServiceUserExperienceIT.java index eb9d822a1..a56ab9b55 100644 --- a/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/DevModeMysqlDevServiceUserExperienceIT.java +++ b/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/DevModeMysqlDevServiceUserExperienceIT.java @@ -1,7 +1,7 @@ package io.quarkus.ts.sqldb.sqlapp; -import static io.quarkus.ts.sqldb.sqlapp.DbUtil.getImageName; -import static io.quarkus.ts.sqldb.sqlapp.DbUtil.getImageVersion; +import static io.quarkus.test.utils.ImageUtil.getImageName; +import static io.quarkus.test.utils.ImageUtil.getImageVersion; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; diff --git a/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/DevModeOracleDevServiceUserExperienceIT.java b/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/DevModeOracleDevServiceUserExperienceIT.java index 7655be7d2..efdfc4621 100644 --- a/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/DevModeOracleDevServiceUserExperienceIT.java +++ b/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/DevModeOracleDevServiceUserExperienceIT.java @@ -1,7 +1,7 @@ package io.quarkus.ts.sqldb.sqlapp; -import static io.quarkus.ts.sqldb.sqlapp.DbUtil.getImageName; -import static io.quarkus.ts.sqldb.sqlapp.DbUtil.getImageVersion; +import static io.quarkus.test.utils.ImageUtil.getImageName; +import static io.quarkus.test.utils.ImageUtil.getImageVersion; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; diff --git a/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/DevModePostgresqlDevServiceUserExperienceIT.java b/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/DevModePostgresqlDevServiceUserExperienceIT.java index 3e077a082..e734df423 100644 --- a/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/DevModePostgresqlDevServiceUserExperienceIT.java +++ b/sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/DevModePostgresqlDevServiceUserExperienceIT.java @@ -1,7 +1,7 @@ package io.quarkus.ts.sqldb.sqlapp; -import static io.quarkus.ts.sqldb.sqlapp.DbUtil.getImageName; -import static io.quarkus.ts.sqldb.sqlapp.DbUtil.getImageVersion; +import static io.quarkus.test.utils.ImageUtil.getImageName; +import static io.quarkus.test.utils.ImageUtil.getImageVersion; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; diff --git a/sql-db/vertx-sql/README.md b/sql-db/vertx-sql/README.md index 26e82a708..75beddf6e 100644 --- a/sql-db/vertx-sql/README.md +++ b/sql-db/vertx-sql/README.md @@ -110,7 +110,6 @@ You could have a look [on this link](src/main/resources/db/migration/common/V1.0 ## Useful material -Docker compose: `src/test/resources/docker-compose.yaml` Swagger: `http://localhost:8082/q/swagger-ui/` Example: diff --git a/sql-db/vertx-sql/src/test/resources/docker-compose.yaml b/sql-db/vertx-sql/src/test/resources/docker-compose.yaml deleted file mode 100644 index 1a43f130b..000000000 --- a/sql-db/vertx-sql/src/test/resources/docker-compose.yaml +++ /dev/null @@ -1,25 +0,0 @@ -version: '2' -services: - postgresql: - image: quay.io/debezium/postgres - hostname: postgresql - container_name: postgresql - ports: - - "5432:5432" - environment: - POSTGRES_USER: test - POSTGRES_PASSWORD: test - POSTGRES_DB: amadeus - - mysql: - image: mysql:5.7 - hostname: mysql - container_name: mysql - ports: - - "3306:3306" - environment: - MYSQL_ROOT_PASSWORD: test - MYSQL_USER: test - MYSQL_PASSWORD: test - MYSQL_DATABASE: amadeus -