Ejemplo n.º 1
0
 public void ProcessMessage(MessageReceivedEventArgs e)
 {
     try
     {
         Logger.Write("Risk: Message Found of " + e.Message.GetType());
         if (e.Message.GetType() == typeof (RiskMetricGeneratedMessage))
         {
             var message = (RiskMetricGeneratedMessage) e.Message;
             Logger.Write("Received risk metric from backend for " + message.Signature + " count = " +
                          message.NodeCount);
             EntryCache.Update(message);
         }
         if (e.Message.GetType() == typeof (ProfilerCompletedMessage) ||
             e.Message.GetType() == typeof (ProfilerInitializedMessage) ||
             e.Message.GetType() == typeof (AssembliesMinimizedMessage) ||
             e.Message.GetType() == typeof (MinimizerInitializedMessage))
         {
             Logger.Write("LL:Received Profiler Message: Invalidating.");
             EntryCache.Invalidate();
         }
         if (e.Message.GetType() == typeof (CacheMessages))
         {
             CurrentTestStatuses.UpdateWith((CacheMessages) e.Message);
         }
     }
     catch(Exception ex)
     {
         Logger.Write("Process message" + ex);
     }
 }
Ejemplo n.º 2
0
        void _server_MessageReceived(object sender, MessageReceivedEventArgs e)
        {
            if (VMSpawned == null)
                return;

            if (e.Message.GetType().Equals(typeof(VMInitializedMessage)))
            {
                var message = (VMInitializedMessage)e.Message;
                VMSpawned(this, new VMSpawnedArgs(new VMSpawnedMessage(message.CorrelationId, message.Port, message.NUnitTestRunner, message.MsTestRunner, message.LoggingEnabled, message.StartedPaused)));
            }
        }
Ejemplo n.º 3
0
 void _client_MessageReceived(object sender, MessageReceivedEventArgs e)
 {
     if (MessageReceived != null)
         MessageReceived(this, e);
     if (_reciever != null)
         _reciever(e.Message);
     lock (_messages)
     {
         _messages.Add(e.Message);
     }
 }
Ejemplo n.º 4
0
 void ClientMessageReceived(object sender, MessageReceivedEventArgs e)
 {
     ProcessMessage(e);
 }
Ejemplo n.º 5
0
        static void OnRecieve(object sender, MessageReceivedEventArgs e)
        {
            Logger.WriteDebug("received A message of type " + e.Message.GetType());

            if (e.Message == null) Logger.WriteDebug("message is null?");
            if (_engine == null) Logger.WriteDebug("ENG is null?");
            
            if (e.Message.GetType() == typeof(RunRecursiveRunDetectorMessage))
            {
                Logger.WriteDebug("Runing recursive run detector");
                _engine.SetupRecursiveCauseDetectorAsNextTrackerType();
                return;
            }
            if (e.Message.GetType() == typeof(ForceFullRunMessage))
            {
                Logger.WriteDebug("Forcing full test run");
                _engine.DoFullRun();
                return;
            }
            if (e.Message.GetType() == typeof(PauseVMMessage))
            {
                Logger.WriteDebug("Pausing VM");
                _engine.Pause();
                return;
            }
            if (e.Message.GetType() == typeof(RequestVisualGraphMessage))
            {
                var m = e.Message as RequestVisualGraphMessage;
                Logger.WriteDebug("Building graph for: " + m.Item);
                var graph = _engine.GetCouplingGraph(m.Item);
                Logger.WriteDebug("Returning graph for: " + m.Item);
                server.Send(graph);
                return;
            }
            if (e.Message.GetType() == typeof(RequestProfiledGraphMessage))
            {
                var m = e.Message as RequestProfiledGraphMessage;
                Logger.WriteDebug("Building profile graph for: " + m.Item);
                var graph = _engine.GetProfiledGraph(m.Item);
                Logger.WriteDebug("Returning profiled graph for: " + m.Item);
                server.Send(graph);
                return;
            }
            if (e.Message.GetType() == typeof(RequestRuntimeTestInformationMessage))
            {
                var m = e.Message as RequestRuntimeTestInformationMessage;
                Logger.WriteDebug("Building runtime test info for: " + m.Item);
                var runtimeTestInformation = _engine.GetRuntimeTestInformation(m.Item);
                Logger.WriteDebug("Returning runtime test info for: " + m.Item);
                server.Send(runtimeTestInformation);
                return;
            }
            if (e.Message.GetType() == typeof(RequestRiskMetricsMessage))
            {
                var m = e.Message as RequestRiskMetricsMessage;
                Logger.WriteDebug("Building metrics for: " + m.Item);
                if(_engine == null) Logger.WriteDebug("engine was null");
                var ret = _engine.GetRiskMetricFor(m.Item);
                Logger.WriteDebug("Returning metrics for: " + m.Item);
                server.Send(ret);
                return;
            }
            if (e.Message.GetType() == typeof(ResumeVMMessage))
            {
                Logger.WriteDebug("Resuming VM");
                if (!_engine.IsRunning)
                    _engine.Start();
                _engine.Resume();
                return;
            }
            if (e.Message.GetType() == typeof(TerminateMessage))
            {
                shutdown();
                return;
            }
            if (e.Message.GetType() == typeof(TestProfilerCorruptedMessage))
            {
                var corrupted = _engine.TestProfilerIsCorrupted();
                if(corrupted != null) server.Send(corrupted);
                return;
            }
            if (e.Message.GetType() == typeof(OnDemandTestRunMessage))
            {
                Logger.WriteDebug("Starting on demand tests");
                var message = (OnDemandTestRunMessage)e.Message;
                _engine.StartOnDemandTestRun(message.Runs);
            }
            if (e.Message.GetType() == typeof(RunRelatedTestsMessage))
            {
                Logger.WriteDebug("Starting run related tests");
                var message = (RunRelatedTestsMessage)e.Message;
                _engine.RunRelatedTests(message.Member);
            }
            if (e.Message.GetType() == typeof(ConfigurationUpdateMessage))
            {
                var message = (ConfigurationUpdateMessage)e.Message;
                if (message.RequiresRestart)
                {
                    Logger.WriteDebug("Restarting engine");
                    _engine.Stop();
                    _engine.Start();
                }
                else
                {
                    Logger.WriteDebug("Reloading configuration");
                    _engine.RefreshConfiguration();
                }
            }
            if (e.Message.GetType() == typeof(ManualMinimizationRequestMessage))
            {
                Logger.WriteDebug("Manual minimization requested");
                _engine.PerformManualMinimization();
            }
            if (e.Message.GetType() == typeof(UpdateCustomOutputpathMessage))
            {
                Logger.WriteDebug("Output path update requested");
                _engine.SetCustomOutputPath(((UpdateCustomOutputpathMessage)e.Message).Outputpath);
            }
            if (e.Message.GetType() == typeof(GoToFileAndLineMessage))
            {
                Logger.WriteDebug("Go to file requested");
                _engine.GoTo(((GoToFileAndLineMessage)e.Message));
            }
            if (e.Message.GetType() == typeof(RequestMessage<AssemblyPathRequest, AssemblyPathResponse>))
            {
                Logger.WriteDebug("Assembly path for project requested");
                var msg = (RequestMessage<AssemblyPathRequest, AssemblyPathResponse>)e.Message;
                server.Send(new AssemblyPathResponse(msg.CorrelationID, _engine.GetAssemblyFromProject(msg.Request.Project)));
            }
            if (e.Message.GetType() == typeof(RequestMessage<IsSolutionInitializedRequest, IsSolutionInitializedResponse>))
            {
                Logger.WriteDebug("Assembly path for project requested");
                var msg = (RequestMessage<IsSolutionInitializedRequest, IsSolutionInitializedResponse>)e.Message;
                server.Send(new IsSolutionInitializedResponse(msg.CorrelationID, _engine.IsSolutionInitialized()));
            }
            if (e.Message.GetType() == typeof(PartialRunMessage))
            {
                Logger.WriteDebug("Assembly path for project requested");
                var msg = (PartialRunMessage)e.Message;
                _engine.DoPartialRun(msg.Projects);
            }
            if (e.Message.GetType() == typeof(RealtimeChangeList))
            {
                Logger.WriteDebug("Realtime change received");
                var msg = (RealtimeChangeList)e.Message;
                _engine.QueueRealtimeRun(msg);
            }
            if (e.Message.GetType() == typeof(RequestMessage<OrderedBuildList, OrderedBuildList>))
            {
                Logger.WriteDebug("Building ordered build list");
                var msg = (RequestMessage<OrderedBuildList, OrderedBuildList>)e.Message;
                server.Send(new OrderedBuildList(msg.CorrelationID, _engine.BuildOrderedProjectList(msg.Request)));
            }
            if (e.Message.GetType() == typeof(GetLastAffectedGraphMessage))
            {
                Logger.WriteDebug("Getting last affected graph");
                server.Send(_engine.GetLastRunCouplingGraph());
            }
            if (e.Message.GetType() == typeof(AbortMessage))
            {
                Logger.WriteDebug("Aborting current run");
                _engine.AbortRun();
            }
            //TODO SERIOUSLY WTF WE NEED TO REFACTOR THIS!!!
            //LOL! yeah :)
        }
Ejemplo n.º 6
0
        void node_MessageReceived(object sender, MessageReceivedEventArgs e)
        {
            _syncContext.Post((m) =>
                {
                    if (!sentFromActiveNode(sender.ToString()))
                        return;
                    addListItem(new ListItemInfo<object>(e.Message));

                    if (e.Message.GetType().Equals(typeof(VMSpawnedMessage)))
                    {
                        var message = (VMSpawnedMessage)e.Message;
                        var client = new DiagnosticNode("127.0.0.1", message.Port, 0, "Client");
                        addListItem(new ListItemInfo<string>("Connected"));
                        addNode(client);
                    }

                    if (e.Message.GetType().Equals(typeof(VMTerminating)))
                    {
                        var message = (VMTerminating)e.Message;
                        var client = _nodes.Where(n => n.IP.Equals("127.0.0.1") && n.Port.Equals(message.Port)).FirstOrDefault();
                        if (client != null)
                        {
                            addListItem(new ListItemInfo<string>("Disconnected"));
                            removeNode(client);
                        }
                    }
                }, null);
        }
Ejemplo n.º 7
0
 private void _spawnClient_MessageReceived(object sender, MessageReceivedEventArgs e)
 {
     Logger.Write(string.Format("Recieving message of type {0} from host", e.Message.GetType()));
     if (e.Message.GetType().Equals(typeof(VMSpawnedMessage)))
     {
         Logger.Write("Recieved VMSpawnedMessage");
         var message = (VMSpawnedMessage)e.Message;
         if (!message.CorrelationId.Equals(_spawnCorrelationID))
             return;
         Logger.Write("Message has correct correlationID");
         _host.Disconnect();
         _host.MessageReceived -= _spawnClient_MessageReceived;
         _host = null;
         Logger.Write(string.Format("Disconnected from 127.0.0.1:{0}", _port));
         if (VMSpawned != null)
             VMSpawned(this, new VMSpawnedArgs(message));
         _spawnHandler.VMStarted(message);
     }
     if (e.Message.GetType().Equals(typeof(ValidLicenseMessage)))
     {
         //throw new NotImplementedException(); WTF was this throwing unimpl exception?!
     }
 }