/// <summary>
        /// Polls this server for the latest cruise control server project statuses and queues.
        /// </summary>
        public void Poll()
        {
            try
            {
                CruiseServerSnapshot cruiseServerSnapshot = cruiseServerManager.GetCruiseServerSnapshot();
                if ((lastCruiseServerSnapshot == null) ||
                    (cruiseServerSnapshot == null) ||
                    lastCruiseServerSnapshot.IsQueueSetSnapshotChanged(cruiseServerSnapshot.QueueSetSnapshot))
                {
                    OnQueueChanged(new MonitorServerQueueChangedEventArgs(this));
                }
                lastCruiseServerSnapshot = cruiseServerSnapshot;

                // Find any changes
                DetectAnyChanges(cruiseServerSnapshot);
            }
            catch (Exception ex)
            {
                Trace.WriteLine("ServerMonitorPoll Exception: " + ex);
                lastCruiseServerSnapshot = null;
                connectException         = ex;
                OnQueueChanged(new MonitorServerQueueChangedEventArgs(this));
            }

            OnPolled(new MonitorServerPolledEventArgs(this));
        }
 public CruiseServerSnapshot GetCruiseServerSnapshot()
 {
     if (cachedSnapshot == null)
     {
         cachedSnapshot = wrappedManager.GetCruiseServerSnapshot();
     }
     return(cachedSnapshot);
 }
Example #3
0
        public void ShouldDelegateFirstSnapshotGet()
        {
            CruiseServerSnapshot snapshot = new CruiseServerSnapshot();

            wrappedManagerMock.ExpectAndReturn("GetCruiseServerSnapshot", snapshot);

            Assert.AreSame(snapshot, cachingManager.GetCruiseServerSnapshot());

            wrappedManagerMock.Verify();
        }
Example #4
0
        public void ShouldDelegateFirstSnapshotGet()
        {
            CruiseServerSnapshot snapshot = new CruiseServerSnapshot();

            wrappedManagerMock.Setup(_manager => _manager.GetCruiseServerSnapshot()).Returns(snapshot).Verifiable();

            Assert.AreSame(snapshot, cachingManager.GetCruiseServerSnapshot());

            wrappedManagerMock.Verify();
        }