=doc #16459 change confusing FaultHandlingDocSpec in Fault Tolerance Document.
This commit is contained in:
parent
c56d670c03
commit
c0867e1308
1 changed files with 77 additions and 70 deletions
|
|
@ -6,8 +6,10 @@ package docs.actor
|
|||
import language.postfixOps
|
||||
|
||||
//#testkit
|
||||
import akka.testkit.{ AkkaSpec, ImplicitSender, EventFilter }
|
||||
import akka.actor.{ ActorRef, Props, Terminated }
|
||||
import akka.testkit.{ TestKit, ImplicitSender, EventFilter }
|
||||
import akka.actor.{ ActorRef, Props, ActorSystem, Terminated }
|
||||
import org.scalatest._
|
||||
import com.typesafe.config.{ Config, ConfigFactory }
|
||||
|
||||
//#testkit
|
||||
object FaultHandlingDocSpec {
|
||||
|
|
@ -91,18 +93,25 @@ object FaultHandlingDocSpec {
|
|||
}
|
||||
}
|
||||
//#child
|
||||
}
|
||||
|
||||
//#testkit
|
||||
class FaultHandlingDocSpec extends AkkaSpec with ImplicitSender {
|
||||
//#testkit
|
||||
val testConf: Config = ConfigFactory.parseString("""
|
||||
akka {
|
||||
loggers = ["akka.testkit.TestEventListener"]
|
||||
}
|
||||
""")
|
||||
}
|
||||
|
||||
import FaultHandlingDocSpec._
|
||||
//#testkit
|
||||
class FaultHandlingDocSpec extends TestKit(ActorSystem("FaultHandlingDocSpec", testConf))
|
||||
with FlatSpecLike with BeforeAndAfterAll with ImplicitSender {
|
||||
|
||||
"A supervisor" must {
|
||||
override def afterAll() {
|
||||
system.terminate()
|
||||
}
|
||||
//#testkit
|
||||
|
||||
"apply the chosen strategy for its child" in {
|
||||
"A supervisor" must "apply the chosen strategy for its child" in {
|
||||
//#testkit
|
||||
|
||||
//#create
|
||||
|
|
@ -140,7 +149,6 @@ class FaultHandlingDocSpec extends AkkaSpec with ImplicitSender {
|
|||
//#escalate-kill
|
||||
supervisor ! Props[Child] // create new child
|
||||
val child2 = expectMsgType[ActorRef]
|
||||
|
||||
watch(child2)
|
||||
child2 ! "get" // verify it is alive
|
||||
expectMsg(0)
|
||||
|
|
@ -169,5 +177,4 @@ class FaultHandlingDocSpec extends AkkaSpec with ImplicitSender {
|
|||
// code here
|
||||
}
|
||||
}
|
||||
}
|
||||
//#testkit
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue