com.dimafeng.testcontainers.CockroachContainer.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of testcontainers-scala-cockroachdb_2.13 Show documentation
Show all versions of testcontainers-scala-cockroachdb_2.13 Show documentation
testcontainers-scala-cockroachdb
package com.dimafeng.testcontainers
import org.testcontainers.containers.{CockroachContainer => JavaCockroachContainer}
import org.testcontainers.utility.DockerImageName
case class CockroachContainer(
dockerImageName: DockerImageName = DockerImageName.parse(CockroachContainer.defaultDockerImageName),
urlParams: Map[String, String] = Map.empty,
commonJdbcParams: JdbcDatabaseContainer.CommonParams = JdbcDatabaseContainer.CommonParams()
) extends SingleContainer[JavaCockroachContainer] with JdbcDatabaseContainer {
override val container: JavaCockroachContainer = {
val c = new JavaCockroachContainer(dockerImageName)
urlParams.foreach { case (key, value) =>
c.withUrlParam(key, value)
}
commonJdbcParams.applyTo(c)
c
}
def testQueryString: String = container.getTestQueryString
}
object CockroachContainer {
val defaultDockerImageName = s"${JavaCockroachContainer.IMAGE}:${JavaCockroachContainer.IMAGE_TAG}"
case class Def(
dockerImageName: DockerImageName = DockerImageName.parse(CockroachContainer.defaultDockerImageName),
urlParams: Map[String, String] = Map.empty,
commonJdbcParams: JdbcDatabaseContainer.CommonParams = JdbcDatabaseContainer.CommonParams()
) extends ContainerDef {
override type Container = CockroachContainer
override def createContainer(): CockroachContainer = {
new CockroachContainer(
dockerImageName,
urlParams,
commonJdbcParams
)
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy