public void Initialize(ActorSystem system)
        {
            var context = new ClusterNodeContext {
                System = system
            };

            context.ClusterActorDiscovery = system.ActorOf(
                Props.Create(() => new ClusterActorDiscovery(null)));

            context.UserTable = new DistributedActorTableRef <long>(system.ActorOf(
                                                                        Props.Create(() => new DistributedActorTable <long>(
                                                                                         "User", context.ClusterActorDiscovery, null, null)),
                                                                        "UserTable"));

            var userTableContainer = system.ActorOf(
                Props.Create(() => new DistributedActorTableContainer <long>(
                                 "User", context.ClusterActorDiscovery, typeof(UserActorFactory), new object[] { context }, InterfacedPoisonPill.Instance)),
                "UserTableContainer");

            context.GameTable = new DistributedActorTableRef <long>(system.ActorOf(
                                                                        Props.Create(() => new DistributedActorTable <long>(
                                                                                         "Game", context.ClusterActorDiscovery, typeof(IncrementalIntegerIdGenerator), null)),
                                                                        "GameTable"));

            var gameTableContainer = system.ActorOf(
                Props.Create(() => new DistributedActorTableContainer <long>(
                                 "Game", context.ClusterActorDiscovery, typeof(GameActorFactory), new object[] { context }, InterfacedPoisonPill.Instance)),
                "GameTableContainer");

            var gamePairMaker = system.ActorOf(Props.Create(() => new GamePairMakerActor(context)));

            context.GamePairMaker = gamePairMaker.Cast <GamePairMakerRef>();

            Context = context;
        }
        public void Initialize(ActorSystem system)
        {
            var context = new ClusterNodeContext { System = system };

            context.ClusterActorDiscovery = system.ActorOf(
                Props.Create(() => new ClusterActorDiscovery(null)));

            context.UserTable = new DistributedActorTableRef<long>(system.ActorOf(
                Props.Create(() => new DistributedActorTable<long>(
                    "User", context.ClusterActorDiscovery, null, null)),
                "UserTable"));

            var userTableContainer = system.ActorOf(
                Props.Create(() => new DistributedActorTableContainer<long>(
                    "User", context.ClusterActorDiscovery, typeof(UserActorFactory), new object[] { context }, InterfacedPoisonPill.Instance)),
                "UserTableContainer");

            context.GameTable = new DistributedActorTableRef<long>(system.ActorOf(
                Props.Create(() => new DistributedActorTable<long>(
                    "Game", context.ClusterActorDiscovery, typeof(IncrementalIntegerIdGenerator), null)),
                "GameTable"));

            var gameTableContainer = system.ActorOf(
                Props.Create(() => new DistributedActorTableContainer<long>(
                    "Game", context.ClusterActorDiscovery, typeof(GameActorFactory), new object[] { context }, InterfacedPoisonPill.Instance)),
                "GameTableContainer");

            var gamePairMaker = system.ActorOf(Props.Create(() => new GamePairMakerActor(context)));
            context.GamePairMaker = gamePairMaker.Cast<GamePairMakerRef>();

            Context = context;
        }
        public void Dispose()
        {
            if (Context == null)
                return;

            Context.System.Terminate();
            Context = null;
        }
        public void Dispose()
        {
            if (Context == null)
            {
                return;
            }

            Context.System.Terminate();
            Context = null;
        }
Beispiel #5
0
        public MockClient(ClusterNodeContext clusterContex)
        {
            _clusterContext = clusterContex;

            var channel = new TestActorRef<TestActorBoundChannel>(
                _clusterContext.System,
                 Props.Create(() => new TestActorBoundChannel(CreateInitialActor)));
            Channel = channel.UnderlyingActor;
            ChannelRef = channel.Cast<ActorBoundChannelRef>();

            UserLogin = Channel.CreateRef<UserLoginRef>();
        }
Beispiel #6
0
        public MockClient(ClusterNodeContext clusterContex)
        {
            _clusterContext = clusterContex;

            var channel = new TestActorRef <TestActorBoundChannel>(
                _clusterContext.System,
                Props.Create(() => new TestActorBoundChannel(CreateInitialActor)));

            Channel    = channel.UnderlyingActor;
            ChannelRef = channel.Cast <ActorBoundChannelRef>();

            UserLogin = Channel.CreateRef <UserLoginRef>();
        }
Beispiel #7
0
 public UserLoginActorTest(ClusterContextFixture clusterContext)
 {
     clusterContext.Initialize(Sys);
     _clusterContext = clusterContext.Context;
     _client         = new MockClient(_clusterContext);
 }