Skip to content

Commit

Permalink
DevServices DS test cases for reactive Oracle, Pg and MySQL clients
Browse files Browse the repository at this point in the history
  • Loading branch information
tsegismont committed May 10, 2022
1 parent c4a4640 commit a2b1712
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 0 deletions.
5 changes: 5 additions & 0 deletions extensions/reactive-mysql-client/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@
<artifactId>quarkus-smallrye-health-deployment</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package io.quarkus.reactive.mysql.client;

import static org.assertj.core.api.Assertions.assertThat;

import java.time.Duration;
import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.LogRecord;

import javax.inject.Inject;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.test.QuarkusUnitTest;
import io.vertx.mutiny.mysqlclient.MySQLPool;

public class DevServicesMySQLDatasourceTestCase {

@RegisterExtension
static QuarkusUnitTest test = new QuarkusUnitTest()
.withEmptyApplication()
// Expect no warnings from reactive
.setLogRecordPredicate(record -> record.getLevel().intValue() >= Level.WARNING.intValue()
&& record.getMessage().toLowerCase(Locale.ENGLISH).contains("reactive"))
.assertLogRecords(records -> assertThat(records)
// This is just to get meaningful error messages, as LogRecord doesn't have a toString()
.extracting(LogRecord::getMessage)
.isEmpty());

@Inject
MySQLPool pool;

@Test
public void testDatasource() throws Exception {
pool.withConnection(conn -> conn.query("SELECT 1").execute().replaceWithVoid())
.await().atMost(Duration.ofMinutes(2));
}
}
5 changes: 5 additions & 0 deletions extensions/reactive-oracle-client/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@
<artifactId>quarkus-smallrye-health-deployment</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package io.quarkus.reactive.oracle.client;

import static org.assertj.core.api.Assertions.assertThat;

import java.time.Duration;
import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.LogRecord;

import javax.inject.Inject;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.test.QuarkusUnitTest;
import io.vertx.mutiny.oracleclient.OraclePool;

public class DevServicesOracleDatasourceTestCase {

@RegisterExtension
static QuarkusUnitTest test = new QuarkusUnitTest()
.withEmptyApplication()
// Expect no warnings from reactive
.setLogRecordPredicate(record -> record.getLevel().intValue() >= Level.WARNING.intValue()
&& record.getMessage().toLowerCase(Locale.ENGLISH).contains("reactive"))
.assertLogRecords(records -> assertThat(records)
// This is just to get meaningful error messages, as LogRecord doesn't have a toString()
.extracting(LogRecord::getMessage)
.isEmpty());

@Inject
OraclePool pool;

@Test
public void testDatasource() throws Exception {
pool.withConnection(conn -> conn.query("SELECT 1 FROM DUAL").execute().replaceWithVoid())
.await().atMost(Duration.ofMinutes(2));
}
}
5 changes: 5 additions & 0 deletions extensions/reactive-pg-client/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@
<artifactId>quarkus-smallrye-health-deployment</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package io.quarkus.reactive.pg.client;

import static org.assertj.core.api.Assertions.assertThat;

import java.time.Duration;
import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.LogRecord;

import javax.inject.Inject;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.test.QuarkusUnitTest;
import io.vertx.mutiny.pgclient.PgPool;

public class DevServicesPostgresqlDatasourceTestCase {

@RegisterExtension
static QuarkusUnitTest test = new QuarkusUnitTest()
.withEmptyApplication()
// Expect no warnings from reactive
.setLogRecordPredicate(record -> record.getLevel().intValue() >= Level.WARNING.intValue()
&& record.getMessage().toLowerCase(Locale.ENGLISH).contains("reactive"))
.assertLogRecords(records -> assertThat(records)
// This is just to get meaningful error messages, as LogRecord doesn't have a toString()
.extracting(LogRecord::getMessage)
.isEmpty());

@Inject
PgPool pool;

@Test
public void testDatasource() throws Exception {
pool.withConnection(conn -> conn.query("SELECT 1").execute().replaceWithVoid())
.await().atMost(Duration.ofMinutes(2));
}
}

0 comments on commit a2b1712

Please sign in to comment.