You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pekko.apache.org by gi...@apache.org on 2025/01/14 19:37:59 UTC
(pekko) 02/03: Reformat with scalafmt 3.8.4
This is an automated email from the ASF dual-hosted git repository.
github-bot pushed a commit to branch update/scalafmt-core-3.8.4
in repository https://gitbox.apache.org/repos/asf/pekko.git
commit f48453e60a8d11f74acc7a10d3a9da90b8acd4af
Author: scala-steward-asf[bot] <14...@users.noreply.github.com>
AuthorDate: Tue Jan 14 19:37:51 2025 +0000
Reformat with scalafmt 3.8.4
Executed command: scalafmt --non-interactive
---
.../actor/ActorConfigurationVerificationSpec.scala | 2 +-
.../apache/pekko/actor/ActorCreationPerfSpec.scala | 10 ++--
.../org/apache/pekko/actor/ActorRefSpec.scala | 6 +-
.../org/apache/pekko/actor/ActorSystemSpec.scala | 14 ++---
.../pekko/actor/ActorWithBoundedStashSpec.scala | 4 +-
.../apache/pekko/actor/ActorWithStashSpec.scala | 8 +--
.../org/apache/pekko/actor/ConsistencySpec.scala | 2 +-
.../org/apache/pekko/actor/DeathWatchSpec.scala | 6 +-
.../org/apache/pekko/actor/DeployerSpec.scala | 4 +-
.../org/apache/pekko/actor/FSMActorSpec.scala | 36 +++++------
.../org/apache/pekko/actor/FSMTimingSpec.scala | 44 +++++++-------
.../org/apache/pekko/actor/FSMTransitionSpec.scala | 12 ++--
.../org/apache/pekko/actor/ForwardActorSpec.scala | 6 +-
.../pekko/actor/LocalActorRefProviderSpec.scala | 4 +-
.../apache/pekko/actor/ReceiveTimeoutSpec.scala | 20 +++----
.../apache/pekko/actor/RestartStrategySpec.scala | 42 ++++++-------
.../org/apache/pekko/actor/SchedulerSpec.scala | 22 +++----
.../pekko/actor/SupervisorHierarchySpec.scala | 12 ++--
.../apache/pekko/actor/SupervisorMiscSpec.scala | 2 +-
.../org/apache/pekko/actor/SupervisorSpec.scala | 18 +++---
.../apache/pekko/actor/SupervisorTreeSpec.scala | 6 +-
.../org/apache/pekko/actor/Ticket669Spec.scala | 2 +-
.../org/apache/pekko/actor/TypedActorSpec.scala | 32 +++++-----
.../pekko/actor/dispatch/ActorModelSpec.scala | 6 +-
.../pekko/actor/dispatch/DispatcherActorSpec.scala | 2 +-
.../org/apache/pekko/dataflow/Future2Actor.scala | 6 +-
.../apache/pekko/dispatch/MailboxConfigSpec.scala | 14 ++---
.../pekko/dispatch/PriorityDispatcherSpec.scala | 4 +-
.../dispatch/StablePriorityDispatcherSpec.scala | 6 +-
.../apache/pekko/event/LoggingReceiveSpec.scala | 12 ++--
.../org/apache/pekko/io/TcpIntegrationSpec.scala | 2 +-
.../scala/org/apache/pekko/pattern/AskSpec.scala | 66 ++++++++++----------
.../pattern/BackoffOnRestartSupervisorSpec.scala | 26 ++++----
.../apache/pekko/pattern/CircuitBreakerSpec.scala | 2 +-
.../org/apache/pekko/pattern/PatternSpec.scala | 14 ++---
.../scala/org/apache/pekko/pattern/RetrySpec.scala | 36 +++++------
.../pekko/routing/ConfiguredLocalRoutingSpec.scala | 12 ++--
.../org/apache/pekko/routing/RandomSpec.scala | 10 ++--
.../org/apache/pekko/routing/ResizerSpec.scala | 14 ++---
.../org/apache/pekko/routing/RoundRobinSpec.scala | 12 ++--
.../org/apache/pekko/routing/RoutingSpec.scala | 2 +-
.../apache/pekko/serialization/SerializeSpec.scala | 2 +-
.../scala/org/apache/pekko/util/DurationSpec.scala | 12 ++--
.../pekko/actor/typed/delivery/TestConsumer.scala | 3 +-
.../org/apache/pekko/io/DirectByteBufferPool.scala | 4 +-
.../apache/pekko/cluster/metrics/Provision.scala | 2 +-
.../metrics/ClusterMetricsExtensionSpec.scala | 4 +-
.../metrics/ClusterMetricsRoutingSpec.scala | 2 +-
.../cluster/metrics/sample/StatsSampleSpec.scala | 6 +-
.../metrics/ClusterMetricsExtensionSpec.scala | 4 +-
.../metrics/ClusterMetricsSettingsSpec.scala | 8 +--
.../cluster/metrics/MetricsCollectorSpec.scala | 2 +-
.../apache/pekko/cluster/metrics/TestUtil.scala | 2 +-
.../RandomizedBrainResolverIntegrationSpec.scala | 4 +-
.../cluster/sharding/ClusterShardingSpec.scala | 48 +++++++--------
.../pekko/cluster/client/ClusterClientSpec.scala | 12 ++--
.../pubsub/DistributedPubSubMediatorSpec.scala | 30 +++++-----
.../pubsub/DistributedPubSubRestartSpec.scala | 4 +-
.../ClusterSingletonManagerChaosSpec.scala | 4 +-
.../singleton/ClusterSingletonManagerSpec.scala | 16 ++---
.../org/apache/pekko/cluster/ClusterEvent.scala | 6 +-
.../scala/org/apache/pekko/cluster/Member.scala | 3 +-
.../pekko/cluster/sbr/SplitBrainResolver.scala | 3 +-
.../pekko/cluster/ClusterDeathWatchSpec.scala | 8 +--
.../org/apache/pekko/cluster/ConvergenceSpec.scala | 2 +-
.../pekko/cluster/InitialHeartbeatSpec.scala | 6 +-
.../LeaderDowningNodeThatIsUnreachableSpec.scala | 2 +-
.../apache/pekko/cluster/LeaderElectionSpec.scala | 4 +-
.../scala/org/apache/pekko/cluster/MBeanSpec.scala | 6 +-
.../apache/pekko/cluster/MemberWeaklyUpSpec.scala | 6 +-
.../pekko/cluster/RestartFirstSeedNodeSpec.scala | 4 +-
.../org/apache/pekko/cluster/SplitBrainSpec.scala | 2 +-
.../org/apache/pekko/cluster/StressSpec.scala | 2 +-
.../cluster/UnreachableNodeJoinsAgainSpec.scala | 12 ++--
.../cluster/routing/ClusterRoundRobinSpec.scala | 2 +-
.../pekko/cluster/routing/UseRoleIgnoredSpec.scala | 2 +-
.../apache/pekko/cluster/ClusterConfigSpec.scala | 24 ++++----
docs/src/test/scala/docs/actor/ActorDocSpec.scala | 18 +++---
docs/src/test/scala/docs/actor/FSMDocSpec.scala | 6 +-
.../scala/docs/actor/FaultHandlingDocSample.scala | 10 ++--
.../scala/docs/actor/FaultHandlingDocSpec.scala | 6 +-
.../test/scala/docs/actor/SchedulerDocSpec.scala | 6 +-
docs/src/test/scala/docs/duration/Sample.scala | 2 +-
.../src/test/scala/docs/future/FutureDocSpec.scala | 56 ++++++++---------
.../stream/operators/sourceorflow/FoldAsync.scala | 3 +-
.../test/scala/docs/testkit/TestKitUsageSpec.scala | 10 ++--
.../test/scala/docs/testkit/TestkitDocSpec.scala | 14 ++---
.../pekko/remote/testconductor/Conductor.scala | 2 +-
.../typed/javadsl/CommandHandlerWithReply.scala | 3 +-
.../AtLeastOnceDeliveryFailureSpec.scala | 2 +-
.../SnapshotFailureRobustnessSpec.scala | 2 +-
.../pekko/persistence/fsm/PersistentFSMSpec.scala | 36 +++++------
.../apache/pekko/remote/NewRemoteActorSpec.scala | 2 +-
.../apache/pekko/remote/RemoteDeliverySpec.scala | 2 +-
.../remote/RemoteDeploymentDeathWatchSpec.scala | 2 +-
.../pekko/remote/RemoteNodeDeathWatchSpec.scala | 70 +++++++++++-----------
.../artery/RemoteRestartedQuarantinedSpec.scala | 2 +-
.../RemoteNodeShutdownAndComesBackSpec.scala | 2 +-
.../remote/routing/RemoteRoundRobinSpec.scala | 6 +-
.../remote/testconductor/TestConductorSpec.scala | 10 ++--
.../pekko/remote/testconductor/BarrierSpec.scala | 46 +++++++-------
.../org/apache/pekko/remote/RemoteConfigSpec.scala | 30 +++++-----
.../pekko/remote/artery/RemoteWatcherSpec.scala | 68 ++++++++++-----------
.../pekko/remote/classic/RemoteInitErrorSpec.scala | 2 +-
.../pekko/remote/classic/RemoteWatcherSpec.scala | 68 ++++++++++-----------
.../apache/pekko/event/slf4j/Slf4jLoggerSpec.scala | 28 ++++-----
.../pekko/stream/scaladsl/GraphZipLatestSpec.scala | 6 +-
.../stream/scaladsl/GraphZipLatestWithSpec.scala | 4 +-
.../stream/scaladsl/SinkForeachAsyncSpec.scala | 6 +-
.../pekko/stream/MapAsyncPartitionedSpec.scala | 36 +++++------
.../org/apache/pekko/stream/javadsl/Flow.scala | 3 +-
.../org/apache/pekko/stream/javadsl/Source.scala | 3 +-
.../pekko/testkit/CallingThreadDispatcher.scala | 2 +-
.../scala/org/apache/pekko/testkit/TestKit.scala | 2 +-
.../scala/org/apache/pekko/testkit/PekkoSpec.scala | 2 +-
.../org/apache/pekko/testkit/PekkoSpecSpec.scala | 8 +--
.../apache/pekko/testkit/TestActorRefSpec.scala | 4 +-
.../org/apache/pekko/testkit/TestFSMRefSpec.scala | 6 +-
.../org/apache/pekko/testkit/TestProbeSpec.scala | 22 +++----
119 files changed, 724 insertions(+), 717 deletions(-)
diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/ActorConfigurationVerificationSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/ActorConfigurationVerificationSpec.scala
index 5e5546324e..ea93a9f890 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/actor/ActorConfigurationVerificationSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/actor/ActorConfigurationVerificationSpec.scala
@@ -79,7 +79,7 @@ class ActorConfigurationVerificationSpec
"fail verification with a ConfigurationException if also configured with a ScatterGatherFirstCompletedPool" in {
intercept[ConfigurationException] {
system.actorOf(
- ScatterGatherFirstCompletedPool(nrOfInstances = 2, within = 2 seconds)
+ ScatterGatherFirstCompletedPool(nrOfInstances = 2, within = 2.seconds)
.withDispatcher("balancing-dispatcher")
.props(Props[TestActor]()))
}
diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/ActorCreationPerfSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/ActorCreationPerfSpec.scala
index 140a821f02..7200d2cc86 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/actor/ActorCreationPerfSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/actor/ActorCreationPerfSpec.scala
@@ -153,10 +153,10 @@ class ActorCreationPerfSpec
expectMsg(Alive)
driver ! Create(number, propsCreator)
- expectMsgPF(15 seconds, s"$scenarioName waiting for Created") { case Created => }
+ expectMsgPF(15.seconds, s"$scenarioName waiting for Created") { case Created => }
driver ! WaitForChildren
- expectMsgPF(15 seconds, s"$scenarioName waiting for Waited") { case Waited => }
+ expectMsgPF(15.seconds, s"$scenarioName waiting for Waited") { case Waited => }
driver ! PoisonPill
watch(driver)
@@ -175,10 +175,10 @@ class ActorCreationPerfSpec
val before = mem.getHeapSnapshot
driver ! Create(number, propsCreator)
- expectMsgPF(15 seconds, s"$scenarioName waiting for Created") { case Created => }
+ expectMsgPF(15.seconds, s"$scenarioName waiting for Created") { case Created => }
driver ! WaitForChildren
- expectMsgPF(15 seconds, s"$scenarioName waiting for Waited") { case Waited => }
+ expectMsgPF(15.seconds, s"$scenarioName waiting for Waited") { case Waited => }
gc()
val after = mem.getHeapSnapshot
@@ -252,5 +252,5 @@ class ActorCreationPerfSpec
override def afterTermination() = shutdownMetrics()
- override def expectedTestDuration = 5 minutes
+ override def expectedTestDuration = 5.minutes
}
diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/ActorRefSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/ActorRefSpec.scala
index ebf47bed86..272e05b04b 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/actor/ActorRefSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/actor/ActorRefSpec.scala
@@ -141,7 +141,7 @@ class ActorRefSpec extends PekkoSpec("""
def wrap[T](f: Promise[Actor] => T): T = {
val result = Promise[Actor]()
val r = f(result)
- Await.result(result.future, 1 minute)
+ Await.result(result.future, 1.minute)
r
}
@@ -448,7 +448,7 @@ class ActorRefSpec extends PekkoSpec("""
val boss = system.actorOf(Props(new Actor {
override val supervisorStrategy =
- OneForOneStrategy(maxNrOfRetries = 2, withinTimeRange = 1 second)(List(classOf[Throwable]))
+ OneForOneStrategy(maxNrOfRetries = 2, withinTimeRange = 1.second)(List(classOf[Throwable]))
val ref = context.actorOf(Props(new Actor {
def receive = { case _ => }
@@ -460,7 +460,7 @@ class ActorRefSpec extends PekkoSpec("""
}))
boss ! "sendKill"
- Await.ready(latch, 5 seconds)
+ Await.ready(latch, 5.seconds)
}
}
diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/ActorSystemSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/ActorSystemSpec.scala
index c8af272fa9..06e0dfbcd4 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/actor/ActorSystemSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/actor/ActorSystemSpec.scala
@@ -224,7 +224,7 @@ class ActorSystemSpec extends PekkoSpec(ActorSystemSpec.config) with ImplicitSen
}
system2.terminate()
- Await.ready(latch, 5 seconds)
+ Await.ready(latch, 5.seconds)
val expected = (for (i <- 1 to count) yield i).reverse
@@ -243,7 +243,7 @@ class ActorSystemSpec extends PekkoSpec(ActorSystemSpec.config) with ImplicitSen
import system.dispatcher
system2.scheduler.scheduleOnce(200.millis.dilated) { system2.terminate() }
- Await.ready(system2.whenTerminated, 5 seconds)
+ Await.ready(system2.whenTerminated, 5.seconds)
callbackWasRun should ===(true)
}
@@ -252,17 +252,17 @@ class ActorSystemSpec extends PekkoSpec(ActorSystemSpec.config) with ImplicitSen
val wt = system.whenTerminated
wt.isCompleted should ===(false)
val f = system.terminate()
- val terminated = Await.result(wt, 10 seconds)
+ val terminated = Await.result(wt, 10.seconds)
system.whenTerminated.isCompleted should ===(true)
terminated.actor should ===(system.provider.rootGuardian)
terminated.addressTerminated should ===(true)
terminated.existenceConfirmed should ===(true)
- (terminated should be).theSameInstanceAs(Await.result(f, 10 seconds))
+ (terminated should be).theSameInstanceAs(Await.result(f, 10.seconds))
}
"throw RejectedExecutionException when shutdown" in {
val system2 = ActorSystem("RejectedExecution-1", PekkoSpec.testConf)
- Await.ready(system2.terminate(), 10 seconds)
+ Await.ready(system2.terminate(), 10.seconds)
intercept[RejectedExecutionException] {
system2.registerOnTermination { println("IF YOU SEE THIS THEN THERE'S A BUG HERE") }
@@ -287,7 +287,7 @@ class ActorSystemSpec extends PekkoSpec(ActorSystemSpec.config) with ImplicitSen
"reliably create waves of actors" in {
import system.dispatcher
- implicit val timeout: Timeout = Timeout((20 seconds).dilated)
+ implicit val timeout: Timeout = Timeout(20.seconds.dilated)
val waves = for (_ <- 1 to 3) yield system.actorOf(Props[ActorSystemSpec.Waves]()) ? 50000
Await.result(Future.sequence(waves), timeout.duration + 5.seconds) should ===(Vector("done", "done", "done"))
}
@@ -300,7 +300,7 @@ class ActorSystemSpec extends PekkoSpec(ActorSystemSpec.config) with ImplicitSen
"reliable deny creation of actors while shutting down" in {
val system = ActorSystem()
import system.dispatcher
- system.scheduler.scheduleOnce(100 millis) { system.terminate() }
+ system.scheduler.scheduleOnce(100.millis) { system.terminate() }
var failing = false
var created = Vector.empty[ActorRef]
while (!system.whenTerminated.isCompleted) {
diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/ActorWithBoundedStashSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/ActorWithBoundedStashSpec.scala
index e8a1ec7d2d..f89d2e20e3 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/actor/ActorWithBoundedStashSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/actor/ActorWithBoundedStashSpec.scala
@@ -67,9 +67,9 @@ object ActorWithBoundedStashSpec {
}
// bounded deque-based mailbox with capacity 10
- class Bounded10(@unused settings: Settings, @unused config: Config) extends BoundedDequeBasedMailbox(10, 500 millis)
+ class Bounded10(@unused settings: Settings, @unused config: Config) extends BoundedDequeBasedMailbox(10, 500.millis)
- class Bounded100(@unused settings: Settings, @unused config: Config) extends BoundedDequeBasedMailbox(100, 500 millis)
+ class Bounded100(@unused settings: Settings, @unused config: Config) extends BoundedDequeBasedMailbox(100, 500.millis)
val dispatcherId1 = "my-dispatcher-1"
val dispatcherId2 = "my-dispatcher-2"
diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/ActorWithStashSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/ActorWithStashSpec.scala
index 636117cd85..d568f561eb 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/actor/ActorWithStashSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/actor/ActorWithStashSpec.scala
@@ -144,13 +144,13 @@ class ActorWithStashSpec extends PekkoSpec with DefaultTimeout with BeforeAndAft
val stasher = system.actorOf(Props[StashingTwiceActor]())
stasher ! "hello"
stasher ! "hello"
- Await.ready(state.expectedException, 10 seconds)
+ Await.ready(state.expectedException, 10.seconds)
}
"process stashed messages after restart" in {
val boss = system.actorOf(
Props(
- new Supervisor(OneForOneStrategy(maxNrOfRetries = 2, withinTimeRange = 1 second)(List(classOf[Throwable])))))
+ new Supervisor(OneForOneStrategy(maxNrOfRetries = 2, withinTimeRange = 1.second)(List(classOf[Throwable])))))
val restartLatch = new TestLatch
val hasMsgLatch = new TestLatch
@@ -180,8 +180,8 @@ class ActorWithStashSpec extends PekkoSpec with DefaultTimeout with BeforeAndAft
employee ! "hello"
employee ! "crash"
- Await.ready(restartLatch, 10 seconds)
- Await.ready(hasMsgLatch, 10 seconds)
+ Await.ready(restartLatch, 10.seconds)
+ Await.ready(hasMsgLatch, 10.seconds)
}
"re-receive unstashed Terminated messages" in {
diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/ConsistencySpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/ConsistencySpec.scala
index b4777152a3..40def6754d 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/actor/ConsistencySpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/actor/ConsistencySpec.scala
@@ -80,7 +80,7 @@ class ConsistencySpec extends PekkoSpec(ConsistencySpec.config) {
for (a <- actors) { a.tell("done", testActor) }
- for (_ <- actors) expectMsg(5 minutes, "done")
+ for (_ <- actors) expectMsg(5.minutes, "done")
}
}
}
diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/DeathWatchSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/DeathWatchSpec.scala
index 6c25147c31..17d46d39ef 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/actor/DeathWatchSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/actor/DeathWatchSpec.scala
@@ -125,11 +125,11 @@ trait DeathWatchSpec { this: PekkoSpec with ImplicitSender with DefaultTimeout =
lazy val supervisor = system.actorOf(Props(classOf[Supervisor], SupervisorStrategy.defaultStrategy), "watchers")
def startWatching(target: ActorRef) =
- Await.result((supervisor ? Watcher.props(target, testActor)).mapTo[ActorRef], 3 seconds)
+ Await.result((supervisor ? Watcher.props(target, testActor)).mapTo[ActorRef], 3.seconds)
"The Death Watch" must {
def expectTerminationOf(actorRef: ActorRef) =
- expectMsgPF(5 seconds, "" + actorRef + ": Stopped or Already terminated when linking") {
+ expectMsgPF(5.seconds, "" + actorRef + ": Stopped or Already terminated when linking") {
case WrappedTerminated(Terminated(`actorRef`)) => true
}
@@ -236,7 +236,7 @@ trait DeathWatchSpec { this: PekkoSpec with ImplicitSender with DefaultTimeout =
startWatching(brother)
failed ! Kill
- val result = receiveWhile(3 seconds, messages = 3) {
+ val result = receiveWhile(3.seconds, messages = 3) {
case FF(Failed(_, _: ActorKilledException, _)) if lastSender eq failed => 1
case FF(Failed(_, DeathPactException(`failed`), _)) if lastSender eq brother => 2
case WrappedTerminated(Terminated(`brother`)) => 3
diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/DeployerSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/DeployerSpec.scala
index e19dedaabc..4fb87ac4f2 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/actor/DeployerSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/actor/DeployerSpec.scala
@@ -201,7 +201,7 @@ class DeployerSpec extends PekkoSpec(DeployerSpec.deployerConf) {
"be able to parse 'pekko.actor.deployment._' with scatter-gather router" in {
assertRouting(
"/service-scatter-gather",
- ScatterGatherFirstCompletedPool(nrOfInstances = 1, within = 2 seconds),
+ ScatterGatherFirstCompletedPool(nrOfInstances = 1, within = 2.seconds),
"/service-scatter-gather")
}
@@ -218,7 +218,7 @@ class DeployerSpec extends PekkoSpec(DeployerSpec.deployerConf) {
assertRouting("/some/wildcardmatch", RandomPool(1), "/some/*")
assertRouting(
"/somewildcardmatch/some",
- ScatterGatherFirstCompletedPool(nrOfInstances = 1, within = 2 seconds),
+ ScatterGatherFirstCompletedPool(nrOfInstances = 1, within = 2.seconds),
"/*/some")
}
diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/FSMActorSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/FSMActorSpec.scala
index 5138864c2c..422f2839f3 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/actor/FSMActorSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/actor/FSMActorSpec.scala
@@ -113,7 +113,7 @@ object FSMActorSpec {
class FSMActorSpec extends PekkoSpec(Map("pekko.actor.debug.fsm" -> true)) with ImplicitSender {
import FSMActorSpec._
- val timeout = Timeout(2 seconds)
+ val timeout = Timeout(2.seconds)
"An FSM Actor" must {
@@ -125,7 +125,7 @@ class FSMActorSpec extends PekkoSpec(Map("pekko.actor.debug.fsm" -> true)) with
import latches._
// lock that locked after being open for 1 sec
- val lock = system.actorOf(Props(new Lock("33221", 1 second, latches)))
+ val lock = system.actorOf(Props(new Lock("33221", 1.second, latches)))
val transitionTester = system.actorOf(Props(new Actor {
def receive = {
@@ -179,7 +179,7 @@ class FSMActorSpec extends PekkoSpec(Map("pekko.actor.debug.fsm" -> true)) with
EventFilter.error("Next state 2 does not exist", occurrences = 1).intercept {
system.eventStream.subscribe(testActor, classOf[Logging.Error])
fsm ! "go"
- expectMsgPF(1 second, hint = "Next state 2 does not exist") {
+ expectMsgPF(1.second, hint = "Next state 2 does not exist") {
case Logging.Error(_, `name`, _, "Next state 2 does not exist") => true
}
system.eventStream.unsubscribe(testActor)
@@ -203,7 +203,7 @@ class FSMActorSpec extends PekkoSpec(Map("pekko.actor.debug.fsm" -> true)) with
val ref = system.actorOf(Props(fsm))
Await.ready(started, timeout.duration)
system.stop(ref)
- expectMsg(1 second, fsm.StopEvent(FSM.Shutdown, 1, null))
+ expectMsg(1.second, fsm.StopEvent(FSM.Shutdown, 1, null))
}
"run onTermination with updated state upon stop(reason, stateData)" in {
@@ -230,12 +230,12 @@ class FSMActorSpec extends PekkoSpec(Map("pekko.actor.debug.fsm" -> true)) with
when("not-started") {
case Event("start", _) => goto("started").replying("starting")
}
- when("started", stateTimeout = 10 seconds) {
+ when("started", stateTimeout = 10.seconds) {
case Event("stop", _) => stop()
}
onTransition {
case "not-started" -> "started" =>
- for (timerName <- timerNames) startSingleTimer(timerName, (), 10 seconds)
+ for (timerName <- timerNames) startSingleTimer(timerName, (), 10.seconds)
}
onTermination {
case _ => {
@@ -253,11 +253,11 @@ class FSMActorSpec extends PekkoSpec(Map("pekko.actor.debug.fsm" -> true)) with
checkTimersActive(false)
fsmref ! "start"
- expectMsg(1 second, "starting")
+ expectMsg(1.second, "starting")
checkTimersActive(true)
fsmref ! "stop"
- expectMsg(1 second, "stopped")
+ expectMsg(1.second, "stopped")
}
"log events and transitions if asked to do so" in {
@@ -273,7 +273,7 @@ class FSMActorSpec extends PekkoSpec(Map("pekko.actor.debug.fsm" -> true)) with
startWith(1, null)
when(1) {
case Event("go", _) =>
- startSingleTimer("t", FSM.Shutdown, 1.5 seconds)
+ startSingleTimer("t", FSM.Shutdown, 1.5.seconds)
goto(2)
}
when(2) {
@@ -289,21 +289,21 @@ class FSMActorSpec extends PekkoSpec(Map("pekko.actor.debug.fsm" -> true)) with
val fsmClass = fsm.underlyingActor.getClass
system.eventStream.subscribe(testActor, classOf[Logging.Debug])
fsm ! "go"
- expectMsgPF(1 second, hint = "processing Event(go,null)") {
+ expectMsgPF(1.second, hint = "processing Event(go,null)") {
case Logging.Debug(`name`, `fsmClass`, s: String)
if s.startsWith("processing Event(go,null) from Actor[") =>
true
}
- expectMsg(1 second, Logging.Debug(name, fsmClass, "setting timer 't'/1500 milliseconds: Shutdown"))
- expectMsg(1 second, Logging.Debug(name, fsmClass, "transition 1 -> 2"))
+ expectMsg(1.second, Logging.Debug(name, fsmClass, "setting timer 't'/1500 milliseconds: Shutdown"))
+ expectMsg(1.second, Logging.Debug(name, fsmClass, "transition 1 -> 2"))
fsm ! "stop"
- expectMsgPF(1 second, hint = "processing Event(stop,null)") {
+ expectMsgPF(1.second, hint = "processing Event(stop,null)") {
case Logging.Debug(`name`, `fsmClass`, s: String)
if s.startsWith("processing Event(stop,null) from Actor[") =>
true
}
- expectMsgAllOf(1 second, Logging.Debug(name, fsmClass, "canceling timer 't'"), FSM.Normal)
- expectNoMessage(1 second)
+ expectMsgAllOf(1.second, Logging.Debug(name, fsmClass, "canceling timer 't'"), FSM.Normal)
+ expectNoMessage(1.second)
system.eventStream.unsubscribe(testActor)
}
}
@@ -323,13 +323,13 @@ class FSMActorSpec extends PekkoSpec(Map("pekko.actor.debug.fsm" -> true)) with
})
fsmref ! "log"
import FSM.LogEntry
- expectMsg(1 second, IndexedSeq(LogEntry(1, 0, "log")))
+ expectMsg(1.second, IndexedSeq(LogEntry(1, 0, "log")))
fsmref ! "count"
fsmref ! "log"
- expectMsg(1 second, IndexedSeq(LogEntry(1, 0, "log"), LogEntry(1, 0, "count"), LogEntry(1, 1, "log")))
+ expectMsg(1.second, IndexedSeq(LogEntry(1, 0, "log"), LogEntry(1, 0, "count"), LogEntry(1, 1, "log")))
fsmref ! "count"
fsmref ! "log"
- expectMsg(1 second, IndexedSeq(LogEntry(1, 1, "log"), LogEntry(1, 1, "count"), LogEntry(1, 2, "log")))
+ expectMsg(1.second, IndexedSeq(LogEntry(1, 1, "log"), LogEntry(1, 1, "count"), LogEntry(1, 2, "log")))
}
"allow transforming of state results" in {
diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/FSMTimingSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/FSMTimingSpec.scala
index 3e032627ba..c5e7cd4929 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/actor/FSMTimingSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/actor/FSMTimingSpec.scala
@@ -24,7 +24,7 @@ class FSMTimingSpec extends PekkoSpec with ImplicitSender {
val fsm = system.actorOf(Props(new StateMachine(testActor)))
fsm ! SubscribeTransitionCallBack(testActor)
- expectMsg(1 second, CurrentState(fsm, Initial))
+ expectMsg(1.second, CurrentState(fsm, Initial))
ignoreMsg {
case Transition(_, bs: FSMTimingSpec.State, _) if bs eq Initial => true // SI-5900 workaround
@@ -33,8 +33,8 @@ class FSMTimingSpec extends PekkoSpec with ImplicitSender {
"A Finite State Machine" must {
"receive StateTimeout" taggedAs TimingTest in {
- within(2 seconds) {
- within(500 millis, 2 seconds) {
+ within(2.seconds) {
+ within(500.millis, 2.seconds) {
fsm ! TestStateTimeout
expectMsg(Transition(fsm, TestStateTimeout, Initial))
}
@@ -43,7 +43,7 @@ class FSMTimingSpec extends PekkoSpec with ImplicitSender {
}
"cancel a StateTimeout" taggedAs TimingTest in {
- within(1 second) {
+ within(1.second) {
fsm ! TestStateTimeout
fsm ! Cancel
expectMsg(Cancel)
@@ -56,18 +56,18 @@ class FSMTimingSpec extends PekkoSpec with ImplicitSender {
val stoppingActor = system.actorOf(Props[StoppingActor]())
system.eventStream.subscribe(testActor, classOf[DeadLetter])
stoppingActor ! TestStoppingActorStateTimeout
- within(400 millis) {
+ within(400.millis) {
expectNoMessage(remainingOrDefault)
}
}
"allow StateTimeout override" taggedAs TimingTest in {
// the timeout in state TestStateTimeout is 800 ms, then it will change to Initial
- within(400 millis) {
+ within(400.millis) {
fsm ! TestStateTimeoutOverride
expectNoMessage()
}
- within(1 second) {
+ within(1.second) {
fsm ! Cancel
expectMsg(Cancel)
expectMsg(Transition(fsm, TestStateTimeout, Initial))
@@ -75,8 +75,8 @@ class FSMTimingSpec extends PekkoSpec with ImplicitSender {
}
"receive single-shot timer" taggedAs TimingTest in {
- within(2 seconds) {
- within(500 millis, 1 second) {
+ within(2.seconds) {
+ within(500.millis, 1.second) {
fsm ! TestSingleTimer
expectMsg(Tick)
expectMsg(Transition(fsm, TestSingleTimer, Initial))
@@ -86,12 +86,12 @@ class FSMTimingSpec extends PekkoSpec with ImplicitSender {
}
"resubmit single-shot timer" taggedAs TimingTest in {
- within(2.5 seconds) {
- within(500 millis, 1 second) {
+ within(2.5.seconds) {
+ within(500.millis, 1.second) {
fsm ! TestSingleTimerResubmit
expectMsg(Tick)
}
- within(1 second) {
+ within(1.second) {
expectMsg(Tock)
expectMsg(Transition(fsm, TestSingleTimerResubmit, Initial))
}
@@ -101,28 +101,28 @@ class FSMTimingSpec extends PekkoSpec with ImplicitSender {
"correctly cancel a named timer" taggedAs TimingTest in {
fsm ! TestCancelTimer
- within(500 millis) {
+ within(500.millis) {
fsm ! Tick
expectMsg(Tick)
}
- within(300 millis, 1 second) {
+ within(300.millis, 1.second) {
expectMsg(Tock)
}
fsm ! Cancel
- expectMsg(1 second, Transition(fsm, TestCancelTimer, Initial))
+ expectMsg(1.second, Transition(fsm, TestCancelTimer, Initial))
}
"not get confused between named and state timers" taggedAs TimingTest in {
fsm ! TestCancelStateTimerInNamedTimerMessage
fsm ! Tick
- expectMsg(500 millis, Tick)
+ expectMsg(500.millis, Tick)
Thread.sleep(200) // this is ugly: need to wait for StateTimeout to be queued
resume(fsm)
expectMsg(
- 500 millis,
+ 500.millis,
Transition(fsm, TestCancelStateTimerInNamedTimerMessage, TestCancelStateTimerInNamedTimerMessage2))
fsm ! Cancel
- within(500 millis) {
+ within(500.millis) {
expectMsg(Cancel) // if this is not received, that means StateTimeout was not properly discarded
expectMsg(Transition(fsm, TestCancelStateTimerInNamedTimerMessage2, Initial))
}
@@ -130,11 +130,11 @@ class FSMTimingSpec extends PekkoSpec with ImplicitSender {
"receive and cancel a repeated timer" taggedAs TimingTest in {
fsm ! TestRepeatedTimer
- val seq = receiveWhile(2 seconds) {
+ val seq = receiveWhile(2.seconds) {
case Tick => Tick
}
(seq should have).length(5)
- within(500 millis) {
+ within(500.millis) {
expectMsg(Transition(fsm, TestRepeatedTimer, Initial))
}
}
@@ -147,7 +147,7 @@ class FSMTimingSpec extends PekkoSpec with ImplicitSender {
source = fsm.path.toString,
occurrences = 1)) {
fsm ! TestUnhandled
- within(3 second) {
+ within(3.second) {
fsm ! Tick
fsm ! SetHandler
fsm ! Tick
@@ -292,7 +292,7 @@ object FSMTimingSpec {
class StoppingActor extends Actor with FSM[State, Int] {
startWith(Initial, 0)
- when(Initial, 200 millis) {
+ when(Initial, 200.millis) {
case Event(TestStoppingActorStateTimeout, _) =>
context.stop(self)
stay()
diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/FSMTransitionSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/FSMTransitionSpec.scala
index 35c092e040..38a9c7b1c1 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/actor/FSMTransitionSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/actor/FSMTransitionSpec.scala
@@ -91,7 +91,7 @@ class FSMTransitionSpec extends PekkoSpec with ImplicitSender {
import FSM.{ CurrentState, SubscribeTransitionCallBack, Transition }
val fsm = system.actorOf(Props(new MyFSM(testActor)))
- within(1 second) {
+ within(1.second) {
fsm ! SubscribeTransitionCallBack(testActor)
expectMsg(CurrentState(fsm, 0))
fsm ! "tick"
@@ -105,10 +105,10 @@ class FSMTransitionSpec extends PekkoSpec with ImplicitSender {
val forward = system.actorOf(Props(new Forwarder(testActor)))
val fsm = system.actorOf(Props(new MyFSM(testActor)))
- within(1 second) {
+ within(1.second) {
fsm ! FSM.SubscribeTransitionCallBack(forward)
expectMsg(FSM.CurrentState(fsm, 0))
- pekko.pattern.gracefulStop(forward, 5 seconds)
+ pekko.pattern.gracefulStop(forward, 5.seconds)
fsm ! "tick"
expectNoMessage()
}
@@ -119,7 +119,7 @@ class FSMTransitionSpec extends PekkoSpec with ImplicitSender {
"make previous and next state data available in onTransition" in {
val fsm = system.actorOf(Props(new OtherFSM(testActor)))
- within(1 second) {
+ within(1.second) {
fsm ! "tick"
expectMsg((0, 1))
}
@@ -130,7 +130,7 @@ class FSMTransitionSpec extends PekkoSpec with ImplicitSender {
val forward = system.actorOf(Props(new Forwarder(testActor)))
val fsm = system.actorOf(Props(new OtherFSM(testActor)))
- within(1 second) {
+ within(1.second) {
fsm ! FSM.SubscribeTransitionCallBack(forward)
expectMsg(FSM.CurrentState(fsm, 0))
fsm ! "tick"
@@ -146,7 +146,7 @@ class FSMTransitionSpec extends PekkoSpec with ImplicitSender {
val forward = system.actorOf(Props(new Forwarder(testActor)))
val fsm = system.actorOf(Props(new OtherFSM(testActor)))
- within(1 second) {
+ within(1.second) {
fsm ! FSM.SubscribeTransitionCallBack(forward)
expectMsg(FSM.CurrentState(fsm, 0))
fsm ! "stay"
diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/ForwardActorSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/ForwardActorSpec.scala
index e7f1efa3c1..433e6ccae0 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/actor/ForwardActorSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/actor/ForwardActorSpec.scala
@@ -52,13 +52,13 @@ class ForwardActorSpec extends PekkoSpec {
val chain = createForwardingChain(system)
chain.tell(ExpectedMessage, replyTo)
- expectMsg(5 seconds, ExpectedMessage)
+ expectMsg(5.seconds, ExpectedMessage)
}
"forward actor reference when invoking forward on ask" in {
val chain = createForwardingChain(system)
- chain.ask(ExpectedMessage)(5 seconds).pipeTo(testActor)
- expectMsg(5 seconds, ExpectedMessage)
+ chain.ask(ExpectedMessage)(5.seconds).pipeTo(testActor)
+ expectMsg(5.seconds, ExpectedMessage)
}
}
}
diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/LocalActorRefProviderSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/LocalActorRefProviderSpec.scala
index 7073d1989d..f8ebd054ed 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/actor/LocalActorRefProviderSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/actor/LocalActorRefProviderSpec.scala
@@ -126,7 +126,7 @@ class LocalActorRefProviderSpec extends PekkoSpec(LocalActorRefProviderSpec.conf
val childProps2 = child.asInstanceOf[LocalActorRef].underlying.props
childProps2 should not be theSameInstanceAs(childProps1)
(childProps2 should be).theSameInstanceAs(ActorCell.terminatedProps)
- }, 1 second)
+ }, 1.second)
}
}
@@ -140,7 +140,7 @@ class LocalActorRefProviderSpec extends PekkoSpec(LocalActorRefProviderSpec.conf
for (i <- 0 until 100) {
val address = "new-actor" + i
- implicit val timeout: Timeout = Timeout(5 seconds)
+ implicit val timeout: Timeout = Timeout(5.seconds)
val actors =
for (_ <- 1 to 4)
yield Future(system.actorOf(Props(new Actor { def receive = { case _ => } }), address))
diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/ReceiveTimeoutSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/ReceiveTimeoutSpec.scala
index e00687a900..30f5d3b02a 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/actor/ReceiveTimeoutSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/actor/ReceiveTimeoutSpec.scala
@@ -85,7 +85,7 @@ class ReceiveTimeoutSpec extends PekkoSpec() {
val timeoutLatch = TestLatch()
val timeoutActor = system.actorOf(Props(new Actor {
- context.setReceiveTimeout(500 milliseconds)
+ context.setReceiveTimeout(500.milliseconds)
def receive = {
case ReceiveTimeout => timeoutLatch.open()
@@ -100,7 +100,7 @@ class ReceiveTimeoutSpec extends PekkoSpec() {
val timeoutLatch = TestLatch()
val timeoutActor = system.actorOf(Props(new Actor {
- context.setReceiveTimeout(500 milliseconds)
+ context.setReceiveTimeout(500.milliseconds)
def receive = {
case Tick => ()
@@ -119,7 +119,7 @@ class ReceiveTimeoutSpec extends PekkoSpec() {
val timeoutLatch = TestLatch()
val timeoutActor = system.actorOf(Props(new Actor {
- context.setReceiveTimeout(500 milliseconds)
+ context.setReceiveTimeout(500.milliseconds)
def receive = {
case Tick => ()
@@ -146,7 +146,7 @@ class ReceiveTimeoutSpec extends PekkoSpec() {
}
}))
- intercept[TimeoutException] { Await.ready(timeoutLatch, 1 second) }
+ intercept[TimeoutException] { Await.ready(timeoutLatch, 1.second) }
system.stop(timeoutActor)
}
@@ -154,7 +154,7 @@ class ReceiveTimeoutSpec extends PekkoSpec() {
val timeoutLatch = TestLatch()
val timeoutActor = system.actorOf(Props(new Actor {
- context.setReceiveTimeout(1 second)
+ context.setReceiveTimeout(1.second)
def receive = {
case ReceiveTimeout => timeoutLatch.open()
@@ -176,7 +176,7 @@ class ReceiveTimeoutSpec extends PekkoSpec() {
val timeoutLatch = TestLatch(2)
val timeoutActor = system.actorOf(Props(new Actor {
- context.setReceiveTimeout(1 second)
+ context.setReceiveTimeout(1.second)
def receive = {
case ReceiveTimeout =>
@@ -198,7 +198,7 @@ class ReceiveTimeoutSpec extends PekkoSpec() {
timers.startTimerWithFixedDelay("transparentTick", TransparentTick, 100.millis)
timers.startTimerWithFixedDelay("identifyTick", Identify(None), 100.millis)
- context.setReceiveTimeout(1 second)
+ context.setReceiveTimeout(1.second)
def receive: Receive = {
case ReceiveTimeout =>
timeoutLatch.open()
@@ -219,7 +219,7 @@ class ReceiveTimeoutSpec extends PekkoSpec() {
val timeoutActor = system.actorOf(Props(new Actor {
def receive = {
- case TransparentTick => context.setReceiveTimeout(500 milliseconds)
+ case TransparentTick => context.setReceiveTimeout(500.milliseconds)
case ReceiveTimeout => timeoutLatch.open()
}
}))
@@ -234,7 +234,7 @@ class ReceiveTimeoutSpec extends PekkoSpec() {
val timeoutLatch = TestLatch()
val timeoutActor = system.actorOf(Props(new Actor {
- context.setReceiveTimeout(500 milliseconds)
+ context.setReceiveTimeout(500.milliseconds)
def receive = {
case TransparentTick => context.setReceiveTimeout(Duration.Inf)
@@ -244,7 +244,7 @@ class ReceiveTimeoutSpec extends PekkoSpec() {
timeoutActor ! TransparentTick
- intercept[TimeoutException] { Await.ready(timeoutLatch, 1 second) }
+ intercept[TimeoutException] { Await.ready(timeoutLatch, 1.second) }
system.stop(timeoutActor)
}
diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/RestartStrategySpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/RestartStrategySpec.scala
index 0e7dec918f..d3cdd70cc8 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/actor/RestartStrategySpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/actor/RestartStrategySpec.scala
@@ -44,7 +44,7 @@ class RestartStrategySpec extends PekkoSpec with DefaultTimeout {
"ensure that employee stays dead after max restarts within time range" in {
val boss = system.actorOf(
Props(
- new Supervisor(OneForOneStrategy(maxNrOfRetries = 2, withinTimeRange = 1 second)(List(classOf[Throwable])))))
+ new Supervisor(OneForOneStrategy(maxNrOfRetries = 2, withinTimeRange = 1.second)(List(classOf[Throwable])))))
val restartLatch = new TestLatch
val secondRestartLatch = new TestLatch
@@ -76,17 +76,17 @@ class RestartStrategySpec extends PekkoSpec with DefaultTimeout {
employee ! Ping
// test restart and post restart ping
- Await.ready(restartLatch, 10 seconds)
+ Await.ready(restartLatch, 10.seconds)
// now crash again... should not restart
employee ! Crash
employee ! Ping
- Await.ready(secondRestartLatch, 10 seconds)
- Await.ready(countDownLatch, 10 seconds)
+ Await.ready(secondRestartLatch, 10.seconds)
+ Await.ready(countDownLatch, 10.seconds)
employee ! Crash
- Await.ready(stopLatch, 10 seconds)
+ Await.ready(stopLatch, 10.seconds)
}
"ensure that employee is immortal without max restarts and time range" in {
@@ -109,13 +109,13 @@ class RestartStrategySpec extends PekkoSpec with DefaultTimeout {
(1 to 100).foreach { _ =>
employee ! Crash
}
- Await.ready(countDownLatch, 2 minutes)
+ Await.ready(countDownLatch, 2.minutes)
assert(!employee.isTerminated)
}
"ensure that employee restarts after number of crashes not within time range" in {
val boss = system.actorOf(Props(
- new Supervisor(OneForOneStrategy(maxNrOfRetries = 2, withinTimeRange = 500 millis)(List(classOf[Throwable])))))
+ new Supervisor(OneForOneStrategy(maxNrOfRetries = 2, withinTimeRange = 500.millis)(List(classOf[Throwable])))))
val restartLatch = new TestLatch
val secondRestartLatch = new TestLatch
@@ -150,14 +150,14 @@ class RestartStrategySpec extends PekkoSpec with DefaultTimeout {
employee ! Ping
employee ! Crash
- Await.ready(restartLatch, 10 seconds)
- Await.ready(pingLatch, 10 seconds)
+ Await.ready(restartLatch, 10.seconds)
+ Await.ready(pingLatch, 10.seconds)
employee ! Ping
employee ! Crash
- Await.ready(secondRestartLatch, 10 seconds)
- Await.ready(secondPingLatch, 10 seconds)
+ Await.ready(secondRestartLatch, 10.seconds)
+ Await.ready(secondPingLatch, 10.seconds)
// sleep to go out of the restart strategy's time range
sleep(700L)
@@ -166,7 +166,7 @@ class RestartStrategySpec extends PekkoSpec with DefaultTimeout {
employee ! Crash
employee ! Ping
- Await.ready(thirdRestartLatch, 1 second)
+ Await.ready(thirdRestartLatch, 1.second)
assert(!employee.isTerminated)
}
@@ -203,7 +203,7 @@ class RestartStrategySpec extends PekkoSpec with DefaultTimeout {
employee ! Ping
// test restart and post restart ping
- Await.ready(restartLatch, 10 seconds)
+ Await.ready(restartLatch, 10.seconds)
assert(!employee.isTerminated)
@@ -211,13 +211,13 @@ class RestartStrategySpec extends PekkoSpec with DefaultTimeout {
employee ! Crash
employee ! Ping
- Await.ready(secondRestartLatch, 10 seconds)
- Await.ready(countDownLatch, 10 seconds)
+ Await.ready(secondRestartLatch, 10.seconds)
+ Await.ready(countDownLatch, 10.seconds)
sleep(700L)
employee ! Crash
- Await.ready(stopLatch, 10 seconds)
+ Await.ready(stopLatch, 10.seconds)
sleep(500L)
assert(employee.isTerminated)
}
@@ -227,7 +227,7 @@ class RestartStrategySpec extends PekkoSpec with DefaultTimeout {
val countDownLatch = new TestLatch(2)
val boss = system.actorOf(Props(new Actor {
- override val supervisorStrategy = OneForOneStrategy(withinTimeRange = 1 second)(List(classOf[Throwable]))
+ override val supervisorStrategy = OneForOneStrategy(withinTimeRange = 1.second)(List(classOf[Throwable]))
def receive = {
case p: Props => sender() ! context.watch(context.actorOf(p))
case _: Terminated => maxNoOfRestartsLatch.open()
@@ -256,7 +256,7 @@ class RestartStrategySpec extends PekkoSpec with DefaultTimeout {
employee ! Ping
// test restart and post restart ping
- Await.ready(restartLatch, 10 seconds)
+ Await.ready(restartLatch, 10.seconds)
assert(!employee.isTerminated)
@@ -265,14 +265,14 @@ class RestartStrategySpec extends PekkoSpec with DefaultTimeout {
// may not be running
employee ! Ping
- Await.ready(countDownLatch, 10 seconds)
+ Await.ready(countDownLatch, 10.seconds)
// may not be running
employee ! Crash
- Await.ready(stopLatch, 10 seconds)
+ Await.ready(stopLatch, 10.seconds)
- Await.ready(maxNoOfRestartsLatch, 10 seconds)
+ Await.ready(maxNoOfRestartsLatch, 10.seconds)
sleep(500L)
assert(employee.isTerminated)
}
diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/SchedulerSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/SchedulerSpec.scala
index cb1fd0b9bc..c8c1c37602 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/actor/SchedulerSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/actor/SchedulerSpec.scala
@@ -118,13 +118,13 @@ trait SchedulerSpec extends BeforeAndAfterEach with DefaultTimeout with Implicit
* ticket #372
*/
"be cancellable" taggedAs TimingTest in {
- for (_ <- 1 to 10) system.scheduler.scheduleOnce(1 second, testActor, "fail").cancel()
+ for (_ <- 1 to 10) system.scheduler.scheduleOnce(1.second, testActor, "fail").cancel()
- expectNoMessage(2 seconds)
+ expectNoMessage(2.seconds)
}
"be canceled if cancel is performed before execution" taggedAs TimingTest in {
- val task = collectCancellable(system.scheduler.scheduleOnce(10 seconds)(()))
+ val task = collectCancellable(system.scheduler.scheduleOnce(10.seconds)(()))
task.cancel() should ===(true)
task.isCancelled should ===(true)
task.cancel() should ===(false)
@@ -133,7 +133,7 @@ trait SchedulerSpec extends BeforeAndAfterEach with DefaultTimeout with Implicit
"notify callback if cancel is performed before execution" taggedAs TimingTest in {
val latch = new CountDownLatch(1)
- val task = system.scheduler.scheduleOnce(100 millis,
+ val task = system.scheduler.scheduleOnce(100.millis,
new SchedulerTask {
override def run(): Unit = ()
override def cancelled(): Unit = latch.countDown()
@@ -172,7 +172,7 @@ trait SchedulerSpec extends BeforeAndAfterEach with DefaultTimeout with Implicit
Thread.sleep(5)
}
- Await.ready(ticks, 3 seconds)
+ Await.ready(ticks, 3.seconds)
}
"handle timeouts equal to multiple of wheel period" taggedAs TimingTest in {
@@ -374,7 +374,7 @@ trait SchedulerSpec extends BeforeAndAfterEach with DefaultTimeout with Implicit
val pingLatch = new TestLatch(6)
val supervisor =
- system.actorOf(Props(new Supervisor(AllForOneStrategy(3, 1 second)(List(classOf[Exception])))))
+ system.actorOf(Props(new Supervisor(AllForOneStrategy(3, 1.second)(List(classOf[Exception])))))
val props = Props(new Actor {
def receive = {
case Ping => pingLatch.countDown()
@@ -391,9 +391,9 @@ trait SchedulerSpec extends BeforeAndAfterEach with DefaultTimeout with Implicit
collectCancellable(system.scheduler.scheduleOnce(1000.millis, actor, Crash))
}
- Await.ready(restartLatch, 2 seconds)
+ Await.ready(restartLatch, 2.seconds)
// should be enough time for the ping countdown to recover and reach 6 pings
- Await.ready(pingLatch, 5 seconds)
+ Await.ready(pingLatch, 5.seconds)
}
"schedule with different initial delay and frequency" taggedAs TimingTest in {
@@ -406,8 +406,8 @@ trait SchedulerSpec extends BeforeAndAfterEach with DefaultTimeout with Implicit
}))
val startTime = System.nanoTime()
- collectCancellable(scheduleAdapter.schedule(1 second, 300.millis, actor, Msg))
- Await.ready(ticks, 3 seconds)
+ collectCancellable(scheduleAdapter.schedule(1.second, 300.millis, actor, Msg))
+ Await.ready(ticks, 3.seconds)
// LARS is a bit more aggressive in scheduling recurring tasks at the right
// frequency and may execute them a little earlier; the actual expected timing
@@ -810,7 +810,7 @@ class LightArrayRevolverSchedulerSpec extends PekkoSpec(SchedulerSpec.testConfRe
time
}
- override protected def getShutdownTimeout: FiniteDuration = (10 seconds).dilated
+ override protected def getShutdownTimeout: FiniteDuration = 10.seconds.dilated
override protected def waitNanos(ns: Long): Unit = {
// println(s"waiting $ns")
diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/SupervisorHierarchySpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/SupervisorHierarchySpec.scala
index 2ed576a222..3a5a5efaea 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/actor/SupervisorHierarchySpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/actor/SupervisorHierarchySpec.scala
@@ -240,7 +240,7 @@ object SupervisorHierarchySpec {
case (_, x) =>
log :+= Event("unhandled exception from " + sender() + Logging.stackTraceFor(x), identityHashCode(this))
sender() ! Dump(0)
- context.system.scheduler.scheduleOnce(1 second, self, Dump(0))(context.dispatcher)
+ context.system.scheduler.scheduleOnce(1.second, self, Dump(0))(context.dispatcher)
Resume
})
@@ -477,7 +477,7 @@ object SupervisorHierarchySpec {
case this.Event(Init, _) =>
hierarchy = context.watch(
context.actorOf(Props(new Hierarchy(size, breadth, self, 0, random)).withDispatcher("hierarchy"), "head"))
- startSingleTimer("phase", StateTimeout, 5 seconds)
+ startSingleTimer("phase", StateTimeout, 5.seconds)
goto(Init)
}
@@ -646,7 +646,7 @@ object SupervisorHierarchySpec {
goto(Failed)
}
- when(GC, stateTimeout = 10 seconds) {
+ when(GC, stateTimeout = 10.seconds) {
case this.Event(GCcheck(weak), _) =>
val next = weak.filter(_.get ne null)
if (next.nonEmpty) {
@@ -793,7 +793,7 @@ class SupervisorHierarchySpec extends PekkoSpec(SupervisorHierarchySpec.config)
val countDownMax = new CountDownLatch(1)
val boss = system.actorOf(Props(new Actor {
override val supervisorStrategy =
- OneForOneStrategy(maxNrOfRetries = 1, withinTimeRange = 5 seconds)(List(classOf[Throwable]))
+ OneForOneStrategy(maxNrOfRetries = 1, withinTimeRange = 5.seconds)(List(classOf[Throwable]))
val crasher = context.watch(
context.actorOf(Props(new CountDownActor(countDownMessages, SupervisorStrategy.defaultStrategy))))
@@ -853,7 +853,7 @@ class SupervisorHierarchySpec extends PekkoSpec(SupervisorHierarchySpec.config)
boss ! "fail"
awaitCond(worker.asInstanceOf[LocalActorRef].underlying.mailbox.isSuspended)
worker ! "ping"
- expectNoMessage(2 seconds)
+ expectNoMessage(2.seconds)
latch.countDown()
}
expectMsg("pong")
@@ -935,7 +935,7 @@ class SupervisorHierarchySpec extends PekkoSpec(SupervisorHierarchySpec.config)
fsm ! Init
- expectMsg(110 seconds, "stressTestSuccessful")
+ expectMsg(110.seconds, "stressTestSuccessful")
expectMsg("stressTestStopped")
}
}
diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/SupervisorMiscSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/SupervisorMiscSpec.scala
index cb6941f62d..31380ff722 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/actor/SupervisorMiscSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/actor/SupervisorMiscSpec.scala
@@ -49,7 +49,7 @@ class SupervisorMiscSpec extends PekkoSpec(SupervisorMiscSpec.config) with Defau
val countDownLatch = new CountDownLatch(4)
val supervisor = system.actorOf(Props(
- new Supervisor(OneForOneStrategy(maxNrOfRetries = 3, withinTimeRange = 5 seconds)(List(classOf[Exception])))))
+ new Supervisor(OneForOneStrategy(maxNrOfRetries = 3, withinTimeRange = 5.seconds)(List(classOf[Exception])))))
val workerProps = Props(new Actor {
override def postRestart(cause: Throwable): Unit = { countDownLatch.countDown() }
diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/SupervisorSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/SupervisorSpec.scala
index 22801ed2e1..049fb2b616 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/actor/SupervisorSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/actor/SupervisorSpec.scala
@@ -224,7 +224,7 @@ class SupervisorSpec
def killExpectNoRestart(pingPongActor: ActorRef) = {
val result = pingPongActor.?(DieReply)(DilatedTimeout)
- expectNoMessage(500 milliseconds)
+ expectNoMessage(500.milliseconds)
intercept[RuntimeException] { Await.result(result, DilatedTimeout) }
}
@@ -234,8 +234,8 @@ class SupervisorSpec
val master = system.actorOf(Props(new Master(testActor)))
master ! Die
- expectMsg(3 seconds, "terminated")
- expectNoMessage(1 second)
+ expectMsg(3.seconds, "terminated")
+ expectNoMessage(1.second)
}
"restart properly when same instance is returned" in {
@@ -287,7 +287,7 @@ class SupervisorSpec
expectMsg("postStop1")
}
- expectNoMessage(1 second)
+ expectNoMessage(1.second)
}
"not restart temporary actor" in {
@@ -295,13 +295,13 @@ class SupervisorSpec
intercept[RuntimeException] { Await.result(temporaryActor.?(DieReply)(DilatedTimeout), DilatedTimeout) }
- expectNoMessage(1 second)
+ expectNoMessage(1.second)
}
"start server for nested supervisor hierarchy" in {
val (actor1, _, _, _) = nestedSupervisorsAllForOne
ping(actor1)
- expectNoMessage(1 second)
+ expectNoMessage(1.second)
}
"kill single actor OneForOne" in {
@@ -420,7 +420,7 @@ class SupervisorSpec
"attempt restart when exception during restart" in {
val inits = new AtomicInteger(0)
val supervisor = system.actorOf(Props(
- new Supervisor(OneForOneStrategy(maxNrOfRetries = 3, withinTimeRange = 10 seconds)(classOf[Exception] :: Nil))))
+ new Supervisor(OneForOneStrategy(maxNrOfRetries = 3, withinTimeRange = 10.seconds)(classOf[Exception] :: Nil))))
val dyingProps = Props(new Actor {
val init = inits.getAndIncrement()
@@ -467,7 +467,7 @@ class SupervisorSpec
val child = context.watch(context.actorOf(Props(new Actor {
override def postRestart(reason: Throwable): Unit = testActor ! "child restarted"
def receive = {
- case l: TestLatch => { Await.ready(l, 5 seconds); throw new IllegalStateException("OHNOES") }
+ case l: TestLatch => { Await.ready(l, 5.seconds); throw new IllegalStateException("OHNOES") }
case "test" => sender() ! "child green"
}
}), "child"))
@@ -589,7 +589,7 @@ class SupervisorSpec
"treats maxNrOfRetries = -1 as maxNrOfRetries = 1 if withinTimeRange is non-infinite Duration" in {
val supervisor = system.actorOf(Props(
- new Supervisor(OneForOneStrategy(maxNrOfRetries = -1, withinTimeRange = 10 seconds)(classOf[Exception] :: Nil))))
+ new Supervisor(OneForOneStrategy(maxNrOfRetries = -1, withinTimeRange = 10.seconds)(classOf[Exception] :: Nil))))
val pingpong = child(supervisor, Props(new PingPongActor(testActor)))
diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/SupervisorTreeSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/SupervisorTreeSpec.scala
index 6c442d9784..5e708aead3 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/actor/SupervisorTreeSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/actor/SupervisorTreeSpec.scala
@@ -28,10 +28,10 @@ class SupervisorTreeSpec extends PekkoSpec with ImplicitSender with DefaultTimeo
"be able to kill the middle actor and see itself and its child restarted" in {
EventFilter[ActorKilledException](occurrences = 1).intercept {
- within(5 seconds) {
+ within(5.seconds) {
val p = Props(new Actor {
override val supervisorStrategy =
- OneForOneStrategy(maxNrOfRetries = 3, withinTimeRange = 1 second)(List(classOf[Exception]))
+ OneForOneStrategy(maxNrOfRetries = 3, withinTimeRange = 1.second)(List(classOf[Exception]))
def receive = {
case p: Props => sender() ! context.actorOf(p)
}
@@ -44,7 +44,7 @@ class SupervisorTreeSpec extends PekkoSpec with ImplicitSender with DefaultTimeo
middleActor ! Kill
expectMsg(middleActor.path)
expectMsg(lastActor.path)
- expectNoMessage(2 seconds)
+ expectNoMessage(2.seconds)
system.stop(headActor)
}
}
diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/Ticket669Spec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/Ticket669Spec.scala
index dc298923d0..79f1ab47e3 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/actor/Ticket669Spec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/actor/Ticket669Spec.scala
@@ -38,7 +38,7 @@ class Ticket669Spec extends PekkoSpec with BeforeAndAfterAll with ImplicitSender
"be able to reply on failure during preRestart" in {
filterEvents(EventFilter[Exception]("test", occurrences = 1)) {
val supervisor =
- system.actorOf(Props(new Supervisor(AllForOneStrategy(5, 10 seconds)(List(classOf[Exception])))))
+ system.actorOf(Props(new Supervisor(AllForOneStrategy(5, 10.seconds)(List(classOf[Exception])))))
val supervised = Await.result((supervisor ? Props[Supervised]()).mapTo[ActorRef], timeout.duration)
supervised.!("test")(testActor)
diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/TypedActorSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/TypedActorSpec.scala
index 828fd86c51..1f32ed97f7 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/actor/TypedActorSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/actor/TypedActorSpec.scala
@@ -148,7 +148,7 @@ object TypedActorSpec {
@nowarn
def futureComposePigdogFrom(foo: Foo): Future[String] = {
- foo.futurePigdog(500 millis).map(_.toUpperCase)
+ foo.futurePigdog(500.millis).map(_.toUpperCase)
}
def optionPigdog(): Option[String] = Some(pigdog())
@@ -360,7 +360,7 @@ class TypedActorSpec
"be able to call Future-returning methods non-blockingly" in {
val t = newFooBar
- val f = t.futurePigdog(200 millis)
+ val f = t.futurePigdog(200.millis)
f.isCompleted should ===(false)
Await.result(f, timeout.duration) should ===("Pigdog")
mustStop(t)
@@ -368,7 +368,7 @@ class TypedActorSpec
"be able to call multiple Future-returning methods non-blockingly" in within(timeout.duration) {
val t = newFooBar
- val futures = for (i <- 1 to 20) yield (i, t.futurePigdog(20 millis, i))
+ val futures = for (i <- 1 to 20) yield (i, t.futurePigdog(20.millis, i))
for ((i, f) <- futures) {
Await.result(f, remaining) should ===("Pigdog" + i)
}
@@ -376,22 +376,22 @@ class TypedActorSpec
}
"be able to call methods returning Java Options" taggedAs TimingTest in {
- val t = newFooBar(1 second)
- t.joptionPigdog(100 millis).get should ===("Pigdog")
- t.joptionPigdog(2 seconds) should ===(JOption.none[String])
+ val t = newFooBar(1.second)
+ t.joptionPigdog(100.millis).get should ===("Pigdog")
+ t.joptionPigdog(2.seconds) should ===(JOption.none[String])
mustStop(t)
}
"be able to handle AskTimeoutException as None" taggedAs TimingTest in {
- val t = newFooBar(200 millis)
- t.joptionPigdog(600 millis) should ===(JOption.none[String])
+ val t = newFooBar(200.millis)
+ t.joptionPigdog(600.millis) should ===(JOption.none[String])
mustStop(t)
}
"be able to call methods returning Scala Options" taggedAs TimingTest in {
- val t = newFooBar(1 second)
- t.optionPigdog(100 millis).get should ===("Pigdog")
- t.optionPigdog(2 seconds) should ===(None)
+ val t = newFooBar(1.second)
+ t.optionPigdog(100.millis).get should ===("Pigdog")
+ t.optionPigdog(2.seconds) should ===(None)
mustStop(t)
}
@@ -415,14 +415,14 @@ class TypedActorSpec
}
}))
val t = Await.result(
- (boss ? TypedProps[Bar](classOf[Foo], classOf[Bar]).withTimeout(2 seconds)).mapTo[Foo],
+ (boss ? TypedProps[Bar](classOf[Foo], classOf[Bar]).withTimeout(2.seconds)).mapTo[Foo],
timeout.duration)
t.incr()
t.failingPigdog()
t.read() should ===(1) // Make sure state is not reset after failure
- intercept[IllegalStateException] { Await.result(t.failingFuturePigdog(), 2 seconds) }.getMessage should ===(
+ intercept[IllegalStateException] { Await.result(t.failingFuturePigdog(), 2.seconds) }.getMessage should ===(
"expected")
t.read() should ===(1) // Make sure state is not reset after failure
@@ -461,7 +461,7 @@ class TypedActorSpec
"be able to support implementation only typed actors" in within(timeout.duration) {
val t: Foo = pekko.actor.TypedActor(system).typedActorOf(TypedProps[Bar]())
- val f = t.futurePigdog(200 millis)
+ val f = t.futurePigdog(200.millis)
val f2 = t.futurePigdog(Duration.Zero)
f2.isCompleted should ===(false)
f.isCompleted should ===(false)
@@ -477,10 +477,10 @@ class TypedActorSpec
}
"be able to use balancing dispatcher" in within(timeout.duration) {
- val thais = for (_ <- 1 to 60) yield newFooBar("pooled-dispatcher", 6 seconds)
+ val thais = for (_ <- 1 to 60) yield newFooBar("pooled-dispatcher", 6.seconds)
val iterator = new CyclicIterator(thais)
- val results = for (i <- 1 to 120) yield (i, iterator.next().futurePigdog(200 millis, i))
+ val results = for (i <- 1 to 120) yield (i, iterator.next().futurePigdog(200.millis, i))
for ((i, r) <- results) Await.result(r, remaining) should ===("Pigdog" + i)
diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/dispatch/ActorModelSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/dispatch/ActorModelSpec.scala
index 1a64adbdc1..584208cf74 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/actor/dispatch/ActorModelSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/actor/dispatch/ActorModelSpec.scala
@@ -273,7 +273,7 @@ abstract class ActorModelSpec(config: String) extends PekkoSpec(config) with Def
awaitCond(ref match {
case r: RepointableRef => r.isStarted
case _ => true
- }, 1 second, 10 millis)
+ }, 1.second, 10.millis)
}
protected def interceptedDispatcher(): MessageDispatcherInterceptor
@@ -322,7 +322,7 @@ abstract class ActorModelSpec(config: String) extends PekkoSpec(config) with Def
a ! Wait(1000)
a ! CountDown(oneAtATime)
// in case of serialization violation, restart would happen instead of count down
- assertCountDown(oneAtATime, (1.5 seconds).dilated.toMillis, "Processed message when allowed")
+ assertCountDown(oneAtATime, 1.5.seconds.dilated.toMillis, "Processed message when allowed")
assertRefDefaultZero(a)(registers = 1, msgsReceived = 3, msgsProcessed = 3)
system.stop(a)
@@ -389,7 +389,7 @@ abstract class ActorModelSpec(config: String) extends PekkoSpec(config) with Def
val cachedMessage = CountDownNStop(new CountDownLatch(num))
val stopLatch = new CountDownLatch(num)
val keepAliveLatch = new CountDownLatch(1)
- val waitTime = (20 seconds).dilated.toMillis
+ val waitTime = 20.seconds.dilated.toMillis
val boss = system.actorOf(Props(new Actor {
def receive = {
case "run" => for (_ <- 1 to num) context.watch(context.actorOf(props)) ! cachedMessage
diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/dispatch/DispatcherActorSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/dispatch/DispatcherActorSpec.scala
index 36eb3b875d..bf0a6b9cf9 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/actor/dispatch/DispatcherActorSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/actor/dispatch/DispatcherActorSpec.scala
@@ -112,7 +112,7 @@ class DispatcherActorSpec extends PekkoSpec(DispatcherActorSpec.config) with Def
}
"respect throughput deadline" in {
- val deadline = 100 millis
+ val deadline = 100.millis
val throughputDispatcher = "test-throughput-deadline-dispatcher"
val works = new AtomicBoolean(true)
diff --git a/actor-tests/src/test/scala/org/apache/pekko/dataflow/Future2Actor.scala b/actor-tests/src/test/scala/org/apache/pekko/dataflow/Future2Actor.scala
index a7372d1d5a..f6f785c882 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/dataflow/Future2Actor.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/dataflow/Future2Actor.scala
@@ -33,20 +33,20 @@ class Future2ActorSpec extends PekkoSpec with DefaultTimeout {
"support convenient sending to multiple destinations" in {
Future(42).pipeTo(testActor).pipeTo(testActor)
- expectMsgAllOf(1 second, 42, 42)
+ expectMsgAllOf(1.second, 42, 42)
}
"support convenient sending to multiple destinations with implicit sender" in {
implicit val someActor: ActorRef = system.actorOf(Props(new Actor { def receive = Actor.emptyBehavior }))
Future(42).pipeTo(testActor).pipeTo(testActor)
- expectMsgAllOf(1 second, 42, 42)
+ expectMsgAllOf(1.second, 42, 42)
lastSender should ===(someActor)
}
"support convenient sending with explicit sender" in {
val someActor = system.actorOf(Props(new Actor { def receive = Actor.emptyBehavior }))
Future(42).to(testActor, someActor)
- expectMsgAllOf(1 second, 42)
+ expectMsgAllOf(1.second, 42)
lastSender should ===(someActor)
}
diff --git a/actor-tests/src/test/scala/org/apache/pekko/dispatch/MailboxConfigSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/dispatch/MailboxConfigSpec.scala
index 02ae1a5624..51330e36c6 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/dispatch/MailboxConfigSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/dispatch/MailboxConfigSpec.scala
@@ -51,11 +51,11 @@ abstract class MailboxSpec extends PekkoSpec with BeforeAndAfterAll with BeforeA
}
"BoundedMailbox.numberOfMessages should be consistent with queue size" in {
- ensureSingleConsumerEnqueueDequeue(BoundedMailbox(1000, 10 milliseconds))
+ ensureSingleConsumerEnqueueDequeue(BoundedMailbox(1000, 10.milliseconds))
}
"create a bounded mailbox with 10 capacity and with push timeout" in {
- val config = BoundedMailbox(10, 10 milliseconds)
+ val config = BoundedMailbox(10, 10.milliseconds)
config.capacity should ===(10)
val q = factory(config)
ensureInitialMailboxState(config, q)
@@ -80,15 +80,15 @@ abstract class MailboxSpec extends PekkoSpec with BeforeAndAfterAll with BeforeA
}
"dequeue what was enqueued properly for bounded mailboxes" in {
- testEnqueueDequeue(BoundedMailbox(10000, -1 millisecond))
+ testEnqueueDequeue(BoundedMailbox(10000, -1.millisecond))
}
"dequeue what was enqueued properly for bounded mailboxes with 0 pushTimeout" in {
- testEnqueueDequeue(BoundedMailbox(10, 0 millisecond), 20, 10, false)
+ testEnqueueDequeue(BoundedMailbox(10, 0.millisecond), 20, 10, false)
}
"dequeue what was enqueued properly for bounded mailboxes with pushTimeout" in {
- testEnqueueDequeue(BoundedMailbox(10000, 100 milliseconds))
+ testEnqueueDequeue(BoundedMailbox(10000, 100.milliseconds))
}
}
@@ -144,7 +144,7 @@ abstract class MailboxSpec extends PekkoSpec with BeforeAndAfterAll with BeforeA
config: MailboxType,
enqueueN: Int = 10000,
dequeueN: Int = 10000,
- parallel: Boolean = true): Unit = within(10 seconds) {
+ parallel: Boolean = true): Unit = within(10.seconds) {
val q = factory(config)
ensureInitialMailboxState(config, q)
@@ -260,7 +260,7 @@ class CustomMailboxSpec extends PekkoSpec(CustomMailboxSpec.config) {
awaitCond(actor match {
case r: RepointableRef => r.isStarted
case _ => true
- }, 1 second, 10 millis)
+ }, 1.second, 10.millis)
val queue = actor.asInstanceOf[ActorRefWithCell].underlying.asInstanceOf[ActorCell].mailbox.messageQueue
queue.getClass should ===(classOf[CustomMailboxSpec.MyMailbox])
}
diff --git a/actor-tests/src/test/scala/org/apache/pekko/dispatch/PriorityDispatcherSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/dispatch/PriorityDispatcherSpec.scala
index 5eb6552cd6..b99a0fa559 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/dispatch/PriorityDispatcherSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/dispatch/PriorityDispatcherSpec.scala
@@ -48,7 +48,7 @@ object PriorityDispatcherSpec {
case i: Int => i // Reverse order
case Result => Int.MaxValue
case _ => throw new RuntimeException() // compiler exhaustiveness check pleaser
- }: Any => Int), 1000, 10 seconds)
+ }: Any => Int), 1000, 10.seconds)
}
@@ -68,7 +68,7 @@ class PriorityDispatcherSpec extends PekkoSpec(PriorityDispatcherSpec.config) wi
}
def testOrdering(dispatcherKey: String): Unit = {
- val msgs = (1 to 100) toList
+ val msgs = (1 to 100).toList
// It's important that the actor under test is not a top level actor
// with RepointableActorRef, since messages might be queued in
diff --git a/actor-tests/src/test/scala/org/apache/pekko/dispatch/StablePriorityDispatcherSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/dispatch/StablePriorityDispatcherSpec.scala
index 88caa4c8fe..a23082b77b 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/dispatch/StablePriorityDispatcherSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/dispatch/StablePriorityDispatcherSpec.scala
@@ -49,7 +49,7 @@ object StablePriorityDispatcherSpec {
case _: Int => 101 // Don't care for other integers
case Result => Int.MaxValue
case _ => throw new RuntimeException() // compiler exhaustiveness check pleaser
- }: Any => Int), 1000, 10 seconds)
+ }: Any => Int), 1000, 10.seconds)
}
@@ -70,7 +70,7 @@ class StablePriorityDispatcherSpec extends PekkoSpec(StablePriorityDispatcherSpe
}
def testOrdering(dispatcherKey: String): Unit = {
- val msgs = (1 to 200) toList
+ val msgs = (1 to 200).toList
val shuffled = scala.util.Random.shuffle(msgs)
// It's important that the actor under test is not a top level actor
@@ -100,7 +100,7 @@ class StablePriorityDispatcherSpec extends PekkoSpec(StablePriorityDispatcherSpe
// Low messages should come out first, and in priority order. High messages follow - they are equal priority and
// should come out in the same order in which they were sent.
- val lo = (1 to 100) toList
+ val lo = (1 to 100).toList
val hi = shuffled.filter { _ > 100 }
(expectMsgType[List[Int]]: List[Int]) should ===(lo ++ hi)
}
diff --git a/actor-tests/src/test/scala/org/apache/pekko/event/LoggingReceiveSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/event/LoggingReceiveSpec.scala
index 503c6842dd..8a739e042f 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/event/LoggingReceiveSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/event/LoggingReceiveSpec.scala
@@ -29,7 +29,7 @@ import pekko.util.ccompat.JavaConverters._
object LoggingReceiveSpec {
class TestLogActor extends Actor {
override val supervisorStrategy =
- OneForOneStrategy(maxNrOfRetries = 5, withinTimeRange = 5 seconds)(List(classOf[Throwable]))
+ OneForOneStrategy(maxNrOfRetries = 5, withinTimeRange = 5.seconds)(List(classOf[Throwable]))
def receive = { case _ => }
}
}
@@ -85,12 +85,12 @@ class LoggingReceiveSpec extends AnyWordSpec with BeforeAndAfterAll {
}))
a ! "hallo"
expectMsg(
- 1 second,
+ 1.second,
Logging.Debug(
"funky",
classOf[DummyClassForStringSources],
"received unhandled message hallo from " + system.deadLetters))
- expectMsgType[UnhandledMessage](1 second)
+ expectMsgType[UnhandledMessage](1.second)
}
}
@@ -206,7 +206,7 @@ class LoggingReceiveSpec extends AnyWordSpec with BeforeAndAfterAll {
"log Supervision events if requested" in {
new TestKit(appLifecycle) {
system.eventStream.subscribe(testActor, classOf[Logging.Debug])
- within(3 seconds) {
+ within(3.seconds) {
val lifecycleGuardian = appLifecycle.asInstanceOf[ActorSystemImpl].guardian
val lname = lifecycleGuardian.path.toString
val supervisor = TestActorRef[TestLogActor](Props[TestLogActor]())
@@ -230,7 +230,7 @@ class LoggingReceiveSpec extends AnyWordSpec with BeforeAndAfterAll {
"log DeathWatch events if requested" in {
new TestKit(appLifecycle) {
system.eventStream.subscribe(testActor, classOf[Logging.Debug])
- within(3 seconds) {
+ within(3.seconds) {
val supervisor = TestActorRef[TestLogActor](Props[TestLogActor]())
val sclass = classOf[TestLogActor]
val actor = TestActorRef[TestLogActor](Props[TestLogActor](), supervisor, "none")
@@ -255,7 +255,7 @@ class LoggingReceiveSpec extends AnyWordSpec with BeforeAndAfterAll {
new TestKit(appLifecycle) {
system.eventStream.subscribe(testActor, classOf[Logging.Debug])
system.eventStream.subscribe(testActor, classOf[Logging.Error])
- within(3 seconds) {
+ within(3.seconds) {
val supervisor = TestActorRef[TestLogActor](Props[TestLogActor]())
val sname = supervisor.path.toString
val sclass = classOf[TestLogActor]
diff --git a/actor-tests/src/test/scala/org/apache/pekko/io/TcpIntegrationSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/io/TcpIntegrationSpec.scala
index f02bb50bee..aca4627aeb 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/io/TcpIntegrationSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/io/TcpIntegrationSpec.scala
@@ -194,7 +194,7 @@ class TcpIntegrationSpec extends PekkoSpec("""
connectCommander.expectMsgType[Connected].remoteAddress should ===(endpoint)
val connectionActor = connectCommander.lastSender
connectCommander.send(connectionActor, PoisonPill)
- failAfter(3 seconds) {
+ failAfter(3.seconds) {
try {
accept.getInputStream.read() should ===(-1)
} catch {
diff --git a/actor-tests/src/test/scala/org/apache/pekko/pattern/AskSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/pattern/AskSpec.scala
index e84777167b..241ad9607d 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/pattern/AskSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/pattern/AskSpec.scala
@@ -41,7 +41,7 @@ class AskSpec extends PekkoSpec("""
}
"return broken promises on DeadLetters" in {
- val f = system.deadLetters.ask(42)(1 second)
+ val f = system.deadLetters.ask(42)(1.second)
f.isCompleted should ===(true)
f.value.get match {
case Failure(_: AskTimeoutException) =>
@@ -50,7 +50,7 @@ class AskSpec extends PekkoSpec("""
}
"return broken promises on EmptyLocalActorRefs" in {
- implicit val timeout: Timeout = Timeout(5 seconds)
+ implicit val timeout: Timeout = Timeout(5.seconds)
val empty = system.asInstanceOf[ExtendedActorSystem].provider.resolveActorRef("/user/unknown")
val f = empty ? 3.14
f.isCompleted should ===(true)
@@ -61,7 +61,7 @@ class AskSpec extends PekkoSpec("""
}
"return broken promises on unsupported ActorRefs" in {
- implicit val timeout: Timeout = Timeout(5 seconds)
+ implicit val timeout: Timeout = Timeout(5.seconds)
val f = ask(null: ActorRef, 3.14)
f.isCompleted should ===(true)
@@ -72,7 +72,7 @@ class AskSpec extends PekkoSpec("""
}
"return broken promises on 0 timeout" in {
- implicit val timeout: Timeout = Timeout(0 seconds)
+ implicit val timeout: Timeout = Timeout(0.seconds)
val echo = system.actorOf(Props(new Actor { def receive = { case x => sender() ! x } }))
val f = echo ? "foo"
val expectedMsg =
@@ -83,7 +83,7 @@ class AskSpec extends PekkoSpec("""
}
"return broken promises on < 0 timeout" in {
- implicit val timeout: Timeout = Timeout(-1000 seconds)
+ implicit val timeout: Timeout = Timeout(-1000.seconds)
val echo = system.actorOf(Props(new Actor { def receive = { case x => sender() ! x } }))
val f = echo ? "foo"
val expectedMsg =
@@ -94,51 +94,51 @@ class AskSpec extends PekkoSpec("""
}
"include target information in AskTimeout" in {
- implicit val timeout: Timeout = Timeout(0.5 seconds)
+ implicit val timeout: Timeout = Timeout(0.5.seconds)
val silentOne = system.actorOf(Props.empty, "silent")
val f = silentOne ? "noreply"
intercept[AskTimeoutException] {
- Await.result(f, 1 second)
+ Await.result(f, 1.second)
}.getMessage.contains("/user/silent") should ===(true)
}
"include timeout information in AskTimeout" in {
- implicit val timeout: Timeout = Timeout(0.5 seconds)
+ implicit val timeout: Timeout = Timeout(0.5.seconds)
val f = system.actorOf(Props.empty) ? "noreply"
intercept[AskTimeoutException] {
- Await.result(f, 1 second)
+ Await.result(f, 1.second)
}.getMessage should include(timeout.duration.toMillis.toString)
}
"include sender information in AskTimeout" in {
- implicit val timeout: Timeout = Timeout(0.5 seconds)
+ implicit val timeout: Timeout = Timeout(0.5.seconds)
implicit val sender: ActorRef = system.actorOf(Props.empty)
val f = system.actorOf(Props.empty) ? "noreply"
intercept[AskTimeoutException] {
- Await.result(f, 1 second)
+ Await.result(f, 1.second)
}.getMessage.contains(sender.toString) should ===(true)
}
"include message class information in AskTimeout" in {
- implicit val timeout: Timeout = Timeout(0.5 seconds)
+ implicit val timeout: Timeout = Timeout(0.5.seconds)
val f = system.actorOf(Props.empty) ? Integer.valueOf(17)
intercept[AskTimeoutException] {
- Await.result(f, 1 second)
+ Await.result(f, 1.second)
}.getMessage should include("[java.lang.Integer")
}
"work for ActorSelection" in {
- implicit val timeout: Timeout = Timeout(5 seconds)
+ implicit val timeout: Timeout = Timeout(5.seconds)
import system.dispatcher
val echo = system.actorOf(Props(new Actor { def receive = { case x => sender() ! x } }), "select-echo")
val identityFuture =
(system.actorSelection("/user/select-echo") ? Identify(None)).mapTo[ActorIdentity].map(_.ref.get)
- Await.result(identityFuture, 5 seconds) should ===(echo)
+ Await.result(identityFuture, 5.seconds) should ===(echo)
}
"work when reply uses actor selection" in {
- implicit val timeout: Timeout = Timeout(5 seconds)
+ implicit val timeout: Timeout = Timeout(5.seconds)
val deadListener = TestProbe()
system.eventStream.subscribe(deadListener.ref, classOf[DeadLetter])
@@ -147,13 +147,13 @@ class AskSpec extends PekkoSpec("""
}), "select-echo2")
val f = echo ? "hi"
- Await.result(f, 1 seconds) should ===("hi")
+ Await.result(f, 1.seconds) should ===("hi")
- deadListener.expectNoMessage(200 milliseconds)
+ deadListener.expectNoMessage(200.milliseconds)
}
"throw AskTimeoutException on using *" in {
- implicit val timeout: Timeout = Timeout(0.5 seconds)
+ implicit val timeout: Timeout = Timeout(0.5.seconds)
val deadListener = TestProbe()
system.eventStream.subscribe(deadListener.ref, classOf[DeadLetter])
@@ -162,14 +162,14 @@ class AskSpec extends PekkoSpec("""
"select-echo3")
val f = echo ? "hi"
intercept[AskTimeoutException] {
- Await.result(f, 1 seconds)
+ Await.result(f, 1.seconds)
}
- deadListener.expectMsgClass(200 milliseconds, classOf[DeadLetter])
+ deadListener.expectMsgClass(200.milliseconds, classOf[DeadLetter])
}
"throw AskTimeoutException on using .." in {
- implicit val timeout: Timeout = Timeout(0.5 seconds)
+ implicit val timeout: Timeout = Timeout(0.5.seconds)
val deadListener = TestProbe()
system.eventStream.subscribe(deadListener.ref, classOf[DeadLetter])
@@ -183,14 +183,14 @@ class AskSpec extends PekkoSpec("""
}), "select-echo4")
val f = echo ? "hi"
intercept[AskTimeoutException] {
- Await.result(f, 1 seconds) should ===("hi")
+ Await.result(f, 1.seconds) should ===("hi")
}
- deadListener.expectMsgClass(200 milliseconds, classOf[DeadLetter])
+ deadListener.expectMsgClass(200.milliseconds, classOf[DeadLetter])
}
"send to DeadLetter when child does not exist" in {
- implicit val timeout: Timeout = Timeout(0.5 seconds)
+ implicit val timeout: Timeout = Timeout(0.5.seconds)
val deadListener = TestProbe()
system.eventStream.subscribe(deadListener.ref, classOf[DeadLetter])
@@ -203,13 +203,13 @@ class AskSpec extends PekkoSpec("""
}), "select-echo5")
val f = echo ? "hi"
intercept[AskTimeoutException] {
- Await.result(f, 1 seconds) should ===("hi")
+ Await.result(f, 1.seconds) should ===("hi")
}
- deadListener.expectMsgClass(200 milliseconds, classOf[DeadLetter])
+ deadListener.expectMsgClass(200.milliseconds, classOf[DeadLetter])
}
"send DeadLetter when answering to grandchild" in {
- implicit val timeout: Timeout = Timeout(0.5 seconds)
+ implicit val timeout: Timeout = Timeout(0.5.seconds)
val deadListener = TestProbe()
system.eventStream.subscribe(deadListener.ref, classOf[DeadLetter])
@@ -221,13 +221,13 @@ class AskSpec extends PekkoSpec("""
}), "select-echo6")
val f = echo ? "hi"
intercept[AskTimeoutException] {
- Await.result(f, 1 seconds) should ===(ActorSelectionMessage("hi", Vector(SelectChildName("missing")), false))
+ Await.result(f, 1.seconds) should ===(ActorSelectionMessage("hi", Vector(SelectChildName("missing")), false))
}
- deadListener.expectMsgClass(200 milliseconds, classOf[DeadLetter])
+ deadListener.expectMsgClass(200.milliseconds, classOf[DeadLetter])
}
"allow watching the promiseActor and send Terminated() when completes" in {
- implicit val timeout: Timeout = Timeout(300 millis)
+ implicit val timeout: Timeout = Timeout(300.millis)
val p = TestProbe()
val act = system.actorOf(Props(new Actor {
@@ -248,7 +248,7 @@ class AskSpec extends PekkoSpec("""
}
"encode target name in temporary actor name" in {
- implicit val timeout: Timeout = Timeout(300 millis)
+ implicit val timeout: Timeout = Timeout(300.millis)
val p = TestProbe()
val act = system.actorOf(Props(new Actor {
@@ -268,7 +268,7 @@ class AskSpec extends PekkoSpec("""
}
"proper path when promise actor terminated" in {
- implicit val timeout: Timeout = Timeout(300 millis)
+ implicit val timeout: Timeout = Timeout(300.millis)
val p = TestProbe()
val act = system.actorOf(Props(new Actor {
diff --git a/actor-tests/src/test/scala/org/apache/pekko/pattern/BackoffOnRestartSupervisorSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/pattern/BackoffOnRestartSupervisorSpec.scala
index d739891d61..bba9667690 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/pattern/BackoffOnRestartSupervisorSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/pattern/BackoffOnRestartSupervisorSpec.scala
@@ -70,9 +70,9 @@ class BackoffOnRestartSupervisorSpec extends PekkoSpec("""
def supervisorProps(probeRef: ActorRef) = {
val options = BackoffOpts
- .onFailure(TestActor.props(probeRef), "someChildName", 200 millis, 10 seconds, 0.0)
+ .onFailure(TestActor.props(probeRef), "someChildName", 200.millis, 10.seconds, 0.0)
.withMaxNrOfRetries(-1)
- .withSupervisorStrategy(OneForOneStrategy(maxNrOfRetries = 5, withinTimeRange = 30 seconds) {
+ .withSupervisorStrategy(OneForOneStrategy(maxNrOfRetries = 5, withinTimeRange = 30.seconds) {
case _: TestActor.StoppingException => SupervisorStrategy.Stop
})
BackoffSupervisor.props(options)
@@ -105,23 +105,23 @@ class BackoffOnRestartSupervisorSpec extends PekkoSpec("""
// Exponential back off restart test
supervisor ! "THROW"
// numRestart = 0: expected delay ~200 millis
- probe.expectNoMessage(200 millis)
- probe.expectMsg(250 millis, "STARTED")
+ probe.expectNoMessage(200.millis)
+ probe.expectMsg(250.millis, "STARTED")
supervisor ! "THROW"
// numRestart = 1: expected delay ~400 millis
- probe.expectNoMessage(400 millis)
- probe.expectMsg(250 millis, "STARTED")
+ probe.expectNoMessage(400.millis)
+ probe.expectMsg(250.millis, "STARTED")
supervisor ! "THROW"
// numRestart = 2: expected delay ~800 millis
- probe.expectNoMessage(800 millis)
- probe.expectMsg(250 millis, "STARTED")
+ probe.expectNoMessage(800.millis)
+ probe.expectMsg(250.millis, "STARTED")
supervisor ! "THROW"
// numRestart = 3: expected delay ~1600 millis
- probe.expectNoMessage(1600 millis)
- probe.expectMsg(250 millis, "STARTED")
+ probe.expectNoMessage(1600.millis)
+ probe.expectMsg(250.millis, "STARTED")
// Verify that we only have one child at this point by selecting all the children
// under the supervisor and broadcasting to them.
@@ -166,7 +166,7 @@ class BackoffOnRestartSupervisorSpec extends PekkoSpec("""
val postStopLatch = new CountDownLatch(1)
@nowarn
val options = BackoffOpts
- .onFailure(Props(new SlowlyFailingActor(postStopLatch)), "someChildName", 1 nanos, 1 nanos, 0.0)
+ .onFailure(Props(new SlowlyFailingActor(postStopLatch)), "someChildName", 1.nanos, 1.nanos, 0.0)
.withMaxNrOfRetries(-1)
.withSupervisorStrategy(OneForOneStrategy(loggingEnabled = false) {
case _: TestActor.StoppingException => SupervisorStrategy.Stop
@@ -212,7 +212,7 @@ class BackoffOnRestartSupervisorSpec extends PekkoSpec("""
if (i < 6) {
// Since we should've died on this throw, don't expect to be started.
// We're not testing timing, so set a reasonably high timeout.
- probe.expectMsg(4 seconds, "STARTED")
+ probe.expectMsg(4.seconds, "STARTED")
}
}
// Supervisor should've terminated.
@@ -228,7 +228,7 @@ class BackoffOnRestartSupervisorSpec extends PekkoSpec("""
val options = BackoffOpts
.onFailure(TestActor.props(probe.ref), "someChildName", 300.millis, 10.seconds, 0.0)
.withMaxNrOfRetries(-1)
- .withSupervisorStrategy(OneForOneStrategy(withinTimeRange = 1 seconds, maxNrOfRetries = 3) {
+ .withSupervisorStrategy(OneForOneStrategy(withinTimeRange = 1.seconds, maxNrOfRetries = 3) {
case _: TestActor.StoppingException => SupervisorStrategy.Stop
})
val supervisor = system.actorOf(BackoffSupervisor.props(options))
diff --git a/actor-tests/src/test/scala/org/apache/pekko/pattern/CircuitBreakerSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/pattern/CircuitBreakerSpec.scala
index e1c125eab8..26fdff6b78 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/pattern/CircuitBreakerSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/pattern/CircuitBreakerSpec.scala
@@ -119,7 +119,7 @@ class CircuitBreakerSpec extends PekkoSpec("""
new Breaker(new CircuitBreaker(system.scheduler, 1, 1000.millis.dilated, shortResetTimeout))
def longCallTimeoutCb()(implicit system: ActorSystem, ec: ExecutionContext): Breaker =
- new Breaker(new CircuitBreaker(system.scheduler, 1, 5 seconds, 500.millis.dilated))
+ new Breaker(new CircuitBreaker(system.scheduler, 1, 5.seconds, 500.millis.dilated))
val longResetTimeout = 5.seconds.dilated
def longResetTimeoutCb()(implicit system: ActorSystem, ec: ExecutionContext): Breaker =
diff --git a/actor-tests/src/test/scala/org/apache/pekko/pattern/PatternSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/pattern/PatternSpec.scala
index 3e70bc781d..9c20372ab3 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/pattern/PatternSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/pattern/PatternSpec.scala
@@ -41,21 +41,21 @@ class PatternSpec extends PekkoSpec {
"provide Future for stopping an actor" in {
val target = system.actorOf(Props[TargetActor]())
- val result = gracefulStop(target, 5 seconds)
- Await.result(result, 6 seconds) should ===(true)
+ val result = gracefulStop(target, 5.seconds)
+ Await.result(result, 6.seconds) should ===(true)
}
"complete Future when actor already terminated" in {
val target = system.actorOf(Props[TargetActor]())
- Await.ready(gracefulStop(target, 5 seconds), 6 seconds)
- Await.ready(gracefulStop(target, 1 millis), 1 second)
+ Await.ready(gracefulStop(target, 5.seconds), 6.seconds)
+ Await.ready(gracefulStop(target, 1.millis), 1.second)
}
"complete Future with AskTimeoutException when actor not terminated within timeout" in {
val target = system.actorOf(Props[TargetActor]())
val latch = TestLatch()
target ! ((latch, remainingOrDefault))
- intercept[AskTimeoutException] { Await.result(gracefulStop(target, 500 millis), remainingOrDefault) }
+ intercept[AskTimeoutException] { Await.result(gracefulStop(target, 500.millis), remainingOrDefault) }
latch.open()
}
}
@@ -63,7 +63,7 @@ class PatternSpec extends PekkoSpec {
"pattern.after" must {
"be completed successfully eventually" in {
// TODO after is unfortunately shadowed by ScalaTest, fix as part of #3759
- val f = pekko.pattern.after(1 second, using = system.scheduler)(Future.successful(5))
+ val f = pekko.pattern.after(1.second, using = system.scheduler)(Future.successful(5))
val r = Future.firstCompletedOf(Seq(Promise[Int]().future, f))
Await.result(r, remainingOrDefault) should ===(5)
@@ -72,7 +72,7 @@ class PatternSpec extends PekkoSpec {
"be completed abnormally eventually" in {
// TODO after is unfortunately shadowed by ScalaTest, fix as part of #3759
val f =
- pekko.pattern.after(1 second, using = system.scheduler)(Future.failed(new IllegalStateException("Mexico")))
+ pekko.pattern.after(1.second, using = system.scheduler)(Future.failed(new IllegalStateException("Mexico")))
val r = Future.firstCompletedOf(Seq(Promise[Int]().future, f))
intercept[IllegalStateException] { Await.result(r, remainingOrDefault) }.getMessage should ===("Mexico")
diff --git a/actor-tests/src/test/scala/org/apache/pekko/pattern/RetrySpec.scala b/actor-tests/src/test/scala/org/apache/pekko/pattern/RetrySpec.scala
index 5aa9e093c3..9696279019 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/pattern/RetrySpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/pattern/RetrySpec.scala
@@ -30,9 +30,9 @@ class RetrySpec extends PekkoSpec with RetrySupport {
"pattern.retry" must {
"run a successful Future immediately" in {
- val retried = retry(() => Future.successful(5), 5, 1 second)
+ val retried = retry(() => Future.successful(5), 5, 1.second)
- within(3 seconds) {
+ within(3.seconds) {
Await.result(retried, remaining) should ===(5)
}
}
@@ -46,17 +46,17 @@ class RetrySpec extends PekkoSpec with RetrySupport {
counter
},
5,
- 1 second)
+ 1.second)
- within(3 seconds) {
+ within(3.seconds) {
Await.result(retried, remaining) should ===(1)
}
}
"eventually return a failure for a Future that will never succeed" in {
- val retried = retry(() => Future.failed(new IllegalStateException("Mexico")), 5, 100 milliseconds)
+ val retried = retry(() => Future.failed(new IllegalStateException("Mexico")), 5, 100.milliseconds)
- within(3 second) {
+ within(3.second) {
intercept[IllegalStateException] { Await.result(retried, remaining) }.getMessage should ===("Mexico")
}
}
@@ -71,9 +71,9 @@ class RetrySpec extends PekkoSpec with RetrySupport {
} else Future.successful(5)
}
- val retried = retry(() => attempt(), 10, 100 milliseconds)
+ val retried = retry(() => attempt(), 10, 100.milliseconds)
- within(3 seconds) {
+ within(3.seconds) {
Await.result(retried, remaining) should ===(5)
}
}
@@ -88,9 +88,9 @@ class RetrySpec extends PekkoSpec with RetrySupport {
} else Future.successful(5)
}
- val retried = retry(() => attempt(), 5, 100 milliseconds)
+ val retried = retry(() => attempt(), 5, 100.milliseconds)
- within(3 seconds) {
+ within(3.seconds) {
intercept[IllegalStateException] { Await.result(retried, remaining) }.getMessage should ===("6")
}
}
@@ -111,7 +111,7 @@ class RetrySpec extends PekkoSpec with RetrySupport {
attemptedCount = attempted
Some(100.milliseconds * attempted)
})
- within(30000000 seconds) {
+ within(30000000.seconds) {
intercept[IllegalStateException] { Await.result(retried, remaining) }.getMessage should ===("6")
attemptedCount shouldBe 5
}
@@ -129,7 +129,7 @@ class RetrySpec extends PekkoSpec with RetrySupport {
val start = System.currentTimeMillis()
val retried = retry(() => attempt(), 999)
- within(1 seconds) {
+ within(1.seconds) {
intercept[IllegalStateException] {
Await.result(retried, remaining)
}.getMessage should ===("1000")
@@ -148,9 +148,9 @@ class RetrySpec extends PekkoSpec with RetrySupport {
} else Future.successful(5)
}
- val retried = retry(() => attempt(), 10, 100 milliseconds)
+ val retried = retry(() => attempt(), 10, 100.milliseconds)
- within(3 seconds) {
+ within(3.seconds) {
Await.result(retried, remaining) should ===(5)
}
}
@@ -161,9 +161,9 @@ class RetrySpec extends PekkoSpec with RetrySupport {
Future.successful(counter.incrementAndGet())
}
- val retried = retry(() => attempt(), (t: Int, _) => t < 5, 10, 100 milliseconds)
+ val retried = retry(() => attempt(), (t: Int, _) => t < 5, 10, 100.milliseconds)
- within(3 seconds) {
+ within(3.seconds) {
Await.result(retried, remaining) should ===(5)
}
}
@@ -178,9 +178,9 @@ class RetrySpec extends PekkoSpec with RetrySupport {
}
val retried =
- retry(() => attempt(), (_: Int, e) => !e.isInstanceOf[IllegalArgumentException], 10, 100 milliseconds)
+ retry(() => attempt(), (_: Int, e) => !e.isInstanceOf[IllegalArgumentException], 10, 100.milliseconds)
- within(3 seconds) {
+ within(3.seconds) {
retried.failed.futureValue shouldBe an[IllegalArgumentException]
counter.get() should ===(1)
}
diff --git a/actor-tests/src/test/scala/org/apache/pekko/routing/ConfiguredLocalRoutingSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/routing/ConfiguredLocalRoutingSpec.scala
index 2e33fdbad4..f15f50e299 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/routing/ConfiguredLocalRoutingSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/routing/ConfiguredLocalRoutingSpec.scala
@@ -142,19 +142,19 @@ class ConfiguredLocalRoutingSpec
"be picked up from Props" in {
val actor = system.actorOf(RoundRobinPool(12).props(routeeProps = Props[EchoProps]()), "someOther")
routerConfig(actor) should ===(RoundRobinPool(12))
- Await.result(gracefulStop(actor, 3 seconds), 3 seconds)
+ Await.result(gracefulStop(actor, 3.seconds), 3.seconds)
}
"be overridable in config" in {
val actor = system.actorOf(RoundRobinPool(12).props(routeeProps = Props[EchoProps]()), "config")
routerConfig(actor) should ===(RandomPool(nrOfInstances = 4, usePoolDispatcher = true))
- Await.result(gracefulStop(actor, 3 seconds), 3 seconds)
+ Await.result(gracefulStop(actor, 3.seconds), 3.seconds)
}
"use routees.paths from config" in {
val actor = system.actorOf(RandomPool(12).props(routeeProps = Props[EchoProps]()), "paths")
routerConfig(actor) should ===(RandomGroup(List("/user/service1", "/user/service2")))
- Await.result(gracefulStop(actor, 3 seconds), 3 seconds)
+ Await.result(gracefulStop(actor, 3.seconds), 3.seconds)
}
"be overridable in explicit deployment" in {
@@ -162,7 +162,7 @@ class ConfiguredLocalRoutingSpec
FromConfig.props(routeeProps = Props[EchoProps]()).withDeploy(Deploy(routerConfig = RoundRobinPool(12))),
"someOther")
routerConfig(actor) should ===(RoundRobinPool(12))
- Await.result(gracefulStop(actor, 3 seconds), 3 seconds)
+ Await.result(gracefulStop(actor, 3.seconds), 3.seconds)
}
"be overridable in config even with explicit deployment" in {
@@ -170,7 +170,7 @@ class ConfiguredLocalRoutingSpec
FromConfig.props(routeeProps = Props[EchoProps]()).withDeploy(Deploy(routerConfig = RoundRobinPool(12))),
"config")
routerConfig(actor) should ===(RandomPool(nrOfInstances = 4, usePoolDispatcher = true))
- Await.result(gracefulStop(actor, 3 seconds), 3 seconds)
+ Await.result(gracefulStop(actor, 3.seconds), 3.seconds)
}
"fail with an exception if not correct" in {
@@ -185,7 +185,7 @@ class ConfiguredLocalRoutingSpec
@nowarn
val expc = Set('a', 'b', 'c').map(i => "/user/weird/$" + i)
recv should ===(expc)
- expectNoMessage(1 second)
+ expectNoMessage(1.second)
}
"support custom router" in {
diff --git a/actor-tests/src/test/scala/org/apache/pekko/routing/RandomSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/routing/RandomSpec.scala
index f99cf9b600..4f476db828 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/routing/RandomSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/routing/RandomSpec.scala
@@ -48,12 +48,12 @@ class RandomSpec extends PekkoSpec with DefaultTimeout with ImplicitSender {
actor ! "hello"
actor ! "hello"
- within(2 seconds) {
+ within(2.seconds) {
for (_ <- 1 to 5) expectMsg("world")
}
system.stop(actor)
- Await.ready(stopLatch, 5 seconds)
+ Await.ready(stopLatch, 5.seconds)
}
"deliver messages in a random fashion" in {
@@ -85,7 +85,7 @@ class RandomSpec extends PekkoSpec with DefaultTimeout with ImplicitSender {
counter.get should ===(connectionCount)
actor ! pekko.routing.Broadcast("end")
- Await.ready(doneLatch, 5 seconds)
+ Await.ready(doneLatch, 5.seconds)
replies.values.foreach { _ should be > 0 }
replies.values.sum should ===(iterationCount * connectionCount)
@@ -106,10 +106,10 @@ class RandomSpec extends PekkoSpec with DefaultTimeout with ImplicitSender {
})), "random-broadcast")
actor ! pekko.routing.Broadcast("hello")
- Await.ready(helloLatch, 5 seconds)
+ Await.ready(helloLatch, 5.seconds)
system.stop(actor)
- Await.ready(stopLatch, 5 seconds)
+ Await.ready(stopLatch, 5.seconds)
}
}
}
diff --git a/actor-tests/src/test/scala/org/apache/pekko/routing/ResizerSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/routing/ResizerSpec.scala
index 7524ab6f23..85ba5593a0 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/routing/ResizerSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/routing/ResizerSpec.scala
@@ -205,15 +205,15 @@ class ResizerSpec extends PekkoSpec(ResizerSpec.config) with DefaultTimeout with
}
// 2 more should go through without triggering more
- loop(2, 200 millis)
+ loop(2, 200.millis)
routeeSize(router) should ===(resizer.lowerBound)
// a whole bunch should max it out
- loop(20, 500 millis)
+ loop(20, 500.millis)
routeeSize(router) should ===(resizer.upperBound)
}
- "backoff" in within(10 seconds) {
+ "backoff" in within(10.seconds) {
val resizer = DefaultResizer(
lowerBound = 2,
upperBound = 5,
@@ -226,25 +226,25 @@ class ResizerSpec extends PekkoSpec(ResizerSpec.config) with DefaultTimeout with
val router = system.actorOf(RoundRobinPool(nrOfInstances = 0, resizer = Some(resizer)).props(Props(new Actor {
def receive = {
case n: Int if n <= 0 => // done
- case n: Int => Thread.sleep((n millis).dilated.toMillis)
+ case n: Int => Thread.sleep(n.millis.dilated.toMillis)
}
})))
// put some pressure on the router
for (_ <- 0 until 15) {
router ! 150
- Thread.sleep((20 millis).dilated.toMillis)
+ Thread.sleep(20.millis.dilated.toMillis)
}
val z = routeeSize(router)
z should be > 2
- Thread.sleep((300 millis).dilated.toMillis)
+ Thread.sleep(300.millis.dilated.toMillis)
// let it cool down
awaitCond({
router ! 0 // trigger resize
- Thread.sleep((20 millis).dilated.toMillis)
+ Thread.sleep(20.millis.dilated.toMillis)
routeeSize(router) < z
}, interval = 500.millis.dilated)
diff --git a/actor-tests/src/test/scala/org/apache/pekko/routing/RoundRobinSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/routing/RoundRobinSpec.scala
index 1f7b1c5d24..0a318d4135 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/routing/RoundRobinSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/routing/RoundRobinSpec.scala
@@ -54,10 +54,10 @@ class RoundRobinSpec extends PekkoSpec with DefaultTimeout with ImplicitSender {
actor ! "hello"
actor ! "hello"
actor ! "hello"
- Await.ready(helloLatch, 5 seconds)
+ Await.ready(helloLatch, 5.seconds)
system.stop(actor)
- Await.ready(stopLatch, 5 seconds)
+ Await.ready(stopLatch, 5.seconds)
}
"deliver messages in a round robin fashion" in {
@@ -84,7 +84,7 @@ class RoundRobinSpec extends PekkoSpec with DefaultTimeout with ImplicitSender {
counter.get should ===(connectionCount)
actor ! pekko.routing.Broadcast("end")
- Await.ready(doneLatch, 5 seconds)
+ Await.ready(doneLatch, 5.seconds)
replies.values.foreach { _ should ===(iterationCount) }
}
@@ -104,10 +104,10 @@ class RoundRobinSpec extends PekkoSpec with DefaultTimeout with ImplicitSender {
})), "round-robin-broadcast")
actor ! pekko.routing.Broadcast("hello")
- Await.ready(helloLatch, 5 seconds)
+ Await.ready(helloLatch, 5.seconds)
system.stop(actor)
- Await.ready(stopLatch, 5 seconds)
+ Await.ready(stopLatch, 5.seconds)
}
"be controlled with management messages" in {
@@ -156,7 +156,7 @@ class RoundRobinSpec extends PekkoSpec with DefaultTimeout with ImplicitSender {
}
actor ! pekko.routing.Broadcast("end")
- Await.ready(doneLatch, 5 seconds)
+ Await.ready(doneLatch, 5.seconds)
replies.values.foreach { _ should ===(iterationCount) }
}
diff --git a/actor-tests/src/test/scala/org/apache/pekko/routing/RoutingSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/routing/RoutingSpec.scala
index 893387ea92..b783e4fae6 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/routing/RoutingSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/routing/RoutingSpec.scala
@@ -79,7 +79,7 @@ class RoutingSpec extends PekkoSpec(RoutingSpec.config) with DefaultTimeout with
awaitCond {
router ! ""
router ! ""
- val res = receiveWhile(100 millis, messages = 2) {
+ val res = receiveWhile(100.millis, messages = 2) {
case x: ActorRef => x
}
res == Seq(c1, c1)
diff --git a/actor-tests/src/test/scala/org/apache/pekko/serialization/SerializeSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/serialization/SerializeSpec.scala
index 3a5cc4adef..24cb453c79 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/serialization/SerializeSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/serialization/SerializeSpec.scala
@@ -307,7 +307,7 @@ class SerializeSpec extends PekkoSpec(SerializationTests.serializeConf) {
}
class VerifySerializabilitySpec extends PekkoSpec(SerializationTests.verifySerializabilityConf) {
- implicit val timeout: Timeout = Timeout(5 seconds)
+ implicit val timeout: Timeout = Timeout(5.seconds)
"verify config" in {
system.settings.SerializeAllCreators should ===(true)
diff --git a/actor-tests/src/test/scala/org/apache/pekko/util/DurationSpec.scala b/actor-tests/src/test/scala/org/apache/pekko/util/DurationSpec.scala
index 366fc74348..e18a95ffa2 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/util/DurationSpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/util/DurationSpec.scala
@@ -24,8 +24,8 @@ class DurationSpec extends PekkoSpec {
"Duration" must {
"form a one-dimensional vector field" in {
- val zero = 0 seconds
- val one = 1 second
+ val zero = 0.seconds
+ val one = 1.second
val two = one + one
val three = 3 * one
(0 * one) should ===(zero)
@@ -96,11 +96,11 @@ class DurationSpec extends PekkoSpec {
val dead = 2.seconds.fromNow
val dead2 = 2.seconds(fromNow)
// view bounds vs. very local type inference vs. operator precedence: sigh
- dead.timeLeft should be > (1 second: Duration)
- dead2.timeLeft should be > (1 second: Duration)
+ dead.timeLeft should be > (1.second: Duration)
+ dead2.timeLeft should be > (1.second: Duration)
Thread.sleep(1.second.toMillis)
- dead.timeLeft should be < (1 second: Duration)
- dead2.timeLeft should be < (1 second: Duration)
+ dead.timeLeft should be < (1.second: Duration)
+ dead2.timeLeft should be < (1.second: Duration)
}
}
diff --git a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/delivery/TestConsumer.scala b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/delivery/TestConsumer.scala
index d7681948ab..fd565d095f 100644
--- a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/delivery/TestConsumer.scala
+++ b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/delivery/TestConsumer.scala
@@ -113,8 +113,7 @@ class TestConsumer(
case job @ SomeAsyncJob(_, confirmTo, producerId, seqNr) =>
// when replacing producer the seqNr may start from 1 again
val cleanProcessed =
- if (seqNr == 1L) processed.filterNot { case (pid, _) => pid == producerId }
- else processed
+ if (seqNr == 1L) processed.filterNot { case (pid, _) => pid == producerId } else processed
if (cleanProcessed((producerId, seqNr)))
throw new RuntimeException(s"Received duplicate [($producerId,$seqNr)]")
diff --git a/actor/src/main/scala/org/apache/pekko/io/DirectByteBufferPool.scala b/actor/src/main/scala/org/apache/pekko/io/DirectByteBufferPool.scala
index e8902db9d8..b0efe71a4a 100644
--- a/actor/src/main/scala/org/apache/pekko/io/DirectByteBufferPool.scala
+++ b/actor/src/main/scala/org/apache/pekko/io/DirectByteBufferPool.scala
@@ -100,7 +100,9 @@ private[pekko] object DirectByteBufferPool {
val cleaner = cleanerMethod.invoke(bb)
cleanMethod.invoke(cleaner)
}
- catch { case NonFatal(_) => /* ok, best effort attempt to cleanup failed */ }
+ catch {
+ case NonFatal(_) => /* ok, best effort attempt to cleanup failed */
+ }
}
} catch { case NonFatal(_) => _ => () /* reflection failed, use no-op fallback */ }
diff --git a/cluster-metrics/src/main/scala/org/apache/pekko/cluster/metrics/Provision.scala b/cluster-metrics/src/main/scala/org/apache/pekko/cluster/metrics/Provision.scala
index 7af138a738..be84f8928f 100644
--- a/cluster-metrics/src/main/scala/org/apache/pekko/cluster/metrics/Provision.scala
+++ b/cluster-metrics/src/main/scala/org/apache/pekko/cluster/metrics/Provision.scala
@@ -81,7 +81,7 @@ trait SigarProvider {
})
.recover {
case e: Throwable => throw new RuntimeException("Failed to load sigar:", e)
- } get
+ }.get
}
}
diff --git a/cluster-metrics/src/multi-jvm/scala/org/apache/pekko/cluster/metrics/ClusterMetricsExtensionSpec.scala b/cluster-metrics/src/multi-jvm/scala/org/apache/pekko/cluster/metrics/ClusterMetricsExtensionSpec.scala
index a772dd2d17..727bda2147 100644
--- a/cluster-metrics/src/multi-jvm/scala/org/apache/pekko/cluster/metrics/ClusterMetricsExtensionSpec.scala
+++ b/cluster-metrics/src/multi-jvm/scala/org/apache/pekko/cluster/metrics/ClusterMetricsExtensionSpec.scala
@@ -113,7 +113,7 @@ abstract class ClusterMetricsEnabledSpec
"Cluster metrics" must {
"periodically collect metrics on each node, publish to the event stream, " +
- "and gossip metrics around the node ring" in within(60 seconds) {
+ "and gossip metrics around the node ring" in within(60.seconds) {
awaitClusterUp(roles: _*)
enterBarrier("cluster-started")
awaitAssert(clusterView.members.count(_.status == MemberStatus.Up) should ===(roles.size))
@@ -124,7 +124,7 @@ abstract class ClusterMetricsEnabledSpec
collector.sample().metrics.size should be > 3
enterBarrier("after")
}
- "reflect the correct number of node metrics in cluster view" in within(30 seconds) {
+ "reflect the correct number of node metrics in cluster view" in within(30.seconds) {
runOn(node2) {
cluster.leave(node1)
}
diff --git a/cluster-metrics/src/multi-jvm/scala/org/apache/pekko/cluster/metrics/ClusterMetricsRoutingSpec.scala b/cluster-metrics/src/multi-jvm/scala/org/apache/pekko/cluster/metrics/ClusterMetricsRoutingSpec.scala
index 62da2a0f6d..81eb4129e7 100644
--- a/cluster-metrics/src/multi-jvm/scala/org/apache/pekko/cluster/metrics/ClusterMetricsRoutingSpec.scala
+++ b/cluster-metrics/src/multi-jvm/scala/org/apache/pekko/cluster/metrics/ClusterMetricsRoutingSpec.scala
@@ -143,7 +143,7 @@ abstract class AdaptiveLoadBalancingRouterSpec
def receiveReplies(expectedReplies: Int): Map[Address, Int] = {
val zero = Map.empty[Address, Int] ++ roles.map(address(_) -> 0)
- receiveWhile(5 seconds, messages = expectedReplies) {
+ receiveWhile(5.seconds, messages = expectedReplies) {
case Reply(address) => address
}.foldLeft(zero) {
case (replyMap, address) => replyMap + (address -> (replyMap(address) + 1))
diff --git a/cluster-metrics/src/multi-jvm/scala/org/apache/pekko/cluster/metrics/sample/StatsSampleSpec.scala b/cluster-metrics/src/multi-jvm/scala/org/apache/pekko/cluster/metrics/sample/StatsSampleSpec.scala
index 05376e313c..eec1bc235e 100644
--- a/cluster-metrics/src/multi-jvm/scala/org/apache/pekko/cluster/metrics/sample/StatsSampleSpec.scala
+++ b/cluster-metrics/src/multi-jvm/scala/org/apache/pekko/cluster/metrics/sample/StatsSampleSpec.scala
@@ -104,7 +104,7 @@ abstract class StatsSampleSpec
"The stats sample" must {
// #startup-cluster
- "illustrate how to startup cluster" in within(15 seconds) {
+ "illustrate how to startup cluster" in within(15.seconds) {
Cluster(system).subscribe(testActor, classOf[MemberUp])
expectMsgClass(classOf[CurrentClusterState])
@@ -131,7 +131,7 @@ abstract class StatsSampleSpec
// #startup-cluster
// #test-statsService
- "show usage of the statsService from one node" in within(15 seconds) {
+ "show usage of the statsService from one node" in within(15.seconds) {
runOn(second) {
assertServiceOk()
}
@@ -151,7 +151,7 @@ abstract class StatsSampleSpec
}
// #test-statsService
- "show usage of the statsService from all nodes" in within(15 seconds) {
+ "show usage of the statsService from all nodes" in within(15.seconds) {
assertServiceOk()
testConductor.enter("done-3")
}
diff --git a/cluster-metrics/src/test/scala/org/apache/pekko/cluster/metrics/ClusterMetricsExtensionSpec.scala b/cluster-metrics/src/test/scala/org/apache/pekko/cluster/metrics/ClusterMetricsExtensionSpec.scala
index f9532a2e7a..1da1efce1a 100644
--- a/cluster-metrics/src/test/scala/org/apache/pekko/cluster/metrics/ClusterMetricsExtensionSpec.scala
+++ b/cluster-metrics/src/test/scala/org/apache/pekko/cluster/metrics/ClusterMetricsExtensionSpec.scala
@@ -54,11 +54,11 @@ class ClusterMetricsExtensionSpec
"collect metrics after start command" in {
extension.supervisor ! CollectionStartMessage
- awaitAssert(metricsNodeCount should ===(nodeCount), 15 seconds)
+ awaitAssert(metricsNodeCount should ===(nodeCount), 15.seconds)
}
"collect mock sample during a time window" in {
- awaitAssert(metricsHistorySize should ===(sampleCount), 15 seconds)
+ awaitAssert(metricsHistorySize should ===(sampleCount), 15.seconds)
extension.supervisor ! CollectionStopMessage
awaitSample()
metricsNodeCount should ===(nodeCount)
diff --git a/cluster-metrics/src/test/scala/org/apache/pekko/cluster/metrics/ClusterMetricsSettingsSpec.scala b/cluster-metrics/src/test/scala/org/apache/pekko/cluster/metrics/ClusterMetricsSettingsSpec.scala
index a8622f72e4..9640d30528 100644
--- a/cluster-metrics/src/test/scala/org/apache/pekko/cluster/metrics/ClusterMetricsSettingsSpec.scala
+++ b/cluster-metrics/src/test/scala/org/apache/pekko/cluster/metrics/ClusterMetricsSettingsSpec.scala
@@ -32,7 +32,7 @@ class ClusterMetricsSettingsSpec extends PekkoSpec {
// Extension.
MetricsDispatcher should ===(Dispatchers.DefaultDispatcherId)
- PeriodicTasksInitialDelay should ===(1 second)
+ PeriodicTasksInitialDelay should ===(1.second)
NativeLibraryExtractFolder should ===(System.getProperty("user.dir") + "/native")
// Supervisor.
@@ -44,9 +44,9 @@ class ClusterMetricsSettingsSpec extends PekkoSpec {
// Collector.
CollectorEnabled should ===(true)
CollectorProvider should ===("")
- CollectorSampleInterval should ===(3 seconds)
- CollectorGossipInterval should ===(3 seconds)
- CollectorMovingAverageHalfLife should ===(12 seconds)
+ CollectorSampleInterval should ===(3.seconds)
+ CollectorGossipInterval should ===(3.seconds)
+ CollectorMovingAverageHalfLife should ===(12.seconds)
}
}
}
diff --git a/cluster-metrics/src/test/scala/org/apache/pekko/cluster/metrics/MetricsCollectorSpec.scala b/cluster-metrics/src/test/scala/org/apache/pekko/cluster/metrics/MetricsCollectorSpec.scala
index 276db67891..83bd81c059 100644
--- a/cluster-metrics/src/test/scala/org/apache/pekko/cluster/metrics/MetricsCollectorSpec.scala
+++ b/cluster-metrics/src/test/scala/org/apache/pekko/cluster/metrics/MetricsCollectorSpec.scala
@@ -103,7 +103,7 @@ class MetricsCollectorSpec
c.processors.isDefined should ===(true)
}
- "collect 50 node metrics samples in an acceptable duration" taggedAs LongRunningTest in within(10 seconds) {
+ "collect 50 node metrics samples in an acceptable duration" taggedAs LongRunningTest in within(10.seconds) {
(1 to 50).foreach { _ =>
val sample = collector.sample()
sample.metrics.size should be >= 3
diff --git a/cluster-metrics/src/test/scala/org/apache/pekko/cluster/metrics/TestUtil.scala b/cluster-metrics/src/test/scala/org/apache/pekko/cluster/metrics/TestUtil.scala
index 8b19504066..672d5fece1 100644
--- a/cluster-metrics/src/test/scala/org/apache/pekko/cluster/metrics/TestUtil.scala
+++ b/cluster-metrics/src/test/scala/org/apache/pekko/cluster/metrics/TestUtil.scala
@@ -80,7 +80,7 @@ case class MockitoSigarProvider(
/** Generate monotonic array from 0 to value. */
def increase(value: Double): Array[Double] = {
val delta = value / steps
- (0 to steps).map { _ * delta } toArray
+ (0 to steps).map { _ * delta }.toArray
}
/** Sigar mock instance. */
diff --git a/cluster-sharding/src/multi-jvm/scala/org/apache/pekko/cluster/sbr/RandomizedBrainResolverIntegrationSpec.scala b/cluster-sharding/src/multi-jvm/scala/org/apache/pekko/cluster/sbr/RandomizedBrainResolverIntegrationSpec.scala
index 0672f41223..39ca53bb23 100644
--- a/cluster-sharding/src/multi-jvm/scala/org/apache/pekko/cluster/sbr/RandomizedBrainResolverIntegrationSpec.scala
+++ b/cluster-sharding/src/multi-jvm/scala/org/apache/pekko/cluster/sbr/RandomizedBrainResolverIntegrationSpec.scala
@@ -312,7 +312,9 @@ class RandomizedSplitBrainResolverIntegrationSpec
(if (cleanSplit)
s"side1 [${side1.map(_.name).mkString(", ")}], side2 [${side2.map(_.name).mkString(", ")}] "
else " ") +
- s", flaky [${flaky.map { case (_, (from, to)) => from.name -> to.map(_.name).mkString("(", ", ", ")") }.mkString("; ")}] " +
+ s", flaky [${flaky.map { case (_, (from, to)) =>
+ from.name -> to.map(_.name).mkString("(", ", ", ")")
+ }.mkString("; ")}] " +
s", healLastFlaky [$healLastFlaky] " +
s", delays [${delays.mkString(", ")}]")
diff --git a/cluster-sharding/src/multi-jvm/scala/org/apache/pekko/cluster/sharding/ClusterShardingSpec.scala b/cluster-sharding/src/multi-jvm/scala/org/apache/pekko/cluster/sharding/ClusterShardingSpec.scala
index 5adffa7f22..cc166cdebb 100644
--- a/cluster-sharding/src/multi-jvm/scala/org/apache/pekko/cluster/sharding/ClusterShardingSpec.scala
+++ b/cluster-sharding/src/multi-jvm/scala/org/apache/pekko/cluster/sharding/ClusterShardingSpec.scala
@@ -430,7 +430,7 @@ abstract class ClusterShardingSpec(multiNodeConfig: ClusterShardingSpecConfig)
enterBarrier("after-1")
}
- "work in single node cluster" in within(20 seconds) {
+ "work in single node cluster" in within(20.seconds) {
join(first, first)
runOn(first) {
@@ -448,7 +448,7 @@ abstract class ClusterShardingSpec(multiNodeConfig: ClusterShardingSpecConfig)
enterBarrier("after-2")
}
- "use second node" in within(20 seconds) {
+ "use second node" in within(20.seconds) {
join(second, first)
runOn(second) {
@@ -534,7 +534,7 @@ abstract class ClusterShardingSpec(multiNodeConfig: ClusterShardingSpecConfig)
enterBarrier("after-5")
}
- "failover shards on crashed node" in within(30 seconds) {
+ "failover shards on crashed node" in within(30.seconds) {
// mute logging of deadLetters during shutdown of systems
if (!log.isDebugEnabled)
system.eventStream.publish(Mute(DeadLettersFilter[Any]))
@@ -567,7 +567,7 @@ abstract class ClusterShardingSpec(multiNodeConfig: ClusterShardingSpecConfig)
enterBarrier("after-6")
}
- "use third and fourth node" in within(15 seconds) {
+ "use third and fourth node" in within(15.seconds) {
join(third, first)
runOn(third) {
@@ -618,7 +618,7 @@ abstract class ClusterShardingSpec(multiNodeConfig: ClusterShardingSpecConfig)
enterBarrier("after-7")
}
- "recover coordinator state after coordinator crash" in within(60 seconds) {
+ "recover coordinator state after coordinator crash" in within(60.seconds) {
join(fifth, fourth)
runOn(controller) {
@@ -649,7 +649,7 @@ abstract class ClusterShardingSpec(multiNodeConfig: ClusterShardingSpecConfig)
enterBarrier("after-8")
}
- "rebalance to nodes with less shards" in within(60 seconds) {
+ "rebalance to nodes with less shards" in within(60.seconds) {
runOn(fourth) {
for (n <- 1 to 10) {
rebalancingRegion ! EntityEnvelope(n, Increment)
@@ -799,26 +799,26 @@ abstract class ClusterShardingSpec(multiNodeConfig: ClusterShardingSpecConfig)
// clean up shard cache everywhere
runOn(third, fourth, fifth) {
persistentEntitiesRegion ! BeginHandOff("1")
- expectMsg(10 seconds, "ShardStopped not received", BeginHandOffAck("1"))
+ expectMsg(10.seconds, "ShardStopped not received", BeginHandOffAck("1"))
}
enterBarrier("everybody-hand-off-ack")
runOn(third) {
// Stop the shard cleanly
region ! HandOff("1")
- expectMsg(10 seconds, "ShardStopped not received", ShardStopped("1"))
+ expectMsg(10.seconds, "ShardStopped not received", ShardStopped("1"))
val probe = TestProbe()
awaitAssert({
shard.tell(Identify(1), probe.ref)
- probe.expectMsg(1 second, "Shard was still around", ActorIdentity(1, None))
- }, 5 seconds, 500 millis)
+ probe.expectMsg(1.second, "Shard was still around", ActorIdentity(1, None))
+ }, 5.seconds, 500.millis)
// Get the path to where the shard now resides
awaitAssert({
persistentEntitiesRegion ! Get(13)
expectMsg(0)
- }, 5 seconds, 500 millis)
+ }, 5.seconds, 500.millis)
// Check that counter 1 is now alive again, even though we have
// not sent a message to it via the ShardRegion
@@ -847,7 +847,7 @@ abstract class ClusterShardingSpec(multiNodeConfig: ClusterShardingSpecConfig)
// Check that no counter "1" exists in this shard
val secondCounter1 = system.actorSelection(lastSender.path.parent / "1")
secondCounter1 ! Identify(3)
- expectMsg(3 seconds, ActorIdentity(3, None))
+ expectMsg(3.seconds, ActorIdentity(3, None))
}
enterBarrier("after-12")
@@ -883,24 +883,24 @@ abstract class ClusterShardingSpec(multiNodeConfig: ClusterShardingSpecConfig)
shard.tell(Passivate(Stop), counter1)
// Watch for the terminated message
- expectTerminated(counter1, 5 seconds)
+ expectTerminated(counter1, 5.seconds)
val probe1 = TestProbe()
awaitAssert({
// Check counter 1 is dead
counter1.tell(Identify(1), probe1.ref)
- probe1.expectMsg(1 second, "Entity 1 was still around", ActorIdentity(1, None))
- }, 5 second, 500 millis)
+ probe1.expectMsg(1.second, "Entity 1 was still around", ActorIdentity(1, None))
+ }, 5.second, 500.millis)
// Stop the shard cleanly
region ! HandOff("1")
- expectMsg(10 seconds, "ShardStopped not received", ShardStopped("1"))
+ expectMsg(10.seconds, "ShardStopped not received", ShardStopped("1"))
val probe2 = TestProbe()
awaitAssert({
shard.tell(Identify(2), probe2.ref)
- probe2.expectMsg(1 second, "Shard was still around", ActorIdentity(2, None))
- }, 5 seconds, 500 millis)
+ probe2.expectMsg(1.second, "Shard was still around", ActorIdentity(2, None))
+ }, 5.seconds, 500.millis)
}
enterBarrier("shard-shutdown-12")
@@ -920,8 +920,8 @@ abstract class ClusterShardingSpec(multiNodeConfig: ClusterShardingSpecConfig)
val probe3 = TestProbe()
awaitAssert({
system.actorSelection(shard / "13").tell(Identify(4), probe3.ref)
- probe3.expectMsgType[ActorIdentity](1 second).ref should not be None
- }, 5 seconds, 500 millis)
+ probe3.expectMsgType[ActorIdentity](1.second).ref should not be None
+ }, 5.seconds, 500.millis)
}
enterBarrier("after-13")
@@ -946,7 +946,7 @@ abstract class ClusterShardingSpec(multiNodeConfig: ClusterShardingSpecConfig)
val probe = TestProbe()
awaitAssert({
counter1.tell(Identify(1), probe.ref)
- probe.expectMsgType[ActorIdentity](1 second).ref should not be None
+ probe.expectMsgType[ActorIdentity](1.second).ref should not be None
}, 5.seconds, 500.millis)
}
@@ -983,8 +983,8 @@ abstract class ClusterShardingSpec(multiNodeConfig: ClusterShardingSpecConfig)
val probe = TestProbe()
awaitAssert({
counter1.tell(Identify(1), probe.ref)
- probe.expectMsgType[ActorIdentity](1 second).ref should not be None
- }, 5.seconds, 500 millis)
+ probe.expectMsgType[ActorIdentity](1.second).ref should not be None
+ }, 5.seconds, 500.millis)
counter1 ! Get(1)
expectMsg(2)
@@ -1017,7 +1017,7 @@ abstract class ClusterShardingSpec(multiNodeConfig: ClusterShardingSpecConfig)
for (n <- 2 to 12) {
val entity = system.actorSelection(rebalancingPersistentRegion.path / (n % 12).toString / n.toString)
entity ! Identify(n)
- receiveOne(3 seconds) match {
+ receiveOne(3.seconds) match {
case ActorIdentity(id, Some(_)) if id == n => count = count + 1
case ActorIdentity(_, None) => // Not on the fifth shard
case _ => fail()
diff --git a/cluster-tools/src/multi-jvm/scala/org/apache/pekko/cluster/client/ClusterClientSpec.scala b/cluster-tools/src/multi-jvm/scala/org/apache/pekko/cluster/client/ClusterClientSpec.scala
index 2854065cd5..d43e6009d6 100644
--- a/cluster-tools/src/multi-jvm/scala/org/apache/pekko/cluster/client/ClusterClientSpec.scala
+++ b/cluster-tools/src/multi-jvm/scala/org/apache/pekko/cluster/client/ClusterClientSpec.scala
@@ -216,7 +216,7 @@ class ClusterClientSpec extends MultiNodeSpec(ClusterClientSpec) with STMultiNod
"A ClusterClient" must {
- "startup cluster" in within(30 seconds) {
+ "startup cluster" in within(30.seconds) {
join(first, first)
join(second, first)
join(third, first)
@@ -232,7 +232,7 @@ class ClusterClientSpec extends MultiNodeSpec(ClusterClientSpec) with STMultiNod
enterBarrier("after-1")
}
- "communicate to actor on any node in cluster" in within(10 seconds) {
+ "communicate to actor on any node in cluster" in within(10.seconds) {
runOn(client) {
val c = system.actorOf(
ClusterClient.props(ClusterClientSettings(system).withInitialContacts(initialContacts)),
@@ -248,7 +248,7 @@ class ClusterClientSpec extends MultiNodeSpec(ClusterClientSpec) with STMultiNod
enterBarrier("after-2")
}
- "work with ask" in within(10 seconds) {
+ "work with ask" in within(10.seconds) {
runOn(client) {
import pekko.pattern.ask
val c = system.actorOf(
@@ -266,7 +266,7 @@ class ClusterClientSpec extends MultiNodeSpec(ClusterClientSpec) with STMultiNod
enterBarrier("after-3")
}
- "demonstrate usage" in within(15 seconds) {
+ "demonstrate usage" in within(15.seconds) {
def host1 = first
def host2 = second
def host3 = third
@@ -308,7 +308,7 @@ class ClusterClientSpec extends MultiNodeSpec(ClusterClientSpec) with STMultiNod
enterBarrier("after-4")
}
- "report events" in within(15 seconds) {
+ "report events" in within(15.seconds) {
runOn(client) {
implicit val timeout: Timeout = Timeout(1.second.dilated)
val client = Await.result(system.actorSelection("/user/client").resolveOne(), timeout.duration)
@@ -348,7 +348,7 @@ class ClusterClientSpec extends MultiNodeSpec(ClusterClientSpec) with STMultiNod
enterBarrier("after-5")
}
- "report a removal of a receptionist" in within(10 seconds) {
+ "report a removal of a receptionist" in within(10.seconds) {
runOn(client) {
val unreachableContact = node(client) / "system" / "receptionist"
val expectedRoles = Set(first, second, third, fourth)
diff --git a/cluster-tools/src/multi-jvm/scala/org/apache/pekko/cluster/pubsub/DistributedPubSubMediatorSpec.scala b/cluster-tools/src/multi-jvm/scala/org/apache/pekko/cluster/pubsub/DistributedPubSubMediatorSpec.scala
index 26b6a1837d..5bd8f1e2ae 100644
--- a/cluster-tools/src/multi-jvm/scala/org/apache/pekko/cluster/pubsub/DistributedPubSubMediatorSpec.scala
+++ b/cluster-tools/src/multi-jvm/scala/org/apache/pekko/cluster/pubsub/DistributedPubSubMediatorSpec.scala
@@ -186,13 +186,13 @@ class DistributedPubSubMediatorSpec
"A DistributedPubSubMediator" must {
- "startup 2 node cluster" in within(15 seconds) {
+ "startup 2 node cluster" in within(15.seconds) {
join(first, first)
join(second, first)
enterBarrier("after-1")
}
- "keep track of added users" in within(15 seconds) {
+ "keep track of added users" in within(15.seconds) {
runOn(first) {
val u1 = createChatUser("u1")
mediator ! Put(u1)
@@ -242,7 +242,7 @@ class DistributedPubSubMediatorSpec
enterBarrier("after-2")
}
- "replicate users to new node" in within(20 seconds) {
+ "replicate users to new node" in within(20.seconds) {
join(third, first)
runOn(third) {
@@ -265,7 +265,7 @@ class DistributedPubSubMediatorSpec
enterBarrier("after-3")
}
- "keep track of removed users" in within(15 seconds) {
+ "keep track of removed users" in within(15.seconds) {
runOn(first) {
val u6 = createChatUser("u6")
mediator ! Put(u6)
@@ -281,7 +281,7 @@ class DistributedPubSubMediatorSpec
enterBarrier("after-4")
}
- "remove terminated users" in within(5 seconds) {
+ "remove terminated users" in within(5.seconds) {
runOn(second) {
chatUser("u3") ! PoisonPill
}
@@ -290,7 +290,7 @@ class DistributedPubSubMediatorSpec
enterBarrier("after-5")
}
- "publish" in within(15 seconds) {
+ "publish" in within(15.seconds) {
runOn(first, second) {
val u7 = createChatUser("u7")
mediator ! Put(u7)
@@ -313,7 +313,7 @@ class DistributedPubSubMediatorSpec
enterBarrier("after-6")
}
- "publish to topic" in within(15 seconds) {
+ "publish to topic" in within(15.seconds) {
runOn(first) {
val s8 = Subscribe("topic1", createChatUser("u8"))
mediator ! s8
@@ -352,7 +352,7 @@ class DistributedPubSubMediatorSpec
enterBarrier("after-7")
}
- "demonstrate usage of Publish" in within(15 seconds) {
+ "demonstrate usage of Publish" in within(15.seconds) {
def later(): Unit = {
awaitCount(10)
}
@@ -379,7 +379,7 @@ class DistributedPubSubMediatorSpec
enterBarrier("after-8")
}
- "demonstrate usage of Send" in within(15 seconds) {
+ "demonstrate usage of Send" in within(15.seconds) {
def later(): Unit = {
awaitCount(12)
}
@@ -405,7 +405,7 @@ class DistributedPubSubMediatorSpec
enterBarrier("after-8")
}
- "send-all to all other nodes" in within(15 seconds) {
+ "send-all to all other nodes" in within(15.seconds) {
runOn(first, second, third) { // create the user on all nodes
val u11 = createChatUser("u11")
mediator ! Put(u11)
@@ -428,7 +428,7 @@ class DistributedPubSubMediatorSpec
enterBarrier("after-11")
}
- "send one message to each group" in within(20 seconds) {
+ "send one message to each group" in within(20.seconds) {
runOn(first) {
val u12 = createChatUser("u12")
u12 ! JoinGroup("topic2", "group1")
@@ -517,7 +517,7 @@ class DistributedPubSubMediatorSpec
enterBarrier("after-13")
}
- "remove entries when node is removed" in within(30 seconds) {
+ "remove entries when node is removed" in within(30.seconds) {
mediator ! Count
val countBefore = expectMsgType[Int]
@@ -535,7 +535,7 @@ class DistributedPubSubMediatorSpec
enterBarrier("after-14")
}
- "receive proper unsubscribeAck message" in within(15 seconds) {
+ "receive proper unsubscribeAck message" in within(15.seconds) {
runOn(first) {
val user = createChatUser("u111")
val topic = "sample-topic1"
@@ -549,7 +549,7 @@ class DistributedPubSubMediatorSpec
enterBarrier("after-14")
}
- "get topics after simple publish" in within(15 seconds) {
+ "get topics after simple publish" in within(15.seconds) {
runOn(first) {
val s1 = Subscribe("topic_a1", createChatUser("u14"))
mediator ! s1
@@ -597,7 +597,7 @@ class DistributedPubSubMediatorSpec
}
- "remove topic subscribers when they terminate" in within(15 seconds) {
+ "remove topic subscribers when they terminate" in within(15.seconds) {
runOn(first) {
val s1 = Subscribe("topic_b1", createChatUser("u18"))
mediator ! s1
diff --git a/cluster-tools/src/multi-jvm/scala/org/apache/pekko/cluster/pubsub/DistributedPubSubRestartSpec.scala b/cluster-tools/src/multi-jvm/scala/org/apache/pekko/cluster/pubsub/DistributedPubSubRestartSpec.scala
index 55c87551ca..bfbba5ee23 100644
--- a/cluster-tools/src/multi-jvm/scala/org/apache/pekko/cluster/pubsub/DistributedPubSubRestartSpec.scala
+++ b/cluster-tools/src/multi-jvm/scala/org/apache/pekko/cluster/pubsub/DistributedPubSubRestartSpec.scala
@@ -93,14 +93,14 @@ class DistributedPubSubRestartSpec
"A Cluster with DistributedPubSub" must {
- "startup 3 node cluster" in within(15 seconds) {
+ "startup 3 node cluster" in within(15.seconds) {
join(first, first)
join(second, first)
join(third, first)
enterBarrier("after-1")
}
- "handle restart of nodes with same address" in within(30 seconds) {
+ "handle restart of nodes with same address" in within(30.seconds) {
mediator ! Subscribe("topic1", testActor)
expectMsgType[SubscribeAck]
awaitCount(3)
diff --git a/cluster-tools/src/multi-jvm/scala/org/apache/pekko/cluster/singleton/ClusterSingletonManagerChaosSpec.scala b/cluster-tools/src/multi-jvm/scala/org/apache/pekko/cluster/singleton/ClusterSingletonManagerChaosSpec.scala
index 57b0819af3..2f97a988bc 100644
--- a/cluster-tools/src/multi-jvm/scala/org/apache/pekko/cluster/singleton/ClusterSingletonManagerChaosSpec.scala
+++ b/cluster-tools/src/multi-jvm/scala/org/apache/pekko/cluster/singleton/ClusterSingletonManagerChaosSpec.scala
@@ -122,7 +122,7 @@ class ClusterSingletonManagerChaosSpec
"A ClusterSingletonManager in chaotic cluster" must {
- "startup 6 node cluster" in within(60 seconds) {
+ "startup 6 node cluster" in within(60.seconds) {
val memberProbe = TestProbe()
Cluster(system).subscribe(memberProbe.ref, classOf[MemberUp])
memberProbe.expectMsgClass(classOf[CurrentClusterState])
@@ -157,7 +157,7 @@ class ClusterSingletonManagerChaosSpec
}
- "take over when three oldest nodes crash in 6 nodes cluster" in within(90 seconds) {
+ "take over when three oldest nodes crash in 6 nodes cluster" in within(90.seconds) {
// mute logging of deadLetters during shutdown of systems
if (!log.isDebugEnabled)
system.eventStream.publish(Mute(DeadLettersFilter[Any]))
diff --git a/cluster-tools/src/multi-jvm/scala/org/apache/pekko/cluster/singleton/ClusterSingletonManagerSpec.scala b/cluster-tools/src/multi-jvm/scala/org/apache/pekko/cluster/singleton/ClusterSingletonManagerSpec.scala
index f04c2aa276..39fe21d2ca 100644
--- a/cluster-tools/src/multi-jvm/scala/org/apache/pekko/cluster/singleton/ClusterSingletonManagerSpec.scala
+++ b/cluster-tools/src/multi-jvm/scala/org/apache/pekko/cluster/singleton/ClusterSingletonManagerSpec.scala
@@ -313,13 +313,13 @@ class ClusterSingletonManagerSpec
runOn(controller) {
queue ! msg
// make sure it's not terminated, which would be wrong
- expectNoMessage(1 second)
+ expectNoMessage(1.second)
}
runOn(oldest) {
expectMsg(5.seconds, msg)
}
runOn(roles.filterNot(r => r == oldest || r == controller || r == observer): _*) {
- expectNoMessage(1 second)
+ expectNoMessage(1.second)
}
enterBarrier("after-" + msg + "-verified")
}
@@ -337,7 +337,7 @@ class ClusterSingletonManagerSpec
"A ClusterSingletonManager" must {
- "startup 6 node cluster" in within(60 seconds) {
+ "startup 6 node cluster" in within(60.seconds) {
val memberProbe = TestProbe()
Cluster(system).subscribe(memberProbe.ref, classOf[MemberUp])
@@ -387,7 +387,7 @@ class ClusterSingletonManagerSpec
enterBarrier("after-1")
}
- "let the proxy route messages to the singleton in a 6 node cluster" in within(60 seconds) {
+ "let the proxy route messages to the singleton in a 6 node cluster" in within(60.seconds) {
verifyProxyMsg(first, first, msg = msg())
verifyProxyMsg(first, second, msg = msg())
verifyProxyMsg(first, third, msg = msg())
@@ -396,7 +396,7 @@ class ClusterSingletonManagerSpec
verifyProxyMsg(first, sixth, msg = msg())
}
- "hand over when oldest leaves in 6 nodes cluster " in within(30 seconds) {
+ "hand over when oldest leaves in 6 nodes cluster " in within(30.seconds) {
val leaveRole = first
runOn(leaveRole) {
@@ -424,7 +424,7 @@ class ClusterSingletonManagerSpec
enterBarrier("after-leave")
}
- "take over when oldest crashes in 5 nodes cluster" in within(60 seconds) {
+ "take over when oldest crashes in 5 nodes cluster" in within(60.seconds) {
// mute logging of deadLetters during shutdown of systems
if (!log.isDebugEnabled)
system.eventStream.publish(Mute(DeadLettersFilter[Any]))
@@ -439,7 +439,7 @@ class ClusterSingletonManagerSpec
verifyProxyMsg(third, sixth, msg = msg())
}
- "take over when two oldest crash in 3 nodes cluster" in within(60 seconds) {
+ "take over when two oldest crash in 3 nodes cluster" in within(60.seconds) {
crash(third, fourth)
verifyRegistration(fifth)
verifyMsg(fifth, msg = msg())
@@ -447,7 +447,7 @@ class ClusterSingletonManagerSpec
verifyProxyMsg(fifth, sixth, msg = msg())
}
- "take over when oldest crashes in 2 nodes cluster" in within(60 seconds) {
+ "take over when oldest crashes in 2 nodes cluster" in within(60.seconds) {
crash(fifth)
verifyRegistration(sixth)
verifyMsg(sixth, msg = msg())
diff --git a/cluster/src/main/scala/org/apache/pekko/cluster/ClusterEvent.scala b/cluster/src/main/scala/org/apache/pekko/cluster/ClusterEvent.scala
index d571f39978..bdc779ab5d 100644
--- a/cluster/src/main/scala/org/apache/pekko/cluster/ClusterEvent.scala
+++ b/cluster/src/main/scala/org/apache/pekko/cluster/ClusterEvent.scala
@@ -166,7 +166,7 @@ object ClusterEvent {
/**
* Java API: get address of current data center leader, or null if none
*/
- def getLeader: Address = leader orNull
+ def getLeader: Address = leader.orNull
/**
* get address of current leader, if any, within the data center that has the given role
@@ -366,7 +366,7 @@ object ClusterEvent {
* Java API
* @return address of current leader, or null if none
*/
- def getLeader: Address = leader orNull
+ def getLeader: Address = leader.orNull
}
/**
@@ -380,7 +380,7 @@ object ClusterEvent {
* Java API
* @return address of current leader, or null if none
*/
- def getLeader: Address = leader orNull
+ def getLeader: Address = leader.orNull
}
/**
diff --git a/cluster/src/main/scala/org/apache/pekko/cluster/Member.scala b/cluster/src/main/scala/org/apache/pekko/cluster/Member.scala
index d09e31fd27..0c813132f9 100644
--- a/cluster/src/main/scala/org/apache/pekko/cluster/Member.scala
+++ b/cluster/src/main/scala/org/apache/pekko/cluster/Member.scala
@@ -52,7 +52,8 @@ class Member private[cluster] (
case _ => false
}
override def toString: String = {
- s"Member($address, $status${if (dataCenter == ClusterSettings.DefaultDataCenter) "" else s", $dataCenter"}${if (appVersion == Version.Zero) ""
+ s"Member($address, $status${if (dataCenter == ClusterSettings.DefaultDataCenter) ""
+ else s", $dataCenter"}${if (appVersion == Version.Zero) ""
else s", $appVersion"})"
}
diff --git a/cluster/src/main/scala/org/apache/pekko/cluster/sbr/SplitBrainResolver.scala b/cluster/src/main/scala/org/apache/pekko/cluster/sbr/SplitBrainResolver.scala
index 0fed30518c..1386b812fa 100644
--- a/cluster/src/main/scala/org/apache/pekko/cluster/sbr/SplitBrainResolver.scala
+++ b/cluster/src/main/scala/org/apache/pekko/cluster/sbr/SplitBrainResolver.scala
@@ -484,7 +484,8 @@ import pekko.remote.artery.ThisActorSystemQuarantinedEvent
log.warning(
ClusterLogMarker.sbrDowning(decision),
- s"SBR took decision $decision and is downing [${nodesToDown.map(_.address).mkString(", ")}]${if (downMyself) " including myself"
+ s"SBR took decision $decision and is downing [${nodesToDown.map(_.address).mkString(", ")}]${if (downMyself)
+ " including myself"
else ""}, " +
s"[${strategy.unreachable.size}] unreachable of [${strategy.members.size}] members" +
indirectlyConnectedLogMessage +
diff --git a/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/ClusterDeathWatchSpec.scala b/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/ClusterDeathWatchSpec.scala
index dd5147d0f1..b4afa83bad 100644
--- a/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/ClusterDeathWatchSpec.scala
+++ b/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/ClusterDeathWatchSpec.scala
@@ -86,7 +86,7 @@ abstract class ClusterDeathWatchSpec
"An actor watching a remote actor in the cluster" must {
- "receive Terminated when watched node becomes Down/Removed" in within(20 seconds) {
+ "receive Terminated when watched node becomes Down/Removed" in within(20.seconds) {
awaitClusterUp(first, second, third, fourth)
enterBarrier("cluster-up")
@@ -163,7 +163,7 @@ abstract class ClusterDeathWatchSpec
}
"not be able to watch an actor before node joins cluster, ClusterRemoteWatcher takes over from RemoteWatcher" in within(
- 20 seconds) {
+ 20.seconds) {
runOn(fifth) {
system.actorOf(
Props(new Actor { def receive = Actor.emptyBehavior }).withDeploy(Deploy.local),
@@ -253,7 +253,7 @@ abstract class ClusterDeathWatchSpec
enterBarrier("after-4")
}
- "be able to shutdown system when using remote deployed actor on node that crash" in within(20 seconds) {
+ "be able to shutdown system when using remote deployed actor on node that crash" in within(20.seconds) {
// fourth actor system will be shutdown, not part of testConductor any more
// so we can't use barriers to synchronize with it
val firstAddress = address(first)
@@ -298,7 +298,7 @@ abstract class ClusterDeathWatchSpec
endProbe.expectMsg(EndActor.EndAck)
} finally {
- shutdown(endSystem, 10 seconds)
+ shutdown(endSystem, 10.seconds)
}
// no barrier here, because it is not part of testConductor roles any more
diff --git a/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/ConvergenceSpec.scala b/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/ConvergenceSpec.scala
index 6c88cd46c2..4fe6a9f11c 100644
--- a/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/ConvergenceSpec.scala
+++ b/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/ConvergenceSpec.scala
@@ -79,7 +79,7 @@ abstract class ConvergenceSpec(multiNodeConfig: ConvergenceMultiNodeConfig)
runOn(first, second) {
- within(28 seconds) {
+ within(28.seconds) {
// third becomes unreachable
awaitAssert(clusterView.unreachableMembers.size should ===(1))
awaitSeenSameState(first, second)
diff --git a/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/InitialHeartbeatSpec.scala b/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/InitialHeartbeatSpec.scala
index c5895573a5..3c7e1ab506 100644
--- a/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/InitialHeartbeatSpec.scala
+++ b/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/InitialHeartbeatSpec.scala
@@ -54,7 +54,7 @@ abstract class InitialHeartbeatSpec extends MultiNodeClusterSpec(InitialHeartbea
awaitClusterUp(first)
runOn(first) {
- within(10 seconds) {
+ within(10.seconds) {
awaitAssert({
cluster.sendCurrentClusterState(testActor)
expectMsgType[CurrentClusterState].members.map(_.address) should contain(secondAddress)
@@ -63,7 +63,7 @@ abstract class InitialHeartbeatSpec extends MultiNodeClusterSpec(InitialHeartbea
}
runOn(second) {
cluster.join(first)
- within(10 seconds) {
+ within(10.seconds) {
awaitAssert({
cluster.sendCurrentClusterState(testActor)
expectMsgType[CurrentClusterState].members.map(_.address) should contain(firstAddress)
@@ -81,7 +81,7 @@ abstract class InitialHeartbeatSpec extends MultiNodeClusterSpec(InitialHeartbea
}
runOn(second) {
- within(15 seconds) {
+ within(15.seconds) {
awaitCond(!cluster.failureDetector.isAvailable(first))
}
}
diff --git a/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/LeaderDowningNodeThatIsUnreachableSpec.scala b/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/LeaderDowningNodeThatIsUnreachableSpec.scala
index 2b58a8a72a..16a183fd88 100644
--- a/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/LeaderDowningNodeThatIsUnreachableSpec.scala
+++ b/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/LeaderDowningNodeThatIsUnreachableSpec.scala
@@ -124,7 +124,7 @@ abstract class LeaderDowningNodeThatIsUnreachableSpec(
runOn(third) {
enterBarrier("down-second-node")
- awaitMembersUp(numberOfMembers = 2, canNotBePartOfMemberRing = Set(secondAddress), 30 seconds)
+ awaitMembersUp(numberOfMembers = 2, canNotBePartOfMemberRing = Set(secondAddress), 30.seconds)
}
enterBarrier("await-completion-2")
diff --git a/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/LeaderElectionSpec.scala b/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/LeaderElectionSpec.scala
index 9a09a425cc..aaaa15876b 100644
--- a/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/LeaderElectionSpec.scala
+++ b/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/LeaderElectionSpec.scala
@@ -121,13 +121,13 @@ abstract class LeaderElectionSpec(multiNodeConfig: LeaderElectionMultiNodeConfig
}
}
- "be able to 're-elect' a single leader after leader has left" taggedAs LongRunningTest in within(30 seconds) {
+ "be able to 're-elect' a single leader after leader has left" taggedAs LongRunningTest in within(30.seconds) {
shutdownLeaderAndVerifyNewLeader(alreadyShutdown = 0)
enterBarrier("after-2")
}
"be able to 're-elect' a single leader after leader has left (again)" taggedAs LongRunningTest in within(
- 30 seconds) {
+ 30.seconds) {
shutdownLeaderAndVerifyNewLeader(alreadyShutdown = 1)
enterBarrier("after-3")
}
diff --git a/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/MBeanSpec.scala b/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/MBeanSpec.scala
index 9fc91cbb05..bc57ec910a 100644
--- a/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/MBeanSpec.scala
+++ b/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/MBeanSpec.scala
@@ -107,7 +107,7 @@ abstract class MBeanSpec extends MultiNodeClusterSpec(MBeanMultiJvmSpec) {
val fourthAddress = address(fourth)
- "format cluster status as JSON with full reachability info" taggedAs LongRunningTest in within(30 seconds) {
+ "format cluster status as JSON with full reachability info" taggedAs LongRunningTest in within(30.seconds) {
runOn(first) {
testConductor.exit(fourth, 0).await
}
@@ -187,7 +187,7 @@ abstract class MBeanSpec extends MultiNodeClusterSpec(MBeanMultiJvmSpec) {
}
- "support down" taggedAs LongRunningTest in within(20 seconds) {
+ "support down" taggedAs LongRunningTest in within(20.seconds) {
// fourth unreachable in previous step
@@ -205,7 +205,7 @@ abstract class MBeanSpec extends MultiNodeClusterSpec(MBeanMultiJvmSpec) {
enterBarrier("after-6")
}
- "support leave" taggedAs LongRunningTest in within(20 seconds) {
+ "support leave" taggedAs LongRunningTest in within(20.seconds) {
runOn(second) {
mbeanServer.invoke(mbeanName, "leave", Array(address(third).toString), Array("java.lang.String"))
}
diff --git a/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/MemberWeaklyUpSpec.scala b/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/MemberWeaklyUpSpec.scala
index 83736605b2..858e20756a 100644
--- a/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/MemberWeaklyUpSpec.scala
+++ b/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/MemberWeaklyUpSpec.scala
@@ -63,7 +63,7 @@ abstract class MemberWeaklyUpSpec extends MultiNodeClusterSpec(MemberWeaklyUpSpe
}
"detect network partition and mark nodes on other side as unreachable" taggedAs LongRunningTest in within(
- 20 seconds) {
+ 20.seconds) {
runOn(first) {
// split the cluster in two parts (first, second) / (third, fourth, fifth)
for (role1 <- side1; role2 <- side2) {
@@ -83,7 +83,7 @@ abstract class MemberWeaklyUpSpec extends MultiNodeClusterSpec(MemberWeaklyUpSpe
enterBarrier("after-2")
}
- "accept joining on each side and set status to WeaklyUp" taggedAs LongRunningTest in within(20 seconds) {
+ "accept joining on each side and set status to WeaklyUp" taggedAs LongRunningTest in within(20.seconds) {
runOn(second) {
Cluster(system).join(first)
}
@@ -113,7 +113,7 @@ abstract class MemberWeaklyUpSpec extends MultiNodeClusterSpec(MemberWeaklyUpSpe
enterBarrier("after-3")
}
- "change status to Up after healed network partition" taggedAs LongRunningTest in within(20 seconds) {
+ "change status to Up after healed network partition" taggedAs LongRunningTest in within(20.seconds) {
runOn(first) {
for (role1 <- side1; role2 <- side2) {
testConductor.passThrough(role1, role2, Direction.Both).await
diff --git a/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/RestartFirstSeedNodeSpec.scala b/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/RestartFirstSeedNodeSpec.scala
index 956007b693..283a351963 100644
--- a/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/RestartFirstSeedNodeSpec.scala
+++ b/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/RestartFirstSeedNodeSpec.scala
@@ -84,7 +84,7 @@ abstract class RestartFirstSeedNodeSpec
}
"Cluster seed nodes" must {
- "be able to restart first seed node and join other seed nodes" taggedAs LongRunningTest in within(40 seconds) {
+ "be able to restart first seed node and join other seed nodes" taggedAs LongRunningTest in within(40.seconds) {
// seed1System is a separate ActorSystem, to be able to simulate restart
// we must transfer its address to seed2 and seed3
runOn(seed2, seed3) {
@@ -103,7 +103,7 @@ abstract class RestartFirstSeedNodeSpec
seedNode1Address = Cluster(seed1System).selfAddress
List(seed2, seed3).foreach { r =>
system.actorSelection(RootActorPath(r) / "user" / "address-receiver") ! seedNode1Address
- expectMsg(5 seconds, "ok")
+ expectMsg(5.seconds, "ok")
}
}
enterBarrier("seed1-address-transferred")
diff --git a/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/SplitBrainSpec.scala b/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/SplitBrainSpec.scala
index 51b5f41e29..90943f7342 100644
--- a/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/SplitBrainSpec.scala
+++ b/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/SplitBrainSpec.scala
@@ -77,7 +77,7 @@ abstract class SplitBrainSpec(multiNodeConfig: SplitBrainMultiNodeConfig)
}
"detect network partition and mark nodes on other side as unreachable and form new cluster" taggedAs LongRunningTest in within(
- 30 seconds) {
+ 30.seconds) {
enterBarrier("before-split")
runOn(first) {
diff --git a/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/StressSpec.scala b/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/StressSpec.scala
index 6ad2db7aa6..9a179e5520 100644
--- a/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/StressSpec.scala
+++ b/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/StressSpec.scala
@@ -857,7 +857,7 @@ abstract class StressSpec extends MultiNodeClusterSpec(StressMultiJvmSpec) with
// note: there must be one test step before pending, otherwise afterTermination will not run
if (isArteryEnabled && isAeronUdpTransport) pending
- "join seed nodes" taggedAs LongRunningTest in within(30 seconds) {
+ "join seed nodes" taggedAs LongRunningTest in within(30.seconds) {
val otherNodesJoiningSeedNodes =
roles.slice(numberOfSeedNodes, numberOfSeedNodes + numberOfNodesJoiningToSeedNodesInitially)
diff --git a/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/UnreachableNodeJoinsAgainSpec.scala b/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/UnreachableNodeJoinsAgainSpec.scala
index 3bfe0beda3..aeb7a1f3e6 100644
--- a/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/UnreachableNodeJoinsAgainSpec.scala
+++ b/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/UnreachableNodeJoinsAgainSpec.scala
@@ -96,7 +96,7 @@ abstract class UnreachableNodeJoinsAgainSpec extends MultiNodeClusterSpec(Unreac
val allButVictim = allBut(victim, roles)
runOn(victim) {
allButVictim.foreach(markNodeAsUnavailable(_))
- within(30 seconds) {
+ within(30.seconds) {
// victim becomes all alone
awaitAssert {
clusterView.unreachableMembers.size should ===(roles.size - 1)
@@ -107,7 +107,7 @@ abstract class UnreachableNodeJoinsAgainSpec extends MultiNodeClusterSpec(Unreac
runOn(allButVictim: _*) {
markNodeAsUnavailable(victim)
- within(30 seconds) {
+ within(30.seconds) {
// victim becomes unreachable
awaitAssert {
clusterView.unreachableMembers.size should ===(1)
@@ -132,7 +132,7 @@ abstract class UnreachableNodeJoinsAgainSpec extends MultiNodeClusterSpec(Unreac
runOn(allButVictim: _*) {
// eventually removed
awaitMembersUp(roles.size - 1, Set(victim))
- awaitAssert(clusterView.unreachableMembers should ===(Set.empty), 15 seconds)
+ awaitAssert(clusterView.unreachableMembers should ===(Set.empty), 15.seconds)
awaitAssert(clusterView.members.map(_.address) should ===(allButVictim.map(address).toSet))
}
@@ -184,14 +184,14 @@ abstract class UnreachableNodeJoinsAgainSpec extends MultiNodeClusterSpec(Unreac
}""")
.withFallback(system.settings.config)
- Await.ready(system.whenTerminated, 10 seconds)
+ Await.ready(system.whenTerminated, 10.seconds)
// create new ActorSystem with same host:port
val freshSystem = ActorSystem(system.name, freshConfig)
try {
Cluster(freshSystem).join(masterAddress)
- within(30 seconds) {
+ within(30.seconds) {
awaitAssert(Cluster(freshSystem).readView.members.map(_.address) should contain(victimAddress))
awaitAssert(Cluster(freshSystem).readView.members.size should ===(expectedNumberOfMembers))
awaitAssert(Cluster(freshSystem).readView.members.unsorted.map(_.status) should ===(Set(MemberStatus.Up)))
@@ -213,7 +213,7 @@ abstract class UnreachableNodeJoinsAgainSpec extends MultiNodeClusterSpec(Unreac
awaitMembersUp(expectedNumberOfMembers)
// don't end the test until the freshSystem is done
runOn(master) {
- expectMsg(20 seconds, EndActor.End)
+ expectMsg(20.seconds, EndActor.End)
}
endBarrier()
}
diff --git a/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/routing/ClusterRoundRobinSpec.scala b/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/routing/ClusterRoundRobinSpec.scala
index e49c82e0e6..f991d7dbed 100644
--- a/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/routing/ClusterRoundRobinSpec.scala
+++ b/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/routing/ClusterRoundRobinSpec.scala
@@ -132,7 +132,7 @@ abstract class ClusterRoundRobinSpec
def receiveReplies(routeeType: RouteeType, expectedReplies: Int): Map[Address, Int] = {
val zero = Map.empty[Address, Int] ++ roles.map(address(_) -> 0)
- receiveWhile(5 seconds, messages = expectedReplies) {
+ receiveWhile(5.seconds, messages = expectedReplies) {
case Reply(`routeeType`, ref) => fullAddress(ref)
}.foldLeft(zero) {
case (replyMap, address) => replyMap + (address -> (replyMap(address) + 1))
diff --git a/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/routing/UseRoleIgnoredSpec.scala b/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/routing/UseRoleIgnoredSpec.scala
index d0dec303a1..3dd0a8e9c9 100644
--- a/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/routing/UseRoleIgnoredSpec.scala
+++ b/cluster/src/multi-jvm/scala/org/apache/pekko/cluster/routing/UseRoleIgnoredSpec.scala
@@ -75,7 +75,7 @@ abstract class UseRoleIgnoredSpec
def receiveReplies(routeeType: RouteeType, expectedReplies: Int): Map[Address, Int] = {
val zero = Map.empty[Address, Int] ++ roles.map(address(_) -> 0)
- receiveWhile(5 seconds, messages = expectedReplies) {
+ receiveWhile(5.seconds, messages = expectedReplies) {
case Reply(`routeeType`, ref) => fullAddress(ref)
}.foldLeft(zero) {
case (replyMap, address) => replyMap + (address -> (replyMap(address) + 1))
diff --git a/cluster/src/test/scala/org/apache/pekko/cluster/ClusterConfigSpec.scala b/cluster/src/test/scala/org/apache/pekko/cluster/ClusterConfigSpec.scala
index f17380cbbf..7141dd9da9 100644
--- a/cluster/src/test/scala/org/apache/pekko/cluster/ClusterConfigSpec.scala
+++ b/cluster/src/test/scala/org/apache/pekko/cluster/ClusterConfigSpec.scala
@@ -38,21 +38,21 @@ class ClusterConfigSpec extends PekkoSpec {
LogInfo should ===(true)
FailureDetectorConfig.getDouble("threshold") should ===(8.0 +- 0.0001)
FailureDetectorConfig.getInt("max-sample-size") should ===(1000)
- FailureDetectorConfig.getMillisDuration("min-std-deviation") should ===(100 millis)
- FailureDetectorConfig.getMillisDuration("acceptable-heartbeat-pause") should ===(3 seconds)
+ FailureDetectorConfig.getMillisDuration("min-std-deviation") should ===(100.millis)
+ FailureDetectorConfig.getMillisDuration("acceptable-heartbeat-pause") should ===(3.seconds)
FailureDetectorImplementationClass should ===(classOf[PhiAccrualFailureDetector].getName)
SeedNodes should ===(Vector.empty[Address])
- SeedNodeTimeout should ===(5 seconds)
- RetryUnsuccessfulJoinAfter should ===(10 seconds)
+ SeedNodeTimeout should ===(5.seconds)
+ RetryUnsuccessfulJoinAfter should ===(10.seconds)
ShutdownAfterUnsuccessfulJoinSeedNodes should ===(Duration.Undefined)
- PeriodicTasksInitialDelay should ===(1 seconds)
- GossipInterval should ===(1 second)
- GossipTimeToLive should ===(2 seconds)
- HeartbeatInterval should ===(1 second)
+ PeriodicTasksInitialDelay should ===(1.seconds)
+ GossipInterval should ===(1.second)
+ GossipTimeToLive should ===(2.seconds)
+ HeartbeatInterval should ===(1.second)
MonitoredByNrOfMembers should ===(9)
- HeartbeatExpectedResponseAfter should ===(1 seconds)
- LeaderActionsInterval should ===(1 second)
- UnreachableNodesReaperInterval should ===(1 second)
+ HeartbeatExpectedResponseAfter should ===(1.seconds)
+ LeaderActionsInterval should ===(1.second)
+ UnreachableNodesReaperInterval should ===(1.second)
PublishStatsInterval should ===(Duration.Undefined)
DownRemovalMargin should ===(Duration.Zero)
MinNrOfMembers should ===(1)
@@ -64,7 +64,7 @@ class ClusterConfigSpec extends PekkoSpec {
UseDispatcher should ===(Dispatchers.InternalDispatcherId)
GossipDifferentViewProbability should ===(0.8 +- 0.0001)
ReduceGossipDifferentViewProbability should ===(400)
- SchedulerTickDuration should ===(33 millis)
+ SchedulerTickDuration should ===(33.millis)
SchedulerTicksPerWheel should ===(512)
}
diff --git a/docs/src/test/scala/docs/actor/ActorDocSpec.scala b/docs/src/test/scala/docs/actor/ActorDocSpec.scala
index da97a4f7d2..90679a4804 100644
--- a/docs/src/test/scala/docs/actor/ActorDocSpec.scala
+++ b/docs/src/test/scala/docs/actor/ActorDocSpec.scala
@@ -400,10 +400,10 @@ class ActorDocSpec extends PekkoSpec("""
system.eventStream.subscribe(testActor, classOf[Logging.Info])
myActor ! "test"
- expectMsgPF(1 second) { case Logging.Info(_, _, "received test") => true }
+ expectMsgPF(1.second) { case Logging.Info(_, _, "received test") => true }
myActor ! "unknown"
- expectMsgPF(1 second) { case Logging.Info(_, _, "received unknown message") => true }
+ expectMsgPF(1.second) { case Logging.Info(_, _, "received unknown message") => true }
system.eventStream.unsubscribe(testActor)
system.eventStream.publish(TestEvent.UnMute(filter))
@@ -420,7 +420,7 @@ class ActorDocSpec extends PekkoSpec("""
val ponger = system.actorOf(Props(classOf[Ponger], pinger), "ponger")
import system.dispatcher
- system.scheduler.scheduleOnce(500 millis) {
+ system.scheduler.scheduleOnce(500.millis) {
ponger ! Ping
}
@@ -546,9 +546,9 @@ class ActorDocSpec extends PekkoSpec("""
// #using-explicit-timeout
import scala.concurrent.duration._
import org.apache.pekko.pattern.ask
- val future = myActor.ask("hello")(5 seconds)
+ val future = myActor.ask("hello")(5.seconds)
// #using-explicit-timeout
- Await.result(future, 5 seconds) should be("hello")
+ Await.result(future, 5.seconds) should be("hello")
}
"using receiveTimeout" in {
@@ -557,11 +557,11 @@ class ActorDocSpec extends PekkoSpec("""
import scala.concurrent.duration._
class MyActor extends Actor {
// To set an initial delay
- context.setReceiveTimeout(30 milliseconds)
+ context.setReceiveTimeout(30.milliseconds)
def receive = {
case "Hello" =>
// To set in a response to a message
- context.setReceiveTimeout(100 milliseconds)
+ context.setReceiveTimeout(100.milliseconds)
case ReceiveTimeout =>
// To turn it off
context.setReceiveTimeout(Duration.Undefined)
@@ -671,8 +671,8 @@ class ActorDocSpec extends PekkoSpec("""
import scala.concurrent.Await
try {
- val stopped: Future[Boolean] = gracefulStop(actorRef, 5 seconds, Manager.Shutdown)
- Await.result(stopped, 6 seconds)
+ val stopped: Future[Boolean] = gracefulStop(actorRef, 5.seconds, Manager.Shutdown)
+ Await.result(stopped, 6.seconds)
// the actor has been stopped
} catch {
// the actor wasn't stopped within 5 seconds
diff --git a/docs/src/test/scala/docs/actor/FSMDocSpec.scala b/docs/src/test/scala/docs/actor/FSMDocSpec.scala
index b5f7f4067b..3741d6fe42 100644
--- a/docs/src/test/scala/docs/actor/FSMDocSpec.scala
+++ b/docs/src/test/scala/docs/actor/FSMDocSpec.scala
@@ -81,7 +81,7 @@ class FSMDocSpec extends MyFavoriteTestFrameWorkPlusPekkoTestKit {
// #transition-elided
// #when-syntax
- when(Active, stateTimeout = 1 second) {
+ when(Active, stateTimeout = 1.second) {
case Event(Flush | StateTimeout, t: Todo) =>
goto(Idle).using(t.copy(queue = Vector.empty))
}
@@ -120,13 +120,13 @@ class FSMDocSpec extends MyFavoriteTestFrameWorkPlusPekkoTestKit {
// #modifier-syntax
when(SomeState) {
case Event(msg, _) =>
- goto(Processing).using(newData).forMax(5 seconds).replying(WillDo)
+ goto(Processing).using(newData).forMax(5.seconds).replying(WillDo)
}
// #modifier-syntax
// #transition-syntax
onTransition {
- case Idle -> Active => startTimerWithFixedDelay("timeout", Tick, 1 second)
+ case Idle -> Active => startTimerWithFixedDelay("timeout", Tick, 1.second)
case Active -> _ => cancelTimer("timeout")
case x -> Idle => log.info("entering Idle from " + x)
}
diff --git a/docs/src/test/scala/docs/actor/FaultHandlingDocSample.scala b/docs/src/test/scala/docs/actor/FaultHandlingDocSample.scala
index 74c6ba09aa..8e1ee58e2a 100644
--- a/docs/src/test/scala/docs/actor/FaultHandlingDocSample.scala
+++ b/docs/src/test/scala/docs/actor/FaultHandlingDocSample.scala
@@ -57,7 +57,7 @@ object FaultHandlingDocSample extends App {
class Listener extends Actor with ActorLogging {
import Worker._
// If we don't get any progress within 15 seconds then the service is unavailable
- context.setReceiveTimeout(15 seconds)
+ context.setReceiveTimeout(15.seconds)
def receive = {
case Progress(percent) =>
@@ -90,7 +90,7 @@ object Worker {
class Worker extends Actor with ActorLogging {
import Worker._
import CounterService._
- implicit val askTimeout: Timeout = Timeout(5 seconds)
+ implicit val askTimeout: Timeout = Timeout(5.seconds)
// Stop the CounterService child if it throws ServiceUnavailable
override val supervisorStrategy = OneForOneStrategy() {
@@ -107,7 +107,7 @@ class Worker extends Actor with ActorLogging {
def receive = LoggingReceive {
case Start if progressListener.isEmpty =>
progressListener = Some(sender())
- context.system.scheduler.scheduleWithFixedDelay(Duration.Zero, 1 second, self, Do)
+ context.system.scheduler.scheduleWithFixedDelay(Duration.Zero, 1.second, self, Do)
case Do =>
counterService ! Increment(1)
@@ -147,7 +147,7 @@ class CounterService extends Actor {
// Restart the storage child when StorageException is thrown.
// After 3 restarts within 5 seconds it will be stopped.
- override val supervisorStrategy = OneForOneStrategy(maxNrOfRetries = 3, withinTimeRange = 5 seconds) {
+ override val supervisorStrategy = OneForOneStrategy(maxNrOfRetries = 3, withinTimeRange = 5.seconds) {
case _: Storage.StorageException => Restart
}
@@ -200,7 +200,7 @@ class CounterService extends Actor {
// Tell the counter that there is no storage for the moment
counter.foreach { _ ! UseStorage(None) }
// Try to re-establish storage after while
- context.system.scheduler.scheduleOnce(10 seconds, self, Reconnect)
+ context.system.scheduler.scheduleOnce(10.seconds, self, Reconnect)
case Reconnect =>
// Re-establish storage after the scheduled delay
diff --git a/docs/src/test/scala/docs/actor/FaultHandlingDocSpec.scala b/docs/src/test/scala/docs/actor/FaultHandlingDocSpec.scala
index 71166a8307..cb10485a4f 100644
--- a/docs/src/test/scala/docs/actor/FaultHandlingDocSpec.scala
+++ b/docs/src/test/scala/docs/actor/FaultHandlingDocSpec.scala
@@ -39,7 +39,7 @@ object FaultHandlingDocSpec {
import scala.concurrent.duration._
override val supervisorStrategy =
- OneForOneStrategy(maxNrOfRetries = 10, withinTimeRange = 1 minute) {
+ OneForOneStrategy(maxNrOfRetries = 10, withinTimeRange = 1.minute) {
case _: ArithmeticException => Resume
case _: NullPointerException => Restart
case _: IllegalArgumentException => Stop
@@ -62,7 +62,7 @@ object FaultHandlingDocSpec {
import scala.concurrent.duration._
override val supervisorStrategy =
- OneForOneStrategy(maxNrOfRetries = 10, withinTimeRange = 1 minute) {
+ OneForOneStrategy(maxNrOfRetries = 10, withinTimeRange = 1.minute) {
case _: ArithmeticException => Resume
case _: NullPointerException => Restart
case _: IllegalArgumentException => Stop
@@ -86,7 +86,7 @@ object FaultHandlingDocSpec {
import scala.concurrent.duration._
override val supervisorStrategy =
- OneForOneStrategy(maxNrOfRetries = 10, withinTimeRange = 1 minute) {
+ OneForOneStrategy(maxNrOfRetries = 10, withinTimeRange = 1.minute) {
case _: ArithmeticException => Resume
case t =>
super.supervisorStrategy.decider.applyOrElse(t, (_: Any) => Escalate)
diff --git a/docs/src/test/scala/docs/actor/SchedulerDocSpec.scala b/docs/src/test/scala/docs/actor/SchedulerDocSpec.scala
index ab9e060335..ec8290950a 100644
--- a/docs/src/test/scala/docs/actor/SchedulerDocSpec.scala
+++ b/docs/src/test/scala/docs/actor/SchedulerDocSpec.scala
@@ -44,14 +44,14 @@ class SchedulerDocSpec extends PekkoSpec(Map("pekko.loglevel" -> "INFO")) {
import system.dispatcher
// Schedules to send the "foo"-message to the testActor after 50ms
- system.scheduler.scheduleOnce(50 milliseconds, testActor, "foo")
+ system.scheduler.scheduleOnce(50.milliseconds, testActor, "foo")
// #schedule-one-off-message
- expectMsg(1 second, "foo")
+ expectMsg(1.second, "foo")
// #schedule-one-off-thunk
// Schedules a function to be executed (send a message to the testActor) after 50ms
- system.scheduler.scheduleOnce(50 milliseconds) {
+ system.scheduler.scheduleOnce(50.milliseconds) {
testActor ! System.currentTimeMillis
}
// #schedule-one-off-thunk
diff --git a/docs/src/test/scala/docs/duration/Sample.scala b/docs/src/test/scala/docs/duration/Sample.scala
index e9e4c79ee4..59dec6b9d8 100644
--- a/docs/src/test/scala/docs/duration/Sample.scala
+++ b/docs/src/test/scala/docs/duration/Sample.scala
@@ -24,7 +24,7 @@ object Scala {
val diff = fivesec - threemillis
assert(diff < fivesec)
val fourmillis = threemillis * 4 / 3 // you cannot write it the other way around
- val n = threemillis / (1 millisecond)
+ val n = threemillis / (1.millisecond)
// #dsl
// #deadline
diff --git a/docs/src/test/scala/docs/future/FutureDocSpec.scala b/docs/src/test/scala/docs/future/FutureDocSpec.scala
index e6dfd16a56..ba6ba57309 100644
--- a/docs/src/test/scala/docs/future/FutureDocSpec.scala
+++ b/docs/src/test/scala/docs/future/FutureDocSpec.scala
@@ -116,7 +116,7 @@ object FutureDocSpec {
import org.apache.pekko.pattern.{ ask, pipe }
implicit val ec: ExecutionContext = context.dispatcher
- implicit val timeout: Timeout = Timeout(5 seconds)
+ implicit val timeout: Timeout = Timeout(5.seconds)
def receive = {
case GetUserData =>
@@ -200,7 +200,7 @@ class FutureDocSpec extends PekkoSpec {
}
future.foreach(println)
// #future-eval
- Await.result(future, 3 seconds) should be("HelloWorld")
+ Await.result(future, 3.seconds) should be("HelloWorld")
}
"demonstrate usage of map" in {
@@ -213,7 +213,7 @@ class FutureDocSpec extends PekkoSpec {
}
f2.foreach(println)
// #map
- val result = Await.result(f2, 3 seconds)
+ val result = Await.result(f2, 3.seconds)
result should be(10)
f1.value should be(Some(Success("HelloWorld")))
}
@@ -231,7 +231,7 @@ class FutureDocSpec extends PekkoSpec {
}
f3.foreach(println)
// #wrong-nested-map
- Await.ready(f3, 3 seconds)
+ Await.ready(f3, 3.seconds)
}
"demonstrate usage of flatMap" in {
@@ -247,7 +247,7 @@ class FutureDocSpec extends PekkoSpec {
}
f3.foreach(println)
// #flat-map
- val result = Await.result(f3, 3 seconds)
+ val result = Await.result(f3, 3.seconds)
result should be(30)
}
@@ -265,9 +265,9 @@ class FutureDocSpec extends PekkoSpec {
failedFilter.foreach(println)
// #filter
- val result = Await.result(future2, 3 seconds)
+ val result = Await.result(future2, 3.seconds)
result should be(4)
- val result2 = Await.result(failedFilter, 3 seconds)
+ val result2 = Await.result(failedFilter, 3.seconds)
result2 should be(0) // Can only be 0 when there was a MatchError
}
@@ -285,7 +285,7 @@ class FutureDocSpec extends PekkoSpec {
f.foreach(println)
// #for-comprehension
- val result = Await.result(f, 3 seconds)
+ val result = Await.result(f, 3.seconds)
result should be(24)
}
@@ -303,12 +303,12 @@ class FutureDocSpec extends PekkoSpec {
val f1 = ask(actor1, msg1)
val f2 = ask(actor2, msg2)
- val a = Await.result(f1, 3 seconds).asInstanceOf[Int]
- val b = Await.result(f2, 3 seconds).asInstanceOf[Int]
+ val a = Await.result(f1, 3.seconds).asInstanceOf[Int]
+ val b = Await.result(f2, 3.seconds).asInstanceOf[Int]
val f3 = ask(actor3, a + b)
- val result = Await.result(f3, 3 seconds).asInstanceOf[Int]
+ val result = Await.result(f3, 3.seconds).asInstanceOf[Int]
// #composing-wrong
result should be(3)
}
@@ -335,7 +335,7 @@ class FutureDocSpec extends PekkoSpec {
f3.foreach(println)
// #composing
- val result = Await.result(f3, 3 seconds).asInstanceOf[Int]
+ val result = Await.result(f3, 3.seconds).asInstanceOf[Int]
result should be(3)
}
@@ -353,7 +353,7 @@ class FutureDocSpec extends PekkoSpec {
val oddSum = futureList.map(_.sum)
oddSum.foreach(println)
// #sequence-ask
- Await.result(oddSum, 3 seconds).asInstanceOf[Int] should be(10000)
+ Await.result(oddSum, 3.seconds).asInstanceOf[Int] should be(10000)
}
"demonstrate usage of sequence" in {
@@ -362,7 +362,7 @@ class FutureDocSpec extends PekkoSpec {
val oddSum = futureList.map(_.sum)
oddSum.foreach(println)
// #sequence
- Await.result(oddSum, 3 seconds).asInstanceOf[Int] should be(10000)
+ Await.result(oddSum, 3.seconds).asInstanceOf[Int] should be(10000)
}
"demonstrate usage of traverse" in {
@@ -371,7 +371,7 @@ class FutureDocSpec extends PekkoSpec {
val oddSum = futureList.map(_.sum)
oddSum.foreach(println)
// #traverse
- Await.result(oddSum, 3 seconds).asInstanceOf[Int] should be(10000)
+ Await.result(oddSum, 3.seconds).asInstanceOf[Int] should be(10000)
}
"demonstrate usage of fold" in {
@@ -381,7 +381,7 @@ class FutureDocSpec extends PekkoSpec {
val futureSum = Future.foldLeft(futures)(0)(_ + _)
futureSum.foreach(println)
// #fold
- Await.result(futureSum, 3 seconds) should be(1001000)
+ Await.result(futureSum, 3.seconds) should be(1001000)
}
"demonstrate usage of reduce" in {
@@ -391,7 +391,7 @@ class FutureDocSpec extends PekkoSpec {
val futureSum = Future.reduceLeft(futures)(_ + _)
futureSum.foreach(println)
// #reduce
- Await.result(futureSum, 3 seconds) should be(1001000)
+ Await.result(futureSum, 3.seconds) should be(1001000)
}
"demonstrate usage of recover" in {
@@ -419,7 +419,7 @@ class FutureDocSpec extends PekkoSpec {
}
future.foreach(println)
// #try-recover
- Await.result(future, 3 seconds) should be(0)
+ Await.result(future, 3.seconds) should be(0)
}
"demonstrate usage of zip" in {
@@ -429,7 +429,7 @@ class FutureDocSpec extends PekkoSpec {
val future3 = future1.zip(future2).map { case (a, b) => a + " " + b }
future3.foreach(println)
// #zip
- Await.result(future3, 3 seconds) should be("foo bar")
+ Await.result(future3, 3.seconds) should be("foo bar")
}
"demonstrate usage of andThen" in {
@@ -447,7 +447,7 @@ class FutureDocSpec extends PekkoSpec {
}
result.foreach(println)
// #and-then
- Await.result(result, 3 seconds) should be("foo bar")
+ Await.result(result, 3.seconds) should be("foo bar")
}
"demonstrate usage of fallbackTo" in {
@@ -458,7 +458,7 @@ class FutureDocSpec extends PekkoSpec {
val future4 = future1.fallbackTo(future2).fallbackTo(future3)
future4.foreach(println)
// #fallback-to
- Await.result(future4, 3 seconds) should be("foo")
+ Await.result(future4, 3.seconds) should be("foo")
}
"demonstrate usage of onComplete" in {
@@ -471,7 +471,7 @@ class FutureDocSpec extends PekkoSpec {
case Failure(failure) => doSomethingOnFailure(failure)
}
// #onComplete
- Await.result(future, 3 seconds) should be("foo")
+ Await.result(future, 3.seconds) should be("foo")
}
"demonstrate usage of Future.successful & Future.failed & Future.promise" in {
@@ -486,9 +486,9 @@ class FutureDocSpec extends PekkoSpec {
val theFuture = promise.future
promise.success("hello")
// #promise
- Await.result(future, 3 seconds) should be("Yay!")
- intercept[IllegalArgumentException] { Await.result(otherFuture, 3 seconds) }
- Await.result(theFuture, 3 seconds) should be("hello")
+ Await.result(future, 3.seconds) should be("Yay!")
+ intercept[IllegalArgumentException] { Await.result(otherFuture, 3.seconds) }
+ Await.result(theFuture, 3.seconds) should be("hello")
}
"demonstrate usage of pattern.after" in {
@@ -501,7 +501,7 @@ class FutureDocSpec extends PekkoSpec {
val future = Future { Thread.sleep(1000); "foo" }
val result = Future.firstCompletedOf(Seq(future, delayed))
// #after
- intercept[IllegalStateException] { Await.result(result, 2 second) }
+ intercept[IllegalStateException] { Await.result(result, 2.second) }
}
"demonstrate pattern.retry" in {
@@ -523,10 +523,10 @@ class FutureDocSpec extends PekkoSpec {
}
// Return a new future that will retry up to 10 times
- val retried: Future[Int] = pekko.pattern.retry(() => futureToAttempt(), attempts = 10, 100 milliseconds)
+ val retried: Future[Int] = pekko.pattern.retry(() => futureToAttempt(), attempts = 10, 100.milliseconds)
// #retry
- Await.result(retried, 1 second) should ===(5)
+ Await.result(retried, 1.second) should ===(5)
}
"demonstrate context.dispatcher" in {
diff --git a/docs/src/test/scala/docs/stream/operators/sourceorflow/FoldAsync.scala b/docs/src/test/scala/docs/stream/operators/sourceorflow/FoldAsync.scala
index 18ba1cc259..dfc6476e8a 100644
--- a/docs/src/test/scala/docs/stream/operators/sourceorflow/FoldAsync.scala
+++ b/docs/src/test/scala/docs/stream/operators/sourceorflow/FoldAsync.scala
@@ -29,8 +29,7 @@ object FoldAsync extends App {
// #foldAsync
case class Histogram(low: Long = 0, high: Long = 0) {
def add(i: Int): Future[Histogram] =
- if (i < 100) Future { copy(low = low + 1) }
- else Future { copy(high = high + 1) }
+ if (i < 100) Future { copy(low = low + 1) } else Future { copy(high = high + 1) }
}
Source(1 to 150).foldAsync(Histogram())((acc, n) => acc.add(n)).runForeach(println)
diff --git a/docs/src/test/scala/docs/testkit/TestKitUsageSpec.scala b/docs/src/test/scala/docs/testkit/TestKitUsageSpec.scala
index 7545669649..cf5cc5bca2 100644
--- a/docs/src/test/scala/docs/testkit/TestKitUsageSpec.scala
+++ b/docs/src/test/scala/docs/testkit/TestKitUsageSpec.scala
@@ -61,7 +61,7 @@ class TestKitUsageSpec
"An EchoActor" should {
"Respond with the same message it receives" in {
- within(500 millis) {
+ within(500.millis) {
echoRef ! "test"
expectMsg("test")
}
@@ -69,7 +69,7 @@ class TestKitUsageSpec
}
"A ForwardingActor" should {
"Forward a message it receives" in {
- within(500 millis) {
+ within(500.millis) {
forwardRef ! "test"
expectMsg("test")
}
@@ -78,7 +78,7 @@ class TestKitUsageSpec
"A FilteringActor" should {
"Filter all messages, except expected messagetypes it receives" in {
var messages = Seq[String]()
- within(500 millis) {
+ within(500.millis) {
filterRef ! "test"
expectMsg("test")
filterRef ! 1
@@ -89,7 +89,7 @@ class TestKitUsageSpec
filterRef ! "text"
filterRef ! 1
- receiveWhile(500 millis) {
+ receiveWhile(500.millis) {
case msg: String => messages = msg +: messages
}
}
@@ -99,7 +99,7 @@ class TestKitUsageSpec
}
"A SequencingActor" should {
"receive an interesting message at some point " in {
- within(500 millis) {
+ within(500.millis) {
ignoreMsg {
case msg: String => msg != "something"
}
diff --git a/docs/src/test/scala/docs/testkit/TestkitDocSpec.scala b/docs/src/test/scala/docs/testkit/TestkitDocSpec.scala
index 93a1b92ff9..0f63079800 100644
--- a/docs/src/test/scala/docs/testkit/TestkitDocSpec.scala
+++ b/docs/src/test/scala/docs/testkit/TestkitDocSpec.scala
@@ -164,7 +164,7 @@ class TestKitDocSpec extends PekkoSpec with DefaultTimeout with ImplicitSender {
assert(fsm.stateName == 1)
assert(fsm.isTimerActive("test") == false)
- fsm.startTimerWithFixedDelay("test", 12, 10 millis)
+ fsm.startTimerWithFixedDelay("test", 12, 10.millis)
assert(fsm.isTimerActive("test") == true)
fsm.cancelTimer("test")
assert(fsm.isTimerActive("test") == false)
@@ -191,7 +191,7 @@ class TestKitDocSpec extends PekkoSpec with DefaultTimeout with ImplicitSender {
system.eventStream.subscribe(testActor, classOf[UnhandledMessage])
val ref = TestActorRef[MyActor]
ref.receive(Unknown)
- expectMsg(1 second, UnhandledMessage(Unknown, system.deadLetters, ref))
+ expectMsg(1.second, UnhandledMessage(Unknown, system.deadLetters, ref))
// #test-unhandled
}
@@ -215,7 +215,7 @@ class TestKitDocSpec extends PekkoSpec with DefaultTimeout with ImplicitSender {
import scala.concurrent.duration._
val worker = system.actorOf(Props[Worker]())
- within(200 millis) {
+ within(200.millis) {
worker ! "some work"
expectMsg("some result")
expectNoMessage() // will block for the rest of the 200ms
@@ -239,8 +239,8 @@ class TestKitDocSpec extends PekkoSpec with DefaultTimeout with ImplicitSender {
val actor = system.actorOf(Props[MyDoubleEcho]())
actor ! ((probe1.ref, probe2.ref))
actor ! "hello"
- probe1.expectMsg(500 millis, "hello")
- probe2.expectMsg(500 millis, "hello")
+ probe1.expectMsg(500.millis, "hello")
+ probe2.expectMsg(500.millis, "hello")
// #test-probe
// #test-special-probe
@@ -285,7 +285,7 @@ class TestKitDocSpec extends PekkoSpec with DefaultTimeout with ImplicitSender {
// #test-probe-reply
val probe = TestProbe()
val future = probe.ref ? "hello"
- probe.expectMsg(0 millis, "hello") // TestActor runs on CallingThreadDispatcher
+ probe.expectMsg(0.millis, "hello") // TestActor runs on CallingThreadDispatcher
probe.reply("world")
assert(future.isCompleted && future.value.contains(Success("world")))
// #test-probe-reply
@@ -372,7 +372,7 @@ class TestKitDocSpec extends PekkoSpec with DefaultTimeout with ImplicitSender {
intercept[AssertionError] {
// #test-within-probe
val probe = TestProbe()
- within(1 second) {
+ within(1.second) {
probe.expectMsg("hello")
}
// #test-within-probe
diff --git a/multi-node-testkit/src/main/scala/org/apache/pekko/remote/testconductor/Conductor.scala b/multi-node-testkit/src/main/scala/org/apache/pekko/remote/testconductor/Conductor.scala
index 6062023843..0762a21f84 100644
--- a/multi-node-testkit/src/main/scala/org/apache/pekko/remote/testconductor/Conductor.scala
+++ b/multi-node-testkit/src/main/scala/org/apache/pekko/remote/testconductor/Conductor.scala
@@ -371,7 +371,7 @@ private[pekko] class ServerFSM(val controller: ActorRef, val channel: Channel)
channel.close()
}
- when(Initial, stateTimeout = 10 seconds) {
+ when(Initial, stateTimeout = 10.seconds) {
case Event(Hello(name, address), _) =>
roleName = RoleName(name)
controller ! NodeInfo(roleName, address, self)
diff --git a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/javadsl/CommandHandlerWithReply.scala b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/javadsl/CommandHandlerWithReply.scala
index 4d9a1440d0..14fc4b540a 100644
--- a/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/javadsl/CommandHandlerWithReply.scala
+++ b/persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/javadsl/CommandHandlerWithReply.scala
@@ -252,7 +252,8 @@ final class CommandHandlerWithReplyBuilderByState[Command, Event, S <: State, St
*/
def onCommand(predicate: Predicate[Command], handler: JFunction[Command, ReplyEffect[Event, State]])
: CommandHandlerWithReplyBuilderByState[Command, Event, S, State] = {
- addCase(cmd => predicate.test(cmd),
+ addCase(
+ cmd => predicate.test(cmd),
new BiFunction[S, Command, ReplyEffect[Event, State]] {
override def apply(state: S, cmd: Command): ReplyEffect[Event, State] = handler(cmd)
})
diff --git a/persistence/src/test/scala/org/apache/pekko/persistence/AtLeastOnceDeliveryFailureSpec.scala b/persistence/src/test/scala/org/apache/pekko/persistence/AtLeastOnceDeliveryFailureSpec.scala
index 5b405b495c..1d5db7a7ff 100644
--- a/persistence/src/test/scala/org/apache/pekko/persistence/AtLeastOnceDeliveryFailureSpec.scala
+++ b/persistence/src/test/scala/org/apache/pekko/persistence/AtLeastOnceDeliveryFailureSpec.scala
@@ -199,6 +199,6 @@ class AtLeastOnceDeliveryFailureSpec
}
def expectDone() = within(numMessages.seconds) {
- expectMsgType[Done].ints.sorted should ===(1 to numMessages toVector)
+ expectMsgType[Done].ints.sorted should ===((1 to numMessages).toVector)
}
}
diff --git a/persistence/src/test/scala/org/apache/pekko/persistence/SnapshotFailureRobustnessSpec.scala b/persistence/src/test/scala/org/apache/pekko/persistence/SnapshotFailureRobustnessSpec.scala
index 0369188db9..e37047c656 100644
--- a/persistence/src/test/scala/org/apache/pekko/persistence/SnapshotFailureRobustnessSpec.scala
+++ b/persistence/src/test/scala/org/apache/pekko/persistence/SnapshotFailureRobustnessSpec.scala
@@ -146,7 +146,7 @@ class SnapshotFailureRobustnessSpec
}
expectMsg("kablama-2")
expectMsg(RecoveryCompleted)
- expectNoMessage(1 second)
+ expectNoMessage(1.second)
} finally {
system.eventStream.unsubscribe(testActor, classOf[Logging.Error])
system.eventStream.publish(TestEvent.UnMute(EventFilter.error(start = "Error loading snapshot [")))
diff --git a/persistence/src/test/scala/org/apache/pekko/persistence/fsm/PersistentFSMSpec.scala b/persistence/src/test/scala/org/apache/pekko/persistence/fsm/PersistentFSMSpec.scala
index 6b1a9c5eab..65e5be7c49 100644
--- a/persistence/src/test/scala/org/apache/pekko/persistence/fsm/PersistentFSMSpec.scala
+++ b/persistence/src/test/scala/org/apache/pekko/persistence/fsm/PersistentFSMSpec.scala
@@ -62,7 +62,7 @@ abstract class PersistentFSMSpec(config: Config) extends PersistenceSpec(config)
expectMsg(CurrentState(fsmRef, LookingAround, None))
expectMsg(EmptyShoppingCart)
- expectMsg(Transition(fsmRef, LookingAround, Shopping, Some(1 second)))
+ expectMsg(Transition(fsmRef, LookingAround, Shopping, Some(1.second)))
expectMsg(NonEmptyShoppingCart(List(shirt)))
expectMsg(NonEmptyShoppingCart(List(shirt, shoes)))
expectMsg(NonEmptyShoppingCart(List(shirt, shoes, coat)))
@@ -88,11 +88,11 @@ abstract class PersistentFSMSpec(config: Config) extends PersistenceSpec(config)
expectMsg(CurrentState(fsmRef, LookingAround, None))
- expectMsg(Transition(fsmRef, LookingAround, Shopping, Some(1 second)))
+ expectMsg(Transition(fsmRef, LookingAround, Shopping, Some(1.second)))
val adjustedMin = 1.second - (System.nanoTime - before).nanos
within(min = adjustedMin, max = remainingOrDefault) {
- expectMsg(Transition(fsmRef, Shopping, Inactive, Some(2 seconds)))
+ expectMsg(Transition(fsmRef, Shopping, Inactive, Some(2.seconds)))
}
expectTerminated(fsmRef)
@@ -118,7 +118,7 @@ abstract class PersistentFSMSpec(config: Config) extends PersistenceSpec(config)
expectMsg(CurrentState(fsmRef, LookingAround, None))
expectMsg(EmptyShoppingCart)
- expectMsg(Transition(fsmRef, LookingAround, Shopping, Some(1 second)))
+ expectMsg(Transition(fsmRef, LookingAround, Shopping, Some(1.second)))
expectMsg(NonEmptyShoppingCart(List(shirt)))
expectMsg(NonEmptyShoppingCart(List(shirt, shoes)))
@@ -138,7 +138,7 @@ abstract class PersistentFSMSpec(config: Config) extends PersistenceSpec(config)
recoveredFsmRef ! GetCurrentCart
recoveredFsmRef ! Leave
- expectMsg(CurrentState(recoveredFsmRef, Shopping, Some(1 second)))
+ expectMsg(CurrentState(recoveredFsmRef, Shopping, Some(1.second)))
expectMsg(NonEmptyShoppingCart(List(shirt, shoes)))
expectMsg(NonEmptyShoppingCart(List(shirt, shoes, coat)))
@@ -168,7 +168,7 @@ abstract class PersistentFSMSpec(config: Config) extends PersistenceSpec(config)
fsmRef ! Leave
expectMsg(CurrentState(fsmRef, LookingAround, None))
- expectMsg(Transition(fsmRef, LookingAround, Shopping, Some(1 second)))
+ expectMsg(Transition(fsmRef, LookingAround, Shopping, Some(1.second)))
expectMsg(Transition(fsmRef, Shopping, Paid, None))
reportActorProbe.expectMsg(PurchaseWasMade(List(shirt, shoes, coat)))
expectTerminated(fsmRef)
@@ -192,7 +192,7 @@ abstract class PersistentFSMSpec(config: Config) extends PersistenceSpec(config)
fsmRef ! Leave
expectMsg(CurrentState(fsmRef, LookingAround, None))
- expectMsg(Transition(fsmRef, LookingAround, Shopping, Some(1 second)))
+ expectMsg(Transition(fsmRef, LookingAround, Shopping, Some(1.second)))
reportActorProbe.expectMsg(ShoppingCardDiscarded)
expectTerminated(fsmRef)
}
@@ -209,9 +209,9 @@ abstract class PersistentFSMSpec(config: Config) extends PersistenceSpec(config)
fsmRef ! AddItem(shirt)
expectMsg(CurrentState(fsmRef, LookingAround, None))
- expectMsg(Transition(fsmRef, LookingAround, Shopping, Some(1 second)))
+ expectMsg(Transition(fsmRef, LookingAround, Shopping, Some(1.second)))
- expectNoMessage(0.6 seconds) // arbitrarily chosen delay, less than the timeout, before stopping the FSM
+ expectNoMessage(0.6.seconds) // arbitrarily chosen delay, less than the timeout, before stopping the FSM
fsmRef ! PoisonPill
expectTerminated(fsmRef)
@@ -221,14 +221,14 @@ abstract class PersistentFSMSpec(config: Config) extends PersistenceSpec(config)
// this isn't when it got into that state, but close enough
val before = System.nanoTime
- expectMsg(CurrentState(recoveredFsmRef, Shopping, Some(1 second)))
+ expectMsg(CurrentState(recoveredFsmRef, Shopping, Some(1.second)))
val adjustedMin = 1.second - (System.nanoTime - before).nanos
within(min = adjustedMin, max = remainingOrDefault) {
- expectMsg(Transition(recoveredFsmRef, Shopping, Inactive, Some(2 seconds)))
+ expectMsg(Transition(recoveredFsmRef, Shopping, Inactive, Some(2.seconds)))
}
- expectNoMessage(0.6 seconds) // arbitrarily chosen delay, less than the timeout, before stopping the FSM
+ expectNoMessage(0.6.seconds) // arbitrarily chosen delay, less than the timeout, before stopping the FSM
recoveredFsmRef ! PoisonPill
expectTerminated(recoveredFsmRef)
@@ -236,7 +236,7 @@ abstract class PersistentFSMSpec(config: Config) extends PersistenceSpec(config)
watch(recoveredFsmRef)
recoveredFsmRef ! SubscribeTransitionCallBack(testActor)
- expectMsg(CurrentState(recoveredFsmRef, Inactive, Some(2 seconds)))
+ expectMsg(CurrentState(recoveredFsmRef, Inactive, Some(2.seconds)))
expectTerminated(recoveredFsmRef)
}
@@ -330,7 +330,7 @@ abstract class PersistentFSMSpec(config: Config) extends PersistenceSpec(config)
expectMsg(NonEmptyShoppingCart(List(shirt, shoes, coat)))
expectMsg(NonEmptyShoppingCart(List(shirt, shoes, coat)))
- expectNoMessage(1 second)
+ expectNoMessage(1.second)
fsmRef ! PoisonPill
expectTerminated(fsmRef)
@@ -499,14 +499,14 @@ object PersistentFSMSpec {
when(LookingAround) {
case Event(AddItem(item), _) =>
- goto(Shopping).applying(ItemAdded(item)).forMax(1 seconds)
+ goto(Shopping).applying(ItemAdded(item)).forMax(1.seconds)
case Event(GetCurrentCart, data) =>
stay().replying(data)
}
when(Shopping) {
case Event(AddItem(item), _) =>
- stay().applying(ItemAdded(item)).forMax(1 seconds)
+ stay().applying(ItemAdded(item)).forMax(1.seconds)
case Event(Buy, _) =>
// #customer-andthen-example
goto(Paid).applying(OrderExecuted).andThen {
@@ -529,12 +529,12 @@ object PersistentFSMSpec {
case Event(GetCurrentCart, data) =>
stay().replying(data)
case Event(StateTimeout, _) =>
- goto(Inactive).forMax(2 seconds)
+ goto(Inactive).forMax(2.seconds)
}
when(Inactive) {
case Event(AddItem(item), _) =>
- goto(Shopping).applying(ItemAdded(item)).forMax(1 seconds)
+ goto(Shopping).applying(ItemAdded(item)).forMax(1.seconds)
case Event(StateTimeout, _) =>
stop().applying(OrderDiscarded).andThen {
case _ => reportActor ! ShoppingCardDiscarded
diff --git a/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/NewRemoteActorSpec.scala b/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/NewRemoteActorSpec.scala
index eea6869942..2a8932eceb 100644
--- a/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/NewRemoteActorSpec.scala
+++ b/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/NewRemoteActorSpec.scala
@@ -122,7 +122,7 @@ abstract class NewRemoteActorSpec(multiNodeConfig: NewRemoteActorMultiJvmSpec)
enterBarrier("done")
}
- "be able to shutdown system when using remote deployed actor" in within(20 seconds) {
+ "be able to shutdown system when using remote deployed actor" in within(20.seconds) {
runOn(leader) {
val actor = system.actorOf(Props[SomeActor](), "service-hello3")
actor.isInstanceOf[RemoteActorRef] should ===(true)
diff --git a/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/RemoteDeliverySpec.scala b/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/RemoteDeliverySpec.scala
index 1a209b4d8c..191254d8c0 100644
--- a/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/RemoteDeliverySpec.scala
+++ b/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/RemoteDeliverySpec.scala
@@ -63,7 +63,7 @@ abstract class RemoteDeliverySpec(multiNodeConfig: RemoteDeliveryConfig)
override def initialParticipants = roles.size
- def identify(role: RoleName, actorName: String): ActorRef = within(10 seconds) {
+ def identify(role: RoleName, actorName: String): ActorRef = within(10.seconds) {
system.actorSelection(node(role) / "user" / actorName) ! Identify(actorName)
expectMsgType[ActorIdentity].ref.get
}
diff --git a/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/RemoteDeploymentDeathWatchSpec.scala b/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/RemoteDeploymentDeathWatchSpec.scala
index 301cdcc307..a3a4683f5b 100644
--- a/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/RemoteDeploymentDeathWatchSpec.scala
+++ b/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/RemoteDeploymentDeathWatchSpec.scala
@@ -92,7 +92,7 @@ abstract class RemoteDeploymentDeathWatchSpec(multiNodeConfig: RemoteDeploymentD
"An actor system that deploys actors on another node" must {
- "be able to shutdown when remote node crash" taggedAs LongRunningTest in within(20 seconds) {
+ "be able to shutdown when remote node crash" taggedAs LongRunningTest in within(20.seconds) {
runOn(second) {
// remote deployment to third
val hello = system.actorOf(Props[Hello](), "hello")
diff --git a/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/RemoteNodeDeathWatchSpec.scala b/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/RemoteNodeDeathWatchSpec.scala
index 77a4a3d3ac..08bea73a62 100644
--- a/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/RemoteNodeDeathWatchSpec.scala
+++ b/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/RemoteNodeDeathWatchSpec.scala
@@ -146,7 +146,7 @@ abstract class RemoteNodeDeathWatchSpec(multiNodeConfig: RemoteNodeDeathWatchCon
val subject = identify(second, "subject1")
watcher ! WatchIt(subject)
- expectMsg(1 second, Ack)
+ expectMsg(1.second, Ack)
subject ! "hello1"
enterBarrier("hello1-message-sent")
enterBarrier("watch-established-1")
@@ -160,7 +160,7 @@ abstract class RemoteNodeDeathWatchSpec(multiNodeConfig: RemoteNodeDeathWatchCon
enterBarrier("actors-started-1")
enterBarrier("hello1-message-sent")
- expectMsg(3 seconds, "hello1")
+ expectMsg(3.seconds, "hello1")
enterBarrier("watch-established-1")
sleep()
@@ -190,12 +190,12 @@ abstract class RemoteNodeDeathWatchSpec(multiNodeConfig: RemoteNodeDeathWatchCon
val subject = identify(second, "subject2")
watcher ! WatchIt(subject)
- expectMsg(1 second, Ack)
+ expectMsg(1.second, Ack)
enterBarrier("watch-2")
sleep()
watcher ! UnwatchIt(subject)
- expectMsg(1 second, Ack)
+ expectMsg(1.second, Ack)
enterBarrier("unwatch-2")
}
@@ -225,12 +225,12 @@ abstract class RemoteNodeDeathWatchSpec(multiNodeConfig: RemoteNodeDeathWatchCon
val other = if (myself == first) second else first
val subject = identify(other, "subject3")
watcher ! WatchIt(subject)
- expectMsg(1 second, Ack)
+ expectMsg(1.second, Ack)
enterBarrier("watch-3")
sleep()
watcher ! UnwatchIt(subject)
- expectMsg(1 second, Ack)
+ expectMsg(1.second, Ack)
enterBarrier("unwatch-3")
}
@@ -260,17 +260,17 @@ abstract class RemoteNodeDeathWatchSpec(multiNodeConfig: RemoteNodeDeathWatchCon
val subject1 = identify(other, "s1")
val subject2 = identify(other, "s2")
watcher1 ! WatchIt(subject1)
- expectMsg(1 second, Ack)
+ expectMsg(1.second, Ack)
watcher2 ! WatchIt(subject2)
- expectMsg(1 second, Ack)
+ expectMsg(1.second, Ack)
enterBarrier("watch-4")
sleep()
watcher1 ! UnwatchIt(subject1)
- expectMsg(1 second, Ack)
+ expectMsg(1.second, Ack)
enterBarrier("unwatch-s1-4")
system.stop(s1)
- expectNoMessage(2 seconds)
+ expectNoMessage(2.seconds)
enterBarrier("stop-s1-4")
system.stop(s2)
@@ -308,16 +308,16 @@ abstract class RemoteNodeDeathWatchSpec(multiNodeConfig: RemoteNodeDeathWatchCon
val b3 = identify(second, "b3")
a1 ! WatchIt(b1)
- expectMsg(1 second, Ack)
+ expectMsg(1.second, Ack)
a1 ! WatchIt(b2)
- expectMsg(1 second, Ack)
+ expectMsg(1.second, Ack)
a2 ! WatchIt(b2)
- expectMsg(1 second, Ack)
+ expectMsg(1.second, Ack)
a3 ! WatchIt(b3)
- expectMsg(1 second, Ack)
+ expectMsg(1.second, Ack)
sleep()
a2 ! UnwatchIt(b2)
- expectMsg(1 second, Ack)
+ expectMsg(1.second, Ack)
enterBarrier("watch-established-5")
@@ -347,33 +347,33 @@ abstract class RemoteNodeDeathWatchSpec(multiNodeConfig: RemoteNodeDeathWatchCon
val a3 = identify(first, "a3")
b1 ! WatchIt(a1)
- expectMsg(1 second, Ack)
+ expectMsg(1.second, Ack)
b1 ! WatchIt(a2)
- expectMsg(1 second, Ack)
+ expectMsg(1.second, Ack)
b2 ! WatchIt(a2)
- expectMsg(1 second, Ack)
+ expectMsg(1.second, Ack)
b3 ! WatchIt(a3)
- expectMsg(1 second, Ack)
+ expectMsg(1.second, Ack)
b3 ! WatchIt(a3)
- expectMsg(1 second, Ack)
+ expectMsg(1.second, Ack)
sleep()
b2 ! UnwatchIt(a2)
- expectMsg(1 second, Ack)
+ expectMsg(1.second, Ack)
enterBarrier("watch-established-5")
enterBarrier("stopped-5")
- p1.receiveN(2, 5 seconds).collect { case WrappedTerminated(t) => t.actor }.toSet should ===(Set(a1, a2))
- p3.expectMsgType[WrappedTerminated](5 seconds).t.actor should ===(a3)
- p2.expectNoMessage(2 seconds)
+ p1.receiveN(2, 5.seconds).collect { case WrappedTerminated(t) => t.actor }.toSet should ===(Set(a1, a2))
+ p3.expectMsgType[WrappedTerminated](5.seconds).t.actor should ===(a3)
+ p2.expectNoMessage(2.seconds)
enterBarrier("terminated-verified-5")
// verify that things are cleaned up, and heartbeating is stopped
assertCleanup()
expectNoMessage(2.seconds)
- p1.expectNoMessage(100 millis)
- p2.expectNoMessage(100 millis)
- p3.expectNoMessage(100 millis)
+ p1.expectNoMessage(100.millis)
+ p2.expectNoMessage(100.millis)
+ p3.expectNoMessage(100.millis)
assertCleanup()
}
@@ -395,15 +395,15 @@ abstract class RemoteNodeDeathWatchSpec(multiNodeConfig: RemoteNodeDeathWatchCon
val subject = identify(second, "subject6")
watcher ! WatchIt(subject)
- expectMsg(1 second, Ack)
+ expectMsg(1.second, Ack)
watcher2 ! WatchIt(subject)
- expectMsg(1 second, Ack)
+ expectMsg(1.second, Ack)
subject ! "hello6"
// testing with this watch/unwatch of watcher2 to make sure that the unwatch doesn't
// remove the first watch
watcher2 ! UnwatchIt(subject)
- expectMsg(1 second, Ack)
+ expectMsg(1.second, Ack)
enterBarrier("watch-established-6")
@@ -411,7 +411,7 @@ abstract class RemoteNodeDeathWatchSpec(multiNodeConfig: RemoteNodeDeathWatchCon
log.info("exit second")
testConductor.exit(second, 0).await
- expectMsgType[WrappedTerminated](15 seconds).t.actor should ===(subject)
+ expectMsgType[WrappedTerminated](15.seconds).t.actor should ===(subject)
// verify that things are cleaned up, and heartbeating is stopped
assertCleanup()
@@ -423,7 +423,7 @@ abstract class RemoteNodeDeathWatchSpec(multiNodeConfig: RemoteNodeDeathWatchCon
system.actorOf(Props(classOf[ProbeActor], testActor), "subject6")
enterBarrier("actors-started-6")
- expectMsg(3 seconds, "hello6")
+ expectMsg(3.seconds, "hello6")
enterBarrier("watch-established-6")
}
@@ -442,7 +442,7 @@ abstract class RemoteNodeDeathWatchSpec(multiNodeConfig: RemoteNodeDeathWatchCon
val subject = identify(first, "subject7")
watcher ! WatchIt(subject)
- expectMsg(1 second, Ack)
+ expectMsg(1.second, Ack)
subject ! "hello7"
enterBarrier("watch-established-7")
}
@@ -451,7 +451,7 @@ abstract class RemoteNodeDeathWatchSpec(multiNodeConfig: RemoteNodeDeathWatchCon
system.actorOf(Props(classOf[ProbeActor], testActor), "subject7")
enterBarrier("actors-started-7")
- expectMsg(3 seconds, "hello7")
+ expectMsg(3.seconds, "hello7")
enterBarrier("watch-established-7")
sleep()
@@ -459,7 +459,7 @@ abstract class RemoteNodeDeathWatchSpec(multiNodeConfig: RemoteNodeDeathWatchCon
testConductor.exit(third, 0).await
// verify that things are cleaned up, and heartbeating is stopped
- assertCleanup(20 seconds)
+ assertCleanup(20.seconds)
expectNoMessage(2.seconds)
assertCleanup()
}
diff --git a/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/artery/RemoteRestartedQuarantinedSpec.scala b/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/artery/RemoteRestartedQuarantinedSpec.scala
index e7bf806767..3b4b12a3aa 100644
--- a/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/artery/RemoteRestartedQuarantinedSpec.scala
+++ b/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/artery/RemoteRestartedQuarantinedSpec.scala
@@ -110,7 +110,7 @@ abstract class RemoteRestartedQuarantinedSpec extends RemotingMultiNodeSpec(Remo
enterBarrier("before-quarantined")
enterBarrier("quarantined")
- expectMsgPF(10 seconds) {
+ expectMsgPF(10.seconds) {
case ThisActorSystemQuarantinedEvent(_, _) =>
}
diff --git a/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/classic/RemoteNodeShutdownAndComesBackSpec.scala b/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/classic/RemoteNodeShutdownAndComesBackSpec.scala
index f0b14b0d23..fa13980463 100644
--- a/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/classic/RemoteNodeShutdownAndComesBackSpec.scala
+++ b/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/classic/RemoteNodeShutdownAndComesBackSpec.scala
@@ -114,7 +114,7 @@ abstract class RemoteNodeShutdownAndComesBackSpec extends RemotingMultiNodeSpec(
awaitAssert {
val p = TestProbe()
system.actorSelection(RootActorPath(secondAddress) / "user" / "subject").tell(Identify("subject"), p.ref)
- p.expectMsgPF(1 second) {
+ p.expectMsgPF(1.second) {
case ActorIdentity("subject", Some(_)) => true
}
}
diff --git a/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/routing/RemoteRoundRobinSpec.scala b/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/routing/RemoteRoundRobinSpec.scala
index 9266aaa57b..a8862e2fc2 100644
--- a/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/routing/RemoteRoundRobinSpec.scala
+++ b/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/routing/RemoteRoundRobinSpec.scala
@@ -111,7 +111,7 @@ class RemoteRoundRobinSpec(multiNodeConfig: RemoteRoundRobinConfig)
actor ! "hit"
}
- val replies: Map[Address, Int] = receiveWhile(5 seconds, messages = connectionCount * iterationCount) {
+ val replies: Map[Address, Int] = receiveWhile(5.seconds, messages = connectionCount * iterationCount) {
case ref: ActorRef =>
info(s"reply from $ref")
ref.path.address
@@ -136,7 +136,7 @@ class RemoteRoundRobinSpec(multiNodeConfig: RemoteRoundRobinConfig)
}
"A remote round robin pool with resizer" must {
- "be locally instantiated on a remote node after several resize rounds" in within(5 seconds) {
+ "be locally instantiated on a remote node after several resize rounds" in within(5.seconds) {
runOn(first, second, third) {
enterBarrier("start", "broadcast-end", "end")
@@ -199,7 +199,7 @@ class RemoteRoundRobinSpec(multiNodeConfig: RemoteRoundRobinConfig)
actor ! "hit"
}
- val replies: Map[Address, Int] = receiveWhile(5 seconds, messages = connectionCount * iterationCount) {
+ val replies: Map[Address, Int] = receiveWhile(5.seconds, messages = connectionCount * iterationCount) {
case ref: ActorRef => ref.path.address
}.foldLeft(Map(node(first).address -> 0, node(second).address -> 0, node(third).address -> 0)) {
case (replyMap, address) => replyMap + (address -> (replyMap(address) + 1))
diff --git a/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/testconductor/TestConductorSpec.scala b/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/testconductor/TestConductorSpec.scala
index 5b495779a7..d489e370a5 100644
--- a/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/testconductor/TestConductorSpec.scala
+++ b/remote-tests/src/multi-jvm/scala/org/apache/pekko/remote/testconductor/TestConductorSpec.scala
@@ -83,8 +83,8 @@ class TestConductorSpec extends RemotingMultiNodeSpec(TestConductorMultiJvmSpec)
for (i <- 0 to 9) echo ! i
}
- within(0.5 seconds, 2 seconds) {
- expectMsg(500 millis, 0)
+ within(0.5.seconds, 2.seconds) {
+ expectMsg(500.millis, 0)
receiveN(9) should ===(1 to 9)
}
@@ -102,11 +102,11 @@ class TestConductorSpec extends RemotingMultiNodeSpec(TestConductorMultiJvmSpec)
}
val (min, max) =
- if (isNode(leader)) (0 seconds, 500 millis)
- else (0.3 seconds, 3 seconds)
+ if (isNode(leader)) (0.seconds, 500.millis)
+ else (0.3.seconds, 3.seconds)
within(min, max) {
- expectMsg(500 millis, 10)
+ expectMsg(500.millis, 10)
receiveN(9) should ===(11 to 19)
}
diff --git a/remote-tests/src/test/scala/org/apache/pekko/remote/testconductor/BarrierSpec.scala b/remote-tests/src/test/scala/org/apache/pekko/remote/testconductor/BarrierSpec.scala
index 55249e13d7..8553fe7612 100644
--- a/remote-tests/src/test/scala/org/apache/pekko/remote/testconductor/BarrierSpec.scala
+++ b/remote-tests/src/test/scala/org/apache/pekko/remote/testconductor/BarrierSpec.scala
@@ -60,9 +60,9 @@ class BarrierSpec extends PekkoSpec(BarrierSpec.config) with ImplicitSender {
val b = getBarrier()
b ! NodeInfo(A, AddressFromURIString("pekko://sys"), system.deadLetters)
b ! ClientDisconnected(B)
- expectNoMessage(1 second)
+ expectNoMessage(1.second)
b ! ClientDisconnected(A)
- expectNoMessage(1 second)
+ expectNoMessage(1.second)
}
"fail entering barrier when nobody registered" taggedAs TimingTest in {
@@ -78,7 +78,7 @@ class BarrierSpec extends PekkoSpec(BarrierSpec.config) with ImplicitSender {
barrier ! NodeInfo(B, AddressFromURIString("pekko://sys"), b.ref)
a.send(barrier, EnterBarrier("bar2", None))
noMsg(a, b)
- within(2 seconds) {
+ within(2.seconds) {
b.send(barrier, EnterBarrier("bar2", None))
a.expectMsg(ToClient(BarrierResult("bar2", true)))
b.expectMsg(ToClient(BarrierResult("bar2", true)))
@@ -94,7 +94,7 @@ class BarrierSpec extends PekkoSpec(BarrierSpec.config) with ImplicitSender {
barrier ! NodeInfo(C, AddressFromURIString("pekko://sys"), c.ref)
b.send(barrier, EnterBarrier("bar3", None))
noMsg(a, b, c)
- within(2 seconds) {
+ within(2.seconds) {
c.send(barrier, EnterBarrier("bar3", None))
a.expectMsg(ToClient(BarrierResult("bar3", true)))
b.expectMsg(ToClient(BarrierResult("bar3", true)))
@@ -113,12 +113,12 @@ class BarrierSpec extends PekkoSpec(BarrierSpec.config) with ImplicitSender {
barrier ! RemoveClient(A)
barrier ! ClientDisconnected(A)
noMsg(a, b, c)
- b.within(2 seconds) {
+ b.within(2.seconds) {
barrier ! RemoveClient(C)
b.expectMsg(ToClient(BarrierResult("bar4", true)))
}
barrier ! ClientDisconnected(C)
- expectNoMessage(1 second)
+ expectNoMessage(1.second)
}
"leave barrier when last “arrived” is removed" taggedAs TimingTest in {
@@ -232,7 +232,7 @@ class BarrierSpec extends PekkoSpec(BarrierSpec.config) with ImplicitSender {
barrier ! nodeB
a.send(barrier, EnterBarrier("bar10", None))
EventFilter[BarrierTimeout](occurrences = 1).intercept {
- val msg = expectMsgType[Failed](7 seconds)
+ val msg = expectMsgType[Failed](7.seconds)
msg match {
case Failed(_, thr: BarrierTimeout)
if thr == BarrierTimeout(Data(Set(nodeA, nodeB), "bar10", a.ref :: Nil, thr.data.deadline)) =>
@@ -263,7 +263,7 @@ class BarrierSpec extends PekkoSpec(BarrierSpec.config) with ImplicitSender {
}
"finally have no failure messages left" taggedAs TimingTest in {
- expectNoMessage(1 second)
+ expectNoMessage(1.second)
}
}
@@ -288,9 +288,9 @@ class BarrierSpec extends PekkoSpec(BarrierSpec.config) with ImplicitSender {
b ! NodeInfo(A, AddressFromURIString("pekko://sys"), testActor)
expectMsg(ToClient(Done))
b ! ClientDisconnected(B)
- expectNoMessage(1 second)
+ expectNoMessage(1.second)
b ! ClientDisconnected(A)
- expectNoMessage(1 second)
+ expectNoMessage(1.second)
}
}
@@ -310,7 +310,7 @@ class BarrierSpec extends PekkoSpec(BarrierSpec.config) with ImplicitSender {
b.expectMsg(ToClient(Done))
a.send(barrier, EnterBarrier("bar11", None))
noMsg(a, b)
- within(2 seconds) {
+ within(2.seconds) {
b.send(barrier, EnterBarrier("bar11", None))
a.expectMsg(ToClient(BarrierResult("bar11", true)))
b.expectMsg(ToClient(BarrierResult("bar11", true)))
@@ -330,7 +330,7 @@ class BarrierSpec extends PekkoSpec(BarrierSpec.config) with ImplicitSender {
c.expectMsg(ToClient(Done))
b.send(barrier, EnterBarrier("bar12", None))
noMsg(a, b, c)
- within(2 seconds) {
+ within(2.seconds) {
c.send(barrier, EnterBarrier("bar12", None))
a.expectMsg(ToClient(BarrierResult("bar12", true)))
b.expectMsg(ToClient(BarrierResult("bar12", true)))
@@ -353,12 +353,12 @@ class BarrierSpec extends PekkoSpec(BarrierSpec.config) with ImplicitSender {
barrier ! Remove(A)
barrier ! ClientDisconnected(A)
noMsg(a, b, c)
- b.within(2 seconds) {
+ b.within(2.seconds) {
barrier ! Remove(C)
b.expectMsg(ToClient(BarrierResult("bar13", true)))
}
barrier ! ClientDisconnected(C)
- expectNoMessage(1 second)
+ expectNoMessage(1.second)
}
}
@@ -441,7 +441,7 @@ class BarrierSpec extends PekkoSpec(BarrierSpec.config) with ImplicitSender {
barrier ! nodeB
a.expectMsg(ToClient(Done))
b.expectMsg(ToClient(Done))
- a.send(barrier, EnterBarrier("bar18", Option(2 seconds)))
+ a.send(barrier, EnterBarrier("bar18", Option(2.seconds)))
EventFilter[BarrierTimeout](occurrences = 1).intercept {
Thread.sleep(4000)
}
@@ -490,11 +490,11 @@ class BarrierSpec extends PekkoSpec(BarrierSpec.config) with ImplicitSender {
barrier ! nodeB
a.expectMsg(ToClient(Done))
b.expectMsg(ToClient(Done))
- a.send(barrier, EnterBarrier("bar20", Option(2 seconds)))
+ a.send(barrier, EnterBarrier("bar20", Option(2.seconds)))
EventFilter[FailedBarrier](occurrences = 1).intercept {
b.send(barrier, FailBarrier("bar20"))
a.expectMsg(ToClient(BarrierResult("bar20", false)))
- b.expectNoMessage(1 second)
+ b.expectNoMessage(1.second)
}
a.send(barrier, EnterBarrier("bar21", None))
b.send(barrier, EnterBarrier("bar21", None))
@@ -515,8 +515,8 @@ class BarrierSpec extends PekkoSpec(BarrierSpec.config) with ImplicitSender {
a.expectMsg(ToClient(Done))
b.expectMsg(ToClient(Done))
c.expectMsg(ToClient(Done))
- a.send(barrier, EnterBarrier("bar22", Option(10 seconds)))
- b.send(barrier, EnterBarrier("bar22", Option(2 seconds)))
+ a.send(barrier, EnterBarrier("bar22", Option(10.seconds)))
+ b.send(barrier, EnterBarrier("bar22", Option(2.seconds)))
EventFilter[BarrierTimeout](occurrences = 1).intercept {
Thread.sleep(4000)
}
@@ -539,8 +539,8 @@ class BarrierSpec extends PekkoSpec(BarrierSpec.config) with ImplicitSender {
a.expectMsg(ToClient(Done))
b.expectMsg(ToClient(Done))
c.expectMsg(ToClient(Done))
- a.send(barrier, EnterBarrier("bar23", Option(2 seconds)))
- b.send(barrier, EnterBarrier("bar23", Option(10 seconds)))
+ a.send(barrier, EnterBarrier("bar23", Option(2.seconds)))
+ b.send(barrier, EnterBarrier("bar23", Option(10.seconds)))
EventFilter[BarrierTimeout](occurrences = 1).intercept {
Thread.sleep(4000)
}
@@ -552,7 +552,7 @@ class BarrierSpec extends PekkoSpec(BarrierSpec.config) with ImplicitSender {
}
"finally have no failure messages left" taggedAs TimingTest in {
- expectNoMessage(1 second)
+ expectNoMessage(1.second)
}
}
@@ -592,7 +592,7 @@ class BarrierSpec extends PekkoSpec(BarrierSpec.config) with ImplicitSender {
}
private def noMsg(probes: TestProbe*): Unit = {
- expectNoMessage(1 second)
+ expectNoMessage(1.second)
probes.foreach(_.msgAvailable should ===(false))
}
diff --git a/remote/src/test/scala/org/apache/pekko/remote/RemoteConfigSpec.scala b/remote/src/test/scala/org/apache/pekko/remote/RemoteConfigSpec.scala
index 62434d809e..4daf91943c 100644
--- a/remote/src/test/scala/org/apache/pekko/remote/RemoteConfigSpec.scala
+++ b/remote/src/test/scala/org/apache/pekko/remote/RemoteConfigSpec.scala
@@ -43,21 +43,21 @@ class RemoteConfigSpec extends PekkoSpec("""
LogSend should ===(false)
UntrustedMode should ===(false)
TrustedSelectionPaths should ===(Set.empty[String])
- ShutdownTimeout.duration should ===(10 seconds)
- FlushWait should ===(2 seconds)
- StartupTimeout.duration should ===(10 seconds)
- RetryGateClosedFor should ===(5 seconds)
+ ShutdownTimeout.duration should ===(10.seconds)
+ FlushWait should ===(2.seconds)
+ StartupTimeout.duration should ===(10.seconds)
+ RetryGateClosedFor should ===(5.seconds)
Dispatcher should ===("pekko.remote.default-remote-dispatcher")
UsePassiveConnections should ===(true)
- BackoffPeriod should ===(5 millis)
+ BackoffPeriod should ===(5.millis)
LogBufferSizeExceeding should ===(50000)
- SysMsgAckTimeout should ===(0.3 seconds)
- SysResendTimeout should ===(2 seconds)
+ SysMsgAckTimeout should ===(0.3.seconds)
+ SysResendTimeout should ===(2.seconds)
SysResendLimit should ===(200)
SysMsgBufferSize should ===(20000)
- InitialSysMsgDeliveryTimeout should ===(3 minutes)
- QuarantineDuration should ===(5 days)
- CommandAckTimeout.duration should ===(30 seconds)
+ InitialSysMsgDeliveryTimeout should ===(3.minutes)
+ QuarantineDuration should ===(5.days)
+ CommandAckTimeout.duration should ===(30.seconds)
Transports.size should ===(1)
Transports.head._1 should ===(classOf[pekko.remote.transport.netty.NettyTransport].getName)
Transports.head._2 should ===(Nil)
@@ -67,13 +67,13 @@ class RemoteConfigSpec extends PekkoSpec("""
"trttl" -> classOf[pekko.remote.transport.ThrottlerProvider].getName))
WatchFailureDetectorImplementationClass should ===(classOf[PhiAccrualFailureDetector].getName)
- WatchHeartBeatInterval should ===(1 seconds)
- WatchHeartbeatExpectedResponseAfter should ===(1 seconds)
- WatchUnreachableReaperInterval should ===(1 second)
+ WatchHeartBeatInterval should ===(1.seconds)
+ WatchHeartbeatExpectedResponseAfter should ===(1.seconds)
+ WatchUnreachableReaperInterval should ===(1.second)
WatchFailureDetectorConfig.getDouble("threshold") should ===(10.0 +- 0.0001)
WatchFailureDetectorConfig.getInt("max-sample-size") should ===(200)
- WatchFailureDetectorConfig.getMillisDuration("acceptable-heartbeat-pause") should ===(10 seconds)
- WatchFailureDetectorConfig.getMillisDuration("min-std-deviation") should ===(100 millis)
+ WatchFailureDetectorConfig.getMillisDuration("acceptable-heartbeat-pause") should ===(10.seconds)
+ WatchFailureDetectorConfig.getMillisDuration("min-std-deviation") should ===(100.millis)
remoteSettings.config.getString("pekko.remote.classic.log-frame-size-exceeding") should ===("off")
}
diff --git a/remote/src/test/scala/org/apache/pekko/remote/artery/RemoteWatcherSpec.scala b/remote/src/test/scala/org/apache/pekko/remote/artery/RemoteWatcherSpec.scala
index 8f57457a0d..d1bf527d34 100644
--- a/remote/src/test/scala/org/apache/pekko/remote/artery/RemoteWatcherSpec.scala
+++ b/remote/src/test/scala/org/apache/pekko/remote/artery/RemoteWatcherSpec.scala
@@ -124,48 +124,48 @@ class RemoteWatcherSpec
monitorA ! Stats
// (a1->b1), (a1->b2), (a2->b2)
expectMsg(Stats.counts(watching = 3, watchingNodes = 1))
- expectNoMessage(100 millis)
+ expectNoMessage(100.millis)
monitorA ! HeartbeatTick
expectMsg(ArteryHeartbeat)
- expectNoMessage(100 millis)
+ expectNoMessage(100.millis)
monitorA ! HeartbeatTick
expectMsg(ArteryHeartbeat)
- expectNoMessage(100 millis)
+ expectNoMessage(100.millis)
monitorA.tell(heartbeatRspB, monitorB)
monitorA ! HeartbeatTick
expectMsg(ArteryHeartbeat)
- expectNoMessage(100 millis)
+ expectNoMessage(100.millis)
monitorA ! UnwatchRemote(b1, a1)
// still (a1->b2) and (a2->b2) left
monitorA ! Stats
expectMsg(Stats.counts(watching = 2, watchingNodes = 1))
- expectNoMessage(100 millis)
+ expectNoMessage(100.millis)
monitorA ! HeartbeatTick
expectMsg(ArteryHeartbeat)
- expectNoMessage(100 millis)
+ expectNoMessage(100.millis)
monitorA ! UnwatchRemote(b2, a2)
// still (a1->b2) left
monitorA ! Stats
expectMsg(Stats.counts(watching = 1, watchingNodes = 1))
- expectNoMessage(100 millis)
+ expectNoMessage(100.millis)
monitorA ! HeartbeatTick
expectMsg(ArteryHeartbeat)
- expectNoMessage(100 millis)
+ expectNoMessage(100.millis)
monitorA ! UnwatchRemote(b2, a1)
// all unwatched
monitorA ! Stats
expectMsg(Stats.empty)
- expectNoMessage(100 millis)
+ expectNoMessage(100.millis)
monitorA ! HeartbeatTick
- expectNoMessage(100 millis)
+ expectNoMessage(100.millis)
monitorA ! HeartbeatTick
- expectNoMessage(100 millis)
+ expectNoMessage(100.millis)
// make sure nothing floods over to next test
- expectNoMessage(2 seconds)
+ expectNoMessage(2.seconds)
}
"generate AddressTerminated when missing heartbeats" taggedAs LongRunningTest in {
@@ -185,24 +185,24 @@ class RemoteWatcherSpec
monitorA ! HeartbeatTick
expectMsg(ArteryHeartbeat)
monitorA.tell(heartbeatRspB, monitorB)
- expectNoMessage(1 second)
+ expectNoMessage(1.second)
monitorA ! HeartbeatTick
expectMsg(ArteryHeartbeat)
monitorA.tell(heartbeatRspB, monitorB)
- within(10 seconds) {
+ within(10.seconds) {
awaitAssert {
monitorA ! HeartbeatTick
expectMsg(ArteryHeartbeat)
// but no HeartbeatRsp
monitorA ! ReapUnreachableTick
- p.expectMsg(1 second, TestRemoteWatcher.AddressTerm(b.path.address))
- q.expectMsg(1 second, TestRemoteWatcher.Quarantined(b.path.address, Some(remoteAddressUid)))
+ p.expectMsg(1.second, TestRemoteWatcher.AddressTerm(b.path.address))
+ q.expectMsg(1.second, TestRemoteWatcher.Quarantined(b.path.address, Some(remoteAddressUid)))
}
}
// make sure nothing floods over to next test
- expectNoMessage(2 seconds)
+ expectNoMessage(2.seconds)
}
"generate AddressTerminated when missing first heartbeat" taggedAs LongRunningTest in {
@@ -224,20 +224,20 @@ class RemoteWatcherSpec
expectMsg(ArteryHeartbeat)
// no HeartbeatRsp sent
- within(20 seconds) {
+ within(20.seconds) {
awaitAssert {
monitorA ! HeartbeatTick
expectMsg(ArteryHeartbeat)
// but no HeartbeatRsp
monitorA ! ReapUnreachableTick
- p.expectMsg(1 second, TestRemoteWatcher.AddressTerm(b.path.address))
+ p.expectMsg(1.second, TestRemoteWatcher.AddressTerm(b.path.address))
// no real quarantine when missing first heartbeat, uid unknown
- q.expectMsg(1 second, TestRemoteWatcher.Quarantined(b.path.address, None))
+ q.expectMsg(1.second, TestRemoteWatcher.Quarantined(b.path.address, None))
}
}
// make sure nothing floods over to next test
- expectNoMessage(2 seconds)
+ expectNoMessage(2.seconds)
}
"generate AddressTerminated for new watch after broken connection that was re-established and broken again" taggedAs LongRunningTest in {
@@ -257,19 +257,19 @@ class RemoteWatcherSpec
monitorA ! HeartbeatTick
expectMsg(ArteryHeartbeat)
monitorA.tell(heartbeatRspB, monitorB)
- expectNoMessage(1 second)
+ expectNoMessage(1.second)
monitorA ! HeartbeatTick
expectMsg(ArteryHeartbeat)
monitorA.tell(heartbeatRspB, monitorB)
- within(10 seconds) {
+ within(10.seconds) {
awaitAssert {
monitorA ! HeartbeatTick
expectMsg(ArteryHeartbeat)
// but no HeartbeatRsp
monitorA ! ReapUnreachableTick
- p.expectMsg(1 second, TestRemoteWatcher.AddressTerm(b.path.address))
- q.expectMsg(1 second, TestRemoteWatcher.Quarantined(b.path.address, Some(remoteAddressUid)))
+ p.expectMsg(1.second, TestRemoteWatcher.AddressTerm(b.path.address))
+ q.expectMsg(1.second, TestRemoteWatcher.Quarantined(b.path.address, Some(remoteAddressUid)))
}
}
@@ -279,7 +279,7 @@ class RemoteWatcherSpec
monitorA ! Stats
expectMsg(Stats.empty)
}
- expectNoMessage(2 seconds)
+ expectNoMessage(2.seconds)
// assume that connection comes up again, or remote system is restarted
val c = createRemoteActor(Props[MyActor](), "c6")
@@ -289,37 +289,37 @@ class RemoteWatcherSpec
monitorA ! HeartbeatTick
expectMsg(ArteryHeartbeat)
monitorA.tell(heartbeatRspB, monitorB)
- expectNoMessage(1 second)
+ expectNoMessage(1.second)
monitorA ! HeartbeatTick
expectMsg(ArteryHeartbeat)
monitorA.tell(heartbeatRspB, monitorB)
monitorA ! HeartbeatTick
expectMsg(ArteryHeartbeat)
monitorA ! ReapUnreachableTick
- p.expectNoMessage(1 second)
+ p.expectNoMessage(1.second)
monitorA ! HeartbeatTick
expectMsg(ArteryHeartbeat)
monitorA.tell(heartbeatRspB, monitorB)
monitorA ! HeartbeatTick
expectMsg(ArteryHeartbeat)
monitorA ! ReapUnreachableTick
- p.expectNoMessage(1 second)
- q.expectNoMessage(1 second)
+ p.expectNoMessage(1.second)
+ q.expectNoMessage(1.second)
// then stop heartbeating again, should generate new AddressTerminated
- within(10 seconds) {
+ within(10.seconds) {
awaitAssert {
monitorA ! HeartbeatTick
expectMsg(ArteryHeartbeat)
// but no HeartbeatRsp
monitorA ! ReapUnreachableTick
- p.expectMsg(1 second, TestRemoteWatcher.AddressTerm(c.path.address))
- q.expectMsg(1 second, TestRemoteWatcher.Quarantined(c.path.address, Some(remoteAddressUid)))
+ p.expectMsg(1.second, TestRemoteWatcher.AddressTerm(c.path.address))
+ q.expectMsg(1.second, TestRemoteWatcher.Quarantined(c.path.address, Some(remoteAddressUid)))
}
}
// make sure nothing floods over to next test
- expectNoMessage(2 seconds)
+ expectNoMessage(2.seconds)
}
}
diff --git a/remote/src/test/scala/org/apache/pekko/remote/classic/RemoteInitErrorSpec.scala b/remote/src/test/scala/org/apache/pekko/remote/classic/RemoteInitErrorSpec.scala
index 5d374eaa11..313be08387 100644
--- a/remote/src/test/scala/org/apache/pekko/remote/classic/RemoteInitErrorSpec.scala
+++ b/remote/src/test/scala/org/apache/pekko/remote/classic/RemoteInitErrorSpec.scala
@@ -62,7 +62,7 @@ class RemoteInitErrorSpec extends AnyWordSpec with Matchers {
fail("initialization should fail due to invalid IP address")
} catch {
case NonFatal(_) => {
- eventually(timeout(30 seconds), interval(800 milliseconds)) {
+ eventually(timeout(30.seconds), interval(800.milliseconds)) {
val current = currentThreadIds()
// no new threads should remain compared to the start state
(current.diff(start)) should be(empty)
diff --git a/remote/src/test/scala/org/apache/pekko/remote/classic/RemoteWatcherSpec.scala b/remote/src/test/scala/org/apache/pekko/remote/classic/RemoteWatcherSpec.scala
index d5ba9b048f..c1ee2daeef 100644
--- a/remote/src/test/scala/org/apache/pekko/remote/classic/RemoteWatcherSpec.scala
+++ b/remote/src/test/scala/org/apache/pekko/remote/classic/RemoteWatcherSpec.scala
@@ -140,48 +140,48 @@ class RemoteWatcherSpec extends PekkoSpec("""
monitorA ! Stats
// (a1->b1), (a1->b2), (a2->b2)
expectMsg(Stats.counts(watching = 3, watchingNodes = 1))
- expectNoMessage(100 millis)
+ expectNoMessage(100.millis)
monitorA ! HeartbeatTick
expectMsg(Heartbeat)
- expectNoMessage(100 millis)
+ expectNoMessage(100.millis)
monitorA ! HeartbeatTick
expectMsg(Heartbeat)
- expectNoMessage(100 millis)
+ expectNoMessage(100.millis)
monitorA.tell(heartbeatRspB, monitorB)
monitorA ! HeartbeatTick
expectMsg(Heartbeat)
- expectNoMessage(100 millis)
+ expectNoMessage(100.millis)
monitorA ! UnwatchRemote(b1, a1)
// still (a1->b2) and (a2->b2) left
monitorA ! Stats
expectMsg(Stats.counts(watching = 2, watchingNodes = 1))
- expectNoMessage(100 millis)
+ expectNoMessage(100.millis)
monitorA ! HeartbeatTick
expectMsg(Heartbeat)
- expectNoMessage(100 millis)
+ expectNoMessage(100.millis)
monitorA ! UnwatchRemote(b2, a2)
// still (a1->b2) left
monitorA ! Stats
expectMsg(Stats.counts(watching = 1, watchingNodes = 1))
- expectNoMessage(100 millis)
+ expectNoMessage(100.millis)
monitorA ! HeartbeatTick
expectMsg(Heartbeat)
- expectNoMessage(100 millis)
+ expectNoMessage(100.millis)
monitorA ! UnwatchRemote(b2, a1)
// all unwatched
monitorA ! Stats
expectMsg(Stats.empty)
- expectNoMessage(100 millis)
+ expectNoMessage(100.millis)
monitorA ! HeartbeatTick
- expectNoMessage(100 millis)
+ expectNoMessage(100.millis)
monitorA ! HeartbeatTick
- expectNoMessage(100 millis)
+ expectNoMessage(100.millis)
// make sure nothing floods over to next test
- expectNoMessage(2 seconds)
+ expectNoMessage(2.seconds)
}
"generate AddressTerminated when missing heartbeats" taggedAs LongRunningTest in {
@@ -201,24 +201,24 @@ class RemoteWatcherSpec extends PekkoSpec("""
monitorA ! HeartbeatTick
expectMsg(Heartbeat)
monitorA.tell(heartbeatRspB, monitorB)
- expectNoMessage(1 second)
+ expectNoMessage(1.second)
monitorA ! HeartbeatTick
expectMsg(Heartbeat)
monitorA.tell(heartbeatRspB, monitorB)
- within(10 seconds) {
+ within(10.seconds) {
awaitAssert {
monitorA ! HeartbeatTick
expectMsg(Heartbeat)
// but no HeartbeatRsp
monitorA ! ReapUnreachableTick
- p.expectMsg(1 second, TestRemoteWatcher.AddressTerm(b.path.address))
- q.expectMsg(1 second, TestRemoteWatcher.Quarantined(b.path.address, Some(remoteAddressUid)))
+ p.expectMsg(1.second, TestRemoteWatcher.AddressTerm(b.path.address))
+ q.expectMsg(1.second, TestRemoteWatcher.Quarantined(b.path.address, Some(remoteAddressUid)))
}
}
// make sure nothing floods over to next test
- expectNoMessage(2 seconds)
+ expectNoMessage(2.seconds)
}
"generate AddressTerminated when missing first heartbeat" taggedAs LongRunningTest in {
@@ -240,20 +240,20 @@ class RemoteWatcherSpec extends PekkoSpec("""
expectMsg(Heartbeat)
// no HeartbeatRsp sent
- within(20 seconds) {
+ within(20.seconds) {
awaitAssert {
monitorA ! HeartbeatTick
expectMsg(Heartbeat)
// but no HeartbeatRsp
monitorA ! ReapUnreachableTick
- p.expectMsg(1 second, TestRemoteWatcher.AddressTerm(b.path.address))
+ p.expectMsg(1.second, TestRemoteWatcher.AddressTerm(b.path.address))
// no real quarantine when missing first heartbeat, uid unknown
- q.expectMsg(1 second, TestRemoteWatcher.Quarantined(b.path.address, None))
+ q.expectMsg(1.second, TestRemoteWatcher.Quarantined(b.path.address, None))
}
}
// make sure nothing floods over to next test
- expectNoMessage(2 seconds)
+ expectNoMessage(2.seconds)
}
"generate AddressTerminated for new watch after broken connection that was re-established and broken again" taggedAs LongRunningTest in {
@@ -273,19 +273,19 @@ class RemoteWatcherSpec extends PekkoSpec("""
monitorA ! HeartbeatTick
expectMsg(Heartbeat)
monitorA.tell(heartbeatRspB, monitorB)
- expectNoMessage(1 second)
+ expectNoMessage(1.second)
monitorA ! HeartbeatTick
expectMsg(Heartbeat)
monitorA.tell(heartbeatRspB, monitorB)
- within(10 seconds) {
+ within(10.seconds) {
awaitAssert {
monitorA ! HeartbeatTick
expectMsg(Heartbeat)
// but no HeartbeatRsp
monitorA ! ReapUnreachableTick
- p.expectMsg(1 second, TestRemoteWatcher.AddressTerm(b.path.address))
- q.expectMsg(1 second, TestRemoteWatcher.Quarantined(b.path.address, Some(remoteAddressUid)))
+ p.expectMsg(1.second, TestRemoteWatcher.AddressTerm(b.path.address))
+ q.expectMsg(1.second, TestRemoteWatcher.Quarantined(b.path.address, Some(remoteAddressUid)))
}
}
@@ -295,7 +295,7 @@ class RemoteWatcherSpec extends PekkoSpec("""
monitorA ! Stats
expectMsg(Stats.empty)
}
- expectNoMessage(2 seconds)
+ expectNoMessage(2.seconds)
// assume that connection comes up again, or remote system is restarted
val c = createRemoteActor(Props[MyActor](), "c6")
@@ -305,37 +305,37 @@ class RemoteWatcherSpec extends PekkoSpec("""
monitorA ! HeartbeatTick
expectMsg(Heartbeat)
monitorA.tell(heartbeatRspB, monitorB)
- expectNoMessage(1 second)
+ expectNoMessage(1.second)
monitorA ! HeartbeatTick
expectMsg(Heartbeat)
monitorA.tell(heartbeatRspB, monitorB)
monitorA ! HeartbeatTick
expectMsg(Heartbeat)
monitorA ! ReapUnreachableTick
- p.expectNoMessage(1 second)
+ p.expectNoMessage(1.second)
monitorA ! HeartbeatTick
expectMsg(Heartbeat)
monitorA.tell(heartbeatRspB, monitorB)
monitorA ! HeartbeatTick
expectMsg(Heartbeat)
monitorA ! ReapUnreachableTick
- p.expectNoMessage(1 second)
- q.expectNoMessage(1 second)
+ p.expectNoMessage(1.second)
+ q.expectNoMessage(1.second)
// then stop heartbeating again, should generate new AddressTerminated
- within(10 seconds) {
+ within(10.seconds) {
awaitAssert {
monitorA ! HeartbeatTick
expectMsg(Heartbeat)
// but no HeartbeatRsp
monitorA ! ReapUnreachableTick
- p.expectMsg(1 second, TestRemoteWatcher.AddressTerm(c.path.address))
- q.expectMsg(1 second, TestRemoteWatcher.Quarantined(c.path.address, Some(remoteAddressUid)))
+ p.expectMsg(1.second, TestRemoteWatcher.AddressTerm(c.path.address))
+ q.expectMsg(1.second, TestRemoteWatcher.Quarantined(c.path.address, Some(remoteAddressUid)))
}
}
// make sure nothing floods over to next test
- expectNoMessage(2 seconds)
+ expectNoMessage(2.seconds)
}
}
diff --git a/slf4j/src/test/scala/org/apache/pekko/event/slf4j/Slf4jLoggerSpec.scala b/slf4j/src/test/scala/org/apache/pekko/event/slf4j/Slf4jLoggerSpec.scala
index 612874a0b6..70ab8f7350 100644
--- a/slf4j/src/test/scala/org/apache/pekko/event/slf4j/Slf4jLoggerSpec.scala
+++ b/slf4j/src/test/scala/org/apache/pekko/event/slf4j/Slf4jLoggerSpec.scala
@@ -100,7 +100,7 @@ class Slf4jLoggerSpec extends PekkoSpec(Slf4jLoggerSpec.config) with BeforeAndAf
"log error with stackTrace" in {
producer ! new RuntimeException("Simulated error")
- awaitCond(outputString.contains("----"), 5 seconds)
+ awaitCond(outputString.contains("----"), 5.seconds)
val s = outputString
s should include("pekkoSource=pekko://Slf4jLoggerSpec/user/logProducer")
s should include("pekkoAddress=pekko://Slf4jLoggerSpec")
@@ -116,7 +116,7 @@ class Slf4jLoggerSpec extends PekkoSpec(Slf4jLoggerSpec.config) with BeforeAndAf
"log info with parameters" in {
producer ! (("test x={} y={}", 3, 17))
- awaitCond(outputString.contains("----"), 5 seconds)
+ awaitCond(outputString.contains("----"), 5.seconds)
val s = outputString
s should include("pekkoSource=pekko://Slf4jLoggerSpec/user/logProducer")
s should include("pekkoAddress=pekko://Slf4jLoggerSpec")
@@ -129,7 +129,7 @@ class Slf4jLoggerSpec extends PekkoSpec(Slf4jLoggerSpec.config) with BeforeAndAf
"log info with marker" in {
producer ! StringWithMarker("security-wise interesting message", LogMarker("SECURITY"))
- awaitCond(outputString.contains("----"), 5 seconds)
+ awaitCond(outputString.contains("----"), 5.seconds)
val s = outputString
s should include("marker=[SECURITY]")
s should include("msg=[security-wise interesting message]")
@@ -138,7 +138,7 @@ class Slf4jLoggerSpec extends PekkoSpec(Slf4jLoggerSpec.config) with BeforeAndAf
"log info with marker and properties" in {
producer ! StringWithMarker("interesting message", LogMarker("testMarker", Map("p1" -> 1, "p2" -> "B")))
- awaitCond(outputString.contains("----"), 5 seconds)
+ awaitCond(outputString.contains("----"), 5.seconds)
val s = outputString
s should include("marker=[testMarker]")
s should include("p1=1")
@@ -151,7 +151,7 @@ class Slf4jLoggerSpec extends PekkoSpec(Slf4jLoggerSpec.config) with BeforeAndAf
slf4jMarker.add(MarkerFactory.getMarker("ADDED")) // slf4j markers can have children
producer ! StringWithSlf4jMarker("security-wise interesting message", slf4jMarker)
- awaitCond(outputString.contains("----"), 5 seconds)
+ awaitCond(outputString.contains("----"), 5.seconds)
val s = outputString
s should include("marker=[SLF [ ADDED ]]")
s should include("msg=[security-wise interesting message]")
@@ -164,7 +164,7 @@ class Slf4jLoggerSpec extends PekkoSpec(Slf4jLoggerSpec.config) with BeforeAndAf
slf4jMarker,
Map("ticketNumber" -> 3671, "ticketDesc" -> "Custom MDC Values"))
- awaitCond(outputString.contains("----"), 5 seconds)
+ awaitCond(outputString.contains("----"), 5.seconds)
val s = outputString
s should include("marker=[SLF [ ADDED ]]")
s should include("ticketDesc=Custom MDC Values")
@@ -176,7 +176,7 @@ class Slf4jLoggerSpec extends PekkoSpec(Slf4jLoggerSpec.config) with BeforeAndAf
"Message with custom MDC values",
Map("ticketNumber" -> 3671, "ticketDesc" -> "Custom MDC Values"))
- awaitCond(outputString.contains("----"), 5 seconds)
+ awaitCond(outputString.contains("----"), 5.seconds)
val s = outputString
s should include("pekkoSource=pekko://Slf4jLoggerSpec/user/logProducer")
s should include("level=[INFO]")
@@ -189,7 +189,7 @@ class Slf4jLoggerSpec extends PekkoSpec(Slf4jLoggerSpec.config) with BeforeAndAf
"support null marker" in {
producer ! StringWithMarker("security-wise interesting message", null)
- awaitCond(outputString.contains("----"), 5 seconds)
+ awaitCond(outputString.contains("----"), 5.seconds)
val s = outputString
s should include("msg=[security-wise interesting message]")
}
@@ -197,7 +197,7 @@ class Slf4jLoggerSpec extends PekkoSpec(Slf4jLoggerSpec.config) with BeforeAndAf
"Support null values in custom MDC" in {
producer ! StringWithMDC("Message with null custom MDC values", Map("ticketNumber" -> 3671, "ticketDesc" -> null))
- awaitCond(outputString.contains("----"), 5 seconds)
+ awaitCond(outputString.contains("----"), 5.seconds)
val s = outputString
s should include("pekkoSource=pekko://Slf4jLoggerSpec/user/logProducer")
s should include("level=[INFO]")
@@ -211,7 +211,7 @@ class Slf4jLoggerSpec extends PekkoSpec(Slf4jLoggerSpec.config) with BeforeAndAf
"include system info in pekkoSource when creating Logging with system" in {
val log = Logging(system, "org.apache.pekko.event.slf4j.Slf4jLoggerSpec.MyLogSource")
log.info("test")
- awaitCond(outputString.contains("----"), 5 seconds)
+ awaitCond(outputString.contains("----"), 5.seconds)
val s = outputString
s should include("pekkoSource=org.apache.pekko.event.slf4j.Slf4jLoggerSpec.MyLogSource(pekko://Slf4jLoggerSpec)")
s should include("logger=[org.apache.pekko.event.slf4j.Slf4jLoggerSpec.MyLogSource(pekko://Slf4jLoggerSpec)]")
@@ -220,7 +220,7 @@ class Slf4jLoggerSpec extends PekkoSpec(Slf4jLoggerSpec.config) with BeforeAndAf
"not include system info in pekkoSource when creating Logging with system.eventStream" in {
val log = Logging(system.eventStream, "org.apache.pekko.event.slf4j.Slf4jLoggerSpec.MyLogSource")
log.info("test")
- awaitCond(outputString.contains("----"), 5 seconds)
+ awaitCond(outputString.contains("----"), 5.seconds)
val s = outputString
s should include("pekkoSource=org.apache.pekko.event.slf4j.Slf4jLoggerSpec.MyLogSource")
s should include("logger=[org.apache.pekko.event.slf4j.Slf4jLoggerSpec.MyLogSource]")
@@ -229,7 +229,7 @@ class Slf4jLoggerSpec extends PekkoSpec(Slf4jLoggerSpec.config) with BeforeAndAf
"use short class name and include system info in pekkoSource when creating Logging with system and class" in {
val log = Logging(system, classOf[MyLogSource])
log.info("test")
- awaitCond(outputString.contains("----"), 5 seconds)
+ awaitCond(outputString.contains("----"), 5.seconds)
val s = outputString
s should include("pekkoSource=Slf4jLoggerSpec$MyLogSource(pekko://Slf4jLoggerSpec)")
s should include("logger=[org.apache.pekko.event.slf4j.Slf4jLoggerSpec$MyLogSource]")
@@ -238,7 +238,7 @@ class Slf4jLoggerSpec extends PekkoSpec(Slf4jLoggerSpec.config) with BeforeAndAf
"use short class name in pekkoSource when creating Logging with system.eventStream and class" in {
val log = Logging(system.eventStream, classOf[MyLogSource])
log.info("test")
- awaitCond(outputString.contains("----"), 5 seconds)
+ awaitCond(outputString.contains("----"), 5.seconds)
val s = outputString
s should include("pekkoSource=Slf4jLoggerSpec$MyLogSource")
s should include("logger=[org.apache.pekko.event.slf4j.Slf4jLoggerSpec$MyLogSource]")
@@ -247,7 +247,7 @@ class Slf4jLoggerSpec extends PekkoSpec(Slf4jLoggerSpec.config) with BeforeAndAf
"include actorSystem name in sourceActorSystem" in {
val log = Logging(system.eventStream, classOf[MyLogSource])
log.info("test")
- awaitCond(outputString.contains("----"), 5 seconds)
+ awaitCond(outputString.contains("----"), 5.seconds)
val s = outputString
s should include("sourceActorSystem=Slf4jLoggerSpec")
}
diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipLatestSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipLatestSpec.scala
index fdea832c4e..13663ae4a0 100644
--- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipLatestSpec.scala
+++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipLatestSpec.scala
@@ -48,7 +48,7 @@ class GraphZipLatestSpec extends StreamSpec with ScalaCheckPropertyChecks with S
bools.sendNext(true)
// does not emit yet
- probe.expectNoMessage(0 seconds)
+ probe.expectNoMessage(0.seconds)
// an element pushed on the other source
ints.sendNext(1)
@@ -94,7 +94,7 @@ class GraphZipLatestSpec extends StreamSpec with ScalaCheckPropertyChecks with S
// another request does not emit a duplicate
probe.request(1)
- probe.expectNoMessage(0 seconds)
+ probe.expectNoMessage(0.seconds)
bools.sendComplete()
probe.expectComplete()
@@ -116,7 +116,7 @@ class GraphZipLatestSpec extends StreamSpec with ScalaCheckPropertyChecks with S
// another request does not emit a duplicate
probe.request(1)
- probe.expectNoMessage(0 seconds)
+ probe.expectNoMessage(0.seconds)
as.sendComplete()
probe.expectComplete()
diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipLatestWithSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipLatestWithSpec.scala
index 6468d9f43e..9e688f1827 100644
--- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipLatestWithSpec.scala
+++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/GraphZipLatestWithSpec.scala
@@ -57,7 +57,7 @@ class GraphZipLatestWithSpec extends TwoStreamsSetup {
RunnableGraph
.fromGraph(GraphDSL.create() { implicit b =>
val zipLatest = b.add(ZipLatestWith((_: Int) + (_: Int)))
- val never = Source.single(3).initialDelay(1 day)
+ val never = Source.single(3).initialDelay(1.day)
Source(1 to 2).concat(never) ~> zipLatest.in0
Source.fromPublisher(upstreamProbe) ~> zipLatest.in1
zipLatest.out ~> Sink.fromSubscriber(downstreamProbe)
@@ -92,7 +92,7 @@ class GraphZipLatestWithSpec extends TwoStreamsSetup {
RunnableGraph
.fromGraph(GraphDSL.create() { implicit b =>
val zip = b.add(ZipLatestWith[Int, Int, Int]((_: Int) / (_: Int)))
- val never = Source.single(2).initialDelay(1 day)
+ val never = Source.single(2).initialDelay(1.day)
Source.single(1).concat(never) ~> zip.in0
Source(-2 to 2) ~> zip.in1
diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/SinkForeachAsyncSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/SinkForeachAsyncSpec.scala
index dcb2e62b82..79fba2fb91 100644
--- a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/SinkForeachAsyncSpec.scala
+++ b/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/SinkForeachAsyncSpec.scala
@@ -121,7 +121,7 @@ class SinkForeachAsyncSpec extends StreamSpec {
assert(!threeCalled)
assert(!fourCalled)
- probe.expectNoMessage(2 seconds)
+ probe.expectNoMessage(2.seconds)
latch(2).countDown()
probe.expectMsg(2)
@@ -129,14 +129,14 @@ class SinkForeachAsyncSpec extends StreamSpec {
assert(!threeCalled)
assert(!fourCalled)
- probe.expectNoMessage(2 seconds)
+ probe.expectNoMessage(2.seconds)
latch(3).countDown()
probe.expectMsg(3)
assert(!fourCalled)
- probe.expectNoMessage(2 seconds)
+ probe.expectNoMessage(2.seconds)
latch(4).countDown()
probe.expectMsg(4)
diff --git a/stream-typed-tests/src/test/scala/org/apache/pekko/stream/MapAsyncPartitionedSpec.scala b/stream-typed-tests/src/test/scala/org/apache/pekko/stream/MapAsyncPartitionedSpec.scala
index 0b5a01a20b..32943ce071 100644
--- a/stream-typed-tests/src/test/scala/org/apache/pekko/stream/MapAsyncPartitionedSpec.scala
+++ b/stream-typed-tests/src/test/scala/org/apache/pekko/stream/MapAsyncPartitionedSpec.scala
@@ -93,8 +93,8 @@ class MapAsyncPartitionedSpec
import MapAsyncPartitionedSpec.TestData._
override implicit def patienceConfig: PatienceConfig = PatienceConfig(
- timeout = 5 seconds,
- interval = 100 millis)
+ timeout = 5.seconds,
+ interval = 100.millis)
private implicit val system: ActorSystem[_] = ActorSystem(Behaviors.empty, "test-system")
private implicit val ec: ExecutionContext = ExecutionContext.fromExecutor(Executors.newCachedThreadPool())
@@ -116,11 +116,11 @@ class MapAsyncPartitionedSpec
it should "process elements in parallel by partition" in {
val elements = List(
- TestKeyValue(key = 1, delay = 1000 millis, value = "1.a"),
- TestKeyValue(key = 2, delay = 700 millis, value = "2.a"),
- TestKeyValue(key = 1, delay = 500 millis, value = "1.b"),
- TestKeyValue(key = 2, delay = 900 millis, value = "2.b"),
- TestKeyValue(key = 1, delay = 500 millis, value = "1.c"))
+ TestKeyValue(key = 1, delay = 1000.millis, value = "1.a"),
+ TestKeyValue(key = 2, delay = 700.millis, value = "2.a"),
+ TestKeyValue(key = 1, delay = 500.millis, value = "1.b"),
+ TestKeyValue(key = 2, delay = 900.millis, value = "2.b"),
+ TestKeyValue(key = 1, delay = 500.millis, value = "1.c"))
val result =
Source(elements)
@@ -222,9 +222,9 @@ class MapAsyncPartitionedSpec
it should "handle nulls" in {
val elements = List(
- TestKeyValue(key = 1, delay = 1000 millis, value = "1.a"),
- TestKeyValue(key = 2, delay = 700 millis, value = "2.a"),
- TestKeyValue(key = 1, delay = 500 millis, value = null))
+ TestKeyValue(key = 1, delay = 1000.millis, value = "1.a"),
+ TestKeyValue(key = 2, delay = 700.millis, value = "2.a"),
+ TestKeyValue(key = 1, delay = 500.millis, value = null))
@nowarn("msg=never used")
def fun(v: TestKeyValue, p: Int): Future[String] = Future.successful(v.value)
@@ -254,11 +254,11 @@ class MapAsyncPartitionedSpec
it should "process elements in parallel by partition" in {
val elements = List(
- TestKeyValue(key = 1, delay = 1000 millis, value = "1.a"),
- TestKeyValue(key = 2, delay = 700 millis, value = "2.a"),
- TestKeyValue(key = 1, delay = 500 millis, value = "1.b"),
- TestKeyValue(key = 1, delay = 500 millis, value = "1.c"),
- TestKeyValue(key = 2, delay = 900 millis, value = "2.b"))
+ TestKeyValue(key = 1, delay = 1000.millis, value = "1.a"),
+ TestKeyValue(key = 2, delay = 700.millis, value = "2.a"),
+ TestKeyValue(key = 1, delay = 500.millis, value = "1.b"),
+ TestKeyValue(key = 1, delay = 500.millis, value = "1.c"),
+ TestKeyValue(key = 2, delay = 900.millis, value = "2.b"))
def processElement(e: TestKeyValue, p: Int)(implicit ec: ExecutionContext): Future[(Int, (String, Instant))] =
Future {
@@ -374,9 +374,9 @@ class MapAsyncPartitionedSpec
it should "handle nulls" in {
val elements = List(
- TestKeyValue(key = 1, delay = 1000 millis, value = "1.a"),
- TestKeyValue(key = 2, delay = 700 millis, value = "2.a"),
- TestKeyValue(key = 1, delay = 500 millis, value = null))
+ TestKeyValue(key = 1, delay = 1000.millis, value = "1.a"),
+ TestKeyValue(key = 2, delay = 700.millis, value = "2.a"),
+ TestKeyValue(key = 1, delay = 500.millis, value = null))
@nowarn("msg=never used")
def fun(v: TestKeyValue, p: Int): Future[String] = Future.successful(v.value)
diff --git a/stream/src/main/scala/org/apache/pekko/stream/javadsl/Flow.scala b/stream/src/main/scala/org/apache/pekko/stream/javadsl/Flow.scala
index 1eb248c0c0..d8b6d2f813 100755
--- a/stream/src/main/scala/org/apache/pekko/stream/javadsl/Flow.scala
+++ b/stream/src/main/scala/org/apache/pekko/stream/javadsl/Flow.scala
@@ -93,7 +93,8 @@ object Flow {
viaFlow: Flow[FOut, FViaOut, FViaMat],
combine: function.Function2[FMat, FViaMat, Mat]
): Flow[FIn, Optional[FViaOut], Mat] =
- scaladsl.Flow.optionalVia(flow.map(_.toScala).asScala, viaFlow.asScala)(combinerToScala(combine)).map(_.toJava).asJava
+ scaladsl.Flow.optionalVia(flow.map(_.toScala).asScala, viaFlow.asScala)(combinerToScala(combine)).map(
+ _.toJava).asJava
/** Create a `Flow` which can process elements of type `T`. */
def of[T](@unused clazz: Class[T]): javadsl.Flow[T, T, NotUsed] = create[T]()
diff --git a/stream/src/main/scala/org/apache/pekko/stream/javadsl/Source.scala b/stream/src/main/scala/org/apache/pekko/stream/javadsl/Source.scala
index 7ad5bd0df7..5241f8b7c2 100755
--- a/stream/src/main/scala/org/apache/pekko/stream/javadsl/Source.scala
+++ b/stream/src/main/scala/org/apache/pekko/stream/javadsl/Source.scala
@@ -161,7 +161,8 @@ object Source {
viaFlow: Flow[SOut, FOut, FMat],
combine: function.Function2[SMat, FMat, Mat]
): Source[Optional[FOut], Mat] =
- scaladsl.Source.optionalVia(source.map(_.toScala).asScala, viaFlow.asScala)(combinerToScala(combine)).map(_.toJava).asJava
+ scaladsl.Source.optionalVia(source.map(_.toScala).asScala, viaFlow.asScala)(combinerToScala(combine)).map(
+ _.toJava).asJava
/**
* Helper to create [[Source]] from `Iterable`.
diff --git a/testkit/src/main/scala/org/apache/pekko/testkit/CallingThreadDispatcher.scala b/testkit/src/main/scala/org/apache/pekko/testkit/CallingThreadDispatcher.scala
index 291969ff52..dfa86caad8 100644
--- a/testkit/src/main/scala/org/apache/pekko/testkit/CallingThreadDispatcher.scala
+++ b/testkit/src/main/scala/org/apache/pekko/testkit/CallingThreadDispatcher.scala
@@ -179,7 +179,7 @@ class CallingThreadDispatcher(_configurator: MessageDispatcherConfigurator) exte
hasMessageHint: Boolean,
hasSystemMessageHint: Boolean): Boolean = false
- protected[pekko] override def shutdownTimeout = 1 second
+ protected[pekko] override def shutdownTimeout = 1.second
protected[pekko] override def register(actor: ActorCell): Unit = {
super.register(actor)
diff --git a/testkit/src/main/scala/org/apache/pekko/testkit/TestKit.scala b/testkit/src/main/scala/org/apache/pekko/testkit/TestKit.scala
index 1b43f58501..504470e2fe 100644
--- a/testkit/src/main/scala/org/apache/pekko/testkit/TestKit.scala
+++ b/testkit/src/main/scala/org/apache/pekko/testkit/TestKit.scala
@@ -441,7 +441,7 @@ trait TestKitBase {
/**
* Same as calling `within(0 seconds, max)(f)`.
*/
- def within[T](max: FiniteDuration)(f: => T): T = within(0 seconds, max)(f)
+ def within[T](max: FiniteDuration)(f: => T): T = within(0.seconds, max)(f)
/**
* Same as `expectMsg(remainingOrDefault, obj)`, but correctly treating the timeFactor.
diff --git a/testkit/src/test/scala/org/apache/pekko/testkit/PekkoSpec.scala b/testkit/src/test/scala/org/apache/pekko/testkit/PekkoSpec.scala
index 807b2f556f..00a4b90c75 100644
--- a/testkit/src/test/scala/org/apache/pekko/testkit/PekkoSpec.scala
+++ b/testkit/src/test/scala/org/apache/pekko/testkit/PekkoSpec.scala
@@ -126,7 +126,7 @@ abstract class PekkoSpec(_system: ActorSystem)
def spawn(dispatcherId: String = Dispatchers.DefaultDispatcherId)(body: => Unit): Unit =
Future(body)(system.dispatchers.lookup(dispatcherId))
- override def expectedTestDuration: FiniteDuration = 60 seconds
+ override def expectedTestDuration: FiniteDuration = 60.seconds
def muteDeadLetters(messageClasses: Class[_]*)(sys: ActorSystem = system): Unit =
if (!sys.log.isDebugEnabled) {
diff --git a/testkit/src/test/scala/org/apache/pekko/testkit/PekkoSpecSpec.scala b/testkit/src/test/scala/org/apache/pekko/testkit/PekkoSpecSpec.scala
index 93442cc279..863592875c 100644
--- a/testkit/src/test/scala/org/apache/pekko/testkit/PekkoSpecSpec.scala
+++ b/testkit/src/test/scala/org/apache/pekko/testkit/PekkoSpecSpec.scala
@@ -59,7 +59,7 @@ class PekkoSpecSpec extends AnyWordSpec with Matchers {
val spec = new PekkoSpec(localSystem) { refs = Seq(testActor, localSystem.actorOf(Props.empty, "name")) }
refs.foreach(_.isTerminated should not be true)
TestKit.shutdownActorSystem(localSystem)
- spec.awaitCond(refs.forall(_.isTerminated), 2 seconds)
+ spec.awaitCond(refs.forall(_.isTerminated), 2.seconds)
}
"stop correctly when sending PoisonPill to rootGuardian" in {
@@ -70,7 +70,7 @@ class PekkoSpecSpec extends AnyWordSpec with Matchers {
system.actorSelection("/") ! PoisonPill
- Await.ready(latch, 2 seconds)
+ Await.ready(latch, 2.seconds)
}
"enqueue unread messages from testActor to deadLetters" in {
@@ -95,14 +95,14 @@ class PekkoSpecSpec extends AnyWordSpec with Matchers {
* may happen that the system.stop() suspends the testActor before it had
* a chance to put the message into its private queue
*/
- probe.receiveWhile(1 second) {
+ probe.receiveWhile(1.second) {
case null =>
}
val latch = new TestLatch(1)(system)
system.registerOnTermination(latch.countDown())
TestKit.shutdownActorSystem(system)
- Await.ready(latch, 2 seconds)
+ Await.ready(latch, 2.seconds)
Await.result(davyJones ? "Die!", timeout.duration) should ===("finally gone")
// this will typically also contain log messages which were sent after the logger shutdown
diff --git a/testkit/src/test/scala/org/apache/pekko/testkit/TestActorRefSpec.scala b/testkit/src/test/scala/org/apache/pekko/testkit/TestActorRefSpec.scala
index 004dc16f46..93ede6bc50 100644
--- a/testkit/src/test/scala/org/apache/pekko/testkit/TestActorRefSpec.scala
+++ b/testkit/src/test/scala/org/apache/pekko/testkit/TestActorRefSpec.scala
@@ -190,7 +190,7 @@ class TestActorRefSpec extends PekkoSpec("disp1.type=Dispatcher") with BeforeAnd
}
}))
a.!(PoisonPill)(testActor)
- expectMsgPF(5 seconds) {
+ expectMsgPF(5.seconds) {
case WrappedTerminated(Terminated(`a`)) => true
}
a.isTerminated should ===(true)
@@ -210,7 +210,7 @@ class TestActorRefSpec extends PekkoSpec("disp1.type=Dispatcher") with BeforeAnd
}), self, "child")
override def supervisorStrategy =
- OneForOneStrategy(maxNrOfRetries = 5, withinTimeRange = 1 second)(List(classOf[ActorKilledException]))
+ OneForOneStrategy(maxNrOfRetries = 5, withinTimeRange = 1.second)(List(classOf[ActorKilledException]))
def receiveT = { case "sendKill" => ref ! Kill }
}))
diff --git a/testkit/src/test/scala/org/apache/pekko/testkit/TestFSMRefSpec.scala b/testkit/src/test/scala/org/apache/pekko/testkit/TestFSMRefSpec.scala
index ca1aaef7db..e2ccd4d9be 100644
--- a/testkit/src/test/scala/org/apache/pekko/testkit/TestFSMRefSpec.scala
+++ b/testkit/src/test/scala/org/apache/pekko/testkit/TestFSMRefSpec.scala
@@ -45,8 +45,8 @@ class TestFSMRefSpec extends PekkoSpec {
fsm.setState(stateData = "buh")
fsm.stateName should ===(1)
fsm.stateData should ===("buh")
- fsm.setState(timeout = 100 millis)
- within(80 millis, 500 millis) {
+ fsm.setState(timeout = 100.millis)
+ within(80.millis, 500.millis) {
awaitCond(fsm.stateName == 2 && fsm.stateData == "timeout")
}
}
@@ -59,7 +59,7 @@ class TestFSMRefSpec extends PekkoSpec {
}
}, "test-fsm-ref-2")
fsm.isTimerActive("test") should ===(false)
- fsm.startTimerWithFixedDelay("test", 12, 10 millis)
+ fsm.startTimerWithFixedDelay("test", 12, 10.millis)
fsm.isTimerActive("test") should ===(true)
fsm.cancelTimer("test")
fsm.isTimerActive("test") should ===(false)
diff --git a/testkit/src/test/scala/org/apache/pekko/testkit/TestProbeSpec.scala b/testkit/src/test/scala/org/apache/pekko/testkit/TestProbeSpec.scala
index 7872c3483e..3ca118f684 100644
--- a/testkit/src/test/scala/org/apache/pekko/testkit/TestProbeSpec.scala
+++ b/testkit/src/test/scala/org/apache/pekko/testkit/TestProbeSpec.scala
@@ -33,7 +33,7 @@ class TestProbeSpec extends PekkoSpec with DefaultTimeout with Eventually {
"reply to futures" in {
val tk = TestProbe()
val future = tk.ref ? "hello"
- tk.expectMsg(0 millis, "hello") // TestActor runs on CallingThreadDispatcher
+ tk.expectMsg(0.millis, "hello") // TestActor runs on CallingThreadDispatcher
tk.lastMessage.sender ! "world"
future.isCompleted should be(true)
Await.result(future, timeout.duration) should ===("world")
@@ -43,18 +43,18 @@ class TestProbeSpec extends PekkoSpec with DefaultTimeout with Eventually {
val tk1 = TestProbe()
val tk2 = TestProbe()
tk1.ref.!("hello")(tk2.ref)
- tk1.expectMsg(0 millis, "hello")
+ tk1.expectMsg(0.millis, "hello")
tk1.lastMessage.sender ! "world"
- tk2.expectMsg(0 millis, "world")
+ tk2.expectMsg(0.millis, "world")
}
"properly send and reply to messages" in {
val probe1 = TestProbe()
val probe2 = TestProbe()
probe1.send(probe2.ref, "hello")
- probe2.expectMsg(0 millis, "hello")
+ probe2.expectMsg(0.millis, "hello")
probe2.lastMessage.sender ! "world"
- probe1.expectMsg(0 millis, "some hint here", "world")
+ probe1.expectMsg(0.millis, "some hint here", "world")
}
"create a child when invoking actorOf" in {
@@ -110,7 +110,7 @@ class TestProbeSpec extends PekkoSpec with DefaultTimeout with Eventually {
val hint = "some hint"
assertFailureMessageContains(hint) {
- probe.expectMsg(0 millis, hint, "hello")
+ probe.expectMsg(0.millis, hint, "hello")
}
}
@@ -120,7 +120,7 @@ class TestProbeSpec extends PekkoSpec with DefaultTimeout with Eventually {
assertFailureMessageContains(hint) {
probe.ref ! "hello"
- probe.expectMsg(0 millis, hint, "bye")
+ probe.expectMsg(0.millis, hint, "bye")
}
}
@@ -155,9 +155,9 @@ class TestProbeSpec extends PekkoSpec with DefaultTimeout with Eventually {
expectMsgAnyClassOf(classOf[Int]) should ===(42)
expectMsgAllClassOf(classOf[Int]) should ===(Seq(42))
expectMsgAllConformingOf(classOf[Int]) should ===(Seq(42))
- expectMsgAllConformingOf(5 seconds, classOf[Int]) should ===(Seq(42))
+ expectMsgAllConformingOf(5.seconds, classOf[Int]) should ===(Seq(42))
expectMsgAllClassOf(classOf[Int]) should ===(Seq(42))
- expectMsgAllClassOf(5 seconds, classOf[Int]) should ===(Seq(42))
+ expectMsgAllClassOf(5.seconds, classOf[Int]) should ===(Seq(42))
}
"be able to fish for messages" in {
@@ -172,7 +172,7 @@ class TestProbeSpec extends PekkoSpec with DefaultTimeout with Eventually {
case _ => false
}
- probe.expectMsg(1 second, "done")
+ probe.expectMsg(1.second, "done")
}
"be able to fish for specific messages" in {
@@ -188,7 +188,7 @@ class TestProbeSpec extends PekkoSpec with DefaultTimeout with Eventually {
msg should be("fishForMe")
- probe.expectMsg(1 second, "done")
+ probe.expectMsg(1.second, "done")
}
"be able to ignore primitive types" in {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pekko.apache.org
For additional commands, e-mail: commits-help@pekko.apache.org