All Downloads are FREE. Search and download functionalities are using the official Maven repository.

blended.itestsupport.condition.Condition.scala Maven / Gradle / Ivy

Go to download

Define an integration test API for collaborating blended container(s) using docker as a runtime for the container(s) under test and an Akka based Camel framework to perform the integration tests as pure blackbox tests. Container(s) may be prestarted and discovered (for execution speed) or started by the integration test (for reproducability).

The newest version!
package blended.itestsupport.condition

import com.typesafe.config.ConfigFactory

import scala.concurrent.duration._

/**
 * A Condition encapsulates an assertion that may change over time. The use case is to
 * wait for a Condition to be satisfied at some - normally that is a pre condition that
 * must be fulfilled before the real tests are executed.
 */
trait Condition {

  /** Is the condition satisfied ? */
  def satisfied   : Boolean
  val description : String

  /** The timeout a ConditionWaiter waits for this particular condition */
  def timeout   : FiniteDuration = defaultTimeout
  def interval  : FiniteDuration = defaultInterval

  lazy val config = {
    val config = ConfigFactory.load()
    config.getConfig("blended.itestsupport.condition")
  }

  override def toString = s"Condition($description, $timeout)"

  private[this] def defaultTimeout = config.getLong("defaultTimeout").millis
  private[this] def defaultInterval = config.getLong("checkfrequency").millis
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy