Example #1
0
        public IAsyncOperation RunTest(UnitTest test, IExecutionHandler context)
        {
            var result = RunTest(test, context, IdeApp.Preferences.BuildBeforeRunningTests);

            result.Completed += (OperationHandler)DispatchService.GuiDispatch(new OperationHandler(OnTestSessionCompleted));
            return(result);
        }
        public IDisposable CreateExternalProcessObject(Type type, IExecutionHandler executionHandler, IList <string> userAssemblyPaths = null, OperationConsole console = null)
        {
            CheckRemoteType(type);
            var hc = GetHost(type.ToString(), false, executionHandler);

            return((IDisposable)hc.CreateInstance(type.Assembly.Location, type.FullName, GetRequiredAddins(type), userAssemblyPaths, console));
        }
Example #3
0
		public override IExecutionHandler GetExecutionHandler ()
		{
			if (handler == null)
				handler = new IronPythonExecutionHandler ();
			
			return handler;
		}
		public Task Connect (NUnitVersion version, IExecutionHandler executionHandler = null, OperationConsole console = null)
		{
			var exePath = Path.Combine (Path.GetDirectoryName (GetType ().Assembly.Location), version.ToString (), "NUnitRunner.exe");
			connection = new RemoteProcessConnection (exePath, executionHandler, console, Runtime.MainSynchronizationContext);
			connection.AddListener (this);
			return connection.Connect ();
		}
Example #5
0
        AsyncOperation RunTest(ITreeNavigator nav, IExecutionHandler mode, bool bringToFront = true)
        {
            if (nav == null)
            {
                return(null);
            }
            UnitTest test = nav.DataItem as UnitTest;

            if (test == null)
            {
                return(null);
            }
            UnitTestService.ResetResult(test.RootTest);

            this.buttonRunAll.Sensitive = false;
            this.buttonStop.Sensitive   = true;

            ExecutionContext context = new ExecutionContext(mode, IdeApp.Workbench.ProgressMonitors.ConsoleFactory, null);

            if (bringToFront)
            {
                IdeApp.Workbench.GetPad <TestPad> ().BringToFront();
            }
            runningTestOperation = UnitTestService.RunTest(test, context);
            runningTestOperation.Task.ContinueWith(t => OnTestSessionCompleted(), TaskScheduler.FromCurrentSynchronizationContext());
            return(runningTestOperation);
        }
Example #6
0
        IAsyncOperation RunTest(ITreeNavigator nav, IExecutionHandler mode, bool bringToFront = true)
        {
            if (nav == null)
            {
                return(null);
            }
            UnitTest test = nav.DataItem as UnitTest;

            if (test == null)
            {
                return(null);
            }
            NUnitService.ResetResult(test.RootTest);

            this.buttonRunAll.Sensitive = false;
            this.buttonStop.Sensitive   = true;

            if (bringToFront)
            {
                IdeApp.Workbench.GetPad <TestPad> ().BringToFront();
            }
            runningTestOperation            = testService.RunTest(test, mode);
            runningTestOperation.Completed += (OperationHandler)DispatchService.GuiDispatch(new OperationHandler(OnTestSessionCompleted));
            return(runningTestOperation);
        }
Example #7
0
        protected override void Run(object dataItem)
        {
            IExecutionHandler h      = ExecutionModeCommandService.GetExecutionModeForCommand(dataItem);
            IBuildTarget      target = IdeApp.ProjectOperations.CurrentSelectedBuildTarget;

            if (h == null || !IdeApp.ProjectOperations.CurrentRunOperation.IsCompleted)
            {
                return;
            }

            if (!IdeApp.Preferences.BuildBeforeExecuting)
            {
                IdeApp.ProjectOperations.Execute(target, h);
            }
            else
            {
                IAsyncOperation asyncOperation = IdeApp.ProjectOperations.Build(target);
                asyncOperation.Completed += delegate
                {
                    if ((asyncOperation.Success) || (IdeApp.Preferences.RunWithWarnings && asyncOperation.SuccessWithWarnings))
                    {
                        IdeApp.ProjectOperations.Execute(target, h);
                    }
                };
            }
        }
        public IAsyncOperation RunTest(UnitTest test, IExecutionHandler context, bool buildOwnerObject)
        {
            string testName = test.FullName;

            if (buildOwnerObject)
            {
                IBuildTarget bt = test.OwnerObject as IBuildTarget;
                if (bt != null && bt.NeedsBuilding(IdeApp.Workspace.ActiveConfiguration))
                {
                    if (!IdeApp.ProjectOperations.CurrentRunOperation.IsCompleted)
                    {
                        MonoDevelop.Ide.Commands.StopHandler.StopBuildOperations();
                        IdeApp.ProjectOperations.CurrentRunOperation.WaitForCompleted();
                    }

                    AsyncOperation retOper = new AsyncOperation();

                    IAsyncOperation op = IdeApp.ProjectOperations.Build(bt);
                    retOper.TrackOperation(op, false);

                    op.Completed += delegate {
                        // The completed event of the build operation is run in the gui thread,
                        // so we need a new thread, because refreshing must be async
                        System.Threading.ThreadPool.QueueUserWorkItem(delegate {
                            if (op.Success)
                            {
                                RefreshTests();
                                test = SearchTest(testName);
                                if (test != null)
                                {
                                    Gtk.Application.Invoke(delegate {
                                        // RunTest must run in the gui thread
                                        retOper.TrackOperation(RunTest(test, context, false), true);
                                    });
                                }
                                else
                                {
                                    retOper.SetCompleted(false);
                                }
                            }
                        });
                    };

                    return(retOper);
                }
            }

            Pad resultsPad = IdeApp.Workbench.GetPad <TestResultsPad>();

            if (resultsPad == null)
            {
                resultsPad = IdeApp.Workbench.ShowPad(new TestResultsPad(), "MonoDevelop.NUnit.TestResultsPad", GettextCatalog.GetString("Test results"), "Bottom", "md-solution");
            }

            resultsPad.BringToFront();
            TestSession session = new TestSession(test, context, (TestResultsPad)resultsPad.Content);

            session.Start();
            return(session);
        }
Example #9
0
        public AsyncOperation RunTest(UnitTest test, IExecutionHandler context)
        {
            var result = RunTest(test, context, IdeApp.Preferences.BuildBeforeRunningTests);

            result.Task.ContinueWith(t => OnTestSessionCompleted(), TaskScheduler.FromCurrentSynchronizationContext());
            return(result);
        }
Example #10
0
        public bool IsValidForRemoteHosting(IExecutionHandler handler)
        {
            string location = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);

            location = Path.Combine(location, "mdhost.exe");
            return(handler.CanExecute(new DotNetExecutionCommand(location)));
        }
Example #11
0
        public Task Connect(NUnitVersion version, IExecutionHandler executionHandler = null, OperationConsole console = null)
        {
            var exePath = Path.Combine(Path.GetDirectoryName(GetType().Assembly.Location), version.ToString(), "NUnitRunner.exe");

            connection = new RemoteProcessConnection(exePath, executionHandler, console, Runtime.MainSynchronizationContext);
            connection.AddListener(this);
            return(connection.Connect());
        }
Example #12
0
 public TestSession(UnitTest test, IExecutionHandler context, TestResultsPad resultsPad)
 {
     this.test       = test;
     this.context    = context;
     this.monitor    = new TestMonitor(resultsPad);
     this.resultsPad = resultsPad;
     resultsPad.InitializeTestRun(test);
 }
 public bool CanRun(IExecutionHandler executionContext)
 {
     if (executionContext == null)
     {
         executionContext = Runtime.ProcessService.DefaultExecutionHandler;
     }
     return(OnCanRun(executionContext));
 }
Example #14
0
        protected void OnRunTest(object data)
        {
            IExecutionHandler h = ExecutionModeCommandService.GetExecutionModeForCommand(data);

            if (h != null)
            {
                RunSelectedTest(h);
            }
        }
Example #15
0
        protected override void Run(object dataItem)
        {
            IExecutionHandler h = ExecutionModeCommandService.GetExecutionModeForCommand(dataItem);

            if (h != null)
            {
                RunHandler.RunMethod(h);
            }
        }
Example #16
0
        public override IExecutionHandler GetExecutionHandler()
        {
            if (handler == null)
            {
                handler = new CPythonExecutionHandler();
            }

            return(handler);
        }
		public bool CanExecute (IExecutionHandler handler)
		{
			if (runCheckDelegate != null)
				return runCheckDelegate (handler);
			else if (cmd != null)
				return handler.CanExecute (cmd);
			else
				return false;
		}
		public TestContext (ITestProgressMonitor monitor, IExecutionHandler executionContext, DateTime testDate)
		{
			this.monitor = monitor;
			if (executionContext == null)
				executionContext = Runtime.ProcessService.DefaultExecutionHandler;
			this.executionContext = executionContext;
			// Round to seconds
			this.testDate = new DateTime ((testDate.Ticks / TimeSpan.TicksPerSecond) * TimeSpan.TicksPerSecond);
		}
Example #19
0
		public ExecutionContext (IExecutionHandler executionHandler, IConsoleFactory consoleFactory, ExecutionTarget target)
		{
			var targetedHandler = executionHandler as ITargetedExecutionHandler;
			if (targetedHandler != null)
				target = targetedHandler.Target ?? target;

			this.executionHandler = executionHandler;
			this.consoleFactory = consoleFactory;
			this.executionTarget = target;
		}
Example #20
0
 public TestSession(UnitTest test, IExecutionHandler context, TestResultsPad resultsPad, CancellationTokenSource cs)
 {
     this.test               = test;
     this.context            = context;
     CancellationTokenSource = cs;
     this.monitor            = new TestMonitor(resultsPad, CancellationTokenSource);
     this.resultsPad         = resultsPad;
     resultsPad.InitializeTestRun(test);
     Task = new Task(RunTests);
 }
		public ProcessHostController (string id, uint stopDelay, IExecutionHandler executionHandlerFactory)
		{
			if (string.IsNullOrEmpty (id))
				id = "?";
			this.id = id;
			this.stopDelay = stopDelay;
			this.executionHandlerFactory = executionHandlerFactory;
			timer = new Timer ();
			timer.AutoReset = false;
			timer.Elapsed += new System.Timers.ElapsedEventHandler (WaitTimeout);
		}
Example #22
0
 public TestContext(ITestProgressMonitor monitor, IExecutionHandler executionContext, DateTime testDate)
 {
     this.monitor = monitor;
     if (executionContext == null)
     {
         executionContext = Runtime.ProcessService.DefaultExecutionHandler;
     }
     this.executionContext = executionContext;
     // Round to seconds
     this.testDate = new DateTime((testDate.Ticks / TimeSpan.TicksPerSecond) * TimeSpan.TicksPerSecond);
 }
Example #23
0
 public static bool CanRun(IExecutionHandler executionHandler)
 {
     if (IdeApp.Workspace.IsOpen)
     {
         return(IdeApp.ProjectOperations.CurrentSelectedSolution != null && IdeApp.ProjectOperations.CanExecute(IdeApp.ProjectOperations.CurrentSelectedSolution, executionHandler));
     }
     else
     {
         return((IdeApp.Workbench.ActiveDocument != null) && (IdeApp.Workbench.ActiveDocument.CanRun(executionHandler)));
     }
 }
Example #24
0
 public static bool CanRun(IExecutionHandler executionHandler)
 {
     if (IdeApp.Workspace.IsOpen)
     {
         var target = GetRunTarget();
         return(target != null && IdeApp.ProjectOperations.CanExecute(target, executionHandler));
     }
     else
     {
         return(false);
     }
 }
Example #25
0
 public static bool CanRun(IExecutionHandler executionHandler)
 {
     if (IdeApp.Workspace.IsOpen)
     {
         var target = GetRunTarget();
         return(target != null && IdeApp.ProjectOperations.CanExecute(target, executionHandler));
     }
     else
     {
         return((IdeApp.Workbench.ActiveDocument != null) && (IdeApp.Workbench.ActiveDocument.CanRun(executionHandler)));
     }
 }
		public RemoteProcessConnection (string exePath, IExecutionHandler executionHandler = null, OperationConsole console = null, SynchronizationContext syncContext = null)
		{
			if (executionHandler == null)
				executionHandler = Runtime.ProcessService.DefaultExecutionHandler;
			if (console == null)
				console = new ProcessHostConsole ();
			this.executionHandler = executionHandler;
			this.exePath = exePath;
			this.syncContext = syncContext;
			this.console = console;
			mainCancelSource = new CancellationTokenSource ();
		}
Example #27
0
        protected override void Run(object dataItem)
        {
            IExecutionHandler h      = ExecutionModeCommandService.GetExecutionModeForCommand(dataItem);
            IBuildTarget      target = IdeApp.ProjectOperations.CurrentSelectedBuildTarget;

            if (h == null || !IdeApp.ProjectOperations.CurrentRunOperation.IsCompleted)
            {
                return;
            }

            IdeApp.ProjectOperations.Execute(target, h);
        }
Example #28
0
        protected override void DoExecute(IProgressMonitor monitor,
                                          ExecutionContext context)
        {
            CProjectConfiguration conf = (CProjectConfiguration)ActiveConfiguration;
            string   command           = conf.Output;
            string   args     = conf.CommandLineParameters;
            string   dir      = Path.GetFullPath(conf.OutputDirectory);
            string   platform = "Native";
            bool     pause    = conf.PauseConsoleOutput;
            IConsole console;

            if (conf.CompileTarget != CBinding.CompileTarget.Bin)
            {
                IdeApp.Services.MessageService.ShowMessage("Compile target is not an executable!");
                return;
            }

            monitor.Log.WriteLine("Running project...");

            if (conf.ExternalConsole)
            {
                console = context.ExternalConsoleFactory.CreateConsole(!pause);
            }
            else
            {
                console = context.ConsoleFactory.CreateConsole(!pause);
            }

            AggregatedOperationMonitor operationMonitor = new AggregatedOperationMonitor(monitor);

            try {
                IExecutionHandler handler = context.ExecutionHandlerFactory.CreateExecutionHandler(platform);

                if (handler == null)
                {
                    monitor.ReportError("Cannot execute \"" + command + "\". The selected execution mode is not supported in the " + platform + " platform.", null);
                    return;
                }

                IProcessAsyncOperation op = handler.Execute(Path.Combine(dir, command), args, dir, console);

                operationMonitor.AddOperation(op);
                op.WaitForCompleted();

                monitor.Log.WriteLine("The operation exited with code: {0}", op.ExitCode);
            } catch (Exception ex) {
                monitor.ReportError("Cannot execute \"" + command + "\"", ex);
            } finally {
                operationMonitor.Dispose();
                console.Dispose();
            }
        }
Example #29
0
        public void Start()
        {
            lock (this)
            {
                if (starting)
                {
                    return;
                }
                starting = true;
                exitRequestEvent.Reset();

                RemotingService.RegisterRemotingChannel();

                BinaryFormatter bf   = new BinaryFormatter();
                ObjRef          oref = RemotingServices.Marshal(this);
                MemoryStream    ms   = new MemoryStream();
                bf.Serialize(ms, oref);
                string sref    = Convert.ToBase64String(ms.ToArray());
                string tmpFile = null;

                if (executionHandlerFactory == null)
                {
                    executionHandlerFactory = Runtime.SystemAssemblyService.CurrentRuntime.GetExecutionHandler();
                }

                try {
                    string location = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
                    location = Path.Combine(location, "mdhost.exe");

                    ProcessHostConsole cons = new ProcessHostConsole();
                    tmpFile = Path.GetTempFileName();
                    File.WriteAllText(tmpFile, sref + "\n" + Process.GetCurrentProcess().Id + "\n");
                    string arguments           = string.Format("{0} \"{1}\"", id, tmpFile);
                    DotNetExecutionCommand cmd = new DotNetExecutionCommand(location, arguments, AppDomain.CurrentDomain.BaseDirectory);
                    cmd.DebugMode = isDebugMode;
                    process       = executionHandlerFactory.Execute(cmd, cons);
                    Counters.ExternalHostProcesses++;

                    process.Completed += ProcessExited;
                } catch (Exception ex) {
                    if (tmpFile != null)
                    {
                        try {
                            File.Delete(tmpFile);
                        } catch {
                        }
                    }
                    LoggingService.LogError(ex.ToString());
                    throw;
                }
            }
        }
        public ExecutionPipeline Add(IExecutionHandler handler, Services.IPredication predication = null)
        {
            if (handler == null)
            {
                throw new ArgumentNullException("handler");
            }

            var item = new ExecutionPipeline(handler, predication);

            base.Add(item);

            return(item);
        }
        protected virtual async Task RunTests(Project testProject)
        {
            IExecutionHandler mode    = null;
            ExecutionContext  context = new ExecutionContext(mode, IdeApp.Workbench.ProgressMonitors.ConsoleFactory, null);
            var firstRootTest         = UnitTestService.FindRootTest(testProject);

            if (coverageCollectionCompletion != null || firstRootTest == null || !firstRootTest.CanRun(mode))
            {
                return;
            }
            coverageCollectionCompletion = new TaskCompletionSource <bool>();
            await UnitTestService.RunTest(firstRootTest, context, true).Task;
        }
Example #32
0
 public ProcessHostController(string id, uint stopDelay, IExecutionHandler executionHandlerFactory)
 {
     if (string.IsNullOrEmpty(id))
     {
         id = "?";
     }
     this.id        = id;
     this.stopDelay = stopDelay;
     this.executionHandlerFactory = executionHandlerFactory;
     timer           = new Timer();
     timer.AutoReset = false;
     timer.Elapsed  += new System.Timers.ElapsedEventHandler(WaitTimeout);
 }
Example #33
0
        public ExecutionContext(IExecutionHandler executionHandler, OperationConsoleFactory consoleFactory, ExecutionTarget target)
        {
            var targetedHandler = executionHandler as ITargetedExecutionHandler;

            if (targetedHandler != null)
            {
                target = targetedHandler.Target ?? target;
            }

            this.executionHandler = executionHandler;
            this.consoleFactory   = consoleFactory;
            this.executionTarget  = target;
        }
 public BackTest(
     IEventBus eventBus,
     IDataHandler bars, 
     IStrategy strategy, 
     IPortfolio portfolio, 
     IExecutionHandler executionHandler)
 {
     this.eventBus = eventBus;
     this.bars = bars;
     this.strategy = strategy;
     this.portfolio = portfolio;
     this.executionHandler = executionHandler;
     this.stopWatch = new Stopwatch();
 }
        public static void RunMethod(IExecutionHandler executionHandler)
        {
            if (!IdeApp.ProjectOperations.CurrentRunOperation.IsCompleted)
            {
                if (!MessageService.Confirm(GettextCatalog.GetString("An application is already running. Do you want to stop it?"), AlertButton.Stop))
                {
                    return;
                }
                StopHandler.StopBuildOperations();
                IdeApp.ProjectOperations.CurrentRunOperation.WaitForCompleted();
            }

            if (!IdeApp.Workspace.IsOpen)
            {
                if (!IdeApp.Preferences.BuildBeforeExecuting)
                {
                    IdeApp.Workbench.ActiveDocument.Run(executionHandler);
                }
                else
                {
                    IAsyncOperation asyncOperation = IdeApp.Workbench.ActiveDocument.Build();
                    asyncOperation.Completed += delegate
                    {
                        if ((asyncOperation.Success) || (IdeApp.Preferences.RunWithWarnings && asyncOperation.SuccessWithWarnings))
                        {
                            IdeApp.Workbench.ActiveDocument.Run(executionHandler);
                        }
                    };
                }
            }
            else
            {
                if (!IdeApp.Preferences.BuildBeforeExecuting)
                {
                    IdeApp.ProjectOperations.Execute(IdeApp.ProjectOperations.CurrentSelectedSolution, executionHandler);
                }
                else
                {
                    Solution        sol            = IdeApp.ProjectOperations.CurrentSelectedSolution;
                    IAsyncOperation asyncOperation = IdeApp.ProjectOperations.Build(sol);
                    asyncOperation.Completed += delegate
                    {
                        if ((asyncOperation.Success) || (IdeApp.Preferences.RunWithWarnings && asyncOperation.SuccessWithWarnings))
                        {
                            IdeApp.ProjectOperations.Execute(sol, executionHandler);
                        }
                    };
                }
            }
        }
Example #36
0
        AsyncOperation RunTest(ITreeNavigator nav, IExecutionHandler mode, bool bringToFront = true)
        {
            if (nav == null)
            {
                return(null);
            }
            UnitTest test = nav.DataItem as UnitTest;

            if (test == null)
            {
                return(null);
            }
            return(RunTests(new UnitTest [] { test }, mode, bringToFront));
        }
Example #37
0
        //TODO add cache support

        internal static void Process(List <string> executionHandlers, HttpContext context)
        {
            if (executionHandlers == null || executionHandlers.Count == 0)
            {
                return;
            }

            foreach (string typeName in executionHandlers)
            {
                IExecutionHandler handler = InstanceHelper.Create <IExecutionHandler>(typeName);

                handler.Process(context);
            }
        }
Example #38
0
		internal IAsyncOperation RunTest (UnitTest test, IExecutionHandler context, bool buildOwnerObject, bool checkCurrentRunOperation)
		{
			string testName = test.FullName;
			
			if (buildOwnerObject) {
				IBuildTarget bt = test.OwnerObject as IBuildTarget;
				if (bt != null && bt.NeedsBuilding (IdeApp.Workspace.ActiveConfiguration)) {
					if (!IdeApp.ProjectOperations.CurrentRunOperation.IsCompleted) {
						MonoDevelop.Ide.Commands.StopHandler.StopBuildOperations ();
						IdeApp.ProjectOperations.CurrentRunOperation.WaitForCompleted ();
					}
	
					AsyncOperation retOper = new AsyncOperation ();
					
					IAsyncOperation op = IdeApp.ProjectOperations.Build (bt);
					retOper.TrackOperation (op, false);
						
					op.Completed += delegate {
						// The completed event of the build operation is run in the gui thread,
						// so we need a new thread, because refreshing must be async
						System.Threading.ThreadPool.QueueUserWorkItem (delegate {
							if (op.Success) {
								RefreshTests ();
								test = SearchTest (testName);
								if (test != null) {
									Gtk.Application.Invoke (delegate {
										// RunTest must run in the gui thread
										retOper.TrackOperation (RunTest (test, context, false), true);
									});
								}
								else
									retOper.SetCompleted (false);
							}
						});
					};
					
					return retOper;
				}
			}
			
			if (checkCurrentRunOperation && !IdeApp.ProjectOperations.ConfirmExecutionOperation ())
				return NullProcessAsyncOperation.Failure;
			
			Pad resultsPad = IdeApp.Workbench.GetPad <TestResultsPad>();
			if (resultsPad == null) {
				resultsPad = IdeApp.Workbench.ShowPad (new TestResultsPad (), "MonoDevelop.NUnit.TestResultsPad", GettextCatalog.GetString ("Test results"), "Bottom", "md-solution");
			}
			
			// Make the pad sticky while the tests are runnig, so the results pad is always visible (even if minimized)
			// That's required since when running in debug mode, the layout is automatically switched to debug.
			
			resultsPad.Sticky = true;
			resultsPad.BringToFront ();
			
			TestSession session = new TestSession (test, context, (TestResultsPad) resultsPad.Content);
			
			session.Completed += delegate {
				Gtk.Application.Invoke (delegate {
					resultsPad.Sticky = false;
				});
			};

			OnTestSessionStarting (new TestSessionEventArgs { Session = session, Test = test });

			session.Start ();

			if (checkCurrentRunOperation)
				IdeApp.ProjectOperations.CurrentRunOperation = session;
			
			return session;
		}
Example #39
0
		public IAsyncOperation RunTest (UnitTest test, IExecutionHandler mode)
		{
			return RunTest (FindTestNode (test), mode, false);
		}
Example #40
0
		public IAsyncOperation ExecuteFile (string file, IExecutionHandler handler)
		{
			ExecutionContext context = new ExecutionContext (handler, IdeApp.Workbench.ProgressMonitors, IdeApp.Workspace.ActiveExecutionTarget);
			return ExecuteFile (file, context);
		}
		public TargetedExecutionHandler (IExecutionHandler handler, ExecutionTarget target)
		{
			Target = target;
			Handler = handler;
		}
Example #42
0
		void RunSelectedTest (IExecutionHandler mode)
		{
			RunTest (TreeView.GetSelectedNode (), mode);
		}
		public ExecutionContext (IExecutionHandler executionHandler, IConsoleFactory consoleFactory)
		{
			this.executionHandler = executionHandler;
			this.consoleFactory = consoleFactory;
		}
		public bool CanExecuteFile (string file, IExecutionHandler handler)
		{
			ExecutionContext context = new ExecutionContext (handler, IdeApp.Workbench.ProgressMonitors.ConsoleFactory, IdeApp.Workspace.ActiveExecutionTarget);
			return CanExecuteFile (file, context);
		}
Example #45
0
		public IAsyncOperation Execute (IBuildTarget entry, IExecutionHandler handler)
		{
			ExecutionContext context = new ExecutionContext (handler, IdeApp.Workbench.ProgressMonitors);
			return Execute (entry, context);
		}
Example #46
0
        public static void RunMethod (IExecutionHandler executionHandler)
        {
            if (!IdeApp.ProjectOperations.CurrentRunOperation.IsCompleted) {
				if (!MessageService.Confirm (GettextCatalog.GetString ("An application is already running. Do you want to stop it?"), AlertButton.Stop))
					return;
                StopHandler.StopBuildOperations ();
                IdeApp.ProjectOperations.CurrentRunOperation.WaitForCompleted ();
            }

            if (!IdeApp.Workspace.IsOpen) {
                if (!IdeApp.Preferences.BuildBeforeExecuting)
                    IdeApp.Workbench.ActiveDocument.Run (executionHandler);
                else {
                    IAsyncOperation asyncOperation = IdeApp.Workbench.ActiveDocument.Build ();
                    asyncOperation.Completed += delegate {
                        if ((asyncOperation.Success) || (IdeApp.Preferences.RunWithWarnings && asyncOperation.SuccessWithWarnings))
                            IdeApp.Workbench.ActiveDocument.Run (executionHandler);
                    };
                }
				return;
            }

			var target = GetRunTarget ();
			var op = IdeApp.ProjectOperations.CheckAndBuildForExecute (target);
			op.Completed += delegate {
				if (op.Success)
					IdeApp.ProjectOperations.Execute (target, executionHandler);
			};
        }
Example #47
0
		public static bool CanRun (IExecutionHandler executionHandler)
		{
            if (IdeApp.Workspace.IsOpen) {
				var target = GetRunTarget ();
				return target != null && IdeApp.ProjectOperations.CanExecute (target, executionHandler);
			}
            else
                return (IdeApp.Workbench.ActiveDocument != null) && (IdeApp.Workbench.ActiveDocument.CanRun (executionHandler));
		}
Example #48
0
		public IAsyncOperation RunTest (UnitTest test, IExecutionHandler context)
		{
			var result = RunTest (test, context, IdeApp.Preferences.BuildBeforeRunningTests);
			result.Completed += (OperationHandler) DispatchService.GuiDispatch (new OperationHandler (OnTestSessionCompleted));
			return result;
		}
Example #49
0
		public IAsyncOperation RunTest (UnitTest test, IExecutionHandler context)
		{
			return RunTest (test, context, IdeApp.Preferences.BuildBeforeExecuting);
		}
		public AsyncOperation Execute (IBuildTarget entry, IExecutionHandler handler, bool buildBeforeExecuting = true)
		{
			ExecutionContext context = new ExecutionContext (handler, IdeApp.Workbench.ProgressMonitors.ConsoleFactory, IdeApp.Workspace.ActiveExecutionTarget);
			return Execute (entry, context, buildBeforeExecuting);
		}
Example #51
0
		public IAsyncOperation RunTest (UnitTest test, IExecutionHandler context, bool buildOwnerObject)
		{
			return RunTest (test, context, buildOwnerObject, true);
		}
Example #52
0
		public TestSession (UnitTest test, IExecutionHandler context, TestResultsPad resultsPad)
		{
			this.test = test;
			this.context = context;
			this.monitor = new TestMonitor (resultsPad);
		}
Example #53
0
		public TestSession (UnitTest test, IExecutionHandler context, TestResultsPad resultsPad)
		{
			this.test = test;
			this.context = context;
			this.monitor = new TestMonitor (resultsPad);
			this.resultsPad = resultsPad;
			resultsPad.InitializeTestRun (test);
		}
Example #54
0
		ProcessHostController GetHost (string id, bool shared, IExecutionHandler executionHandler)
		{
			if (!shared)
				return new ProcessHostController (id, 0, executionHandler);
			
			lock (this) {
				if (externalProcess == null)
					externalProcess = new ProcessHostController ("SharedHostProcess", 10000, null);
	
				return externalProcess;
			}
		}
Example #55
0
		IAsyncOperation RunTest (ITreeNavigator nav, IExecutionHandler mode, bool bringToFront = true)
		{
			if (nav == null)
				return null;
			UnitTest test = nav.DataItem as UnitTest;
			if (test == null)
				return null;
			NUnitService.ResetResult (test.RootTest);
			
			this.buttonRun.Sensitive = false;
			this.buttonRunAll.Sensitive = false;
			this.buttonStop.Sensitive = true;

			if (bringToFront)
				IdeApp.Workbench.GetPad<TestPad> ().BringToFront ();
			runningTestOperation = testService.RunTest (test, mode);
			runningTestOperation.Completed += (OperationHandler) DispatchService.GuiDispatch (new OperationHandler (OnTestSessionCompleted));
			return runningTestOperation;
		}
Example #56
0
		public IDisposable CreateExternalProcessObject (Type type, IExecutionHandler executionHandler, IList<string> userAssemblyPaths = null)
		{
			CheckRemoteType (type);
			return (IDisposable)GetHost (type.ToString (), false, executionHandler).CreateInstance (type.Assembly.Location, type.FullName, GetRequiredAddins (type), userAssemblyPaths);
		}
Example #57
0
		public bool CanExecute (IBuildTarget entry, IExecutionHandler handler)
		{
			ExecutionContext context = new ExecutionContext (handler, IdeApp.Workbench.ProgressMonitors);
			return entry.CanExecute (context, IdeApp.Workspace.ActiveConfiguration);
		}
Example #58
0
		public IDisposable CreateExternalProcessObject (string assemblyPath, string typeName, IExecutionHandler executionHandler, params string[] requiredAddins)
		{
			return (IDisposable) GetHost (typeName, false, executionHandler).CreateInstance (assemblyPath, typeName, requiredAddins);
		}
Example #59
0
		public bool CanExecuteFile (string file, IExecutionHandler handler)
		{
			ExecutionContext context = new ExecutionContext (handler, IdeApp.Workbench.ProgressMonitors);
			return CanExecuteFile (file, context);
		}
Example #60
0
		public bool IsValidForRemoteHosting (IExecutionHandler handler)
		{
			string location = Path.GetDirectoryName (System.Reflection.Assembly.GetExecutingAssembly ().Location);
			location = Path.Combine (location, "mdhost.exe");
			return handler.CanExecute (new DotNetExecutionCommand (location));
		}