Hi Eugene, Yes, one way is to hide the Cluster() extension dependent code behind an interface, and mock it whenever it is needed. Also, for simpler tests you can just start up multiple ActorSystems locally in your test code and let them communicate over localhost.
-Endre On Sun, May 4, 2014 at 6:32 PM, Eugene Dzhurinsky <[email protected]>wrote: > Hello! > > I've read about the testing with *akka-multi-node-testkit*, however the > project I'm working on is based on Maven3. As far as I know, there's no > port of the multi-node testkit plugin for Maven. > > However I guess it could be possible to *mock* the cluster behavior > somehow with the help of *akka-testkit*. The sample code to interact with > cluster (as from examples) is > > val cluster = Cluster(context.system) > > override def preStart(): Unit = { > //#subscribe > cluster.subscribe(self, initialStateMode = InitialStateAsEvents, > classOf[MemberEvent], classOf[UnreachableMember]) > //#subscribe > } > > override def postStop(): Unit = cluster.unsubscribe(self) > > > If I could mock an instance of "cluster" - then probably I could send > "fake" messages from my test cluster to the instance of my actor. While > I've been going into this way, I'd like to know if there's any better way > of setting up such a in-jvm Akka cluster and work with it as with "real" > cluster. > > Thanks! > > -- > >>>>>>>>>> Read the docs: http://akka.io/docs/ > >>>>>>>>>> Check the FAQ: > http://doc.akka.io/docs/akka/current/additional/faq.html > >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user > --- > You received this message because you are subscribed to the Google Groups > "Akka User List" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/akka-user. > For more options, visit https://groups.google.com/d/optout. > -- Akka Team Typesafe - The software stack for applications that scale Blog: letitcrash.com Twitter: @akkateam -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
