Skip to content

Commit

Permalink
fix jdocs tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Roiocam committed Feb 6, 2024
1 parent 160072c commit 9c1022f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.apache.pekko.actor.testkit.typed.javadsl.TestProbe;
import org.apache.pekko.actor.typed.ActorRef;
import org.apache.pekko.actor.typed.Behavior;
import org.apache.pekko.actor.typed.Dispatchers;
import org.apache.pekko.actor.typed.MailboxSelector;
import org.apache.pekko.actor.typed.javadsl.Behaviors;
import com.typesafe.config.ConfigFactory;
Expand Down Expand Up @@ -78,7 +79,7 @@ public void startSomeActorsWithMailboxSelectorInteroperability() {
childBehavior,
"from-config-mailbox-child",
MailboxSelector.fromConfig("my-app.my-special-mailbox")
.withMailboxFromConfig("your-dispatcher"));
.withDispatcherFromConfig(Dispatchers.DefaultDispatcherId()));
// #interoperability-with-dispatcher

testProbe.ref().tell(Done.getInstance());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ object DispatchersDocSpec {
throughput = 1
}
//#config
your-mailbox {
mailbox-type = "org.apache.pekko.dispatch.SingleConsumerOnlyUnboundedMailbox"
}
""".stripMargin)

case class WhichDispatcher(replyTo: ActorRef[Dispatcher])
Expand Down Expand Up @@ -71,13 +74,13 @@ object DispatchersDocSpec {

context.spawn(yourBehavior, "DefaultDispatcher")
context.spawn(yourBehavior, "ExplicitDefaultDispatcher",
DispatcherSelector.default().withMailboxFromConfig("my-app.my-special-mailbox"))
DispatcherSelector.default().withMailboxFromConfig("your-mailbox"))
context.spawn(yourBehavior, "BlockingDispatcher",
DispatcherSelector.blocking().withMailboxFromConfig("my-app.my-special-mailbox"))
DispatcherSelector.blocking().withMailboxFromConfig("your-mailbox"))
context.spawn(yourBehavior, "ParentDispatcher",
DispatcherSelector.sameAsParent().withMailboxFromConfig("my-app.my-special-mailbox"))
DispatcherSelector.sameAsParent().withMailboxFromConfig("your-mailbox"))
context.spawn(yourBehavior, "DispatcherFromConfig",
DispatcherSelector.fromConfig("your-dispatcher").withMailboxFromConfig("my-app.my-special-mailbox"))
DispatcherSelector.fromConfig("your-dispatcher").withMailboxFromConfig("your-mailbox"))
// #interoperability-with-mailbox

Behaviors.same
Expand All @@ -86,8 +89,7 @@ object DispatchersDocSpec {
}

class DispatchersDocSpec
extends ScalaTestWithActorTestKit(
DispatchersDocSpec.config.withFallback(ConfigFactory.load("mailbox-config-sample.conf")))
extends ScalaTestWithActorTestKit(DispatchersDocSpec.config)
with AnyWordSpecLike
with LogCapturing {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import pekko.actor.typed.Behavior
import pekko.actor.typed.MailboxSelector
import pekko.actor.typed.scaladsl.Behaviors
import com.typesafe.config.ConfigFactory
import org.apache.pekko.actor.typed.Dispatchers
import org.scalatest.wordspec.AnyWordSpecLike

class MailboxDocSpec
extends ScalaTestWithActorTestKit(
ConfigFactory.load("mailbox-config-sample.conf").withFallback(DispatchersDocSpec.config))
extends ScalaTestWithActorTestKit(ConfigFactory.load("mailbox-config-sample.conf"))
with AnyWordSpecLike
with LogCapturing {

Expand Down Expand Up @@ -58,7 +58,8 @@ class MailboxDocSpec
context.spawn(childBehavior, "bounded-mailbox-child", MailboxSelector.bounded(100).withDispatcherDefault)

val props =
MailboxSelector.fromConfig("my-app.my-special-mailbox").withDispatcherFromConfig("your-dispatcher")
MailboxSelector.fromConfig("my-app.my-special-mailbox").withDispatcherFromConfig(
Dispatchers.DefaultDispatcherId)
context.spawn(childBehavior, "from-config-mailbox-child", props)
// #interoperability-with-dispatcher

Expand Down

0 comments on commit 9c1022f

Please sign in to comment.