You're welcome. Glad to hear that.

On Thu, Sep 24, 2015 at 4:56 AM, lapming.lee <[email protected]> wrote:

> Thanks Patrik,
>
> I got SBT console working in IntelliJ: there is as plugin for that.  Then
> I tried sbt test and it worked!  So it seems you can't run multi-node
> testing in IntelliJ through the IDE.  It must be though the SBT console.
>

> On Wednesday, September 23, 2015 at 11:37:47 PM UTC+8, Patrik Nordwall
> wrote:
>>
>>
>>
>> On Tue, Sep 22, 2015 at 9:20 AM, lapming.lee <[email protected]> wrote:
>>
>>> I am using Intellij 14.1 and I run the multi-node test.  I notice a few
>>> things
>>>
>>> 1) The multi-jvm folder is automatically unmarked as the *Test Sources
>>> Root*
>>> 2) It causes an exception :
>>>
>>> *Caused by: java.lang.IllegalStateException: need system property
>>> multinode.max-nodes to be set*
>>>
>>>
>>> Here are my questions:
>>> 1) Can you run multi-node testing with IntelliJ 14.1 Ide?
>>>
>>
>> I don't know if that is possible, perhaps if you can run sbt form
>> Intellij? The sbt plugin is required.
>> I would guess it is difficult to get that working.
>>
>>
>>> 2) If not, how do I run it using the SBT prompt?  (I do not understand
>>> the instructions here
>>>
>>> http://doc.akka.io/docs/akka/snapshot/dev/multi-node-testing.html#Running_the_Multi_Node_Tests
>>> )
>>>
>>>
>> What have you tried and what is not working? With a proper sbt project
>> the multi-node tests are run when you run `sbt test`, or you can run
>> individual tests with `multi-jvm:testOnly aaa.bbb.MyCoolSpec`
>>
>> There is an activator tutorial that is useful for setting up the project: 
>> Akka
>> Multi-Node Testing Sample with Scala
>> <https://typesafe.com/activator/template/akka-sample-multi-node-scala?_ga=1.206360347.924914305.1394398072>
>>
>> Regards,
>> Patrik
>>
>>
>>> I have the following
>>>
>>> *Dependencies.scala **(in root project)**:*
>>>
>>> object Dependencies {
>>>
>>>   val AKKA_VERSION = "2.4.0-RC3"
>>>
>>>   val SCALA_VERSION = "2.11.7"
>>>
>>>   val SCALA_TEST_VERSION = "2.2.5"
>>>
>>>
>>>   val core = {
>>>
>>>     val compile = {
>>>
>>>       val akka = "com.typesafe.akka" % "akka-actor_2.11" % AKKA_VERSION
>>>
>>>       val clusterTools = "com.typesafe.akka" %% "akka-cluster-tools" % 
>>> AKKA_VERSION
>>>
>>>       val clusterMetrics = "com.typesafe.akka" % 
>>> "akka-cluster-metrics_2.11" % AKKA_VERSION
>>>
>>>
>>>       Seq(akka, clusterTools, clusterMetrics)
>>>
>>>     }
>>>
>>>
>>>     val test = {
>>>
>>>       val scalaTest = "org.scalatest" % "scalatest_2.11" % 
>>> SCALA_TEST_VERSION % "test"
>>>
>>>       val akkaTest = "com.typesafe.akka" % "akka-testkit_2.11" % 
>>> AKKA_VERSION % "test"
>>>
>>>       val multiNodeTest = "com.typesafe.akka" %% "akka-multi-node-testkit" 
>>> % AKKA_VERSION % "test"
>>>
>>>
>>>       Seq(scalaTest, akkaTest, multiNodeTest)
>>>
>>>     }
>>>
>>>
>>>     compile ++ test
>>>
>>>   }
>>>
>>> }
>>>
>>>
>>> *ProjectBuild.scala **(in root project)**:*
>>>
>>> import com.typesafe.sbt.SbtMultiJvm
>>>
>>> import com.typesafe.sbt.SbtMultiJvm.MultiJvmKeys.MultiJvm
>>>
>>> import sbt.Keys._
>>>
>>> import sbt._
>>>
>>>
>>> object ProjectBuild extends Build {
>>>
>>>   lazy val root = Project(id = “root", base = file("."))
>>>
>>>     .aggregate(macros, core)
>>>
>>>
>>>   lazy val macros = Project(id = "macros", base = file("macros"))
>>>
>>>
>>>   lazy val core = Project(id = "core", base = file("core"))
>>>
>>>     .dependsOn(macros)
>>>
>>>     .settings(libraryDependencies ++= Dependencies.core)
>>>
>>>     .settings(multiJvmSettings)
>>>
>>>     .configs(MultiJvm)
>>>
>>>
>>>   lazy val multiJvmSettings = SbtMultiJvm.multiJvmSettings ++ Seq(
>>>
>>>     compile in MultiJvm <<= (compile in MultiJvm) triggeredBy (compile in 
>>> Test), // make sure that MultiJvm test are compiled by the default test 
>>> compilation
>>>
>>>     parallelExecution in Test := false,                                     
>>>      // disable parallel tests
>>>
>>>     executeTests in Test <<=
>>>
>>>       (executeTests in Test, executeTests in MultiJvm) map {
>>>
>>>         case ((testResults), (multiJvmResults)) =>
>>>
>>>           val overall =
>>>
>>>             if (testResults.overall.id < multiJvmResults.overall.id) 
>>> multiJvmResults.overall
>>>
>>>             else testResults.overall
>>>
>>>           Tests.Output(overall,
>>>
>>>             testResults.events ++ multiJvmResults.events,
>>>
>>>             testResults.summaries ++ multiJvmResults.summaries)
>>>
>>>       }
>>>
>>>   )
>>>
>>> }
>>>
>>>
>>> *plugins.sbt (in root project):*
>>>
>>> addSbtPlugin("com.typesafe.sbt" % "sbt-multi-jvm" % "0.3.11")
>>>
>>>
>>> *Spec (in core project):*
>>>
>>> import akka.remote.testconductor.RoleName
>>>
>>> import akka.remote.testkit.{MultiNodeConfig, MultiNodeSpec}
>>>
>>> import com.typesafe.config.ConfigFactory
>>>
>>>
>>> private object NodeSystemConfig extends MultiNodeConfig {
>>>
>>>   val first = role("first")
>>>
>>>   val second = role("second")
>>>
>>>
>>>   def nodeList: Seq[RoleName] = Seq(first, second)
>>>
>>>
>>>   // Extract individual sigar library for every node
>>>
>>>   nodeList.foreach(r => nodeConfig(r) {
>>>
>>>     ConfigFactory.parseString(
>>>
>>>       s"""
>>>
>>>          |akka.cluster.metrics.enabled = off
>>>
>>>          |akka.extensions=["akka.cluster.metrics.ClusterMetricsExtension"]
>>>
>>>          
>>> |akka.cluster.metrics.native-library-extract-folder=target/native/${r.name}
>>>
>>>        """.stripMargin)
>>>
>>>   })
>>>
>>>
>>>   // Configuration for all nodes
>>>
>>>   commonConfig(ConfigFactory.parseString("""
>>>
>>>       |akka.actor.provider = "akka.cluster.ClusterActorRefProvider"
>>>
>>>       |akka.remote.log-remote-lifecycle-events = off
>>>
>>>       |akka.cluster.roles = [compute]
>>>
>>>       |akka.cluster.auto-join = off
>>>
>>>       |akka.cluster.auto-down = on
>>>
>>>       |akka.loggers = ["akka.testkit.TestEventListener"]
>>>
>>>       |akka.loglevel = INFO
>>>
>>>     """.stripMargin))
>>>
>>> }
>>>
>>>
>>> final class NodeSystemSpecMultiJvmNode1 extends NodeSystemSpec
>>>
>>> final class NodeSystemSpecMultiJvmNode2 extends NodeSystemSpec
>>>
>>>
>>> private[test] abstract class NodeSystemSpec
>>>
>>>   extends MultiNodeSpec(NodeSystemConfig) with STMultiNodeSpec {
>>>
>>>
>>>   override def initialParticipants: Int = roles.size
>>>
>>>
>>>   "A node" should {
>>>
>>>     "do something" in {
>>>
>>>
>>>     }
>>>
>>>   }
>>>
>>> }
>>>
>>> trait STMultiNodeSpec
>>>
>>>   extends MultiNodeSpecCallbacks
>>>
>>>   with WordSpecLike
>>>
>>>   with MustMatchers
>>>
>>>   with BeforeAndAfterAll
>>>
>>>   with ImplicitSender {
>>>
>>>   this: MultiNodeSpec ⇒
>>>
>>>
>>>   override def beforeAll() = multiNodeSpecBeforeAll()
>>>
>>>
>>>   override def afterAll() = multiNodeSpecAfterAll()
>>>
>>> }
>>>
>>> --
>>> >>>>>>>>>> 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.
>>>
>>
>>
>>
>> --
>>
>> Patrik Nordwall
>> Typesafe <http://typesafe.com/> -  Reactive apps on the JVM
>> Twitter: @patriknw
>>
>> --
> >>>>>>>>>> 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.
>



-- 

Patrik Nordwall
Typesafe <http://typesafe.com/> -  Reactive apps on the JVM
Twitter: @patriknw

-- 
>>>>>>>>>>      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.

Reply via email to