Merge pull request #28988 from renatocaval/artery-udp-three-lanes-spec
This commit is contained in:
commit
23535367a0
1 changed files with 28 additions and 20 deletions
|
|
@ -4,12 +4,20 @@
|
||||||
|
|
||||||
package akka.remote.artery
|
package akka.remote.artery
|
||||||
|
|
||||||
|
import java.util.UUID
|
||||||
|
|
||||||
import scala.concurrent.duration._
|
import scala.concurrent.duration._
|
||||||
|
|
||||||
import com.typesafe.config.{ Config, ConfigFactory }
|
import com.typesafe.config.{ Config, ConfigFactory }
|
||||||
|
import akka.actor.Actor
|
||||||
import akka.actor.{ Actor, ActorIdentity, ActorRef, Deploy, Identify, PoisonPill, Props, RootActorPath }
|
import akka.actor.ActorIdentity
|
||||||
|
import akka.actor.ActorPath
|
||||||
|
import akka.actor.ActorRef
|
||||||
import akka.actor.ActorSelection
|
import akka.actor.ActorSelection
|
||||||
|
import akka.actor.Deploy
|
||||||
|
import akka.actor.Identify
|
||||||
|
import akka.actor.PoisonPill
|
||||||
|
import akka.actor.Props
|
||||||
|
import akka.actor.RootActorPath
|
||||||
import akka.testkit.{ ImplicitSender, TestActors, TestProbe }
|
import akka.testkit.{ ImplicitSender, TestActors, TestProbe }
|
||||||
|
|
||||||
class ArteryUpdSendConsistencyWithOneLaneSpec
|
class ArteryUpdSendConsistencyWithOneLaneSpec
|
||||||
|
|
@ -62,6 +70,17 @@ abstract class AbstractRemoteSendConsistencySpec(config: Config)
|
||||||
val addressB = address(systemB)
|
val addressB = address(systemB)
|
||||||
val rootB = RootActorPath(addressB)
|
val rootB = RootActorPath(addressB)
|
||||||
|
|
||||||
|
private def actorRefBySelection(path: ActorPath) = {
|
||||||
|
|
||||||
|
val correlationId = Some(UUID.randomUUID().toString)
|
||||||
|
system.actorSelection(path) ! Identify(correlationId)
|
||||||
|
|
||||||
|
val actorIdentity = expectMsgType[ActorIdentity](5.seconds)
|
||||||
|
actorIdentity.correlationId shouldBe correlationId
|
||||||
|
|
||||||
|
actorIdentity.ref.get
|
||||||
|
}
|
||||||
|
|
||||||
"Artery" must {
|
"Artery" must {
|
||||||
|
|
||||||
"be able to identify a remote actor and ping it" in {
|
"be able to identify a remote actor and ping it" in {
|
||||||
|
|
@ -71,11 +90,9 @@ abstract class AbstractRemoteSendConsistencySpec(config: Config)
|
||||||
}
|
}
|
||||||
}), "echo")
|
}), "echo")
|
||||||
|
|
||||||
val echoSel = system.actorSelection(rootB / "user" / "echo")
|
val actorPath = rootB / "user" / "echo"
|
||||||
val echoRef = {
|
val echoSel = system.actorSelection(actorPath)
|
||||||
system.actorSelection(rootB / "user" / "echo") ! Identify(None)
|
val echoRef = actorRefBySelection(actorPath)
|
||||||
expectMsgType[ActorIdentity](5.seconds).ref.get
|
|
||||||
}
|
|
||||||
|
|
||||||
echoRef ! "ping"
|
echoRef ! "ping"
|
||||||
expectMsg("pong")
|
expectMsg("pong")
|
||||||
|
|
@ -119,18 +136,9 @@ abstract class AbstractRemoteSendConsistencySpec(config: Config)
|
||||||
systemB.actorOf(TestActors.echoActorProps, "echoB")
|
systemB.actorOf(TestActors.echoActorProps, "echoB")
|
||||||
systemB.actorOf(TestActors.echoActorProps, "echoC")
|
systemB.actorOf(TestActors.echoActorProps, "echoC")
|
||||||
|
|
||||||
val remoteRefA = {
|
val remoteRefA = actorRefBySelection(rootB / "user" / "echoA")
|
||||||
system.actorSelection(rootB / "user" / "echoA") ! Identify(None)
|
val remoteRefB = actorRefBySelection(rootB / "user" / "echoB")
|
||||||
expectMsgType[ActorIdentity].ref.get
|
val remoteRefC = actorRefBySelection(rootB / "user" / "echoC")
|
||||||
}
|
|
||||||
val remoteRefB = {
|
|
||||||
system.actorSelection(rootB / "user" / "echoB") ! Identify(None)
|
|
||||||
expectMsgType[ActorIdentity].ref.get
|
|
||||||
}
|
|
||||||
val remoteRefC = {
|
|
||||||
system.actorSelection(rootB / "user" / "echoC") ! Identify(None)
|
|
||||||
expectMsgType[ActorIdentity].ref.get
|
|
||||||
}
|
|
||||||
|
|
||||||
def senderProps(remoteRef: ActorRef) =
|
def senderProps(remoteRef: ActorRef) =
|
||||||
Props(new Actor {
|
Props(new Actor {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue