Skip to content

Commit

Permalink
Revert "try fix oracle connection issue"
Browse files Browse the repository at this point in the history
This reverts commit f8386fe.
  • Loading branch information
vincentlauvlwj committed Jan 25, 2023
1 parent f8386fe commit e1dd6f5
Showing 1 changed file with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@ import java.sql.DriverManager
import kotlin.concurrent.thread

abstract class BaseOracleTest : BaseTest() {
lateinit var connection: Connection

override fun init() {
Class.forName(driverClassName)
connection = DriverManager.getConnection(jdbcUrl, username, password)

database = Database.connect(alwaysQuoteIdentifiers = true) {
object : Connection by connection {
override fun close() {
Expand All @@ -27,10 +23,11 @@ abstract class BaseOracleTest : BaseTest() {

override fun destroy() {
execSqlScript("drop-oracle-data.sql")
connection.close()
}

companion object : OracleContainer("zerda/oracle-database:11.2.0.2-xe") {
lateinit var connection: Connection

init {
// At least 1 GB memory is required by Oracle.
withCreateContainerCmdModifier { cmd -> cmd.hostConfig?.withShmSize((1 * 1024 * 1024 * 1024).toLong()) }
Expand All @@ -39,5 +36,17 @@ abstract class BaseOracleTest : BaseTest() {
// Stop the container when the process exits.
Runtime.getRuntime().addShutdownHook(thread(start = false) { stop() })
}

override fun start() {
super.start()

Class.forName(driverClassName)
connection = DriverManager.getConnection(jdbcUrl, username, password)
}

override fun stop() {
connection.close()
super.stop()
}
}
}

0 comments on commit e1dd6f5

Please sign in to comment.