most tests passing, everything compiling, but docs not updated and nasty
thread-leak preventing me from running the whole test-suite (which is
the reason for this commit: I want to chase down that one first).
- the app.mainbus is classified by Class[_] (currently lookup, will
possibly change to sub-class-aware) and accepts AnyRef messages
- LoggingBus handles akka.event-handlers from config specially:
+ start them as system services, supervised by SystemGuardian
+ keep their subscriptions in sync when logLevel_= is called
+ send them InitializeLogger(bus) message before subscribing them (so
they can register for extras like Mute/UnMute)
- two-phased start-up: first phase with actor-less stdout logging, then
subscription of config loggers, then remove stdout logger (logLevels
configurable separately)
- MainBusReaper watches registered receivers and unsubscribes them upon
death (started in phase 2)
- logger factory on Logging object, needs app/bus and log source;
default instance in app.log
44 lines
1.2 KiB
Scala
44 lines
1.2 KiB
Scala
package akka.testkit
|
|
|
|
import org.scalatest.WordSpec
|
|
import org.scalatest.matchers.MustMatchers
|
|
import org.scalatest.{ BeforeAndAfterEach, WordSpec }
|
|
import akka.actor._
|
|
import akka.dispatch.Future
|
|
import akka.util.duration._
|
|
|
|
@org.junit.runner.RunWith(classOf[org.scalatest.junit.JUnitRunner])
|
|
class TestProbeSpec extends AkkaSpec {
|
|
|
|
"A TestProbe" must {
|
|
|
|
"reply to futures" in {
|
|
val tk = TestProbe()
|
|
val future = tk.ref ? "hello"
|
|
tk.expectMsg(0 millis, "hello") // TestActor runs on CallingThreadDispatcher
|
|
tk.lastMessage.channel ! "world"
|
|
future must be('completed)
|
|
future.get must equal("world")
|
|
}
|
|
|
|
"reply to messages" in {
|
|
val tk1 = TestProbe()
|
|
val tk2 = TestProbe()
|
|
tk1.ref.!("hello")(tk2.ref)
|
|
tk1.expectMsg(0 millis, "hello")
|
|
tk1.lastMessage.channel ! "world"
|
|
tk2.expectMsg(0 millis, "world")
|
|
}
|
|
|
|
"properly send and reply to messages" in {
|
|
val probe1 = TestProbe()
|
|
val probe2 = TestProbe()
|
|
probe1.send(probe2.ref, "hello")
|
|
probe2.expectMsg(0 millis, "hello")
|
|
probe2.lastMessage.channel ! "world"
|
|
probe1.expectMsg(0 millis, "world")
|
|
}
|
|
|
|
}
|
|
|
|
}
|