forked from kotlin-orm/ktorm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cad4e8e
commit 4838537
Showing
19 changed files
with
156 additions
and
171 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
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,4 +1,3 @@ | ||
|
||
drop table if exists "t_department"; | ||
drop table if exists "t_employee"; | ||
drop table if exists "t_employee0"; | ||
|
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,4 +1,3 @@ | ||
|
||
create table "t_department"( | ||
"id" int not null primary key auto_increment, | ||
"name" varchar(128) not 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
27 changes: 27 additions & 0 deletions
27
ktorm-support-mysql/src/test/kotlin/org/ktorm/support/mysql/BaseMySqlTest.kt
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,27 @@ | ||
package org.ktorm.support.mysql | ||
|
||
import org.ktorm.BaseTest | ||
import org.ktorm.database.Database | ||
import org.testcontainers.containers.MySQLContainer | ||
import kotlin.concurrent.thread | ||
|
||
abstract class BaseMySqlTest : BaseTest() { | ||
|
||
override fun init() { | ||
database = Database.connect(jdbcUrl, driverClassName, username, password) | ||
execSqlScript("init-mysql-data.sql") | ||
} | ||
|
||
override fun destroy() { | ||
execSqlScript("drop-mysql-data.sql") | ||
} | ||
|
||
companion object : MySQLContainer<Companion>("mysql:8") { | ||
init { | ||
// Start the container when it's first used. | ||
start() | ||
// Stop the container when the process exits. | ||
Runtime.getRuntime().addShutdownHook(thread(start = false) { stop() }) | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
create table t_department( | ||
id int not null primary key auto_increment, | ||
name varchar(128) not null, | ||
|
29 changes: 29 additions & 0 deletions
29
ktorm-support-oracle/src/test/kotlin/org/ktorm/support/oracle/BaseOracleTest.kt
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,29 @@ | ||
package org.ktorm.support.oracle | ||
|
||
import org.ktorm.BaseTest | ||
import org.ktorm.database.Database | ||
import org.testcontainers.containers.OracleContainer | ||
import kotlin.concurrent.thread | ||
|
||
abstract class BaseOracleTest : BaseTest() { | ||
|
||
override fun init() { | ||
database = Database.connect(jdbcUrl, driverClassName, username, password, alwaysQuoteIdentifiers = true) | ||
execSqlScript("init-oracle-data.sql") | ||
} | ||
|
||
override fun destroy() { | ||
execSqlScript("drop-oracle-data.sql") | ||
} | ||
|
||
companion object : OracleContainer("zerda/oracle-database:11.2.0.2-xe") { | ||
init { | ||
// At least 1 GB memory is required by Oracle. | ||
withCreateContainerCmdModifier { cmd -> cmd.hostConfig?.withShmSize((1 * 1024 * 1024 * 1024).toLong()) } | ||
// Start the container when it's first used. | ||
start() | ||
// Stop the container when the process exits. | ||
Runtime.getRuntime().addShutdownHook(thread(start = false) { stop() }) | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
drop table "t_department"; | ||
drop table "t_employee"; | ||
drop table "t_employee0"; |
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,4 +1,3 @@ | ||
|
||
create table "t_department"( | ||
"id" int not null primary key, | ||
"name" varchar(128) not null, | ||
|
29 changes: 29 additions & 0 deletions
29
ktorm-support-sqlite/src/test/kotlin/org/ktorm/support/sqlite/BaseSQLiteTest.kt
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,29 @@ | ||
package org.ktorm.support.sqlite | ||
|
||
import org.ktorm.BaseTest | ||
import org.ktorm.database.Database | ||
import java.sql.Connection | ||
import java.sql.DriverManager | ||
|
||
abstract class BaseSQLiteTest : BaseTest() { | ||
lateinit var connection: Connection | ||
|
||
override fun init() { | ||
connection = DriverManager.getConnection("jdbc:sqlite::memory:") | ||
|
||
database = Database.connect { | ||
object : Connection by connection { | ||
override fun close() { | ||
// do nothing... | ||
} | ||
} | ||
} | ||
|
||
execSqlScript("init-sqlite-data.sql") | ||
} | ||
|
||
override fun destroy() { | ||
execSqlScript("drop-sqlite-data.sql") | ||
connection.close() | ||
} | ||
} |
Oops, something went wrong.