public void GetCommunicator_MustReturnReferenceToSameObject() { var comm1 = CommunicationFactory.GetCommunicator(); var comm2 = CommunicationFactory.GetCommunicator(); Assert.That(ReferenceEquals(comm1, comm2)); }
public ContentServer() { _subscribers = new List <IContentListener>(); _communicator = CommunicationFactory.GetCommunicator(false); _contentDatabase = new ContentDatabase(); _notificationHandler = new ContentServerNotificationHandler(); _fileServer = new FileServer(_contentDatabase); _chatServer = new ChatServer(_contentDatabase); _chatContextServer = new ChatContextServer(_contentDatabase); _serializer = new Serializer(); _communicator.Subscribe("Content", _notificationHandler); }
public Messager(string ip, int port, string uname) { schemaObj = new MessageSchema(); persistObj = new Persistence(); comm = CommunicationFactory.GetCommunicator(ip, port); ///var time = DateTime.Now; ///string formattedTime = time.ToString("yyyy, MM, dd, hh, mm, ss"); ///Connectifier = new Handler.ConnectHandlers(handler); ///SendMessage(uname, ip, formattedTime, "False"); }
/// <summary> /// Constructor for the ServerSessionManager, calls the /// tracelistener and creates a list for telemetry subscribers. /// </summary> public ServerSessionManager() { _contentServer = ContentServerFactory.GetInstance(); _sessionData = new SessionData(); _serializer = new Serializer(); _telemetrySubscribers = new List <ITelemetryNotifications>(); _summarizer = SummarizerFactory.GetSummarizer(); Session session = new(); session.TraceListener(); userCount = 0; moduleIdentifier = "serverSessionManager"; _communicator = CommunicationFactory.GetCommunicator(false); _communicator.Subscribe(moduleIdentifier, this); }
/// <summary> /// Default constructor that will create a new SessionData object, /// trace listener and the list for maintaining the subscribers for SessionData /// </summary> public ClientSessionManager() { _serializer = new Serializer(); _communicator = CommunicationFactory.GetCommunicator(); Session session = new(); session.TraceListener(); if (_clients == null) { _clients = new List <IClientSessionNotifications>(); } _clientSessionData = null; _user = null; moduleIdentifier = "clientSessionManager"; chatSummary = null; }
public ContentClient() { _userId = -1; _subscribers = new List <IContentListener>(); _allMessages = new List <ChatContext>(); _contextMap = new Dictionary <int, int>(); _fileHandler = new FileClient(); _chatHandler = new ChatClient(); // add message handler functions for each event _messageHandlers = new Dictionary <MessageEvent, Action <MessageData> >(); _messageHandlers[MessageEvent.NewMessage] = NewMessageHandler; _messageHandlers[MessageEvent.Update] = UpdateMessageHandler; _messageHandlers[MessageEvent.Star] = StarMessageHandler; _messageHandlers[MessageEvent.Download] = DownloadMessageHandler; // subscribe to the network _notifHandler = new ContentClientNotificationHandler(); _communicator = CommunicationFactory.GetCommunicator(); _communicator.Subscribe("Content", _notifHandler); }
public void Start_ClientServerStartup_StartupMustPass() { // start the server var server = CommunicationFactory.GetCommunicator(false, true); var address = server.Start(); var s = address.Split(":"); // client1 connection var client1 = CommunicationFactory.GetCommunicator(true, true); var c1 = client1.Start(s[0], s[1]); // client2 connection var client2 = CommunicationFactory.GetCommunicator(true, true); var c2 = client2.Start(s[0], s[1]); // stop all clients client2.Stop(); client1.Stop(); // stop the server server.Stop(); Assert.AreEqual("1", c2); Assert.AreEqual("1", c1); }
public Messager(int port) { schemaObj = new MessageSchema(); persistObj = new Persistence(); comm = CommunicationFactory.GetCommunicator(port); }
/// <summary> /// Public Constructor which will initialize most of the attributes. /// </summary> public ScreenShareServer() { _communicator = CommunicationFactory.GetCommunicator(); //_communicator.Subscribe(); throw new NotImplementedException(); }
/// <summary> /// Public Constructor which will initialize most of the attributes. /// </summary> public ScreenShareClient() { _communicator = CommunicationFactory.GetCommunicator(); throw new NotImplementedException(); }
public FileClient() { _serializer = new Serializer(); _communicator = CommunicationFactory.GetCommunicator(); }