=doc #16910 Fix include sections in fault tolerance docs
* and don't show AkkaSpec in doc code (cherry picked from commit 23be60395cdea846ef168960cd05e88c6bd29556) Conflicts: akka-docs/rst/scala/code/docs/actor/FaultHandlingDocSpec.scala akka-docs/rst/scala/fault-tolerance.rst
This commit is contained in:
parent
83854f87c9
commit
ef387af2fc
3 changed files with 18 additions and 14 deletions
|
|
@ -20,7 +20,6 @@ import scala.collection.immutable.Seq;
|
||||||
import scala.concurrent.Await;
|
import scala.concurrent.Await;
|
||||||
import static akka.pattern.Patterns.ask;
|
import static akka.pattern.Patterns.ask;
|
||||||
import scala.concurrent.duration.Duration;
|
import scala.concurrent.duration.Duration;
|
||||||
import akka.testkit.AkkaSpec;
|
|
||||||
import akka.testkit.TestProbe;
|
import akka.testkit.TestProbe;
|
||||||
|
|
||||||
//#testkit
|
//#testkit
|
||||||
|
|
@ -151,7 +150,7 @@ public class FaultHandlingTest {
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void start() {
|
public static void start() {
|
||||||
system = ActorSystem.create("test", AkkaSpec.testConf());
|
system = ActorSystem.create("test");
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,13 @@
|
||||||
package docs.actor
|
package docs.actor
|
||||||
|
|
||||||
import language.postfixOps
|
import language.postfixOps
|
||||||
|
import akka.actor.{ ActorSystem, ActorRef, Props, Terminated }
|
||||||
|
import FaultHandlingDocSpec._
|
||||||
|
|
||||||
//#testkit
|
//#testkit
|
||||||
import akka.testkit.{ TestKit, ImplicitSender, EventFilter }
|
|
||||||
import akka.actor.{ ActorRef, Props, ActorSystem, Terminated }
|
|
||||||
import org.scalatest._
|
|
||||||
import com.typesafe.config.{ Config, ConfigFactory }
|
import com.typesafe.config.{ Config, ConfigFactory }
|
||||||
|
import org.scalatest.{ FlatSpecLike, Matchers, BeforeAndAfterAll }
|
||||||
|
import akka.testkit.{ TestActors, TestKit, ImplicitSender, EventFilter }
|
||||||
|
|
||||||
//#testkit
|
//#testkit
|
||||||
object FaultHandlingDocSpec {
|
object FaultHandlingDocSpec {
|
||||||
|
|
@ -97,14 +98,20 @@ object FaultHandlingDocSpec {
|
||||||
}
|
}
|
||||||
""")
|
""")
|
||||||
}
|
}
|
||||||
|
|
||||||
import FaultHandlingDocSpec._
|
|
||||||
//#testkit
|
//#testkit
|
||||||
class FaultHandlingDocSpec extends TestKit(ActorSystem("FaultHandlingDocSpec", testConf))
|
class FaultHandlingDocSpec(_system: ActorSystem) extends TestKit(_system)
|
||||||
with FlatSpecLike with BeforeAndAfterAll with ImplicitSender {
|
with ImplicitSender with FlatSpecLike with Matchers with BeforeAndAfterAll {
|
||||||
|
|
||||||
override def afterAll() {
|
def this() = this(ActorSystem("FaultHandlingDocSpec",
|
||||||
system.terminate()
|
ConfigFactory.parseString("""
|
||||||
|
akka {
|
||||||
|
loggers = ["akka.testkit.TestEventListener"]
|
||||||
|
loglevel = "WARNING"
|
||||||
|
}
|
||||||
|
""")))
|
||||||
|
|
||||||
|
override def afterAll {
|
||||||
|
TestKit.shutdownActorSystem(system)
|
||||||
}
|
}
|
||||||
|
|
||||||
"A supervisor" must "apply the chosen strategy for its child" in {
|
"A supervisor" must "apply the chosen strategy for its child" in {
|
||||||
|
|
|
||||||
|
|
@ -126,9 +126,7 @@ This supervisor will be used to create a child, with which we can experiment:
|
||||||
.. includecode:: code/docs/actor/FaultHandlingDocSpec.scala
|
.. includecode:: code/docs/actor/FaultHandlingDocSpec.scala
|
||||||
:include: child
|
:include: child
|
||||||
|
|
||||||
The test is easier by using the utilities described in :ref:`akka-testkit`,
|
The test is easier by using the utilities described in :ref:`akka-testkit`.
|
||||||
where ``AkkaSpec`` is a convenient mixture of
|
|
||||||
``TestKit with WordSpec with MustMatchers``
|
|
||||||
|
|
||||||
.. includecode:: code/docs/actor/FaultHandlingDocSpec.scala
|
.. includecode:: code/docs/actor/FaultHandlingDocSpec.scala
|
||||||
:include: testkit
|
:include: testkit
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue