Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package org.apache.pekko.actor.testkit.typed.internal
import java.util

import scala.annotation.tailrec
import scala.collection.immutable
import scala.jdk.CollectionConverters._
import scala.reflect.ClassTag
import scala.util.control.Exception.Catcher
Expand Down Expand Up @@ -104,7 +103,7 @@ private[pekko] final class BehaviorTestKitImpl[T](

override def selfInbox(): TestInboxImpl[T] = context.selfInbox

override def retrieveAllEffects(): immutable.Seq[Effect] = {
override def retrieveAllEffects(): Seq[Effect] = {
@tailrec def rec(acc: List[Effect]): List[Effect] = context.effectQueue.poll() match {
case null => acc.reverse
case x => rec(x :: acc)
Expand Down Expand Up @@ -202,7 +201,7 @@ private[pekko] final class BehaviorTestKitImpl[T](

override def getAllLogEntries(): util.List[CapturedLogEvent] = logEntries().asJava

override def logEntries(): immutable.Seq[CapturedLogEvent] = context.logEntries
override def logEntries(): Seq[CapturedLogEvent] = context.logEntries

override def clearLog(): Unit = context.clearLog()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package org.apache.pekko.actor.testkit.typed.internal
import java.util.concurrent.ConcurrentLinkedQueue

import scala.annotation.tailrec
import scala.collection.immutable

import org.apache.pekko
import pekko.actor.{ ActorPath, Address, RootActorPath }
Expand Down Expand Up @@ -51,7 +50,7 @@ private[pekko] final class TestInboxImpl[T](path: ActorPath)
this
}

override protected def internalReceiveAll(): immutable.Seq[T] = {
override protected def internalReceiveAll(): Seq[T] = {
@tailrec def rec(acc: List[T]): List[T] = q.poll() match {
case null => acc.reverse
case x => rec(x :: acc)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import java.util.concurrent.LinkedBlockingDeque
import java.util.function.Supplier

import scala.annotation.tailrec
import scala.collection.immutable
import scala.concurrent.duration._
import scala.jdk.CollectionConverters._
import scala.jdk.DurationConverters._
Expand Down Expand Up @@ -251,10 +250,10 @@ private[pekko] final class TestProbeImpl[M](name: String, system: ActorSystem[?]
}
}

override def receiveMessages(n: Int): immutable.Seq[M] =
override def receiveMessages(n: Int): Seq[M] =
receiveMessages_internal(n, remainingOrDefault)

override def receiveMessages(n: Int, max: FiniteDuration): immutable.Seq[M] =
override def receiveMessages(n: Int, max: FiniteDuration): Seq[M] =
receiveMessages_internal(n, max.dilated)

override def receiveSeveralMessages(n: Int): JList[M] =
Expand All @@ -263,7 +262,7 @@ private[pekko] final class TestProbeImpl[M](name: String, system: ActorSystem[?]
override def receiveSeveralMessages(n: Int, max: JDuration): JList[M] =
receiveMessages_internal(n, max.toScala.dilated).asJava

private def receiveMessages_internal(n: Int, max: FiniteDuration): immutable.Seq[M] = {
private def receiveMessages_internal(n: Int, max: FiniteDuration): Seq[M] = {
val stop = max + now
for (x <- 1 to n) yield {
val timeout = stop - now
Expand All @@ -275,17 +274,17 @@ private[pekko] final class TestProbeImpl[M](name: String, system: ActorSystem[?]
}
}

override def fishForMessage(max: FiniteDuration, hint: String)(fisher: M => FishingOutcome): immutable.Seq[M] =
override def fishForMessage(max: FiniteDuration, hint: String)(fisher: M => FishingOutcome): Seq[M] =
fishForMessage_internal(max.dilated, hint, fisher)

override def fishForMessagePF(max: FiniteDuration, hint: String)(
fisher: PartialFunction[M, FishingOutcome]): immutable.Seq[M] =
fisher: PartialFunction[M, FishingOutcome]): Seq[M] =
fishForMessage(max, hint)(fisher)

override def fishForMessage(max: FiniteDuration)(fisher: M => FishingOutcome): immutable.Seq[M] =
override def fishForMessage(max: FiniteDuration)(fisher: M => FishingOutcome): Seq[M] =
fishForMessage(max, "")(fisher)

override def fishForMessagePF(max: FiniteDuration)(fisher: PartialFunction[M, FishingOutcome]): immutable.Seq[M] =
override def fishForMessagePF(max: FiniteDuration)(fisher: PartialFunction[M, FishingOutcome]): Seq[M] =
fishForMessage(max)(fisher)

override def fishForMessage(max: JDuration, fisher: java.util.function.Function[M, FishingOutcome]): JList[M] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ package org.apache.pekko.actor.testkit.typed.javadsl

import java.util.concurrent.ThreadLocalRandom

import scala.collection.immutable
import scala.jdk.CollectionConverters._

import org.apache.pekko
Expand Down Expand Up @@ -71,7 +70,7 @@ abstract class TestInbox[T] {
*/
def getAllReceived(): java.util.List[T] = internalReceiveAll().asJava

protected def internalReceiveAll(): immutable.Seq[T]
protected def internalReceiveAll(): Seq[T]

def hasMessages: Boolean

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ package org.apache.pekko.actor.testkit.typed.scaladsl

import java.util.concurrent.ThreadLocalRandom

import scala.collection.immutable
import scala.reflect.ClassTag

import org.apache.pekko
Expand Down Expand Up @@ -115,7 +114,7 @@ trait BehaviorTestKit[T] {
* Requests all the effects. The effects are consumed, subsequent calls will only
* see new effects.
*/
def retrieveAllEffects(): immutable.Seq[Effect]
def retrieveAllEffects(): Seq[Effect]

/**
* Returns if there have been any effects.
Expand Down Expand Up @@ -174,7 +173,7 @@ trait BehaviorTestKit[T] {
/**
* Returns all the [[CapturedLogEvent]] issued by this behavior(s)
*/
def logEntries(): immutable.Seq[CapturedLogEvent]
def logEntries(): Seq[CapturedLogEvent]

/**
* Clear the log entries
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ package org.apache.pekko.actor.testkit.typed.scaladsl

import java.util.concurrent.ThreadLocalRandom

import scala.collection.immutable

import org.apache.pekko
import pekko.Done
import pekko.actor.{ Address, RootActorPath }
Expand Down Expand Up @@ -68,9 +66,9 @@ trait TestInbox[T] {
/**
* Collect all messages in the inbox and clear it out
*/
def receiveAll(): immutable.Seq[T] = internalReceiveAll()
def receiveAll(): Seq[T] = internalReceiveAll()

protected def internalReceiveAll(): immutable.Seq[T]
protected def internalReceiveAll(): Seq[T]

def hasMessages: Boolean

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

package org.apache.pekko.actor.testkit.typed.scaladsl

import scala.collection.immutable
import scala.concurrent.duration._
import scala.reflect.ClassTag

Expand Down Expand Up @@ -179,14 +178,14 @@ object TestProbe {
/**
* Same as `receiveMessages(n, remaining)` but using the default timeout as deadline.
*/
def receiveMessages(n: Int): immutable.Seq[M]
def receiveMessages(n: Int): Seq[M]

/**
* Receive `n` messages in a row before the given deadline.
*
* Note that the timeout is scaled using the configuration entry "pekko.actor.testkit.typed.timefactor".
*/
def receiveMessages(n: Int, max: FiniteDuration): immutable.Seq[M]
def receiveMessages(n: Int, max: FiniteDuration): Seq[M]

/**
* Allows for flexible matching of multiple messages within a timeout, the fisher function is fed each incoming
Expand All @@ -206,22 +205,22 @@ object TestProbe {
* The timeout is scaled using the configuration entry "pekko.actor.testkit.typed.timefactor".
* @return The messages accepted in the order they arrived
*/
def fishForMessage(max: FiniteDuration, hint: String)(fisher: M => FishingOutcome): immutable.Seq[M]
def fishForMessage(max: FiniteDuration, hint: String)(fisher: M => FishingOutcome): Seq[M]

/**
* Same as `fishForMessage` but accepting a partial function and failing for non-matches
*/
def fishForMessagePF(max: FiniteDuration, hint: String)(fisher: PartialFunction[M, FishingOutcome]): immutable.Seq[M]
def fishForMessagePF(max: FiniteDuration, hint: String)(fisher: PartialFunction[M, FishingOutcome]): Seq[M]

/**
* Same as the other `fishForMessage` but with no hint
*/
def fishForMessage(max: FiniteDuration)(fisher: M => FishingOutcome): immutable.Seq[M]
def fishForMessage(max: FiniteDuration)(fisher: M => FishingOutcome): Seq[M]

/**
* Same as `fishForMessage` but with no hint, accepting a partial function and failing for non-matches
*/
def fishForMessagePF(max: FiniteDuration)(fisher: PartialFunction[M, FishingOutcome]): immutable.Seq[M]
def fishForMessagePF(max: FiniteDuration)(fisher: PartialFunction[M, FishingOutcome]): Seq[M]

/**
* Expect the given actor to be stopped or stop within the given timeout or
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

package org.apache.pekko.actor

import scala.collection.immutable
import scala.concurrent.Await
import scala.concurrent.duration._
import scala.util.{ Failure, Success, Try }
Expand Down Expand Up @@ -97,7 +96,7 @@ class DynamicAccessSpec extends AnyWordSpec with Matchers with BeforeAndAfterAll
"preserve the target exception from a failing constructor" in {
val result = dynamicAccess.createInstanceFor[TestClassWithThrowingConstructor](
classOf[TestClassWithThrowingConstructor],
immutable.Seq(classOf[String] -> "ignored"))
Seq(classOf[String] -> "ignored"))
val exception = result.failed.get
exception shouldBe a[IllegalArgumentException]
exception.getMessage should ===("user-bug")
Expand All @@ -118,7 +117,7 @@ class DynamicAccessSpec extends AnyWordSpec with Matchers with BeforeAndAfterAll
case s: Success[TestSuperclass] => s
case Failure(_: NoSuchMethodException) =>
dynamicAccess
.createInstanceFor[TestSuperclass](fqcn, immutable.Seq((classOf[String], "string ctor argument")))
.createInstanceFor[TestSuperclass](fqcn, Seq((classOf[String], "string ctor argument")))
case f: Failure[?] => f
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@ package org.apache.pekko.actor
import java.net.URLEncoder
import java.nio.charset.StandardCharsets

import scala.collection.immutable

import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec

class RelativeActorPathSpec extends AnyWordSpec with Matchers {

def elements(path: String): immutable.Seq[String] = RelativeActorPath.unapply(path).getOrElse(Nil)
def elements(path: String): Seq[String] = RelativeActorPath.unapply(path).getOrElse(Nil)

"RelativeActorPath" must {
"match single name" in {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package org.apache.pekko.io
import java.net.InetAddress
import java.util.concurrent.atomic.AtomicLong

import scala.collection.immutable
import scala.concurrent.duration._

import org.apache.pekko
Expand All @@ -38,7 +37,7 @@ class SimpleDnsCacheSpec extends AnyWordSpec with Matchers {
val ttl = Ttl.fromPositive(5000.millis)
val cacheEntry = DnsProtocol.Resolved(
"test.local",
immutable.Seq(ARecord("test.local", ttl, InetAddress.getByName("127.0.0.1"))))
Seq(ARecord("test.local", ttl, InetAddress.getByName("127.0.0.1"))))
cache.put(("test.local", Ip()), cacheEntry, ttl)

cache.cached(DnsProtocol.Resolve("test.local")) should ===(Some(cacheEntry))
Expand All @@ -57,7 +56,7 @@ class SimpleDnsCacheSpec extends AnyWordSpec with Matchers {
val cacheEntry =
DnsProtocol.Resolved(
"test.local",
immutable.Seq(ARecord("test.local", ttl, InetAddress.getByName("127.0.0.1"))))
Seq(ARecord("test.local", ttl, InetAddress.getByName("127.0.0.1"))))
cache.put(("test.local", Ip()), cacheEntry, ttl)

cache.cached(DnsProtocol.Resolve("test.local")) should ===(Some(cacheEntry))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import java.nio.file.Files
import java.util.Random

import scala.annotation.tailrec
import scala.collection.immutable
import scala.concurrent.duration._
import scala.util.Try
import scala.util.control.NonFatal
Expand Down Expand Up @@ -962,7 +961,7 @@ class TcpConnectionSpec extends PekkoSpec("""

def createConnectionActor(
serverAddress: InetSocketAddress = serverAddress,
options: immutable.Seq[SocketOption] = Nil,
options: Seq[SocketOption] = Nil,
timeout: Option[FiniteDuration] = None,
pullMode: Boolean = false): TestActorRef[TcpOutgoingConnection] = {
val ref = createConnectionActorWithoutRegistration(serverAddress, options, timeout, pullMode)
Expand All @@ -981,7 +980,7 @@ class TcpConnectionSpec extends PekkoSpec("""

def createConnectionActorWithoutRegistration(
serverAddress: InetSocketAddress = serverAddress,
options: immutable.Seq[SocketOption] = Nil,
options: Seq[SocketOption] = Nil,
timeout: Option[FiniteDuration] = None,
pullMode: Boolean = false): TestActorRef[TcpOutgoingConnection] =
TestActorRef(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

package org.apache.pekko.io.dns.internal

import scala.collection.immutable.Seq

import org.apache.pekko
import pekko.io.Dns
import pekko.io.dns.AAAARecord
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ package org.apache.pekko.io.dns.internal

import java.net.InetSocketAddress

import scala.collection.immutable.Seq

import org.apache.pekko
import pekko.actor.{ ActorKilledException, Kill, Props }
import pekko.io.Tcp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class ConfiguredLocalRoutingSpec
case _ => throw new IllegalArgumentException(s"Unexpected actorref $ref")
}

def collectRouteePaths(probe: TestProbe, router: ActorRef, n: Int): immutable.Seq[ActorPath] = {
def collectRouteePaths(probe: TestProbe, router: ActorRef, n: Int): Seq[ActorPath] = {
for (i <- 1 to n) yield {
val msg = i.toString
router.tell(msg, probe.ref)
Expand Down
Loading