Пример #1
0
        internal static bool WaitForServiceToFinish(ISrcMLGlobalService service, int millisecondsTimeout)
        {
            AutoResetEvent monitoringStartedResetEvent       = new AutoResetEvent(false),
                           updateArchivesStartedResetEvent   = new AutoResetEvent(false),
                           updateArchivesCompletedResetEvent = new AutoResetEvent(false);

            EventHandler monitoringStartedEventHandler = GetEventHandler(monitoringStartedResetEvent),
                         updateStartedEventHandler     = GetEventHandler(updateArchivesStartedResetEvent),
                         updateCompleteEventHandler    = GetEventHandler(updateArchivesCompletedResetEvent);

            service.MonitoringStarted       += monitoringStartedEventHandler;
            service.UpdateArchivesStarted   += updateStartedEventHandler;
            service.UpdateArchivesCompleted += updateCompleteEventHandler;

            service.StartMonitoring();

            Assert.IsTrue(updateArchivesStartedResetEvent.WaitOne(millisecondsTimeout));
            Assert.IsTrue(monitoringStartedResetEvent.WaitOne(millisecondsTimeout));
            Assert.IsTrue(updateArchivesCompletedResetEvent.WaitOne(millisecondsTimeout));

            service.MonitoringStarted       -= monitoringStartedEventHandler;
            service.UpdateArchivesStarted   -= updateStartedEventHandler;
            service.UpdateArchivesCompleted -= updateCompleteEventHandler;

            return(!service.IsUpdating);
        }
Пример #2
0
        internal static bool WaitForServiceToFinish(ISrcMLGlobalService service, int millisecondsTimeout) {
            AutoResetEvent monitoringStartedResetEvent = new AutoResetEvent(false),
                           updateArchivesStartedResetEvent = new AutoResetEvent(false),
                           updateArchivesCompletedResetEvent = new AutoResetEvent(false);

            EventHandler monitoringStartedEventHandler = GetEventHandler(monitoringStartedResetEvent),
                         updateStartedEventHandler = GetEventHandler(updateArchivesStartedResetEvent),
                         updateCompleteEventHandler = GetEventHandler(updateArchivesCompletedResetEvent);

            service.MonitoringStarted += monitoringStartedEventHandler;
            service.UpdateArchivesStarted += updateStartedEventHandler;
            service.UpdateArchivesCompleted += updateCompleteEventHandler;
            
            service.StartMonitoring();

            Assert.IsTrue(updateArchivesStartedResetEvent.WaitOne(millisecondsTimeout));
            Assert.IsTrue(monitoringStartedResetEvent.WaitOne(millisecondsTimeout));
            Assert.IsTrue(updateArchivesCompletedResetEvent.WaitOne(millisecondsTimeout));

            service.MonitoringStarted -= monitoringStartedEventHandler;
            service.UpdateArchivesStarted -= updateStartedEventHandler;
            service.UpdateArchivesCompleted -= updateCompleteEventHandler;

            return !service.IsUpdating;
        }
Пример #3
0
        /// <summary>
        /// SrcML service starts to monitor the opened solution.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="eventArgs"></param>
        private void RespondToSolutionOpened(object sender, DoWorkEventArgs eventArgs)
        {
            //SrcMLFileLogger.DefaultLogger.Info("> SrcML service starts monitoring the opened solution.");

            // This statement should be commented out when releasing SrcML.NET for Sando
            //srcMLService.StartMonitoring(true, SrcMLHelper.GetSrcMLDefaultDirectory(extensionDirectory));
            SrcMLFileLogger.DefaultLogger.Info("srcml service starts monitoring");
            srcMLService.StartMonitoring();
        }
 public void OpenSolution(string testSolutionFilePath)
 {
     // Get the components service
     context = VsIdeTestHostContext.ServiceProvider.GetService(typeof(SComponentModel)) as IComponentModel;
     // Open a solution that is the initial state for your tests
     ModelSolution = VsIdeTestHostContext.Dte.Solution;
     ModelSolution.Open(Path.GetFullPath(testSolutionFilePath));
     Assert.IsNotNull(ModelSolution, "VS solution not found");
     // Start up
     srcMLService.StartMonitoring(true, SrcMLHelper.GetSrcMLDefaultDirectory());
     System.Threading.Thread.Sleep(3000);
 }