Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 01006200C0D for ; Tue, 31 Jan 2017 23:29:10 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id F3C63160B5F; Tue, 31 Jan 2017 22:29:09 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 24CC3160B36 for ; Tue, 31 Jan 2017 23:29:08 +0100 (CET) Received: (qmail 81673 invoked by uid 500); 31 Jan 2017 22:29:08 -0000 Mailing-List: contact commits-help@iota.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@iota.incubator.apache.org Delivered-To: mailing list commits@iota.incubator.apache.org Received: (qmail 81664 invoked by uid 99); 31 Jan 2017 22:29:08 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 Jan 2017 22:29:08 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id EBE4B180031 for ; Tue, 31 Jan 2017 22:29:07 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -6.219 X-Spam-Level: X-Spam-Status: No, score=-6.219 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id h-qKGsdSyF2W for ; Tue, 31 Jan 2017 22:29:06 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with SMTP id 3BC905FE45 for ; Tue, 31 Jan 2017 22:29:05 +0000 (UTC) Received: (qmail 81215 invoked by uid 99); 31 Jan 2017 22:29:04 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 Jan 2017 22:29:04 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 8DE15F402C; Tue, 31 Jan 2017 22:29:04 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: tonyfaustini@apache.org To: commits@iota.incubator.apache.org Date: Tue, 31 Jan 2017 22:29:11 -0000 Message-Id: <15344bc9d4a245dbb41e2f06ec511a71@git.apache.org> In-Reply-To: <694fcacef80f4c54bffc949061f61547@git.apache.org> References: <694fcacef80f4c54bffc949061f61547@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [08/12] incubator-iota git commit: [IOTA-36] Adding test to fey core archived-at: Tue, 31 Jan 2017 22:29:10 -0000 [IOTA-36] Adding test to fey core Project: http://git-wip-us.apache.org/repos/asf/incubator-iota/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-iota/commit/a2e6fac1 Tree: http://git-wip-us.apache.org/repos/asf/incubator-iota/tree/a2e6fac1 Diff: http://git-wip-us.apache.org/repos/asf/incubator-iota/diff/a2e6fac1 Branch: refs/heads/master Commit: a2e6fac1b64657d7edbb83cfac65853a95933759 Parents: 580e301 Author: Barbara Gomes Authored: Mon Jan 30 17:27:45 2017 -0800 Committer: Barbara Gomes Committed: Mon Jan 30 17:27:45 2017 -0800 ---------------------------------------------------------------------- .../scala/org/apache/iota/fey/FeyCore.scala | 1 + .../scala/org/apache/iota/fey/FeyCoreSpec.scala | 64 ++++++++++++++++++++ .../org/apache/iota/fey/Utils_JSONTest.scala | 57 +++++++++++++++++ 3 files changed, 122 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-iota/blob/a2e6fac1/fey-core/src/main/scala/org/apache/iota/fey/FeyCore.scala ---------------------------------------------------------------------- diff --git a/fey-core/src/main/scala/org/apache/iota/fey/FeyCore.scala b/fey-core/src/main/scala/org/apache/iota/fey/FeyCore.scala index 99dc7c4..5dc6f7d 100644 --- a/fey-core/src/main/scala/org/apache/iota/fey/FeyCore.scala +++ b/fey-core/src/main/scala/org/apache/iota/fey/FeyCore.scala @@ -102,6 +102,7 @@ protected class FeyCore extends Actor with ActorLogging{ FEY_CACHE.activeOrchestrations.remove(actorRef.path.name) ORCHESTRATION_CACHE.orchestration_metadata.remove(actorRef.path.name) ORCHESTRATION_CACHE.orchestration_globals.remove(actorRef.path.name) + GlobalPerformer.activeGlobalPerformers.remove(actorRef.path.name) if(!FEY_CACHE.orchestrationsAwaitingTermination.isEmpty) { checkForOrchestrationWaitingForTermination(actorRef.path.name) } http://git-wip-us.apache.org/repos/asf/incubator-iota/blob/a2e6fac1/fey-core/src/test/scala/org/apache/iota/fey/FeyCoreSpec.scala ---------------------------------------------------------------------- diff --git a/fey-core/src/test/scala/org/apache/iota/fey/FeyCoreSpec.scala b/fey-core/src/test/scala/org/apache/iota/fey/FeyCoreSpec.scala index 5ae55c2..927b87a 100644 --- a/fey-core/src/test/scala/org/apache/iota/fey/FeyCoreSpec.scala +++ b/fey-core/src/test/scala/org/apache/iota/fey/FeyCoreSpec.scala @@ -225,6 +225,70 @@ class FeyCoreSpec extends BaseAkkaSpec { } } + + val global_orch_name = "GLOBAL-PERFORMER" + var globalRef:ActorRef= null + + "Sending FeyCore.ORCHESTRATION_RECEIVED with CREATE AND GLOBAL performer command to FeyCore" should { + s"result in creating an Orchestration child actor with the name '$global_orch_name'" in { + feyCoreRef ! FeyCore.ORCHESTRATION_RECEIVED(getJSValueFromString(Utils_JSONTest.global_perf_test), None) + orchestrationref = TestProbe().expectActor(s"$feyPath/$global_orch_name") + } + s"result in creating an Ensemble child actor with the name '$global_orch_name/ENS-GLOBAL'" in { + ensemble1ref = TestProbe().expectActor(s"$feyPath/$global_orch_name/ENS-GLOBAL") + } + s"result in creating a global Performer child actor with the name '$global_orch_name/GLOBAL_MANAGER/GLOBAL-TEST'" in { + globalRef = TestProbe().expectActor(s"$feyPath/$global_orch_name/GLOBAL_MANAGER/GLOBAL-TEST") + } + s"result in creating a Performer child actor with the name '$global_orch_name/ENS-GLOBAL/PERFORMER-SCHEDULER'" in { + ensemble2Test1ref = TestProbe().expectActor(s"$feyPath/$global_orch_name/ENS-GLOBAL/PERFORMER-SCHEDULER") + } + s"result in new entry to FEY_CACHE.activeOrchestrations with key '$global_orch_name'" in { + FEY_CACHE.activeOrchestrations should contain key(global_orch_name) + } + s"result in one global actor created for orchestration" in { + GlobalPerformer.activeGlobalPerformers should have size(1) + GlobalPerformer.activeGlobalPerformers should contain key(global_orch_name) + } + s"result in globa metadata add to table" in { + ORCHESTRATION_CACHE.orchestration_globals should have size(1) + ORCHESTRATION_CACHE.orchestration_globals should contain key(global_orch_name) + } + s"result in right running actors" in { + globalIdentifierRef ! IdentifyFeyActors.IDENTIFY_TREE(feyCoreRef.path.toString) + Thread.sleep(500) + IdentifyFeyActors.actorsPath should contain(s"$feyPath/$global_orch_name") + IdentifyFeyActors.actorsPath should contain(s"$feyPath/$global_orch_name/GLOBAL_MANAGER") + IdentifyFeyActors.actorsPath should contain(s"$feyPath/$global_orch_name/GLOBAL_MANAGER/GLOBAL-TEST") + IdentifyFeyActors.actorsPath should contain(s"$feyPath/$global_orch_name/ENS-GLOBAL/PERFORMER-SCHEDULER") + } + } + + "Stopping Global actor" should { + "result in sending logging error" in { + EventFilter.error(pattern = s".*DEAD Global Performer.*", occurrences = 1) intercept { + globalRef ! PoisonPill + } + } + "result in orchestration restarted" in { + TestProbe().expectActor(s"$feyPath/$global_orch_name/GLOBAL_MANAGER/GLOBAL-TEST") + TestProbe().expectActor(s"$feyPath/$global_orch_name/ENS-GLOBAL/PERFORMER-SCHEDULER") + TestProbe().expectActor(s"$feyPath/$global_orch_name/ENS-GLOBAL") + } + } + + "Stopping orchestration with global performer" should { + "result in sending TERMINATE message to Monitor actor" in { + orchestrationref ! PoisonPill + monitor.expectMsgClass(1.seconds, classOf[Monitor.TERMINATE]) + } + "result in no global actors for orchestration" in { + GlobalPerformer.activeGlobalPerformers should have size(0) + ORCHESTRATION_CACHE.orchestration_globals should have size(0) + ORCHESTRATION_CACHE.orchestration_metadata should not contain key(global_orch_name) + } + } + "Stopping FeyCore" should { "result in sending STOP message to Monitor actor" in { feyCoreRef ! PoisonPill http://git-wip-us.apache.org/repos/asf/incubator-iota/blob/a2e6fac1/fey-core/src/test/scala/org/apache/iota/fey/Utils_JSONTest.scala ---------------------------------------------------------------------- diff --git a/fey-core/src/test/scala/org/apache/iota/fey/Utils_JSONTest.scala b/fey-core/src/test/scala/org/apache/iota/fey/Utils_JSONTest.scala index 106a406..a900df5 100644 --- a/fey-core/src/test/scala/org/apache/iota/fey/Utils_JSONTest.scala +++ b/fey-core/src/test/scala/org/apache/iota/fey/Utils_JSONTest.scala @@ -551,4 +551,61 @@ object Utils_JSONTest { } ] }""" + + + val global_perf_test = + """ + { + "guid":"GLOBAL-PERFORMER", + "command":"RECREATE", + "timestamp":"12347896906", + "name":"recreate global", + "global-performers":[ + { + "guid":"GLOBAL-TEST", + "schedule":0, + "backoff":1000, + "source":{ + "name":"fey-test-actor.jar", + "classPath":"org.apache.iota.fey.TestActor", + "parameters":{ + "param-1":"test", + "param-2":"test2" + } + } + } + ], + "ensembles":[ + { + "guid":"ENS-GLOBAL", + "command":"NONE", + "performers":[ + { + "guid":"PERFORMER-SCHEDULER", + "schedule":200, + "backoff":0, + "autoScale":{ + "lowerBound":4, + "upperBound":6 + }, + "source":{ + "name":"fey-test-actor.jar", + "classPath":"org.apache.iota.fey.TestActor", + "parameters":{ + + } + } + } + ], + "connections":[ + { + "PERFORMER-SCHEDULER":[ + "GLOBAL-TEST" + ] + } + ] + } + ] + } + """ }