public void Getting_an_unknown_child_that_exists_in_extraNames_Should_return_nobody()
 {
     var props = Props.Create<GuardianActor>(new OneForOneStrategy(e => Directive.Stop));
     var rootGuardianActorRef = new RootGuardianActorRef(sys, props, _dispatcher, () => sys.Mailboxes.FromConfig(""), ActorRef.Nobody, _rootActorPath, _deadLetters, _emptyExtraNames);
     var actorRef = rootGuardianActorRef.GetSingleChild("unknown-child");
     Assert.Same(ActorRef.Nobody, actorRef);
 }
 public void Getting_deadLetters_child_Should_return_tempContainer()
 {
     var props = Props.Create<GuardianActor>(new OneForOneStrategy(e => Directive.Stop));
     var rootGuardianActorRef = new RootGuardianActorRef(sys, props, _dispatcher, () => sys.Mailboxes.FromConfig(""), ActorRef.Nobody, _rootActorPath, _deadLetters, _emptyExtraNames);
     var actorRef = rootGuardianActorRef.GetSingleChild("deadLetters");
     Assert.Same(_deadLetters, actorRef);
 }
 public void Parent_Should_be_itself()
 {
     var props = Props.Create<GuardianActor>(new OneForOneStrategy(e => Directive.Stop));
     var rootGuardianActorRef = new RootGuardianActorRef(sys, props, _dispatcher, () => sys.Mailboxes.FromConfig(""), ActorRef.Nobody, _rootActorPath, _deadLetters, _emptyExtraNames);
     var parent = rootGuardianActorRef.Parent;
     Assert.Same(rootGuardianActorRef, parent);
 }
 public void Parent_Should_be_itself()
 {
     var props = Props.Create<GuardianActor>(new OneForOneStrategy(e => Directive.Stop));
     var rootGuardianActorRef = new RootGuardianActorRef((ActorSystemImpl) Sys, props, _dispatcher, Sys.Mailboxes.GetMailboxType(props, _dispatcher.Configurator.Config), ActorRefs.Nobody, _rootActorPath, _deadLetters, _emptyExtraNames);
     var parent = rootGuardianActorRef.Parent;
     Assert.Same(rootGuardianActorRef, parent);
 }
 public void Getting_a_child_that_exists_in_extraNames_Should_return_the_child()
 {
     var extraNameChild = new DummyActorRef(_rootActorPath / "extra");
     var extraNames = new Dictionary<string, InternalActorRef> { { "extra", extraNameChild } };
     var props = Props.Create<GuardianActor>(new OneForOneStrategy(e => Directive.Stop));
     var rootGuardianActorRef = new RootGuardianActorRef(sys, props, _dispatcher, () => sys.Mailboxes.FromConfig(""), ActorRef.Nobody, _rootActorPath, _deadLetters, extraNames);
     var actorRef = rootGuardianActorRef.GetSingleChild("extra");
     Assert.Same(extraNameChild, actorRef);
 }
 public void Getting_temp_child_Should_return_tempContainer()
 {
     var props = Props.Create<GuardianActor>(new OneForOneStrategy(e => Directive.Stop));
     var rootGuardianActorRef = new RootGuardianActorRef((ActorSystemImpl)Sys, props, _dispatcher, () => Sys.Mailboxes.CreateMailbox(props, null), ActorRefs.Nobody, _rootActorPath, _deadLetters, _emptyExtraNames);
     var tempContainer = new DummyActorRef(_rootActorPath / "temp");
     rootGuardianActorRef.SetTempContainer(tempContainer);
     var actorRef = rootGuardianActorRef.GetSingleChild("temp");
     Assert.Same(tempContainer, actorRef);
 }
Ejemplo n.º 7
0
        private RootGuardianActorRef CreateRootGuardian(ActorSystemImpl system)
        {
            var supervisor           = new RootGuardianSupervisor(_rootPath, this, _terminationPromise, _log);
            var rootGuardianStrategy = new OneForOneStrategy(ex =>
            {
                _log.Error(ex, "Guardian failed. Shutting down system");
                return(Directive.Stop);
            });
            var props        = Props.Create <GuardianActor>(rootGuardianStrategy);
            var rootGuardian = new RootGuardianActorRef(system, props, DefaultDispatcher, _defaultMailbox, supervisor, _rootPath, _deadLetters, _extraNames);

            return(rootGuardian);
        }
Ejemplo n.º 8
0
        public void Init(ActorSystemImpl system)
        {
            _system = system;
            //The following are the lazy val statements in Akka
            var defaultDispatcher = system.Dispatchers.DefaultGlobalDispatcher;

            _defaultMailbox = () => new ConcurrentQueueMailbox(); //TODO:system.Mailboxes.FromConfig(Mailboxes.DefaultMailboxId)
            _rootGuardian   = CreateRootGuardian(system);
            _tempContainer  = new VirtualPathContainer(system.Provider, _tempNode, _rootGuardian, _log);
            _rootGuardian.SetTempContainer(_tempContainer);
            _userGuardian   = CreateUserGuardian(_rootGuardian, "user");
            _systemGuardian = CreateSystemGuardian(_rootGuardian, "system", _userGuardian);
            //End of lazy val

            _rootGuardian.Start();
            // chain death watchers so that killing guardian stops the application
            _systemGuardian.Tell(new Watch(_userGuardian, _systemGuardian));    //Should be SendSystemMessage
            _rootGuardian.Tell(new Watch(_systemGuardian, _rootGuardian));      //Should be SendSystemMessage
            _eventStream.StartDefaultLoggers(_system);
        }
Ejemplo n.º 9
0
        public void Init(ActorSystemImpl system)
        {
            _system = system;
            //The following are the lazy val statements in Akka
            var defaultDispatcher = system.Dispatchers.DefaultGlobalDispatcher;
            _defaultMailbox = () => new ConcurrentQueueMailbox(); //TODO:system.Mailboxes.FromConfig(Mailboxes.DefaultMailboxId)
            _rootGuardian = CreateRootGuardian(system);
            _tempContainer = new VirtualPathContainer(system.Provider, _tempNode, _rootGuardian, _log);
            _rootGuardian.SetTempContainer(_tempContainer);
            _userGuardian = CreateUserGuardian(_rootGuardian, "user");
            _systemGuardian = CreateSystemGuardian(_rootGuardian, "system", _userGuardian);
            //End of lazy val

            _rootGuardian.Start();
            // chain death watchers so that killing guardian stops the application
            _systemGuardian.SendSystemMessage(new Watch(_userGuardian, _systemGuardian)); 
            _rootGuardian.SendSystemMessage(new Watch(_systemGuardian, _rootGuardian)); 
            _eventStream.StartDefaultLoggers(_system);
        }
Ejemplo n.º 10
0
 private RootGuardianActorRef CreateRootGuardian(ActorSystemImpl system)
 {
     var supervisor = new RootGuardianSupervisor(_rootPath, this, _terminationPromise, _log);
     var rootGuardianStrategy = new OneForOneStrategy(ex =>
     {
         _log.Error(ex, "Guardian failed. Shutting down system");
         return Directive.Stop;
     });
     var props = Props.Create<GuardianActor>(rootGuardianStrategy);
     var rootGuardian = new RootGuardianActorRef(system, props, DefaultDispatcher, _defaultMailbox, supervisor, _rootPath, _deadLetters, _extraNames);
     return rootGuardian;
 }
Ejemplo n.º 11
0
 public void Path_Should_be_the_same_path_as_specified()
 {
     var props = Props.Create<GuardianActor>(new OneForOneStrategy(e => Directive.Stop));
     var rootGuardianActorRef = new RootGuardianActorRef(sys, props, _dispatcher, () => sys.Mailboxes.FromConfig(""), ActorRef.Nobody, _rootActorPath, _deadLetters, _emptyExtraNames);
     Assert.Equal(_rootActorPath, rootGuardianActorRef.Path);
 }
 public void Path_Should_be_the_same_path_as_specified()
 {
     var props = Props.Create<GuardianActor>(new OneForOneStrategy(e => Directive.Stop));
     var rootGuardianActorRef = new RootGuardianActorRef((ActorSystemImpl) Sys, props, _dispatcher, Sys.Mailboxes.GetMailboxType(props, _dispatcher.Configurator.Config), ActorRefs.Nobody, _rootActorPath, _deadLetters, _emptyExtraNames);
     Assert.Equal(_rootActorPath, rootGuardianActorRef.Path);
 }