blended.itestsupport.condition.ComposedCondition.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of blended.itestsupport Show documentation
Show all versions of blended.itestsupport Show documentation
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 java.util.concurrent.atomic.AtomicBoolean
abstract class ComposedCondition(condition: Condition*) extends Condition {
private var isSatisfied : AtomicBoolean = new AtomicBoolean(false)
override def satisfied = isSatisfied.get()
}
case class SequentialComposedCondition(conditions: Condition*) extends ComposedCondition(conditions.toSeq:_*) {
override def timeout = conditions.foldLeft(interval * 2)( (sum, c) => sum + c.timeout)
override val description = s"SequentialComposedCondition(${conditions.toList}})"
}
case class ParallelComposedCondition(conditions: Condition*) extends ComposedCondition(conditions.toSeq:_*) {
override def timeout = (conditions.foldLeft(interval * 2)((m, c) => if (c.timeout > m) c.timeout else m)) + interval * 2
override val description = s"ParallelComposedCondition(${conditions.toList}})"
}