Skip to content

Commit

Permalink
Merge pull request #25770 from gsmet/2.9.2-backports-2
Browse files Browse the repository at this point in the history
2.9.2 backports 2
  • Loading branch information
gsmet authored May 25, 2022
2 parents 8acfcb8 + 037baaa commit 8b4f62c
Show file tree
Hide file tree
Showing 33 changed files with 631 additions and 74 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/ci-actions-incremental.yml
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,14 @@ jobs:
**/windows-java-11.txt
!**/build/tmp/**
retention-days: 5
- name: Upload build.log (if build failed)
uses: actions/upload-artifact@v2
if: ${{ failure() || cancelled() }}
with:
name: "build-logs-JVM Tests - JDK ${{matrix.java.name}}"
path: |
**/build.log
retention-days: 2

maven-tests:
name: Maven Tests - JDK ${{matrix.java.name}}
Expand Down
4 changes: 2 additions & 2 deletions docs/src/main/asciidoc/resteasy-reactive.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -711,9 +711,9 @@ public class Endpoint {
}
----

NOTE: Response filters are not invoked on streamed responses, because they would give a false
NOTE: Response filters are **not** invoked on streamed responses, because they would give a false
impression that you can set headers or HTTP status codes, which is not true after the initial
response.
response. Exception mappers are also not invoked because part of the response may already have been written.

=== Server-Sent Event (SSE) support

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,16 @@ public static DevServicesDatasourceConfigurationHandlerBuildItem jdbc(String dbK
@Override
public Map<String, String> apply(String dsName,
DevServicesDatasourceProvider.RunningDevServicesDatasource runningDevDb) {
String jdbcUrl = runningDevDb.getJdbcUrl();
if (dsName == null) {
return Collections.singletonMap("quarkus.datasource.jdbc.url", runningDevDb.getUrl());
return Collections.singletonMap("quarkus.datasource.jdbc.url", jdbcUrl);
} else {
// we use quoted and unquoted versions because depending on whether a user configured other JDBC properties
// one of the URLs may be ignored
// see https://github.com/quarkusio/quarkus/issues/21387
return Map.of(
datasourceURLPropName(dsName), runningDevDb.getUrl(),
datasourceURLPropName("\"" + dsName + "\""), runningDevDb.getUrl());
datasourceURLPropName(dsName), jdbcUrl,
datasourceURLPropName("\"" + dsName + "\""), jdbcUrl);
}
}

Expand All @@ -90,12 +91,16 @@ public static DevServicesDatasourceConfigurationHandlerBuildItem reactive(String
@Override
public Map<String, String> apply(String dsName,
DevServicesDatasourceProvider.RunningDevServicesDatasource runningDevDb) {
String reactiveUrl = runningDevDb.getReactiveUrl();
if (dsName == null) {
return Collections.singletonMap("quarkus.datasource.reactive.url",
runningDevDb.getUrl().replaceFirst("jdbc:", "vertx-reactive:"));
return Collections.singletonMap("quarkus.datasource.reactive.url", reactiveUrl);
} else {
return Collections.singletonMap("quarkus.datasource.\"" + dsName + "\".reactive.url",
runningDevDb.getUrl().replaceFirst("jdbc:", "vertx-reactive:"));
// we use quoted and unquoted versions because depending on whether a user configured other JDBC properties
// one of the URLs may be ignored
// see https://github.com/quarkusio/quarkus/issues/21387
return Map.of(
datasourceReactiveURLPropName(dsName, false), reactiveUrl,
datasourceReactiveURLPropName(dsName, true), reactiveUrl);
}
}
}, new Predicate<String>() {
Expand All @@ -104,10 +109,24 @@ public boolean test(String dsName) {
if (dsName == null) {
return ConfigUtils.isPropertyPresent("quarkus.datasource.reactive.url");
} else {
return ConfigUtils.isPropertyPresent("quarkus.datasource.\"" + dsName + "\".reactive.url") ||
ConfigUtils.isPropertyPresent("quarkus.datasource." + dsName + ".reactive.url");
return ConfigUtils.isPropertyPresent(datasourceReactiveURLPropName(dsName, false)) ||
ConfigUtils.isPropertyPresent(datasourceReactiveURLPropName(dsName, true));
}
}
});
}

private static String datasourceReactiveURLPropName(String dsName, boolean quotedName) {
StringBuilder key = new StringBuilder("quarkus.datasource");
key.append('.');
if (quotedName) {
key.append('"');
}
key.append(dsName);
if (quotedName) {
key.append('"');
}
key.append(".reactive.url");
return key.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@ default boolean isDockerRequired() {
class RunningDevServicesDatasource {

private final String id;
private final String url;
private final String jdbcUrl;
private final String reactiveUrl;
private final String username;
private final String password;
private final Closeable closeTask;

public RunningDevServicesDatasource(String id, String url, String username, String password, Closeable closeTask) {
public RunningDevServicesDatasource(String id, String jdbcUrl, String reactiveUrl, String username, String password,
Closeable closeTask) {
this.id = id;
this.url = url;
this.jdbcUrl = jdbcUrl;
this.reactiveUrl = reactiveUrl;
this.username = username;
this.password = password;
this.closeTask = closeTask;
Expand All @@ -41,8 +44,12 @@ public String getId() {
return id;
}

public String getUrl() {
return url;
public String getJdbcUrl() {
return jdbcUrl;
}

public String getReactiveUrl() {
return reactiveUrl;
}

public Closeable getCloseTask() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public RunningDevServicesDatasource startDatabase(Optional<String> username, Opt

return new RunningDevServicesDatasource(container.getContainerId(),
container.getEffectiveJdbcUrl(),
container.getReactiveUrl(),
container.getUsername(),
container.getPassword(),
new Closeable() {
Expand Down Expand Up @@ -104,5 +105,9 @@ public String getEffectiveJdbcUrl() {
return super.getJdbcUrl();
}
}

public String getReactiveUrl() {
return getEffectiveJdbcUrl().replaceFirst("jdbc:", "vertx-reactive:");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public RunningDevServicesDatasource startDatabase(Optional<String> username, Opt
+ additionalArgs.toString(),
null,
null,
null,
new Closeable() {
@Override
public void close() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public RunningDevServicesDatasource startDatabase(Optional<String> username, Opt
+ ";DB_CLOSE_DELAY=-1" + additionalArgs.toString();
return new RunningDevServicesDatasource(null,
connectionUrl,
null,
"sa",
"sa",
new Closeable() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public RunningDevServicesDatasource startDatabase(Optional<String> username, Opt

return new RunningDevServicesDatasource(container.getContainerId(),
container.getEffectiveJdbcUrl(),
container.getReactiveUrl(),
container.getUsername(),
container.getPassword(),
new Closeable() {
Expand Down Expand Up @@ -108,5 +109,9 @@ public String getEffectiveJdbcUrl() {
return super.getJdbcUrl();
}
}

public String getReactiveUrl() {
return getEffectiveJdbcUrl().replaceFirst("jdbc:", "vertx-reactive:");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public RunningDevServicesDatasource startDatabase(Optional<String> username, Opt

return new RunningDevServicesDatasource(container.getContainerId(),
container.getEffectiveJdbcUrl(),
container.getReactiveUrl(),
container.getUsername(),
container.getPassword(),
new Closeable() {
Expand Down Expand Up @@ -101,5 +102,15 @@ public String getEffectiveJdbcUrl() {
return super.getJdbcUrl();
}
}

public String getReactiveUrl() {
StringBuilder url = new StringBuilder("vertx-reactive:sqlserver://");
if (useSharedNetwork) {
url.append(hostName).append(":").append(MS_SQL_SERVER_PORT);
} else {
url.append(this.getHost()).append(":").append(this.getMappedPort(MS_SQL_SERVER_PORT));
}
return url.toString();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public RunningDevServicesDatasource startDatabase(Optional<String> username, Opt

return new RunningDevServicesDatasource(container.getContainerId(),
container.getEffectiveJdbcUrl(),
container.getReactiveUrl(),
container.getUsername(),
container.getPassword(),
new Closeable() {
Expand Down Expand Up @@ -111,5 +112,9 @@ public String getEffectiveJdbcUrl() {
return super.getJdbcUrl();
}
}

public String getReactiveUrl() {
return getEffectiveJdbcUrl().replaceFirst("jdbc:", "vertx-reactive:");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public RunningDevServicesDatasource startDatabase(Optional<String> username, Opt

return new RunningDevServicesDatasource(container.getContainerId(),
container.getEffectiveJdbcUrl(),
container.getReactiveUrl(),
container.getUsername(),
container.getPassword(),
new Closeable() {
Expand Down Expand Up @@ -117,5 +118,9 @@ public String getEffectiveJdbcUrl() {
return super.getJdbcUrl();
}
}

public String getReactiveUrl() {
return getEffectiveJdbcUrl().replaceFirst("jdbc:", "vertx-reactive:");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public RunningDevServicesDatasource startDatabase(Optional<String> username, Opt

return new RunningDevServicesDatasource(container.getContainerId(),
container.getEffectiveJdbcUrl(),
container.getReactiveUrl(),
container.getUsername(),
container.getPassword(),
new Closeable() {
Expand Down Expand Up @@ -114,5 +115,9 @@ public String getEffectiveJdbcUrl() {
return super.getJdbcUrl();
}
}

public String getReactiveUrl() {
return getEffectiveJdbcUrl().replaceFirst("jdbc:", "vertx-reactive:");
}
}
}
5 changes: 5 additions & 0 deletions extensions/reactive-mssql-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,40 @@
package io.quarkus.reactive.mssql.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.mssqlclient.MSSQLPool;

public class DevServicesMsSQLDatasourceTestCase {

@RegisterExtension
static QuarkusUnitTest test = new QuarkusUnitTest()
.withApplicationRoot((jar) -> jar
.addAsResource("container-license-acceptance.txt"))
// 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
MSSQLPool 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-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
Loading

0 comments on commit 8b4f62c

Please sign in to comment.