-
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.
Reactive MS SQL client support (#249)
* +Removed unneeded parameters * ~Test moved to integration tests * +Coverage for MS SQL; support for not using database in SQL requests * +Support of new API * +Full coverage of MS SQL * ~Refactoring * +Temporary fix * ~Format
- Loading branch information
Showing
15 changed files
with
192 additions
and
41 deletions.
There are no files selected for viewing
19 changes: 13 additions & 6 deletions
19
sql-db/sql-app/src/test/java/io/quarkus/ts/sqldb/sqlapp/OpenShiftMssqlDatabaseIT.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 |
---|---|---|
@@ -1,23 +1,30 @@ | ||
package io.quarkus.ts.sqldb.sqlapp; | ||
|
||
import io.quarkus.test.bootstrap.DefaultService; | ||
import io.quarkus.test.bootstrap.RestService; | ||
import io.quarkus.test.bootstrap.SqlServerService; | ||
import io.quarkus.test.scenarios.OpenShiftScenario; | ||
import io.quarkus.test.services.Container; | ||
import io.quarkus.test.services.QuarkusApplication; | ||
|
||
@OpenShiftScenario | ||
public class OpenShiftMssqlDatabaseIT extends AbstractSqlDatabaseIT { | ||
private static final String MSSQL_PASSWORD = "QuArKuS_tEsT"; | ||
private static final String DATABASE = "msdb"; | ||
|
||
static final int MSSQL_PORT = 1433; | ||
|
||
@Container(image = "${mssql.image}", port = MSSQL_PORT, expectedLog = "Service Broker manager has started") | ||
static SqlServerService mssql = new SqlServerService(); | ||
//fixme Replace with SqlServerService when https://github.com/quarkus-qe/quarkus-test-framework/issues/251 will be solved | ||
static DefaultService mssql = new DefaultService() | ||
.withProperty("ACCEPT_EULA", "Y") | ||
.withProperty("SA_PASSWORD", MSSQL_PASSWORD); | ||
|
||
@QuarkusApplication | ||
static RestService app = new RestService() | ||
static final RestService app = new RestService() | ||
.withProperties("mssql.properties") | ||
.withProperty("quarkus.datasource.username", mssql.getUser()) | ||
.withProperty("quarkus.datasource.password", mssql.getPassword()) | ||
.withProperty("quarkus.datasource.jdbc.url", mssql::getJdbcUrl); | ||
.withProperty("quarkus.datasource.username", "sa") | ||
.withProperty("quarkus.datasource.password", MSSQL_PASSWORD) | ||
.withProperty("quarkus.datasource.jdbc.url", | ||
() -> mssql.getHost().replace("http", "jdbc:sqlserver") + ":" + | ||
mssql.getPort() + ";databaseName=" + DATABASE); | ||
} |
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
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
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
67 changes: 67 additions & 0 deletions
67
sql-db/vertx-sql/src/main/resources/db/migration/mssql/V1.0.0__init.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,67 @@ | ||
CREATE TABLE airports ( | ||
id INT NOT NULL IDENTITY(1,1), | ||
iata_code VARCHAR(100) NOT NULL, | ||
city VARCHAR(100) NOT NULL, | ||
PRIMARY KEY(id) | ||
); | ||
|
||
CREATE TABLE airlines ( | ||
id INT NOT NULL IDENTITY(1,1), | ||
iata_code VARCHAR(100) NOT NULL, | ||
name VARCHAR(100) NOT NULL, | ||
infant_price FLOAT(3), | ||
PRIMARY KEY(id) | ||
); | ||
|
||
CREATE TABLE flights ( | ||
id INT NOT NULL IDENTITY(1,1), | ||
origin VARCHAR(100) NOT NULL, | ||
destination VARCHAR(100) NOT NULL, | ||
flight_code VARCHAR(100) NOT NULL, | ||
base_price INTEGER NOT NULL, | ||
PRIMARY KEY(id) | ||
); | ||
|
||
CREATE TABLE pricingRules ( | ||
id INT NOT NULL IDENTITY(1,1), | ||
days_to_departure INTEGER NOT NULL, | ||
until INTEGER NOT NULL, | ||
percentage INTEGER NOT NULL, | ||
PRIMARY KEY(id) | ||
); | ||
|
||
CREATE TABLE address ( | ||
id INT NOT NULL IDENTITY(1,1), | ||
street VARCHAR(300) NOT NULL, | ||
block_number VARCHAR(20) NOT NULL, | ||
zip_code VARCHAR(20) NOT NULL, | ||
city VARCHAR(150) NOT NULL, | ||
country VARCHAR(200) NOT NULL, | ||
created_at BIGINT NOT NULL, | ||
updated_at BIGINT, | ||
PRIMARY KEY(id) | ||
); | ||
|
||
CREATE TABLE passenger ( | ||
id INT NOT NULL IDENTITY(1,1), | ||
nif VARCHAR(10) NOT NULL, | ||
name VARCHAR(25) NOT NULL, | ||
last_name VARCHAR(55) NOT NULL, | ||
contact_number VARCHAR(20) NOT NULL, | ||
created_at BIGINT NOT NULL, | ||
updated_at BIGINT, | ||
address_id INT, | ||
PRIMARY KEY(id), | ||
FOREIGN KEY (address_id) REFERENCES address(id) ON DELETE SET NULL | ||
); | ||
|
||
CREATE TABLE basket ( | ||
id INT NOT NULL IDENTITY(1,1), | ||
flight VARCHAR(10) NOT NULL, | ||
price NUMERIC NOT NULL, | ||
created_at BIGINT NOT NULL, | ||
updated_at BIGINT, | ||
passenger_id INT, | ||
PRIMARY KEY(id), | ||
FOREIGN KEY (passenger_id) REFERENCES passenger(id) ON DELETE SET NULL | ||
); |
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
32 changes: 32 additions & 0 deletions
32
sql-db/vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/handlers/MSsqlHandlerIT.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,32 @@ | ||
package io.quarkus.qe.vertx.sql.handlers; | ||
|
||
import io.quarkus.test.bootstrap.DefaultService; | ||
import io.quarkus.test.bootstrap.RestService; | ||
import io.quarkus.test.scenarios.QuarkusScenario; | ||
import io.quarkus.test.services.Container; | ||
import io.quarkus.test.services.QuarkusApplication; | ||
|
||
@QuarkusScenario | ||
public class MSsqlHandlerIT extends CommonTestCases { | ||
private static final String MSSQL_PASSWORD = "QuArKuS_tEsT"; | ||
private static final String DATABASE = "msdb"; | ||
private static final int MSSQL_PORT = 1433; | ||
|
||
//fixme Replace with SqlServerService when https://github.com/quarkus-qe/quarkus-test-framework/issues/251 will be solved | ||
@Container(image = "${mssql.image}", port = MSSQL_PORT, expectedLog = "Service Broker manager has started") | ||
static DefaultService mssql = new DefaultService() | ||
.withProperty("ACCEPT_EULA", "Y") | ||
.withProperty("SA_PASSWORD", MSSQL_PASSWORD); | ||
|
||
@QuarkusApplication | ||
static final RestService app = new RestService() | ||
.withProperty("quarkus.datasource.mssql.jdbc.url", | ||
() -> mssql.getHost().replace("http", "jdbc:sqlserver") + ":" + | ||
mssql.getPort() + ";databaseName=" + DATABASE) | ||
.withProperty("quarkus.datasource.mssql.reactive.url", | ||
() -> mssql.getHost().replace("http", "sqlserver") + ":" + | ||
mssql.getPort() + "/" + DATABASE) | ||
.withProperty("app.selected.db", "mssql") | ||
// Enable Flyway for MySQL | ||
.withProperty("quarkus.flyway.mssql.migrate-at-start", "true"); | ||
} |
Oops, something went wrong.