tech.harmonysoft.oss.redis.RedisTestEnvironment.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of harmonysoft-redis-environment Show documentation
Show all versions of harmonysoft-redis-environment Show documentation
Common general-purpose Kotlin utility
package tech.harmonysoft.oss.redis
import jakarta.inject.Named
import tech.harmonysoft.oss.environment.TestContext
import tech.harmonysoft.oss.environment.TestEnvironment
import tech.harmonysoft.oss.redis.config.TestRedisConfig
import tech.harmonysoft.oss.redis.spi.RedisEnvironmentSpi
@Named
class RedisTestEnvironment(
private val spi: RedisEnvironmentSpi,
private val manager: TestRedisManager
) : TestEnvironment {
override val id = spi.environmentId
override val configClass = TestRedisConfig::class
override fun isRunning(config: TestRedisConfig): Boolean {
return try {
manager.buildClient(config).get("test")
true
} catch (ignore: Exception) {
false
}
}
override fun start(context: TestContext): TestRedisConfig {
return spi.start(context)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy