This is an automated email from the ASF dual-hosted git repository.
fanningpj pushed a commit to branch 1.3.x
in repository https://gitbox.apache.org/repos/asf/pekko.git
The following commit(s) were added to refs/heads/1.3.x by this push:
new 55721d3422 JavaDSL TestKit - add shutdownActorSystem that takes Java
Duration params (#2278)
55721d3422 is described below
commit 55721d3422a651c1eaf13f4f2a4204b897abdae8
Author: PJ Fanning <[email protected]>
AuthorDate: Sun Sep 28 18:00:10 2025 +0100
JavaDSL TestKit - add shutdownActorSystem that takes Java Duration params
(#2278)
* JavaDSL TestKit - add shutdownActorSystem that takes Java Duration params
(#2277)
* JavaDSL TestKit - add shutdownActorSystem that takes Java Duration params
* format
* need to use pekko util JavaDurationConverters for Scala 2.12 support
---
.../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 aa352257d8..074e716116 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
@@ -899,6 +899,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 pekko.util.JavaDurationConverters._
+ pekko.testkit.TestKit.shutdownActorSystem(actorSystem, duration.asScala)
+ }
+
+ /**
+ * 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 pekko.util.JavaDurationConverters._
+ pekko.testkit.TestKit.shutdownActorSystem(actorSystem, duration.asScala,
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 0d70c2cba4..17716ce3f8 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
@@ -177,5 +177,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]