Added first test of remote actor provisioning using RemoteActorRefProvider.
Signed-off-by: Jonas Bonér <jonas@jonasboner.com>
This commit is contained in:
parent
af49b99d6f
commit
1bfe3716e2
8 changed files with 61 additions and 2 deletions
|
|
@ -2,7 +2,7 @@
|
|||
* Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
|
||||
*/
|
||||
|
||||
package akka.cluster
|
||||
package akka.remote
|
||||
|
||||
import org.scalatest.WordSpec
|
||||
import org.scalatest.matchers.MustMatchers
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
* Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
|
||||
*/
|
||||
|
||||
package akka.cluster
|
||||
package akka.remote
|
||||
|
||||
import org.scalatest.WordSpec
|
||||
import org.scalatest.matchers.MustMatchers
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
akka.enabled-modules = ["remote"]
|
||||
akka.event-handler-level = "DEBUG"
|
||||
akka.actor.deployment.service-hello.remote.hostname = "localhost"
|
||||
akka.actor.deployment.service-hello.remote.port = 9991
|
||||
|
|
@ -0,0 +1 @@
|
|||
-Dakka.cluster.nodename=node1 -Dakka.remote.hostname=localhost -Dakka.remote.port=9991
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
akka.enabled-modules = ["remote"]
|
||||
akka.event-handler-level = "DEBUG"
|
||||
akka.actor.deployment.service-hello.remote.hostname = "localhost"
|
||||
akka.actor.deployment.service-hello.remote.port = 9991
|
||||
|
|
@ -0,0 +1 @@
|
|||
-Dakka.cluster.nodename=node2 -Dakka.remote.hostname=localhost -Dakka.remote.port=9992
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
package akka.remote.new_remote_actor
|
||||
|
||||
import akka.remote._
|
||||
|
||||
import akka.actor.Actor
|
||||
import akka.config.Config
|
||||
|
||||
object NewRemoteActorMultiJvmSpec {
|
||||
val NrOfNodes = 2
|
||||
|
||||
class SomeActor extends Actor with Serializable {
|
||||
def receive = {
|
||||
case "identify" ⇒ {
|
||||
self.reply(Config.nodename)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class NewRemoteActorMultiJvmNode1 extends MasterClusterTestNode {
|
||||
|
||||
import NewRemoteActorMultiJvmSpec._
|
||||
|
||||
val testNodes = NrOfNodes
|
||||
|
||||
"___" must {
|
||||
"___" in {
|
||||
Remote.start()
|
||||
Thread.sleep(5000)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class NewRemoteActorMultiJvmNode2 extends ClusterTestNode {
|
||||
|
||||
import NewRemoteActorMultiJvmSpec._
|
||||
|
||||
"A new remote actor" must {
|
||||
"be locally instantiated on a remote node and be able to communicate through its RemoteActorRef" in {
|
||||
Remote.start()
|
||||
|
||||
val actor = Actor.actorOf[SomeActor]("service-hello")
|
||||
|
||||
val result = (actor ? "identify").get
|
||||
result must equal("node1")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue