public void GetCommunicator_MustReturnReferenceToSameObject() { var comm1 = CommunicationFactory.GetCommunicator(); var comm2 = CommunicationFactory.GetCommunicator(); Assert.That(ReferenceEquals(comm1, comm2)); }
public CommunicationModuleFactory(CommunicationFactory communicationFactory) { Contract.Requires<ArgumentNullException>(communicationFactory != null); this.communicationFactory = communicationFactory; this.iconSource = null; this.name = "Communication"; }
public CommunicationModule(IProcess process, CommunicationFactory communicationFactory) { Contract.Requires<ArgumentNullException>(process != null); Contract.Requires<ArgumentNullException>(communicationFactory != null); this.iconSource = null; this.name = "Communication"; this.communication = communicationFactory.CreateItem(process.Id); }
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"); }
public void OnStartup() { _communicationManager = CommunicationFactory.Create(GameType.Chaarr); try { Json = _communicationManager.Restart(); } catch (Exception exception) { MessageBox.Show(exception.Message); return; } GameState = JsonConverter.Parse(Json); LogManager.AddTurnReport(GameState); }
/// <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; }
/// <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> /// On window loaded - Start Foosbot Application and Threads /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void OnWindowLoaded(object sender, RoutedEventArgs e) { try { InitializeStatistics(); //get operation mode from configuration file _isArduinoConnected = Configuration.Attributes.GetValue <bool>(Configuration.Names.KEY_IS_ARDUINOS_CONNECTED); //Start Diagnostics - Processor and Memory Usage StartDiagnostics(); _imageProcessingPack = ImageProcessPack.Create(Dispatcher, _guiImage); _imageProcessingPack.Start(); VectorCalculationUnit vectorCalcullationUnit = new VectorCalculationUnit(_imageProcessingPack.ImageProcessUnit.BallLocationUpdater, _imageProcessingPack.ImageProcessUnit.ImagingData); vectorCalcullationUnit.Start(); MainDecisionUnit decisionUnit = new MainDecisionUnit(vectorCalcullationUnit.LastBallLocationPublisher); decisionUnit.Start(); if (_isArduinoConnected) { Dictionary <eRod, CommunicationUnit> communication = CommunicationFactory.Create(decisionUnit.RodActionPublishers); foreach (eRod key in communication.Keys) { if (communication[key] != null) { communication[key].Start(); } } } } catch (Exception ex) { MessageBox.Show("Application can not start. Reason: " + ex.Message); Close(); } }
public static ITestContext Create( ISettings settings, IEnumerable <IElementFactory> elementFactories) { var inputSimulator = new InputSimulator(); var logger = new LoggerFactory().GetLogger(settings); var uiNavigationProvider = new CodedUiUiNavigationProvider( inputSimulator.Mouse, inputSimulator.Keyboard, settings, logger); var elFactories = new List <IElementFactory>() { new ElementFactory(settings), }; elFactories.AddRange(elementFactories); var elementCreator = new ElementCreator(elFactories); var sessionHandler = new CodedUiSessionHandler(uiNavigationProvider, settings); var navigationService = new NavigationService( uiNavigationProvider, elementCreator, logger); var commService = new CommunicationFactory().GetCommunicationService(navigationService, settings, logger); var context = new CodedUiTestContext( navigationService, sessionHandler, commService, settings, logger); return(context); }
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 static ITestContext Create( ISettings settings, IEnumerable <IElementFactory> elementFactories) { var logger = new LoggerFactory().GetLogger(settings); var sessionHandler = new AppiumSessionHandler(settings, logger); var wrapperFactory = new AppiumUiItemWrapperFactory(); var uiNavigationProvider = new AppiumUiNavigationProvider(sessionHandler, wrapperFactory, logger, settings); var elFactories = new List <IElementFactory>() { new ElementFactory(settings), }; elFactories.AddRange(elementFactories); var elementCreator = new ElementCreator(elFactories); var navigationService = new NavigationService( uiNavigationProvider, elementCreator, logger); var commService = new CommunicationFactory().GetCommunicationService(navigationService, settings, logger); var context = new AppiumTestContext( navigationService, sessionHandler, commService, settings, logger); return(context); }
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 FileClient() { _serializer = new Serializer(); _communicator = CommunicationFactory.GetCommunicator(); }
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 ScreenShareClient() { _communicator = CommunicationFactory.GetCommunicator(); throw new NotImplementedException(); }
/// <summary> /// Public Constructor which will initialize most of the attributes. /// </summary> public ScreenShareServer() { _communicator = CommunicationFactory.GetCommunicator(); //_communicator.Subscribe(); throw new NotImplementedException(); }