Skip to content

Commit

Permalink
Upgrade Test Framework to 0.0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Sgitario committed Sep 8, 2021
1 parent cdc3880 commit bd23be2
Show file tree
Hide file tree
Showing 36 changed files with 148 additions and 262 deletions.
7 changes: 7 additions & 0 deletions external-applications/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<dependencies>
<dependency>
<groupId>io.quarkus.qe</groupId>
<artifactId>quarkus-test-service-database</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<parent>
<groupId>io.quarkus.ts.qe</groupId>
<artifactId>parent</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
<quarkus.platform.version>2.2.2.Final</quarkus.platform.version>
<quarkus-plugin.version>${quarkus.platform.version}</quarkus-plugin.version>
<quarkus.qe.framework.version>0.0.8</quarkus.qe.framework.version>
<quarkus.qe.framework.version>0.0.9</quarkus.qe.framework.version>
<quarkus-qpid-jms.version>0.27.0</quarkus-qpid-jms.version>
<quarkus-ide-config.version>2.2.2.Final</quarkus-ide-config.version>
<apache-httpclient-fluent.version>4.5.13</apache-httpclient-fluent.version>
Expand Down
5 changes: 5 additions & 0 deletions scheduling/quartz/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jdbc-mysql</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus.qe</groupId>
<artifactId>quarkus-test-service-database</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<!-- Skipped on Windows as does not support Linux Containers / Testcontainers -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
Original file line number Diff line number Diff line change
@@ -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();
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 5 additions & 0 deletions spring/spring-data/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-validator</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus.qe</groupId>
<artifactId>quarkus-test-service-database</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<!-- Skipped on Windows as does not support Linux Containers / Testcontainers -->
Expand Down
Original file line number Diff line number Diff line change
@@ -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);

}
5 changes: 5 additions & 0 deletions spring/spring-web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-qute</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus.qe</groupId>
<artifactId>quarkus-test-service-database</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<!-- Skipped on Windows as does not support Linux Containers / Testcontainers -->
Expand Down
Original file line number Diff line number Diff line change
@@ -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);

}
5 changes: 5 additions & 0 deletions sql-db/multiple-pus/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@
<artifactId>quarkus-jdbc-h2</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus.qe</groupId>
<artifactId>quarkus-test-service-database</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<!-- Skipped on Windows as does not support Linux Containers / Testcontainers -->
Expand Down
4 changes: 2 additions & 2 deletions sql-db/multiple-pus/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -21,44 +22,27 @@
@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;
static final int EXPECTED_VEGETABLES_SIZE = 7;
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;
Expand Down
5 changes: 5 additions & 0 deletions sql-db/panache-flyway/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@
<artifactId>mysql</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus.qe</groupId>
<artifactId>quarkus-test-service-database</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<!-- Skipped on Windows as does not support Linux Containers / Testcontainers -->
Expand Down
Loading

0 comments on commit bd23be2

Please sign in to comment.