From cdb7eee0c30bf42a81eea0c2ec0bb27aafedbdd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Antonsson?= Date: Thu, 26 Mar 2015 12:04:00 +0100 Subject: [PATCH] =con #16946 Make ReliableProxyMultiJvmSpec not reuse actor name --- .../contrib/pattern/ReliableProxySpec.scala | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/akka-contrib/src/multi-jvm/scala/akka/contrib/pattern/ReliableProxySpec.scala b/akka-contrib/src/multi-jvm/scala/akka/contrib/pattern/ReliableProxySpec.scala index 497e8dac45b..ceb0b73ff6f 100644 --- a/akka-contrib/src/multi-jvm/scala/akka/contrib/pattern/ReliableProxySpec.scala +++ b/akka-contrib/src/multi-jvm/scala/akka/contrib/pattern/ReliableProxySpec.scala @@ -59,9 +59,10 @@ class ReliableProxySpec extends MultiNodeSpec(ReliableProxySpec) with STMultiNod } def stopProxy(): Unit = { - proxy ! FSM.UnsubscribeTransitionCallBack(testActor) - system stop proxy - expectMsgType[Terminated] + val currentProxy = proxy + currentProxy ! FSM.UnsubscribeTransitionCallBack(testActor) + currentProxy ! PoisonPill + expectTerminated(currentProxy) } def expectState(s: State) = expectMsg(FSM.CurrentState(proxy, s)) @@ -91,7 +92,7 @@ class ReliableProxySpec extends MultiNodeSpec(ReliableProxySpec) with STMultiNod import akka.contrib.pattern.ReliableProxy idTarget() - proxy = system.actorOf(ReliableProxy.props(target.path, 100.millis, 5.seconds), "proxy") + proxy = system.actorOf(ReliableProxy.props(target.path, 100.millis, 5.seconds), "proxy1") watch(proxy) proxy ! FSM.SubscribeTransitionCallBack(testActor) expectState(Connecting) @@ -289,7 +290,7 @@ class ReliableProxySpec extends MultiNodeSpec(ReliableProxySpec) with STMultiNod stopProxy() // Stop previous proxy // Start new proxy with no reconnections - proxy = system.actorOf(ReliableProxy.props(target.path, 100.millis), "proxy") + proxy = system.actorOf(ReliableProxy.props(target.path, 100.millis), "proxy2") proxy ! FSM.SubscribeTransitionCallBack(testActor) watch(proxy) @@ -308,7 +309,7 @@ class ReliableProxySpec extends MultiNodeSpec(ReliableProxySpec) with STMultiNod runOn(local) { within(5 seconds) { expectMsgType[ProxyTerminated] - expectMsgType[Terminated] + expectTerminated(proxy) } } @@ -332,7 +333,7 @@ class ReliableProxySpec extends MultiNodeSpec(ReliableProxySpec) with STMultiNod runOn(local) { // Proxy is not running after previous test // Start new proxy with 3 reconnections every 2 sec - proxy = system.actorOf(ReliableProxy.props(target.path, 100.millis, 2.seconds, 3), "proxy") + proxy = system.actorOf(ReliableProxy.props(target.path, 100.millis, 2.seconds, 3), "proxy3") proxy ! FSM.SubscribeTransitionCallBack(testActor) watch(proxy) expectState(Connecting) @@ -364,7 +365,7 @@ class ReliableProxySpec extends MultiNodeSpec(ReliableProxySpec) with STMultiNod // Validate that the unsent messages are 50 ints val unsentInts = proxyTerm.outstanding.queue collect { case Message(i: Int, _, _) if i > 0 && i <= 50 ⇒ i } unsentInts should have size 50 - expectMsgType[Terminated] + expectTerminated(proxy) } }