Upgrade versions, etc
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import be.simplenotes.Libs
|
||||
import be.simplenotes.micronaut
|
||||
import be.simplenotes.micronautFixtures
|
||||
|
||||
plugins {
|
||||
id("be.simplenotes.base")
|
||||
@@ -48,7 +47,8 @@ dependencies {
|
||||
testFixturesImplementation(Libs.Database.hikariCP)
|
||||
|
||||
micronaut()
|
||||
micronautFixtures()
|
||||
|
||||
testFixturesImplementation(kotlin("bom"))
|
||||
}
|
||||
|
||||
kotlin.sourceSets["testFixtures"].kotlin.srcDirs("testfixtures")
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
package be.simplenotes.persistence
|
||||
|
||||
import be.simplenotes.config.DataSourceConfig
|
||||
import io.micronaut.context.BeanContext
|
||||
import org.flywaydb.core.Flyway
|
||||
import org.junit.jupiter.api.BeforeAll
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import javax.sql.DataSource
|
||||
|
||||
abstract class DbTest {
|
||||
|
||||
abstract fun dataSourceConfig(): DataSourceConfig
|
||||
|
||||
val beanContext = BeanContext.build()
|
||||
|
||||
inline fun <reified T> BeanContext.getBean(): T = getBean(T::class.java)
|
||||
|
||||
@BeforeAll
|
||||
fun setComponent() {
|
||||
beanContext.registerSingleton(dataSourceConfig())
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
fun beforeEach() {
|
||||
val migration = beanContext.getBean<DbMigrations>()
|
||||
val dataSource = beanContext.getBean<DataSource>()
|
||||
|
||||
Flyway.configure()
|
||||
.dataSource(dataSource)
|
||||
.load()
|
||||
.clean()
|
||||
|
||||
migration.migrate()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
package be.simplenotes.persistence
|
||||
Reference in New Issue
Block a user