pekko/akka-actor-tests/src/test/scala/akka/ticket/Ticket703Spec.scala

32 lines
1 KiB
Scala
Raw Normal View History

2011-03-15 01:00:02 +01:00
package akka.ticket
import akka.actor._
import akka.routing._
2011-10-11 16:05:48 +02:00
import akka.testkit.AkkaSpec
2011-03-15 01:00:02 +01:00
2011-10-11 16:05:48 +02:00
class Ticket703Spec extends AkkaSpec {
2011-03-15 01:00:02 +01:00
2011-06-13 13:43:21 +02:00
"A ? call to an actor pool" should {
2011-03-15 01:00:02 +01:00
"reuse the proper timeout" in {
2011-10-18 17:56:23 +02:00
val actorPool = actorOf(
2011-08-26 17:25:18 +02:00
Props(new Actor with DefaultActorPool with BoundedCapacityStrategy with MailboxPressureCapacitor with SmallestMailboxSelector with BasicNoBackoffFilter {
def lowerBound = 2
def upperBound = 20
def rampupRate = 0.1
def partialFill = true
def selectionCount = 1
def receive = _route
def pressureThreshold = 1
2011-10-18 17:56:23 +02:00
def instance(p: Props) = actorOf(p.withCreator(new Actor {
def receive = {
case req: String
Thread.sleep(6000L)
channel.tryTell("Response")
}
}))
}).withFaultHandler(OneForOneStrategy(List(classOf[Exception]), 5, 1000)))
(actorPool.?("Ping", 10000)).await.result must be === Some("Response")
2011-03-15 01:00:02 +01:00
}
}
}