-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix DevModeMultipleReactiveSqlClientsIT on Aarch64 (#2041)
(cherry picked from commit 2935041)
- Loading branch information
1 parent
11c0db2
commit 278d022
Showing
9 changed files
with
78 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...tive-vanilla/src/main/java/io/quarkus/ts/reactive/db/clients/ReactiveClientConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package io.quarkus.ts.reactive.db.clients; | ||
|
||
import java.lang.annotation.Annotation; | ||
import java.lang.reflect.Type; | ||
|
||
import jakarta.inject.Inject; | ||
import jakarta.inject.Named; | ||
import jakarta.ws.rs.ext.ParamConverter; | ||
import jakarta.ws.rs.ext.ParamConverterProvider; | ||
import jakarta.ws.rs.ext.Provider; | ||
|
||
import io.quarkus.reactive.datasource.ReactiveDataSource; | ||
import io.vertx.mutiny.mssqlclient.MSSQLPool; | ||
import io.vertx.mutiny.sqlclient.Pool; | ||
|
||
@Provider | ||
public class ReactiveClientConverter implements ParamConverterProvider, ParamConverter<Pool> { | ||
|
||
@Inject | ||
@Named("mssql") | ||
MSSQLPool mssql; | ||
|
||
@Inject | ||
@ReactiveDataSource("mariadb") | ||
Pool mariadb; | ||
|
||
@SuppressWarnings("unchecked") | ||
@Override | ||
public <T> ParamConverter<T> getConverter(Class<T> aClass, Type type, Annotation[] annotations) { | ||
if (Pool.class == aClass) { | ||
return (ParamConverter<T>) this; | ||
} | ||
return null; | ||
} | ||
|
||
@Override | ||
public Pool fromString(String reactiveClient) { | ||
return switch (reactiveClient) { | ||
case "mariadb" -> mariadb; | ||
case "mssql" -> mssql; | ||
default -> throw new IllegalStateException("Unexpected reactive client: " + reactiveClient); | ||
}; | ||
} | ||
|
||
@Override | ||
public String toString(Pool pool) { | ||
throw new UnsupportedOperationException("We only convert path param to a Pool"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
sql-db/reactive-vanilla/src/main/resources/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
quarkus.datasource.db-kind=postgresql | ||
quarkus.datasource.mysql.db-kind=mysql | ||
quarkus.datasource.mariadb.db-kind=mariadb | ||
quarkus.datasource.mssql.db-kind=mssql |
5 changes: 5 additions & 0 deletions
5
sql-db/reactive-vanilla/src/main/resources/mariadb-init-script.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
DROP TABLE IF EXISTS hardCoverBook; | ||
CREATE TABLE hardCoverBook (id SERIAL PRIMARY KEY, title TEXT NOT NULL, author TEXT NOT NULL); | ||
INSERT INTO hardCoverBook (title, author) VALUES ('Foundation', 'Isaac Asimov'); | ||
INSERT INTO hardCoverBook (title, author) VALUES ('2001: A Space Odyssey', 'Arthur C. Clarke'); | ||
INSERT INTO hardCoverBook (title, author) VALUES ('Stranger in a Strange Land', 'Robert A. Heinlein'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters