Beispiel #1
0
    public static Sys get()
    {
#if UNITY_EDITOR
        if (Singleton == null) Singleton = FindObjectOfType<Sys>();
#endif //UNITY_EDITOR
        return Singleton;
    }
 protected void Add_Click(object sender, EventArgs e)
 {
     Model.Sys sys = new Sys();
     sys.Language = 0;
     sys.Name = this.tbName.Text.Trim();
     sys.Value = this.tbValue.Text.Trim();
     SysManager.Add(sys);
     this.GridView1.DataBind();
 }
Beispiel #3
0
        private static LicenseChecker GetRemoteChecker(LicenseOptions options, Sys sys)
        {
            var checkUrl = options.CheckUrl;
              if (String.IsNullOrWhiteSpace(checkUrl))
            return new NullRemoteChecker();

              var submitUrl = options.SubmitUrl.NullIfEmpty() ?? checkUrl;
              var remote = new WebRemote(submitUrl);
              var builder = new WebRequestBuilder(sys, checkUrl);
              var parser = new WebResponseParser();

              return new RemoteCheckerClient(remote, builder, parser);
        }
Beispiel #4
0
        public MainForm()
        {
            InitializeComponent();

              var options = new LicenseOptions
              {
            Password = "******",
            Salt = "saltsaltsalt",
            CheckUrl = null,
            SubmitUrl = null,
              };
              licenser = Licenser.Create(options);

              sys = new WinSys();
        }
Beispiel #5
0
 public PrivateAndSysMesge(Sys.SystemMsg.SystemMsg sysMsg)
 {
     try
     {
         this._id = sysMsg._id;
         this.FromMember = sysMsg.FromMember;
         this.ToMember = sysMsg.ToMember;
         this.Comment = sysMsg.Comment;
         this.CreatedTime = sysMsg.CreatedTime;
         this.Readed = sysMsg.Readed;
         this.ReadTime = sysMsg.ReadTime;
     }
     catch (System.Exception err)
     {
         throw new CBB.ExceptionHelper.OperationException(
             CBB.ExceptionHelper.ErrType.SystemErr,
             CBB.ExceptionHelper.ErrNo.DBOperationError,
             err);
     }
 }
 private ActorSelection GetConsumer(RoleName oldest)
 {
     return(Sys.ActorSelection(new RootActorPath(Node(oldest).Address) / "user" / "consumer" / "singleton"));
 }
Beispiel #7
0
 private static OpResult Mult(int pointer, Span <int> program, Sys system, int[] args)
 {
     program[args[2]] = args[0] * args[1];
     return(pointer + args.Length + 1);
 }
Beispiel #8
0
 private static OpResult Equals(int pointer, Span <int> program, Sys system, int[] args)
 {
     program[args[2]] = args[0] == args[1] ? 1 : 0;
     return(pointer + args.Length + 1);
 }
        public void A_RemoteWatcher_must_have_correct_interaction_when_watching()
        {
            var fd       = CreateFailureDetectorRegistry();
            var monitorA = Sys.ActorOf(Props.Create <TestRemoteWatcher>(), "monitor1");
            //TODO: Better way to write this?
            var monitorB = CreateRemoteActor(new Props(new Deploy(), typeof(TestActorProxy), new[] { TestActor }), "monitor1");

            var a1 = Sys.ActorOf(Props.Create <MyActor>(), "a1").AsInstanceOf <IInternalActorRef>();
            var a2 = Sys.ActorOf(Props.Create <MyActor>(), "a2").AsInstanceOf <IInternalActorRef>();
            var b1 = CreateRemoteActor(Props.Create <MyActor>(), "b1");
            var b2 = CreateRemoteActor(Props.Create <MyActor>(), "b2");

            monitorA.Tell(new RemoteWatcher.WatchRemote(b1, a1));
            monitorA.Tell(new RemoteWatcher.WatchRemote(b2, a1));
            monitorA.Tell(new RemoteWatcher.WatchRemote(b2, a2));
            monitorA.Tell(RemoteWatcher.Stats.Empty, TestActor);
            // (a1->b1), (a1->b2), (a2->b2)
            ExpectMsg(RemoteWatcher.Stats.Counts(3, 1));
            ExpectNoMsg(TimeSpan.FromMilliseconds(100));
            monitorA.Tell(RemoteWatcher.HeartbeatTick.Instance, TestActor);
            ExpectMsg <RemoteWatcher.Heartbeat>();
            ExpectNoMsg(TimeSpan.FromMilliseconds(100));
            monitorA.Tell(RemoteWatcher.HeartbeatTick.Instance, TestActor);
            ExpectMsg <RemoteWatcher.Heartbeat>();
            ExpectNoMsg(TimeSpan.FromMilliseconds(100));
            monitorA.Tell(_heartbeatRspB, monitorB);
            monitorA.Tell(RemoteWatcher.HeartbeatTick.Instance, TestActor);
            ExpectMsg <RemoteWatcher.Heartbeat>();
            ExpectNoMsg(TimeSpan.FromMilliseconds(100));

            monitorA.Tell(new RemoteWatcher.UnwatchRemote(b1, a1));
            // still (a1->b2) and (a2->b2) left
            monitorA.Tell(RemoteWatcher.Stats.Empty, TestActor);
            ExpectMsg(RemoteWatcher.Stats.Counts(2, 1));
            ExpectNoMsg(TimeSpan.FromMilliseconds(100));
            monitorA.Tell(RemoteWatcher.HeartbeatTick.Instance, TestActor);
            ExpectMsg <RemoteWatcher.Heartbeat>();
            ExpectNoMsg(TimeSpan.FromMilliseconds(100));

            monitorA.Tell(new RemoteWatcher.UnwatchRemote(b2, a2));
            // still (a1->b2) left
            monitorA.Tell(RemoteWatcher.Stats.Empty, TestActor);
            ExpectMsg(RemoteWatcher.Stats.Counts(1, 1));
            ExpectNoMsg(TimeSpan.FromMilliseconds(100));
            monitorA.Tell(RemoteWatcher.HeartbeatTick.Instance, TestActor);
            ExpectMsg <RemoteWatcher.Heartbeat>();
            ExpectNoMsg(TimeSpan.FromMilliseconds(100));

            monitorA.Tell(new RemoteWatcher.UnwatchRemote(b2, a1));
            // all unwatched
            monitorA.Tell(RemoteWatcher.Stats.Empty, TestActor);
            ExpectMsg(RemoteWatcher.Stats.Empty);
            ExpectNoMsg(TimeSpan.FromMilliseconds(100));
            monitorA.Tell(RemoteWatcher.HeartbeatTick.Instance, TestActor);
            ExpectNoMsg(TimeSpan.FromMilliseconds(100));
            monitorA.Tell(RemoteWatcher.HeartbeatTick.Instance, TestActor);
            ExpectNoMsg(TimeSpan.FromMilliseconds(100));

            // make sure nothing floods over to next test
            ExpectNoMsg(TimeSpan.FromSeconds(2));
        }
        public FlowSelectErrorSpec()
        {
            var settings = ActorMaterializerSettings.Create(Sys).WithInputBuffer(1, 1);

            Materializer = Sys.Materializer(settings);
        }
Beispiel #11
0
 private IActorRef SetupEmpty(string persistenceId)
 {
     return(Sys.ActorOf(TestKit.TestActor.Props(persistenceId)));
 }
Beispiel #12
0
        public void Sql_query_EventsByPersistenceId_should_implement_standard_EventsByTagQuery()
        {
            SqlReadJournal queries = Sys.ReadJournalFor <SqlReadJournal>(SqlReadJournal.Identifier);

            (queries is IEventsByPersistenceIdQuery).Should().BeTrue();
        }
Beispiel #13
0
 internal static CreateIndex FromSQL(Sys.Table table, Sys.Index index)
 {
     return new CreateIndex
     {
         ObjectIdentitifer = SqlUtil.GetQuotedObjectIdentifierString(table.name, table.Schema.name),
         Name = index.name,
         IsUnique = index.is_unique,
         IsClusterd = index.type_desc == "CLUSTERED",
         FilterDefinition = index.has_filter ? index.filter_definition : "",
         KeyColumns = index.Columns.Where(x => !x.is_included_column).OrderBy(x => x.key_ordinal).Select(x => "[" + x.Column.Name + "]" + (x.is_descending_key ? " DESC" : "")),
         IncludedColumns = index.Columns.Where(x => x.is_included_column).OrderBy(x => x.key_ordinal).Select(x => "[" + x.Column.Name + "]" + (x.is_descending_key ? " DESC" : "")),
     };
 }
Beispiel #14
0
 public bool TienePermiso(IElementoDeDatos elemento, Sys.Permisos.Operaciones operacion)
 {
         if (this.Usuario == null)
                 return true;    // FIXME: tengo que decir que si por los módulos que no se loguean
         else
                 return this.Usuario.Pemisos.TienePermiso(elemento, operacion);
 }
Beispiel #15
0
        internal bool ReloadScripts()
        {
            if (ScriptInfo.HalIPAddress != null) {
                Sys ho = new Sys(ScriptInfo.HalIPAddress);
                return (bool)ho.ReloadScripts();
            }

            return false;
        }
        public void PersistentClusterShards_should_recover_entities_upon_restart()
        {
            Within(TimeSpan.FromSeconds(50), () =>
            {
                RunOn(() =>
                {
                    var x = _persistentEntitiesRegion.Value;
                    var y = _anotherPersistentRegion.Value;
                }, _config.Third, _config.Fourth, _config.Fifth);
                EnterBarrier("persistent-start");

                RunOn(() =>
                {
                    //Create an increment counter 1
                    _persistentEntitiesRegion.Value.Tell(new Counter.EntityEnvelope(1, Counter.Increment.Instance));
                    _persistentEntitiesRegion.Value.Tell(new Counter.EntityEnvelope(1, new Counter.Get(1)));
                    ExpectMsg(1);

                    //Shut down the shard and confirm it's dead
                    var shard  = Sys.ActorSelection(LastSender.Path.Parent);
                    var region = Sys.ActorSelection(LastSender.Path.Parent.Parent);

                    //Stop the shard cleanly
                    region.Tell(new PersistentShardCoordinator.HandOff("1"));
                    ExpectMsg <PersistentShardCoordinator.ShardStopped>(s => s.Shard == "1", TimeSpan.FromSeconds(10), "ShardStopped not received");

                    var probe = CreateTestProbe();
                    AwaitAssert(() =>
                    {
                        shard.Tell(new Identify(1), probe.Ref);
                        probe.ExpectMsg <ActorIdentity>(i => i.MessageId.Equals(1) && i.Subject == null, TimeSpan.FromSeconds(1), "Shard was still around");
                    }, TimeSpan.FromSeconds(5), TimeSpan.FromMilliseconds(500));

                    //Get the path to where the shard now resides
                    _persistentEntitiesRegion.Value.Tell(new Counter.Get(13));
                    ExpectMsg(0);

                    //Check that counter 1 is now alive again, even though we have
                    // not sent a message to it via the ShardRegion
                    var counter1 = Sys.ActorSelection(LastSender.Path.Parent / "1");
                    Within(TimeSpan.FromSeconds(5), () =>
                    {
                        AwaitAssert(() =>
                        {
                            var probe2 = CreateTestProbe();
                            counter1.Tell(new Identify(2), probe2.Ref);
                            probe2.ExpectMsg <ActorIdentity>(i => i.Subject != null, TimeSpan.FromSeconds(2));
                        });
                    });

                    counter1.Tell(new Counter.Get(1));
                    ExpectMsg(1);
                }, _config.Third);
                EnterBarrier("after-shard-restart");

                RunOn(() =>
                {
                    //Check a second region does not share the same persistent shards

                    //Create a separate 13 counter
                    _anotherPersistentRegion.Value.Tell(new Counter.EntityEnvelope(13, Counter.Increment.Instance));
                    _anotherPersistentRegion.Value.Tell(new Counter.Get(13));
                    ExpectMsg(1);

                    //Check that no counter "1" exists in this shard
                    var secondCounter1 = Sys.ActorSelection(LastSender.Path.Parent / "1");
                    secondCounter1.Tell(new Identify(3));
                    ExpectMsg <ActorIdentity>(i => i.MessageId.Equals(3) && i.Subject == null, TimeSpan.FromSeconds(3));
                }, _config.Fourth);
                EnterBarrier("after-12");
            });
        }
        public void PersistentClusterShards_should_permanently_stop_entities_which_passivate()
        {
            Within(TimeSpan.FromSeconds(15), () =>
            {
                RunOn(() =>
                {
                    var x = _persistentRegion.Value;
                }, _config.Third, _config.Fourth, _config.Fifth);
                EnterBarrier("cluster-started-12");

                RunOn(() =>
                {
                    //create and increment counter 1
                    _persistentRegion.Value.Tell(new Counter.EntityEnvelope(1, Counter.Increment.Instance));
                    _persistentRegion.Value.Tell(new Counter.Get(1));
                    ExpectMsg(1);

                    var counter1 = LastSender;
                    var shard    = Sys.ActorSelection(counter1.Path.Parent);
                    var region   = Sys.ActorSelection(counter1.Path.Parent.Parent);

                    //create and increment counter 13
                    _persistentRegion.Value.Tell(new Counter.EntityEnvelope(13, Counter.Increment.Instance));
                    _persistentRegion.Value.Tell(new Counter.Get(13));
                    ExpectMsg(1);

                    var counter13 = LastSender;

                    counter13.Path.Parent.Should().Be(counter1.Path.Parent);

                    //Send the shard the passivate message from the counter
                    Watch(counter1);
                    shard.Tell(new Passivate(Counter.Stop.Instance), counter1);

                    // watch for the Terminated message
                    ExpectTerminated(counter1, TimeSpan.FromSeconds(5));

                    var probe1 = CreateTestProbe();
                    AwaitAssert(() =>
                    {
                        // check counter 1 is dead
                        counter1.Tell(new Identify(1), probe1.Ref);
                        probe1.ExpectMsg <ActorIdentity>(i => i.MessageId.Equals(1) && i.Subject == null, TimeSpan.FromSeconds(1), "Entity 1 was still around");
                    }, TimeSpan.FromSeconds(5), TimeSpan.FromMilliseconds(500));

                    // stop shard cleanly
                    region.Tell(new PersistentShardCoordinator.HandOff("1"));
                    ExpectMsg <PersistentShardCoordinator.ShardStopped>(s => s.Shard == "1", TimeSpan.FromSeconds(10), "ShardStopped not received");

                    var probe2 = CreateTestProbe();
                    AwaitAssert(() =>
                    {
                        shard.Tell(new Identify(2), probe2.Ref);
                        probe2.ExpectMsg <ActorIdentity>(i => i.MessageId.Equals(2) && i.Subject == null, TimeSpan.FromSeconds(1), "Shard was still around");
                    }, TimeSpan.FromSeconds(5), TimeSpan.FromMilliseconds(500));
                }, _config.Third);
                EnterBarrier("shard-shutdonw-12");

                RunOn(() =>
                {
                    // force shard backup
                    _persistentRegion.Value.Tell(new Counter.Get(25));
                    ExpectMsg(0);

                    var shard = LastSender.Path.Parent;

                    // check counter 1 is still dead
                    Sys.ActorSelection(shard / "1").Tell(new Identify(3));
                    ExpectMsg <ActorIdentity>(i => i.MessageId.Equals(3) && i.Subject == null);

                    // check counter 13 is alive again
                    var probe3 = CreateTestProbe();
                    AwaitAssert(() =>
                    {
                        Sys.ActorSelection(shard / "13").Tell(new Identify(4), probe3.Ref);
                        probe3.ExpectMsg <ActorIdentity>(i => i.MessageId.Equals(4) && i.Subject != null);
                    }, TimeSpan.FromSeconds(5), TimeSpan.FromMilliseconds(500));
                }, _config.Fourth);
                EnterBarrier("after-13");
            });
        }
Beispiel #18
0
        // type checking is done in the scheme code that implements
        // the standard library.  if we get here, we can assume
        // that the parameters in the registers are all as expected.
		// (starting at register 2)
        public static void dispatch(int num_args, Sys num_proc) {
            switch (num_proc) {
            case Sys.open : open(); break;
            case Sys.unlink : unlink(); break;
            case Sys.close : close(); break;
            case Sys.read : read(); break;
            case Sys.write : write(); break;
            case Sys.get_resource_usage : get_resource_usage(); break;
            // case Sys.dump_heap :
            case Sys.exit : exit(); break;
            case Sys.mtime : mtime(); break;
            case Sys.access : access(); break;
            case Sys.rename : rename(); break;
            case Sys.pollinput : pollinput(); break;
            case Sys.getenv : getenv(); break;
            case Sys.setenv : setenv(); break;
            // case Sys.gc : gc(); break;
            case Sys.flonum_acos:  flonum_acos(); break;
            case Sys.flonum_asin:  flonum_asin(); break;
            case Sys.flonum_atan:  flonum_atan(); break;
            case Sys.flonum_atan2: flonum_atan2(); break;
            case Sys.flonum_cos:   flonum_cos(); break;
            case Sys.flonum_cosh:  flonum_cosh(); break;
            case Sys.flonum_exp:   flonum_exp(); break;
            case Sys.flonum_log:   flonum_log(); break;
            case Sys.flonum_sin:   flonum_sin(); break;
            case Sys.flonum_sinh:  flonum_sinh(); break;
            case Sys.flonum_sqrt:  flonum_sqrt(); break;
            case Sys.flonum_tan:   flonum_tan(); break;

            case Sys.system : system(); break;
            case Sys.c_ffi_dlsym: FFI.ffi_syscall(); break;
            case Sys.sro:         fake_sro(); break;
            case Sys.sys_feature: sys_feature(); break;

            case Sys.segment_code_address : segment_code_address() ; break;
            case Sys.chdir : chdir() ; break;
            case Sys.cwd : cwd() ; break;

            case Sys.errno :    geterrno(); break;
            case Sys.seterrno : seterrno(); break;
            case Sys.time :     gettime();  break;
            case Sys.lseek :    lseek();    break;

            case Sys.sysglobal:
                SObject g = (SObject) Reg.globals[((SByteVL)Reg.Register2).asString()];
                if (g == null) {
                    Reg.Result = Factory.Undefined;
                } else {
                    Reg.Result = g;
                }
                break;
        
            default: Exn.internalError("unsupported syscall: " + num_proc); break;
            }
        }
Beispiel #19
0
 void Awake()
 {
     if (Singleton != null && Singleton != this) Debug.LogError("Singleton violation");
     Singleton = this;
     NetM = FindObjectOfType<NetMan>();
 }
Beispiel #20
0
 ///<summary>
 ///Unregisters a disposable object from the application.
 ///</summary>
 ///<param name="disposableObject">The object to unregister.</param>
 public static void unregisterDisposableObject(Sys.IDisposable disposableObject) { }
Beispiel #21
0
 protected CurrentPersistenceIdsSpec(Config config = null, string actorSystemName = null, ITestOutputHelper output = null)
     : base(config, actorSystemName, output)
 {
     Materializer = Sys.Materializer();
 }
 protected override void OnSequenceStarted(Sys.SequenceStartedEventArgs e)
 {
     _dataSource.Sequence = Sequence;
     _dataSource.Start();
     base.OnSequenceStarted(e);
 }
Beispiel #23
0
 public void Setup()
 {
     _identity = Sys.ActorOf(Props.Create(() => new UserIdentityActor()));
 }
Beispiel #24
0
 public bool TienePermiso(string nombre, Sys.Permisos.Operaciones operacion)
 {
         if (this.Usuario == null)
                 return true;    // FIXME: tengo que decir que si por los módulos que no se loguean
         else
                 return this.Usuario.Pemisos.TienePermiso(nombre, operacion);
 }
 public IActorRef SetUpActorRef()
 {
     return(Sys.ActorOf <T>());
 }
Beispiel #26
0
        //private SqlReadJournal _queries;

        protected EventsByPersistenceIdSpec(Config config, ITestOutputHelper output) : base(config, output: output)
        {
            _materializer = Sys.Materializer();
        }
Beispiel #27
0
 public HubSpec(ITestOutputHelper helper) : base(helper)
 {
     Materializer = Sys.Materializer();
 }
Beispiel #28
0
 //心跳
 //协议参数:无
 public void MsgHeatBeat(Conn conn, ProtocolBase protoBase)
 {
     conn.lastTickTime = Sys.GetTimeStamp();
     Console.WriteLine("[更新心跳时间]" + conn.GetAddress());
 }
Beispiel #29
0
        public LazySinkSpec(ITestOutputHelper helper) : base(helper)
        {
            var settings = ActorMaterializerSettings.Create(Sys).WithInputBuffer(1, 1);

            Materializer = Sys.Materializer(settings);
        }
        A_RemoteWatcher_must_generate_address_terminated_for_new_watch_after_broken_connection_was_reestablished_and_broken_again()
        {
            var p = CreateTestProbe();
            var q = CreateTestProbe();

            Sys.EventStream.Subscribe(p.Ref, typeof(TestRemoteWatcher.AddressTerm));
            Sys.EventStream.Subscribe(q.Ref, typeof(TestRemoteWatcher.Quarantined));

            var monitorA = Sys.ActorOf(Props.Create <TestRemoteWatcher>(), "monitor6");
            var monitorB = CreateRemoteActor(new Props(new Deploy(), typeof(TestActorProxy), new[] { TestActor }), "monitor6");

            var a = Sys.ActorOf(Props.Create <MyActor>(), "a6").AsInstanceOf <IInternalActorRef>();
            var b = CreateRemoteActor(Props.Create <MyActor>(), "b6");

            monitorA.Tell(new RemoteWatcher.WatchRemote(b, a));

            monitorA.Tell(RemoteWatcher.HeartbeatTick.Instance, TestActor);
            ExpectMsg <RemoteWatcher.Heartbeat>();
            monitorA.Tell(_heartbeatRspB, monitorB);
            ExpectNoMsg(TimeSpan.FromSeconds(1));
            monitorA.Tell(RemoteWatcher.HeartbeatTick.Instance, TestActor);
            ExpectMsg <RemoteWatcher.Heartbeat>();
            monitorA.Tell(_heartbeatRspB, monitorB);

            Within(TimeSpan.FromSeconds(10), () =>
            {
                AwaitAssert(() =>
                {
                    monitorA.Tell(RemoteWatcher.HeartbeatTick.Instance, TestActor);
                    ExpectMsg <RemoteWatcher.Heartbeat>();
                    //but no HeartbeatRsp
                    monitorA.Tell(RemoteWatcher.ReapUnreachableTick.Instance);
                    p.ExpectMsg(new TestRemoteWatcher.AddressTerm(b.Path.Address), TimeSpan.FromSeconds(1));
                    q.ExpectMsg(new TestRemoteWatcher.Quarantined(b.Path.Address, RemoteAddressUid), TimeSpan.FromSeconds(1));
                });
                return(true);
            });

            //real AddressTerminated would trigger Terminated for b6, simulate that here
            _remoteSystem.Stop(b);
            AwaitAssert(() =>
            {
                monitorA.Tell(RemoteWatcher.Stats.Empty, TestActor);
                ExpectMsg(RemoteWatcher.Stats.Empty);
            });
            ExpectNoMsg(TimeSpan.FromSeconds(2));

            //assume that connection comes up again, or remote system is restarted
            var c = CreateRemoteActor(Props.Create <MyActor>(), "c6");

            monitorA.Tell(new RemoteWatcher.WatchRemote(c, a));

            monitorA.Tell(RemoteWatcher.HeartbeatTick.Instance, TestActor);
            ExpectMsg <RemoteWatcher.Heartbeat>();
            monitorA.Tell(_heartbeatRspB, monitorB);
            ExpectNoMsg(TimeSpan.FromSeconds(1));
            monitorA.Tell(RemoteWatcher.HeartbeatTick.Instance, TestActor);
            ExpectMsg <RemoteWatcher.Heartbeat>();
            monitorA.Tell(_heartbeatRspB, monitorB);
            monitorA.Tell(RemoteWatcher.HeartbeatTick.Instance, TestActor);
            ExpectMsg <RemoteWatcher.Heartbeat>();
            monitorA.Tell(RemoteWatcher.ReapUnreachableTick.Instance, TestActor);
            p.ExpectNoMsg(TimeSpan.FromSeconds(1));
            monitorA.Tell(RemoteWatcher.HeartbeatTick.Instance, TestActor);
            ExpectMsg <RemoteWatcher.Heartbeat>();
            monitorA.Tell(_heartbeatRspB, monitorB);
            monitorA.Tell(RemoteWatcher.HeartbeatTick.Instance, TestActor);
            ExpectMsg <RemoteWatcher.Heartbeat>();
            monitorA.Tell(RemoteWatcher.ReapUnreachableTick.Instance, TestActor);
            p.ExpectNoMsg(TimeSpan.FromSeconds(1));
            q.ExpectNoMsg(TimeSpan.FromSeconds(1));

            //then stop heartbeating again; should generate a new AddressTerminated
            Within(TimeSpan.FromSeconds(10), () =>
            {
                AwaitAssert(() =>
                {
                    monitorA.Tell(RemoteWatcher.HeartbeatTick.Instance, TestActor);
                    ExpectMsg <RemoteWatcher.Heartbeat>();
                    //but no HeartbeatRsp
                    monitorA.Tell(RemoteWatcher.ReapUnreachableTick.Instance);
                    p.ExpectMsg(new TestRemoteWatcher.AddressTerm(b.Path.Address), TimeSpan.FromSeconds(1));
                    q.ExpectMsg(new TestRemoteWatcher.Quarantined(b.Path.Address, RemoteAddressUid), TimeSpan.FromSeconds(1));
                });
                return(true);
            });

            //make sure nothing floods over to next test
            ExpectNoMsg(TimeSpan.FromSeconds(2));
        }
Beispiel #31
0
 public QueueSourceSpec(ITestOutputHelper output) : base(output)
 {
     _materializer = Sys.Materializer();
 }
Beispiel #32
0
 private static OpResult Stop(int pointer, Span <int> program, Sys system, int[] args) => new OpResult(pointer, ProgramState.Halted);
Beispiel #33
0
 public ClusterSpec()
     : base(Config)
 {
     _selfAddress = Sys.AsInstanceOf <ExtendedActorSystem>().Provider.DefaultAddress;
     _cluster     = Cluster.Get(Sys);
 }
Beispiel #34
0
 private static OpResult Write(int pointer, Span <int> program, Sys system, int[] args)
 {
     system.Write(args[0]);
     return(pointer + args.Length + 1);
 }
Beispiel #35
0
 protected IActorRef NewTestActor(string dispatcher)
 {
     return(Sys.ActorOf(Props.Create <DispatcherActor>().WithDispatcher(dispatcher)));
 }
Beispiel #36
0
 private IActorRef CreateRemoteActor(Props props, string name)
 {
     _remoteSystem.ActorOf(props, name);
     Sys.ActorSelection(new RootActorPath(_remoteAddress) / "user" / name).Tell(new Identify(name), TestActor);
     return(ExpectMsg <ActorIdentity>().Subject);
 }
Beispiel #37
0
        public void A_dispatcher_must_handle_waves_of_actors()
        {
            var dispatcher = InterceptedDispatcher();
            var props      = Props.Create(() => new DispatcherActor()).WithDispatcher(dispatcher.Id);

            Action <int> flood = num =>
            {
                var cachedMessage            = new CountDownNStop(new CountdownEvent(num));
                var stopLatch                = new CountdownEvent(num);
                var keepAliveLatch           = new CountdownEvent(1);
                var waitTime                 = (int)Dilated(TimeSpan.FromSeconds(20)).TotalMilliseconds;
                Action <IActorDsl> bossActor = c =>
                {
                    c.Receive <string>(str => str.Equals("run"), (s, context) =>
                    {
                        for (var i = 1; i <= num; i++)
                        {
                            context.Watch(context.ActorOf(props)).Tell(cachedMessage);
                        }
                    });

                    c.Receive <Terminated>((terminated, context) =>
                    {
                        stopLatch.Signal();
                    });
                };
                var boss = Sys.ActorOf(Props.Create(() => new Act(bossActor)).WithDispatcher("boss"));

                try
                {
                    // this future is meant to keep the dispatcher alive until the end of the test run even if
                    // the boss doesn't create children fast enough to keep the dispatcher from becoming empty
                    // and it needs to be on a separate thread to not deadlock the calling thread dispatcher
                    dispatcher.Schedule(() =>
                    {
                        keepAliveLatch.Wait(waitTime);
                    });
                    boss.Tell("run");
                    try
                    {
                        AssertCountdown(cachedMessage.Latch, waitTime, "Counting down from " + num);
                    }
                    catch (Exception ex)
                    {
                        // TODO balancing dispatcher
                        throw;
                    }
                    AssertCountdown(stopLatch, waitTime, "Expected all children to stop.");
                }
                finally
                {
                    keepAliveLatch.Signal();
                    Sys.Stop(boss);
                }
            };

            for (var i = 1; i <= 3; i++)
            {
                flood(50000);
                AssertDispatcher(dispatcher, i);
            }
        }
Beispiel #38
0
        internal bool SaveScript()
        {
            if (ScriptInfo.HalIPAddress != null) {
                Sys ho = new Sys(ScriptInfo.HalIPAddress);
                if (ScriptInfo.SourceFile == null) {
                    //new file..
                    using (frmSaveDialog dlg = new frmSaveDialog()) {
                        if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
                            ScriptInfo.SourceFile = dlg.textBox1.Text;
                        }
                    }
                }

                //try to save
                object retval = ho.PutScript(ScriptInfo.SourceFile, ScriptInfo.ModifiedScript);
                if ((bool)retval == true) return true; //ok

                if (retval.ToString() != "")
                    throw new Exception(retval.ToString());
            }

            return false;
        }
 protected IActorRef Identify(RoleName role, string actorName)
 {
     Sys.ActorSelection(Node(role) / "user" / actorName).Tell(new Identify(actorName));
     return(ExpectMsg <ActorIdentity>().Subject);
 }
 private Sys DefaultValues(Sys row)
 {
     return row;
 }
Beispiel #41
0
        private IMaterializer CreateMaterializer(bool autoFusing)
        {
            var settings = ActorMaterializerSettings.Create(Sys).WithInputBuffer(2, 16).WithAutoFusing(autoFusing);

            return(Sys.Materializer(settings));
        }
Beispiel #42
0
        /// <summary>
        /// 创建一个带有属性的XmlNode
        /// </summary>
        /// <param name="xmlDocument"></param>
        /// <param name="root">该节点的根节点</param>
        /// <param name="settingElement">节点信息</param>
        private void CreateNode(XmlDocument xmlDocument, XmlNode root, Sys.Configuration.AddElement settingElement)
        {
            XmlNode childNode = xmlDocument.CreateNode(XmlNodeType.Element,"add",null);
            // appName 属性
            XmlAttribute xmlAttribute = xmlDocument.CreateAttribute("appName");
            xmlAttribute.Value = settingElement.AppName;
            childNode.Attributes.Append(xmlAttribute);

            // fileName属性
            xmlAttribute = xmlDocument.CreateAttribute("fileName");
            xmlAttribute.Value = settingElement.FileName;
            childNode.Attributes.Append(xmlAttribute);

            root.AppendChild(childNode);
        }
 public SqlitePersistenceIdsSpec(ITestOutputHelper output) : base(Config, nameof(SqlitePersistenceIdsSpec), output)
 {
     ReadJournal = Sys.ReadJournalFor <SqlReadJournal>(SqlReadJournal.Identifier);
 }
 protected override void OnSequenceEnded(Sys.SequenceEventArgs e)
 {
     _dataSource.Stop();
     base.OnSequenceEnded(e);
 }
Beispiel #45
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Kpn.Length != 0)
            {
                hash ^= Kpn.GetHashCode();
            }
            if (Kpf.Length != 0)
            {
                hash ^= Kpf.GetHashCode();
            }
            if (SubBiz.Length != 0)
            {
                hash ^= SubBiz.GetHashCode();
            }
            if (Uid != 0L)
            {
                hash ^= Uid.GetHashCode();
            }
            if (Did.Length != 0)
            {
                hash ^= Did.GetHashCode();
            }
            if (ClientIp != 0L)
            {
                hash ^= ClientIp.GetHashCode();
            }
            if (AppVer.Length != 0)
            {
                hash ^= AppVer.GetHashCode();
            }
            if (Ver.Length != 0)
            {
                hash ^= Ver.GetHashCode();
            }
            if (Lat.Length != 0)
            {
                hash ^= Lat.GetHashCode();
            }
            if (Lon.Length != 0)
            {
                hash ^= Lon.GetHashCode();
            }
            if (Mond.Length != 0)
            {
                hash ^= Mond.GetHashCode();
            }
            if (Net.Length != 0)
            {
                hash ^= Net.GetHashCode();
            }
            if (Sys.Length != 0)
            {
                hash ^= Sys.GetHashCode();
            }
            if (C.Length != 0)
            {
                hash ^= C.GetHashCode();
            }
            if (Language.Length != 0)
            {
                hash ^= Language.GetHashCode();
            }
            if (CountryCode.Length != 0)
            {
                hash ^= CountryCode.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Beispiel #46
0
		public void DoSomething(Sys.UI.DomEvent ev)
		{
			te.InnerHTML = "goodbye at " + (new DateTime()).GetTime();
		}
Beispiel #47
0
 public void PersistentReceive_must_not_allow_using_ActorSelection_with_wildcards()
 {
     Sys.ActorOf(Props.Create(() => new DeliverToStarSelection(Name))).Tell("anything, really.");
     ExpectMsg <string>().Contains("not supported").ShouldBeTrue();
 }
        public void An_actor_watching_a_remote_actor_in_the_cluster_must_receive_terminated_when_watched_node_becomes_down_removed()
        {
            Within(TimeSpan.FromSeconds(30), () =>
            {
                AwaitClusterUp(_config.First, _config.Second, _config.Third, _config.Fourth);
                EnterBarrier("cluster-up");

                RunOn(() =>
                {
                    EnterBarrier("subjected-started");

                    var path2            = new RootActorPath(GetAddress(_config.Second)) / "user" / "subject";
                    var path3            = new RootActorPath(GetAddress(_config.Third)) / "user" / "subject";
                    var watchEstablished = new TestLatch(2);
                    Sys.ActorOf(Props.Create(() => new Observer(path2, path3, watchEstablished, TestActor))
                                .WithDeploy(Deploy.Local), "observer1");

                    watchEstablished.Ready();
                    EnterBarrier("watch-established");
                    ExpectMsg(path2);
                    ExpectNoMsg(TimeSpan.FromSeconds(2));
                    EnterBarrier("second-terminated");
                    MarkNodeAsUnavailable(GetAddress(_config.Third));
                    AwaitAssert(() => Assert.Contains(GetAddress(_config.Third), ClusterView.UnreachableMembers.Select(x => x.Address)));
                    Cluster.Down(GetAddress(_config.Third));
                    //removed
                    AwaitAssert(() => Assert.DoesNotContain(GetAddress(_config.Third), ClusterView.Members.Select(x => x.Address)));
                    AwaitAssert(() => Assert.DoesNotContain(GetAddress(_config.Third), ClusterView.UnreachableMembers.Select(x => x.Address)));
                    ExpectMsg(path3);
                    EnterBarrier("third-terminated");
                }, _config.First);

                RunOn(() =>
                {
                    Sys.ActorOf(BlackHoleActor.Props, "subject");
                    EnterBarrier("subjected-started");
                    EnterBarrier("watch-established");
                    RunOn(() =>
                    {
                        MarkNodeAsUnavailable(GetAddress(_config.Second));
                        AwaitAssert(() => Assert.Contains(GetAddress(_config.Second), ClusterView.UnreachableMembers.Select(x => x.Address)));
                        Cluster.Down(GetAddress(_config.Second));
                        //removed
                        AwaitAssert(() => Assert.DoesNotContain(GetAddress(_config.Second), ClusterView.Members.Select(x => x.Address)));
                        AwaitAssert(() => Assert.DoesNotContain(GetAddress(_config.Second), ClusterView.UnreachableMembers.Select(x => x.Address)));
                    }, _config.Third);
                    EnterBarrier("second-terminated");
                    EnterBarrier("third-terminated");
                }, _config.Second, _config.Third, _config.Fourth);

                RunOn(() =>
                {
                    EnterBarrier("subjected-started");
                    EnterBarrier("watch-established");
                    EnterBarrier("second-terminated");
                    EnterBarrier("third-terminated");
                }, _config.Fifth);

                EnterBarrier("after-1");
            });
        }
Beispiel #49
0
 public WebRequestBuilder(Sys sys, string queryTemplate)
 {
     this.sys = sys;
       this.queryTemplate = queryTemplate;
 }