You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iota.apache.org by to...@apache.org on 2016/07/18 20:43:31 UTC

[08/12] incubator-iota git commit: Creating global Identifier actor to be used in the tests

Creating global Identifier actor to be used in the tests


Project: http://git-wip-us.apache.org/repos/asf/incubator-iota/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-iota/commit/8722e873
Tree: http://git-wip-us.apache.org/repos/asf/incubator-iota/tree/8722e873
Diff: http://git-wip-us.apache.org/repos/asf/incubator-iota/diff/8722e873

Branch: refs/heads/master
Commit: 8722e873cc44a7ee4794db2d1baef7608d48fec1
Parents: 619d3e0
Author: Barbara Gomes <ba...@gmail.com>
Authored: Sat Jul 16 09:11:49 2016 -0700
Committer: Barbara Gomes <ba...@gmail.com>
Committed: Sat Jul 16 09:11:49 2016 -0700

----------------------------------------------------------------------
 .../org/apache/iota/fey/BaseAkkaSpec.scala      |  5 ++++-
 .../apache/iota/fey/IdentifyFeyActorsSpec.scala | 20 +++++++++-----------
 2 files changed, 13 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-iota/blob/8722e873/fey-core/src/test/scala/org/apache/iota/fey/BaseAkkaSpec.scala
----------------------------------------------------------------------
diff --git a/fey-core/src/test/scala/org/apache/iota/fey/BaseAkkaSpec.scala b/fey-core/src/test/scala/org/apache/iota/fey/BaseAkkaSpec.scala
index 3476718..60fb3aa 100644
--- a/fey-core/src/test/scala/org/apache/iota/fey/BaseAkkaSpec.scala
+++ b/fey-core/src/test/scala/org/apache/iota/fey/BaseAkkaSpec.scala
@@ -21,7 +21,7 @@ package org.apache.iota.fey
 import java.io.File
 import java.nio.file.Paths
 
-import akka.actor.{ActorIdentity, ActorRef, ActorSystem, Identify}
+import akka.actor.{ActorIdentity, ActorRef, ActorSystem, Identify, Props}
 import akka.testkit.{EventFilter, TestActorRef, TestEvent, TestProbe}
 import akka.util.Timeout
 import com.typesafe.config.ConfigFactory
@@ -46,6 +46,9 @@ class BaseAkkaSpec extends BaseSpec with BeforeAndAfterAll{
   system.eventStream.publish(TestEvent.Mute(EventFilter.warning()))
   system.eventStream.publish(TestEvent.Mute(EventFilter.error()))
 
+  val globalIdentifierName = "GLOBAL-IDENTIFIER"
+  val globalIdentifierRef = system.actorOf(Props[IdentifyFeyActors],globalIdentifierName)
+
   override protected def afterAll(): Unit = {
     Await.ready(system.terminate(), 20.seconds)
   }

http://git-wip-us.apache.org/repos/asf/incubator-iota/blob/8722e873/fey-core/src/test/scala/org/apache/iota/fey/IdentifyFeyActorsSpec.scala
----------------------------------------------------------------------
diff --git a/fey-core/src/test/scala/org/apache/iota/fey/IdentifyFeyActorsSpec.scala b/fey-core/src/test/scala/org/apache/iota/fey/IdentifyFeyActorsSpec.scala
index 7a618fc..9d64441 100644
--- a/fey-core/src/test/scala/org/apache/iota/fey/IdentifyFeyActorsSpec.scala
+++ b/fey-core/src/test/scala/org/apache/iota/fey/IdentifyFeyActorsSpec.scala
@@ -22,16 +22,14 @@ import akka.actor.{ActorRef, Props}
 
 class IdentifyFeyActorsSpec extends BaseAkkaSpec {
 
-  val identifyRef = system.actorOf(Props[IdentifyFeyActors],"IDENTIFIER")
-
   "Sending IdentifyFeyActors.IDENTIFY_TREE to IdentifyFeyActors" should {
     s"result in one path added to IdentifyFeyActors.actorsPath" in {
-      identifyRef ! IdentifyFeyActors.IDENTIFY_TREE(s"akka://$systemName/user")
+      globalIdentifierRef ! IdentifyFeyActors.IDENTIFY_TREE(s"akka://$systemName/user")
       Thread.sleep(1000)
       IdentifyFeyActors.actorsPath.size should equal(1)
     }
-    s"result in path 'akka://FEY-TEST/user/IDENTIFIER' " in {
-      IdentifyFeyActors.actorsPath should contain("akka://FEY-TEST/user/IDENTIFIER")
+    s"result in path 'akka://FEY-TEST/user/$globalIdentifierName' " in {
+      IdentifyFeyActors.actorsPath should contain(s"akka://FEY-TEST/user/$globalIdentifierName")
     }
   }
 
@@ -40,24 +38,24 @@ class IdentifyFeyActorsSpec extends BaseAkkaSpec {
   "Creating a new actor in the system and sending IdentifyFeyActors.IDENTIFY_TREE to IdentifyFeyActors" should {
     s"result in two paths added to IdentifyFeyActors.actorsPath" in {
       actor2 = system.actorOf(Props[Monitor],"MONITOR")
-      identifyRef ! IdentifyFeyActors.IDENTIFY_TREE(s"akka://$systemName/user")
+      globalIdentifierRef ! IdentifyFeyActors.IDENTIFY_TREE(s"akka://$systemName/user")
       Thread.sleep(1000)
       IdentifyFeyActors.actorsPath.size should equal(2)
     }
     s"result in matching paths" in {
-      IdentifyFeyActors.actorsPath should contain("akka://FEY-TEST/user/IDENTIFIER")
+      IdentifyFeyActors.actorsPath should contain(s"akka://FEY-TEST/user/$globalIdentifierName")
       IdentifyFeyActors.actorsPath should contain("akka://FEY-TEST/user/MONITOR")
     }
   }
 
-  "Stopping precious added actor and sending IdentifyFeyActors.IDENTIFY_TREE to IdentifyFeyActors" should {
+  "Stopping previous added actor and sending IdentifyFeyActors.IDENTIFY_TREE to IdentifyFeyActors" should {
     "result in going back to have just one path added to IdentifyFeyActors.actorsPath" in {
-      identifyRef ! IdentifyFeyActors.IDENTIFY_TREE(s"akka://$systemName/user")
+      globalIdentifierRef ! IdentifyFeyActors.IDENTIFY_TREE(s"akka://$systemName/user")
       Thread.sleep(1000)
       IdentifyFeyActors.actorsPath.size should equal(2)
     }
-    s"result in path 'akka://FEY-TEST/user/IDENTIFIER' " in {
-      IdentifyFeyActors.actorsPath should contain("akka://FEY-TEST/user/IDENTIFIER")
+    s"result in path 'akka://FEY-TEST/user/$globalIdentifierName' " in {
+      IdentifyFeyActors.actorsPath should contain(s"akka://FEY-TEST/user/$globalIdentifierName")
     }
   }
 }