Adding a MailboxSpec for SingleConsumerOnlyMailbox
This commit is contained in:
parent
68dfada8bc
commit
6e4aa3231d
1 changed files with 14 additions and 1 deletions
|
|
@ -19,6 +19,10 @@ abstract class MailboxSpec extends AkkaSpec with BeforeAndAfterAll with BeforeAn
|
|||
|
||||
def factory: MailboxType ⇒ MessageQueue
|
||||
|
||||
def supportsBeingBounded = true
|
||||
|
||||
def maxConsumers = 4
|
||||
|
||||
name should {
|
||||
"create an unbounded mailbox" in {
|
||||
val config = UnboundedMailbox()
|
||||
|
|
@ -122,7 +126,7 @@ abstract class MailboxSpec extends AkkaSpec with BeforeAndAfterAll with BeforeAn
|
|||
r
|
||||
}
|
||||
|
||||
val consumers = for (i ← (1 to 4).toList) yield createConsumer
|
||||
val consumers = List.fill(maxConsumers)(createConsumer)
|
||||
|
||||
val ps = producers.map(Await.result(_, within))
|
||||
val cs = consumers.map(Await.result(_, within))
|
||||
|
|
@ -187,3 +191,12 @@ class CustomMailboxSpec extends AkkaSpec(CustomMailboxSpec.config) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
class SingleConsumerOnlyMailboxSpec extends MailboxSpec {
|
||||
lazy val name = "The single-consumer-only mailbox implementation"
|
||||
override def maxConsumers = 1
|
||||
def factory = {
|
||||
case u: UnboundedMailbox ⇒ SingleConsumerOnlyUnboundedMailbox().create(None, None)
|
||||
case b: BoundedMailbox ⇒ pending; null
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue