fix ReposoitoryTest
This commit is contained in:
parent
a85e655aba
commit
e86e88c27b
|
|
@ -29,21 +29,13 @@ allprojects {
|
|||
mavenCentral()
|
||||
}
|
||||
|
||||
println("Enabling IDEA plugin in project ${project.name}...")
|
||||
apply(plugin = "idea")
|
||||
}
|
||||
|
||||
subprojects {
|
||||
println("Enabling Kotlin JVM plugin in project ${project.name}...")
|
||||
apply(plugin = "org.jetbrains.kotlin.jvm")
|
||||
|
||||
println("Enabling Kotlin Spring plugin in project ${project.name}...")
|
||||
apply(plugin = "org.jetbrains.kotlin.plugin.spring")
|
||||
|
||||
println("Enabling Spring Boot Dependency Management in project ${project.name}...")
|
||||
apply(plugin = "io.spring.dependency-management")
|
||||
|
||||
println("Enabling Detekt support in project ${project.name}...")
|
||||
apply(plugin = "io.gitlab.arturbosch.detekt")
|
||||
|
||||
detekt {
|
||||
|
|
@ -81,6 +73,7 @@ subprojects {
|
|||
dependency("org.junit.jupiter:junit-jupiter-engine:5.4.2")
|
||||
|
||||
dependency("org.liquibase:liquibase-core:4.4.0")
|
||||
dependency("org.telegram:telegrambots-spring-boot-starter:6.4.0")
|
||||
|
||||
dependency("com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0")
|
||||
dependency("org.mockito:mockito-inline:3.11.0")
|
||||
|
|
|
|||
|
|
@ -4,10 +4,18 @@ package ru.touchin.common.spring.test.jpa.repository
|
|||
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest
|
||||
import org.springframework.context.annotation.Import
|
||||
import org.springframework.test.context.ActiveProfiles
|
||||
import org.springframework.test.context.junit.jupiter.DisabledIf
|
||||
import ru.touchin.common.spring.test.annotations.SlowTest
|
||||
|
||||
@ActiveProfiles("test", "test-slow")
|
||||
@SlowTest
|
||||
@DataJpaTest
|
||||
@Import(RepositoryTestConfiguration::class)
|
||||
@DisabledIf(
|
||||
expression = """
|
||||
#{systemProperties['tests.slow.enabled'] != null
|
||||
? systemProperties['tests.slow.enabled'].toLowerCase().contains('false')
|
||||
: false}
|
||||
"""
|
||||
)
|
||||
annotation class RepositoryTest
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ package ru.touchin.common.spring.test.jpa.repository
|
|||
import com.zaxxer.hikari.HikariConfig
|
||||
import com.zaxxer.hikari.HikariDataSource
|
||||
import org.springframework.beans.factory.annotation.Value
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
|
||||
import org.springframework.boot.test.context.TestConfiguration
|
||||
import org.springframework.context.annotation.Bean
|
||||
import org.springframework.context.annotation.ComponentScan
|
||||
|
|
@ -18,6 +19,7 @@ import javax.sql.DataSource
|
|||
@TestConfiguration
|
||||
@EnableJpaAuditingExtra
|
||||
@ComponentScan
|
||||
@ConditionalOnProperty(name = ["tests.slow.enabled"], matchIfMissing = true)
|
||||
class RepositoryTestConfiguration {
|
||||
|
||||
// запуск и остановка контейнера по lifecycle-событиями компонента (1)
|
||||
|
|
|
|||
|
|
@ -2,9 +2,7 @@
|
|||
package ru.touchin.common.spring.test.annotations
|
||||
|
||||
import org.springframework.context.annotation.Profile
|
||||
import org.springframework.test.context.junit.jupiter.DisabledIf
|
||||
|
||||
@Profile(value = ["test", "test-slow"])
|
||||
@DisabledIf("\${tests.slow.disabled:false}")
|
||||
@Target(allowedTargets = [AnnotationTarget.FUNCTION, AnnotationTarget.CLASS])
|
||||
annotation class SlowTest
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ plugins {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
api 'org.telegram:telegrambots-spring-boot-starter:6.3.0'
|
||||
api 'org.telegram:telegrambots-spring-boot-starter'
|
||||
|
||||
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
|
||||
implementation 'com.fasterxml.jackson.core:jackson-databind'
|
||||
|
|
|
|||
Loading…
Reference in New Issue