Skip to content

Commit d9aa91a

Browse files
fix failed tests
1 parent eba9ffe commit d9aa91a

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

ktorm-support-oracle/src/test/kotlin/org/ktorm/support/oracle/BaseOracleTest.kt

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package org.ktorm.support.oracle
22

3+
import org.junit.ClassRule
34
import org.ktorm.BaseTest
45
import org.ktorm.database.Database
56
import org.testcontainers.containers.OracleContainer
6-
import kotlin.concurrent.thread
77

88
abstract class BaseOracleTest : BaseTest() {
99

@@ -32,17 +32,20 @@ abstract class BaseOracleTest : BaseTest() {
3232
*
3333
* See https://java.testcontainers.org/supported_docker_environment/#colima
3434
*/
35-
companion object : OracleContainer("gvenzl/oracle-xe:11.2.0.2") {
36-
init {
37-
// Configure the container.
38-
usingSid()
39-
withReuse(true)
40-
withCreateContainerCmdModifier { cmd -> cmd.hostConfig?.withShmSize((1 * 1024 * 1024 * 1024).toLong()) }
41-
42-
// Start the container when it's first used.
43-
start()
44-
// Stop the container when the process exits.
45-
Runtime.getRuntime().addShutdownHook(thread(start = false) { stop() })
46-
}
35+
companion object {
36+
@JvmField
37+
@ClassRule
38+
val container: OracleContainer
39+
= OracleContainer("gvenzl/oracle-xe:11.2.0.2")
40+
.usingSid()
41+
.withCreateContainerCmdModifier { cmd -> cmd.hostConfig?.withShmSize((1 * 1024 * 1024 * 1024).toLong()) }
42+
43+
val jdbcUrl: String get() = container.jdbcUrl
44+
45+
val driverClassName: String get() = container.driverClassName
46+
47+
val username: String get() = container.username
48+
49+
val password: String get() = container.password
4750
}
4851
}

0 commit comments

Comments
 (0)