This is an automated email from the ASF dual-hosted git repository.
engelen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko.git
The following commit(s) were added to refs/heads/main by this push:
new 6906820e69 JavaDSL TestKit - add shutdownActorSystem that takes Java
Duration params (#2277)
6906820e69 is described below
commit 6906820e697d6c3289c54687561a3d7b70d5baa6
Author: PJ Fanning <[email protected]>
AuthorDate: Sun Sep 28 16:30:56 2025 +0100
JavaDSL TestKit - add shutdownActorSystem that takes Java Duration params
(#2277)
* JavaDSL TestKit - add shutdownActorSystem that takes Java Duration params
* format
---
.../org/apache/pekko/testkit/javadsl/TestKit.scala | 35 ++++++++++++++++++++++
.../pekko/testkit/javadsl/TestKitApiTest.java | 2 ++
2 files changed, 37 insertions(+)
diff --git
a/testkit/src/main/scala/org/apache/pekko/testkit/javadsl/TestKit.scala
b/testkit/src/main/scala/org/apache/pekko/testkit/javadsl/TestKit.scala
index f2e0398f01..19f4e47023 100644
--- a/testkit/src/main/scala/org/apache/pekko/testkit/javadsl/TestKit.scala
+++ b/testkit/src/main/scala/org/apache/pekko/testkit/javadsl/TestKit.scala
@@ -583,6 +583,41 @@ object TestKit {
shutdownActorSystem(actorSystem, 10.seconds, verifySystemShutdown)
}
+ /**
+ * Shut down an actor system and wait for termination.
+ * On failure debug output will be logged about the remaining actors in the
system.
+ *
+ * The `duration` is dilated by the timefactor. This overloaded
+ * method accepts `java.time.Duration`.
+ *
+ * If verifySystemShutdown is true, then an exception will be thrown on
failure.
+ *
+ * @since 1.3.0
+ */
+ def shutdownActorSystem(
+ actorSystem: ActorSystem,
+ duration: java.time.Duration): Unit = {
+ import scala.jdk.DurationConverters._
+ pekko.testkit.TestKit.shutdownActorSystem(actorSystem, duration.toScala)
+ }
+
+ /**
+ * Shut down an actor system and wait for termination.
+ * On failure debug output will be logged about the remaining actors in the
system.
+ *
+ * The `duration` is dilated by the timefactor. This overloaded
+ * method accepts `java.time.Duration`.
+ *
+ * @since 1.3.0
+ */
+ def shutdownActorSystem(
+ actorSystem: ActorSystem,
+ duration: java.time.Duration,
+ verifySystemShutdown: Boolean): Unit = {
+ import scala.jdk.DurationConverters._
+ pekko.testkit.TestKit.shutdownActorSystem(actorSystem, duration.toScala,
verifySystemShutdown)
+ }
+
}
/**
diff --git
a/testkit/src/test/java/org/apache/pekko/testkit/javadsl/TestKitApiTest.java
b/testkit/src/test/java/org/apache/pekko/testkit/javadsl/TestKitApiTest.java
index 1ac6920a8c..d4dc27a481 100644
--- a/testkit/src/test/java/org/apache/pekko/testkit/javadsl/TestKitApiTest.java
+++ b/testkit/src/test/java/org/apache/pekko/testkit/javadsl/TestKitApiTest.java
@@ -176,5 +176,7 @@ public class TestKitApiTest {
testKit.unwatch(actorRef);
testKit.setAutoPilot(autoPilot);
+
+ TestKit.shutdownActorSystem(testKit.getSystem(), Duration.ofSeconds(10));
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]