Update config

This commit is contained in:
2021-04-12 21:13:49 +02:00
parent 204ae7988e
commit 7ad8b7039b
21 changed files with 138 additions and 217 deletions
+2 -2
View File
@@ -29,8 +29,8 @@ class PersistenceModule {
val hikariConfig = HikariConfig().also {
it.jdbcUrl = conf.jdbcUrl
it.driverClassName = "org.h2.Driver"
it.username = conf.username
it.password = conf.password
it.username = ""
it.password = ""
it.maximumPoolSize = conf.maximumPoolSize
it.connectionTimeout = conf.connectionTimeout
it.dataSourceProperties["CASE_INSENSITIVE_IDENTIFIERS"] = "TRUE"
+2 -18
View File
@@ -1,10 +1,9 @@
package be.simplenotes.persistence
import be.simplenotes.config.DataSourceConfig
import io.micronaut.context.ApplicationContext
import io.micronaut.context.BeanContext
import org.flywaydb.core.Flyway
import org.junit.jupiter.api.AfterAll
import org.junit.jupiter.api.BeforeAll
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.parallel.ResourceLock
import javax.sql.DataSource
@@ -12,25 +11,10 @@ import javax.sql.DataSource
@ResourceLock("h2")
abstract class DbTest {
val beanContext = BeanContext.build()
val beanContext = ApplicationContext.build().deduceEnvironment(false).environments("test").start()
inline fun <reified T> BeanContext.getBean(): T = getBean(T::class.java)
@BeforeAll
fun setComponent() {
beanContext
.registerSingleton(
DataSourceConfig(
jdbcUrl = "jdbc:h2:mem:regular;DB_CLOSE_DELAY=-1",
username = "h2",
password = "",
maximumPoolSize = 2,
connectionTimeout = 3000
)
)
.start()
}
@BeforeEach
fun beforeEach() {
val migration = beanContext.getBean<DbMigrations>()