public UserLoginActorTest(ITestOutputHelper output, ClusterContextFixture clusterContext) : base(output: output) { clusterContext.Initialize(Sys); _clusterContext = clusterContext.Context; _client = new MockClient(_clusterContext); }
public RoomWorker(ClusterNodeContext context, Config config) { _context = context; _channelType = (ChannelType)Enum.Parse(typeof(ChannelType), config.GetString("type", "Tcp"), true); _listenEndPoint = new IPEndPoint(IPAddress.Any, config.GetInt("port", 0)); _connectEndPoint = new IPEndPoint(IPAddress.Parse(config.GetString("address", "127.0.0.1")), config.GetInt("port", 0)); }
public UserLoginActor(ClusterNodeContext clusterContext, ActorBoundChannelRef channel, IPEndPoint clientRemoteEndPoint) { _logger = LogManager.GetLogger($"UserLoginActor({clientRemoteEndPoint})"); _clusterContext = clusterContext; _channel = channel; _isInternalAccess = clientRemoteEndPoint.Address == IPAddress.None; }
public RoomActor(ClusterNodeContext clusterContext, string name) { _logger = LogManager.GetLogger(string.Format("RoomActor({0})", name)); _clusterContext = clusterContext; _name = name; _userMap = new Dictionary <string, UserData>(); }
public UserActor(ClusterNodeContext clusterContext, string id, IUserEventObserver observer) { _logger = LogManager.GetLogger($"UserActor({id})"); _clusterContext = clusterContext; _id = id; _eventObserver = (UserEventObserver)observer; _enteredRoomMap = new Dictionary <string, RoomRef>(); }
public void Dispose() { if (Context == null) { return; } Context.System.Terminate(); Context = null; }
public BotActor(ClusterNodeContext clusterContext, string name, string roomName, Type patternType) { _log = LogManager.GetLogger($"Bot({name})"); _clusterContext = clusterContext; _channel = Context.InterfacedActorOf(() => new ActorBoundDummyChannel()).Cast <ActorBoundChannelRef>(); Self.Tell(new StartMessage { UserId = name, RoomName = roomName, PatternType = patternType }); }
public UserWorker(ClusterNodeContext context, Config config) { _context = context; _channelType = (ChannelType)Enum.Parse(typeof(ChannelType), config.GetString("type", "Tcp"), true); _listenEndPoint = new IPEndPoint(IPAddress.Any, config.GetInt("port", 0)); var connectAddress = config.GetString("connect-address"); var connectPort = config.GetInt("connect-port", _listenEndPoint.Port); _connectEndPoint = new IPEndPoint(connectAddress != null ? IPAddress.Parse(connectAddress) : IPAddress.Loopback, connectPort); }
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>(); }
public static async Task <MockClient[]> PrepareLoginedClients(ClusterNodeContext context, int count) { var clients = new List <MockClient>(); for (var i = 0; i < count; i++) { var client = new MockClient(context); await client.LoginAsync("test" + i, "1234"); clients.Add(client); } return(clients.ToArray()); }
public void Initialize(ActorSystem system) { DeadRequestProcessingActor.Install(system); var context = new ClusterNodeContext { System = system }; context.ClusterActorDiscovery = system.ActorOf(Props.Create( () => new ClusterActorDiscovery(null))); context.UserTable = new DistributedActorTableRef <string>(system.ActorOf( Props.Create(() => new DistributedActorTable <string>( "User", context.ClusterActorDiscovery, null, null)), "UserTable")); context.UserTableContainer = new DistributedActorTableContainerRef <string>(system.ActorOf( Props.Create(() => new DistributedActorTableContainer <string>( "User", context.ClusterActorDiscovery, typeof(UserActorFactory), new object[] { context }, InterfacedPoisonPill.Instance)), "UserTableContainer")); context.RoomTable = new DistributedActorTableRef <string>(system.ActorOf( Props.Create(() => new DistributedActorTable <string>( "Room", context.ClusterActorDiscovery, null, null)), "RoomTable")); var roomTableContainer = system.ActorOf( Props.Create(() => new DistributedActorTableContainer <string>( "Room", context.ClusterActorDiscovery, typeof(RoomActorFactory), new object[] { context }, InterfacedPoisonPill.Instance)), "RoomTableContainer"); context.BotTable = new DistributedActorTableRef <long>(system.ActorOf( Props.Create(() => new DistributedActorTable <long>( "Bot", context.ClusterActorDiscovery, typeof(IncrementalIntegerIdGenerator), null)), "BotTable")); var botTableContainer = system.ActorOf( Props.Create(() => new DistributedActorTableContainer <long>( "Bot", context.ClusterActorDiscovery, typeof(BotActorFactory), new object[] { context }, InterfacedPoisonPill.Instance)), "BotTableContainer"); Context = context; }
public UserActorTest(ITestOutputHelper output, ClusterContextFixture clusterContext) : base(output: output) { clusterContext.Initialize(Sys); _clusterContext = clusterContext.Context; }
public void Initialize(object[] args) { _clusterContext = (ClusterNodeContext)args[0]; }
public BotWorker(ClusterNodeContext context, Config config) { _context = context; }
public UserTableWorker(ClusterNodeContext context, Config config) { _context = context; }