Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DownloaderVcs"/> class.
 /// </summary>
 protected DownloaderVcs(IIO io, Config config, IProcessExecutor process = null, IFileSystem fileSystem = null)
 {
     IO         = io;
     Config     = config;
     Process    = process ?? new BucketProcessExecutor();
     FileSystem = fileSystem ?? new FileSystemLocal(null, Process);
 }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Github"/> class.
 /// </summary>
 public Github(IIO io, Config config, IProcessExecutor process = null, ITransport transport = null)
 {
     this.io        = io;
     this.config    = config;
     this.process   = process ?? new BucketProcessExecutor(io);
     this.transport = transport ?? new Factory().CreateTransport(io, config);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="DreamMaker"/> class.
        /// </summary>
        /// <param name="byond">The value of <see cref="byond"/>.</param>
        /// <param name="ioManager">The value of <see cref="ioManager"/>.</param>
        /// <param name="configuration">The value of <see cref="configuration"/>.</param>
        /// <param name="sessionControllerFactory">The value of <see cref="sessionControllerFactory"/>.</param>
        /// <param name="eventConsumer">The value of <see cref="eventConsumer"/>.</param>
        /// <param name="chatManager">The value of <see cref="chatManager"/>.</param>
        /// <param name="processExecutor">The value of <see cref="processExecutor"/>.</param>
        /// <param name="compileJobConsumer">The value of <see cref="compileJobConsumer"/>.</param>
        /// <param name="repositoryManager">The value of <see cref="repositoryManager"/>.</param>
        /// <param name="remoteDeploymentManagerFactory">The value of <see cref="remoteDeploymentManagerFactory"/>.</param>
        /// <param name="logger">The value of <see cref="logger"/>.</param>
        /// <param name="metadata">The value of <see cref="metadata"/>.</param>
        public DreamMaker(
            IByondManager byond,
            IIOManager ioManager,
            StaticFiles.IConfiguration configuration,
            ISessionControllerFactory sessionControllerFactory,
            IEventConsumer eventConsumer,
            IChatManager chatManager,
            IProcessExecutor processExecutor,
            ICompileJobSink compileJobConsumer,
            IRepositoryManager repositoryManager,
            IRemoteDeploymentManagerFactory remoteDeploymentManagerFactory,
            ILogger <DreamMaker> logger,
            Api.Models.Instance metadata)
        {
            this.byond                          = byond ?? throw new ArgumentNullException(nameof(byond));
            this.ioManager                      = ioManager ?? throw new ArgumentNullException(nameof(ioManager));
            this.configuration                  = configuration ?? throw new ArgumentNullException(nameof(configuration));
            this.sessionControllerFactory       = sessionControllerFactory ?? throw new ArgumentNullException(nameof(sessionControllerFactory));
            this.eventConsumer                  = eventConsumer ?? throw new ArgumentNullException(nameof(eventConsumer));
            this.chatManager                    = chatManager ?? throw new ArgumentNullException(nameof(chatManager));
            this.processExecutor                = processExecutor ?? throw new ArgumentNullException(nameof(processExecutor));
            this.compileJobConsumer             = compileJobConsumer ?? throw new ArgumentNullException(nameof(compileJobConsumer));
            this.repositoryManager              = repositoryManager ?? throw new ArgumentNullException(nameof(repositoryManager));
            this.remoteDeploymentManagerFactory = remoteDeploymentManagerFactory ?? throw new ArgumentNullException(nameof(remoteDeploymentManagerFactory));
            this.logger                         = logger ?? throw new ArgumentNullException(nameof(logger));
            this.metadata                       = metadata ?? throw new ArgumentNullException(nameof(metadata));

            deploymentLock = new object();
        }
Exemple #4
0
        public void RunTests(IEnumerable <TestCase> testCasesToRun, bool isBeingDebugged,
                             IDebuggedProcessLauncher debuggedLauncher, IProcessExecutor executor)
        {
            try
            {
                Stopwatch stopwatch = Stopwatch.StartNew();

                string batch = _settings.GetBatchForTestSetup(_testDirectory, _threadId);
                SafeRunBatch(TestSetup, _settings.SolutionDir, batch, isBeingDebugged);

                _innerTestRunner.RunTests(testCasesToRun, isBeingDebugged, debuggedLauncher, executor);

                batch = _settings.GetBatchForTestTeardown(_testDirectory, _threadId);
                SafeRunBatch(TestTeardown, _settings.SolutionDir, batch, isBeingDebugged);

                stopwatch.Stop();
                _logger.DebugInfo($"{_threadName}Execution took {stopwatch.Elapsed}");

                string errorMessage;
                if (!Utils.DeleteDirectory(_testDirectory, out errorMessage))
                {
                    _logger.DebugWarning(
                        $"{_threadName}Could not delete test directory '" + _testDirectory + "': " + errorMessage);
                }
            }
            catch (Exception e)
            {
                _logger.LogError($"{_threadName}Exception while running tests: " + e);
            }
        }
Exemple #5
0
 /// <summary>
 /// Construct a <see cref="SessionControllerFactory"/>
 /// </summary>
 /// <param name="processExecutor">The value of <see cref="processExecutor"/></param>
 /// <param name="byond">The value of <see cref="byond"/></param>
 /// <param name="byondTopicSender">The value of <see cref="byondTopicSender"/></param>
 /// <param name="cryptographySuite">The value of <see cref="cryptographySuite"/></param>
 /// <param name="application">The value of <see cref="application"/></param>
 /// <param name="instance">The value of <see cref="instance"/></param>
 /// <param name="ioManager">The value of <see cref="ioManager"/></param>
 /// <param name="chat">The value of <see cref="chat"/></param>
 /// <param name="networkPromptReaper">The value of <see cref="networkPromptReaper"/></param>
 /// <param name="platformIdentifier">The value of <see cref="platformIdentifier"/></param>
 /// <param name="loggerFactory">The value of <see cref="loggerFactory"/></param>
 public SessionControllerFactory(
     IProcessExecutor processExecutor,
     IByondManager byond,
     IByondTopicSender byondTopicSender,
     ICryptographySuite cryptographySuite,
     IApplication application,
     IIOManager ioManager,
     IChat chat,
     INetworkPromptReaper networkPromptReaper,
     IPlatformIdentifier platformIdentifier,
     ILoggerFactory loggerFactory,
     Api.Models.Instance instance)
 {
     this.processExecutor   = processExecutor ?? throw new ArgumentNullException(nameof(processExecutor));
     this.byond             = byond ?? throw new ArgumentNullException(nameof(byond));
     this.byondTopicSender  = byondTopicSender ?? throw new ArgumentNullException(nameof(byondTopicSender));
     this.cryptographySuite = cryptographySuite ?? throw new ArgumentNullException(nameof(cryptographySuite));
     this.application       = application ?? throw new ArgumentNullException(nameof(application));
     this.instance          = instance ?? throw new ArgumentNullException(nameof(instance));
     this.ioManager         = ioManager ?? throw new ArgumentNullException(nameof(ioManager));
     this.chat = chat ?? throw new ArgumentNullException(nameof(chat));
     this.networkPromptReaper = networkPromptReaper ?? throw new ArgumentNullException(nameof(networkPromptReaper));
     this.platformIdentifier  = platformIdentifier ?? throw new ArgumentNullException(nameof(platformIdentifier));
     this.loggerFactory       = loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory));
 }
Exemple #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Git"/> class.
 /// </summary>
 public Git(IIO io, Config config, IProcessExecutor process, IFileSystem fileSystem)
 {
     this.io         = io;
     this.config     = config;
     this.process    = process;
     this.fileSystem = fileSystem;
 }
        private List <string> RunTestExecutableWithNewFramework(string executable, string workingDir, CommandLineGenerator.Args arguments, IProcessExecutor executor,
                                                                StreamingStandardOutputTestResultParser streamingParser)
        {
            string pathExtension   = _settings.GetPathExtension(executable);
            bool   printTestOutput = _settings.PrintTestOutput &&
                                     !_settings.ParallelTestExecution;

            if (printTestOutput)
            {
                _logger.LogInfo(
                    $"{_threadName}>>>>>>>>>>>>>>> Output of command '" + executable + " " + arguments.CommandLine + "'");
            }

            Action <string> reportOutputAction = line =>
            {
                try
                {
                    if (!_canceled)
                    {
                        streamingParser.ReportLine(line);
                    }

                    if (printTestOutput)
                    {
                        _logger.LogInfo(line);
                    }
                }
                catch (TestRunCanceledException e)
                {
                    _logger.DebugInfo($"{_threadName}Execution has been canceled: {e.InnerException?.Message ?? e.Message}");
                    Cancel();
                }
            };

            _processExecutor = executor;
            _processExecutor.ExecuteCommandBlocking(
                executable, arguments.CommandLine, workingDir, pathExtension,
                reportOutputAction);
            streamingParser.Flush();

            if (printTestOutput)
            {
                _logger.LogInfo($"{_threadName}<<<<<<<<<<<<<<< End of Output");
            }

            var consoleOutput = new List <string>();

            new TestDurationSerializer().UpdateTestDurations(streamingParser.TestResults);
            _logger.DebugInfo(
                $"{_threadName}Reported {streamingParser.TestResults.Count} test results to VS during test execution, executable: '{executable}'");
            foreach (TestResult result in streamingParser.TestResults)
            {
                if (!_schedulingAnalyzer.AddActualDuration(result.TestCase, (int)result.Duration.TotalMilliseconds))
                {
                    _logger.LogWarning($"{_threadName}TestCase already in analyzer: {result.TestCase.FullyQualifiedName}");
                }
            }
            return(consoleOutput);
        }
Exemple #8
0
        private List <string> RunTestExecutableWithNewFramework(string executable, string workingDir, IDictionary <string, string> envVars,
                                                                CommandLineGenerator.Args arguments, IProcessExecutor executor,
                                                                StreamingStandardOutputTestResultParser streamingParser)
        {
            string pathExtension   = _settings.GetPathExtension(executable);
            bool   printTestOutput = _settings.PrintTestOutput &&
                                     !_settings.ParallelTestExecution;

            if (printTestOutput)
            {
                _logger.LogInfo(String.Format(Resources.OutputOfCommandMessage, _threadName, executable, arguments.CommandLine));
            }

            Action <string> reportOutputAction = line =>
            {
                try
                {
                    if (!_canceled)
                    {
                        streamingParser.ReportLine(line);
                    }

                    if (printTestOutput)
                    {
                        _logger.LogInfo(line);
                    }
                }
                catch (TestRunCanceledException e)
                {
                    _logger.DebugInfo(String.Format(Resources.ExecutionCancelled, _threadName, e.InnerException?.Message ?? e.Message));
                    Cancel();
                }
            };

            _processExecutor = executor;
            _processExecutor.ExecuteCommandBlocking(
                executable, arguments.CommandLine, workingDir, envVars, pathExtension,
                reportOutputAction);
            streamingParser.Flush();

            if (printTestOutput)
            {
                _logger.LogInfo(String.Format(Resources.EndOfOutputMessage, _threadName));
            }

            var consoleOutput = new List <string>();

            new TestDurationSerializer().UpdateTestDurations(streamingParser.TestResults);
            _logger.DebugInfo(String.Format(Resources.ReportedResultsToVS, _threadName, streamingParser.TestResults.Count, executable));

            foreach (TestResult result in streamingParser.TestResults)
            {
                if (!_schedulingAnalyzer.AddActualDuration(result.TestCase, (int)result.Duration.TotalMilliseconds))
                {
                    _logger.LogWarning(String.Format(Resources.AlreadyInAnalyzer, _threadName, result.TestCase.FullyQualifiedName));
                }
            }
            return(consoleOutput);
        }
Exemple #9
0
        /// <summary>
        /// Construct a <see cref="WindowsByondInstaller"/>
        /// </summary>
        /// <param name="processExecutor">The value of <see cref="processExecutor"/></param>
        /// <param name="ioManager">The <see cref="IIOManager"/> for the <see cref="ByondInstallerBase"/>.</param>
        /// <param name="logger">The <see cref="ILogger"/> for the <see cref="ByondInstallerBase"/>.</param>
        public WindowsByondInstaller(IProcessExecutor processExecutor, IIOManager ioManager, ILogger <WindowsByondInstaller> logger)
            : base(ioManager, logger)
        {
            this.processExecutor = processExecutor ?? throw new ArgumentNullException(nameof(processExecutor));

            semaphore        = new SemaphoreSlim(1);
            installedDirectX = false;
        }
Exemple #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LockerBuilder"/> class.
 /// </summary>
 public LockerBuilder(IPackage[] packages, Func <ConfigLocker, bool> doSetLockData, InstallationManager installationManager, IIO io = null)
 {
     this.packages            = packages;
     this.doSetLockData       = doSetLockData;
     this.installationManager = installationManager;
     dumper  = new DumperPackage();
     process = new BucketProcessExecutor(io);
 }
Exemple #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BucketVersions"/> class.
 /// </summary>
 public BucketVersions(IIO io, Config config, ITransport transport, IFileSystem fileSystem = null, IProcessExecutor process = null)
 {
     this.io         = io;
     this.config     = config;
     this.transport  = transport;
     this.fileSystem = fileSystem ?? new FileSystemLocal();
     this.process    = process ?? new BucketProcessExecutor(io);
 }
Exemple #12
0
 public DotnetTestRunner(string path, IProcessExecutor processProxy, ITotalNumberOfTestsParser totalNumberOfTestsParser, OptimizationFlags flags)
 {
     _totalNumberOfTestsParser = totalNumberOfTestsParser;
     _flags          = flags;
     Path            = path;
     ProcessExecutor = processProxy;
     CoverageMutants = new TestCoverageInfos();
 }
 public DotnetTestRunner(string path, IProcessExecutor processProxy, OptimizationFlags flags, IEnumerable<string> testBinariesPaths)
 {
     _logger = ApplicationLogging.LoggerFactory.CreateLogger<DotnetTestRunner>();
     _flags = flags;
     _projectFile = path;
     _processExecutor = processProxy;
     CoverageMutants = new TestCoverageInfos();
     _testBinariesPaths = testBinariesPaths;
 }
Exemple #14
0
        public Process(ProcessId id, IProcessLogger logger, IProcessSetup processSetup, IProcessExecutor processExecutor)
        {
            Guard.IsNotNull(id, nameof(ProcessId));

            Id               = id.CurrentGuid;
            _logger          = logger;
            _processSetup    = processSetup;
            _processExecutor = processExecutor;
        }
Exemple #15
0
        /// <summary>
        /// Executes the given command with command line.
        /// </summary>
        /// <param name="process">The <see cref="IProcessExecutor"/> instance.</param>
        /// <param name="command">The command that will be executed.</param>
        /// <param name="stdout">The output string from the command.</param>
        /// <param name="stderr">The error string from the command.</param>
        /// <param name="cwd">Specify the execution path of the command.</param>
        /// <returns>The return status of the executed command.</returns>
        public static int Execute(this IProcessExecutor process, string command, out string stdout, out string stderr, string cwd = null)
        {
            var ret = process.Execute(command, out string[] output, out string[] error, cwd);

            stdout = string.Join(Environment.NewLine, output ?? Array.Empty <string>());
            stderr = string.Join(Environment.NewLine, error ?? Array.Empty <string>());

            return(ret);
        }
Exemple #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EventDispatcher"/> class.
 /// </summary>
 public EventDispatcher(Bucket bucket, IIO io, IProcessExecutor process = null, IFileSystem fileSystem = null)
 {
     this.bucket     = bucket;
     this.io         = io;
     this.process    = process ?? new BucketProcessExecutor(io);
     listeners       = new Dictionary <string, IList <EventHandler> >();
     eventStack      = new Stack <string>();
     this.fileSystem = fileSystem ?? new FileSystemLocal();
 }
Exemple #17
0
        public DotnetTestRunner(string path, IProcessExecutor processProxy, OptimizationFlags flags, ILogger logger = null)
        {
            _logger = logger ?? ApplicationLogging.LoggerFactory.CreateLogger <DotnetTestRunner>();

            _flags           = flags;
            _path            = Path.GetDirectoryName(FilePathUtils.ConvertPathSeparators(path));
            _processExecutor = processProxy;
            CoverageMutants  = new TestCoverageInfos();
        }
Exemple #18
0
 public NugetExecutor(EnvironmentSettings environmentSettings, IProcessExecutor processExecutor,
                      IWorkingDirectoriesProvider workingDirectoriesProvider)
 {
     environmentSettings.CheckArgumentNull(nameof(environmentSettings));
     processExecutor.CheckArgumentNull(nameof(processExecutor));
     workingDirectoriesProvider.CheckArgumentNull(nameof(workingDirectoriesProvider));
     _environmentSettings        = environmentSettings;
     _processExecutor            = processExecutor;
     _workingDirectoriesProvider = workingDirectoriesProvider;
 }
        /// <summary>
        /// Construct a <see cref="WindowsByondInstaller"/>
        /// </summary>
        /// <param name="processExecutor">The value of <see cref="processExecutor"/></param>
        /// <param name="ioManager">The <see cref="IIOManager"/> for the <see cref="ByondInstallerBase"/>.</param>
        /// <param name="logger">The <see cref="ILogger"/> for the <see cref="ByondInstallerBase"/>.</param>
        public WindowsByondInstaller(IProcessExecutor processExecutor, IIOManager ioManager, ILogger <WindowsByondInstaller> logger)
            : base(ioManager, logger)
        {
            this.processExecutor = processExecutor ?? throw new ArgumentNullException(nameof(processExecutor));

            PathToUserByondFolder = IOManager.ResolvePath(IOManager.ConcatPath(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "BYOND"));

            semaphore        = new SemaphoreSlim(1);
            installedDirectX = false;
        }
        private List <string> RunTestExecutable(string executable, string workingDir, CommandLineGenerator.Args arguments, bool isBeingDebugged, IDebuggedProcessExecutorFactory processExecutorFactory,
                                                StreamingStandardOutputTestResultParser streamingParser)
        {
            string pathExtension         = _settings.GetPathExtension(executable);
            bool   isTestOutputAvailable = !isBeingDebugged || _settings.DebuggerKind > DebuggerKind.VsTestFramework;
            bool   printTestOutput       = _settings.PrintTestOutput &&
                                           !_settings.ParallelTestExecution &&
                                           isTestOutputAvailable;

            void OnNewOutputLine(string line)
            {
                try
                {
                    if (!_canceled)
                    {
                        streamingParser.ReportLine(line);
                    }
                }
                catch (TestRunCanceledException e)
                {
                    _logger.DebugInfo($"{_threadName}Execution has been canceled: {e.InnerException?.Message ?? e.Message}");
                    Cancel();
                }
            }

            _processExecutor = isBeingDebugged
                ? _settings.DebuggerKind == DebuggerKind.VsTestFramework
                    ? processExecutorFactory.CreateFrameworkDebuggingExecutor(printTestOutput, _logger)
                    : processExecutorFactory.CreateNativeDebuggingExecutor(
                _settings.DebuggerKind == DebuggerKind.Native ? DebuggerEngine.Native : DebuggerEngine.ManagedAndNative,
                printTestOutput, _logger)
                : processExecutorFactory.CreateExecutor(printTestOutput, _logger);
            int exitCode = _processExecutor.ExecuteCommandBlocking(
                executable, arguments.CommandLine, workingDir, pathExtension,
                isTestOutputAvailable ? (Action <string>)OnNewOutputLine : null);

            streamingParser.Flush();

            ExecutableResults.Add(new ExecutableResult(executable, exitCode, streamingParser.ExitCodeOutput,
                                                       streamingParser.ExitCodeSkip));

            var consoleOutput = new List <string>();

            new TestDurationSerializer().UpdateTestDurations(streamingParser.TestResults);
            _logger.DebugInfo(
                $"{_threadName}Reported {streamingParser.TestResults.Count} test results to VS during test execution, executable: '{executable}'");
            foreach (TestResult result in streamingParser.TestResults)
            {
                if (!_schedulingAnalyzer.AddActualDuration(result.TestCase, (int)result.Duration.TotalMilliseconds))
                {
                    _logger.DebugWarning($"{_threadName}TestCase already in analyzer: {result.TestCase.FullyQualifiedName}");
                }
            }
            return(consoleOutput);
        }
        /// <summary>
        /// Construct <see cref="Configuration"/>
        /// </summary>
        /// <param name="ioManager">The value of <see cref="ioManager"/></param>
        /// <param name="synchronousIOManager">The value of <see cref="synchronousIOManager"/></param>
        /// <param name="symlinkFactory">The value of <see cref="symlinkFactory"/></param>
        /// <param name="processExecutor">The value of <see cref="processExecutor"/></param>
        /// <param name="postWriteHandler">The value of <see cref="postWriteHandler"/></param>
        /// <param name="logger">The value of <see cref="logger"/></param>
        public Configuration(IIOManager ioManager, ISynchronousIOManager synchronousIOManager, ISymlinkFactory symlinkFactory, IProcessExecutor processExecutor, IPostWriteHandler postWriteHandler, ILogger <Configuration> logger)
        {
            this.ioManager            = ioManager ?? throw new ArgumentNullException(nameof(ioManager));
            this.synchronousIOManager = synchronousIOManager ?? throw new ArgumentNullException(nameof(synchronousIOManager));
            this.symlinkFactory       = symlinkFactory ?? throw new ArgumentNullException(nameof(symlinkFactory));
            this.processExecutor      = processExecutor ?? throw new ArgumentNullException(nameof(processExecutor));
            this.postWriteHandler     = postWriteHandler ?? throw new ArgumentNullException(nameof(postWriteHandler));
            this.logger = logger ?? throw new ArgumentNullException(nameof(logger));

            semaphore = new SemaphoreSlim(1);
        }
Exemple #22
0
        public void Initialize()
        {
            root       = Helper.GetTestFolder <TestsGit>();
            fileSystem = new FileSystemLocal(root);
            process    = new BucketProcessExecutor();
            config     = new Config();

            fileSystem.Delete();

            git = new Git(IONull.That, config, process, fileSystem);
        }
Exemple #23
0
 public Push(
     ILoggerFactory loggerFactory,
     RoboNuGetFile roboNuGetFile,
     IFileSearch fileSearch,
     IProcessExecutor processExecutor
     ) : base(loggerFactory)
 {
     _roboNuGetFile   = roboNuGetFile;
     _fileSearch      = fileSearch;
     _processExecutor = processExecutor;
 }
        public static int ExecuteBatchFileBlocking(this IProcessExecutor executor, string batchFile, string parameters, string workingDir, string pathExtension, Action <string> reportOutputLine)
        {
            if (!File.Exists(batchFile))
            {
                throw new FileNotFoundException("File not found", batchFile);
            }

            string command = Path.Combine(Environment.SystemDirectory, "cmd.exe");

            return(executor.ExecuteCommandBlocking(command, $"/C \"{batchFile}\" {parameters}", workingDir, pathExtension, new Dictionary <string, string>(),
                                                   reportOutputLine));
        }
Exemple #25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DownloaderZip"/> class.
 /// </summary>
 public DownloaderZip(
     IIO io,
     Config config,
     ITransport transport,
     IEventDispatcher eventDispatcher = null,
     ICache cache             = null,
     IFileSystem fileSystem   = null,
     IProcessExecutor process = null)
     : base(io, config, transport, eventDispatcher, cache, fileSystem)
 {
     extractor = new ExtractorZip(io, GetFileSystem(), process ?? new BucketProcessExecutor(io));
 }
Exemple #26
0
        /// <summary>
        /// CTOR
        /// </summary>
        public WebMediator()
        {
            // Order is important
            CustomUrlHandlers = new List <ICustomUrlHandler>
            {
                new DocsHandler()
            };

            // order is not important
            Filters = new List <IFilter>
            {
                new TypeFilter(),
                new HttpMethodFilter(),
                new RouteFilter()
            };

            // order is not important
            FactoryFilters = new List <IFactoryFilter> {
                new IsCachedFactoryFilter()
            };

            DefaultModelBinders = new Dictionary <SignalsApiMethod, BaseModelBinder>
            {
                { SignalsApiMethod.OPTIONS, new FromQuery() },
                { SignalsApiMethod.GET, new FromQuery() },
                { SignalsApiMethod.HEAD, new FromHeader() },
                { SignalsApiMethod.POST, new FromBody() },
                { SignalsApiMethod.PUT, new FromBody() },
                { SignalsApiMethod.DELETE, new FromQuery() }
            };

            // order is important, JsonResult is default fallback
            ResultHandlers = new List <IResultHandler> {
                new HeaderAdderHandler(),
                new AuthenticationFailResultFilter(),
                new AuthorizationFailResultFilter(),
                new UnmanagedFailResultFilter(),
                new SpecificationFailResultFilter(),
                new CodeSpecificFailResultFilter(),
                new GeneralFailResultFilter(),
                new CacheResultHandler(),
                new FileResultHandler(),
                new XmlResultHandler(),
                new NativeResultHandler(),
                new JsonResultHandler()
            };

            // get process repo instance
            ProcessRepository = SystemBootstrapper.GetInstance <ProcessRepository>();
            ProcessFactory    = SystemBootstrapper.GetInstance <IProcessFactory>();
            ProcessExecutor   = SystemBootstrapper.GetInstance <IProcessExecutor>();
        }
Exemple #27
0
        public void Run()
        {
            IProcessExecutor process = ServiceFactory.createProcessExecutor();

            try
            {
                process.EjecuteProcess(1, "userAutorizado", "1234");
            }
            catch (Exception e)
            {
                Console.WriteLine(e.StackTrace);
            }
        }
 /// <summary>
 /// Construct a <see cref="SessionPersistor"/>
 /// </summary>
 /// <param name="databaseContextFactory">The value of <see cref="databaseContextFactory"/></param>
 /// <param name="dmbFactory">The value of <see cref="dmbFactory"/></param>
 /// <param name="processExecutor">The value of <see cref="processExecutor"/></param>
 /// <param name="logger">The value of <see cref="logger"/></param>
 /// <param name="metadata">The value of <see cref="metadata"/></param>
 public SessionPersistor(
     IDatabaseContextFactory databaseContextFactory,
     IDmbFactory dmbFactory,
     IProcessExecutor processExecutor,
     ILogger <SessionPersistor> logger,
     Api.Models.Instance metadata)
 {
     this.databaseContextFactory = databaseContextFactory ?? throw new ArgumentNullException(nameof(databaseContextFactory));
     this.dmbFactory             = dmbFactory ?? throw new ArgumentNullException(nameof(dmbFactory));
     this.processExecutor        = processExecutor ?? throw new ArgumentNullException(nameof(processExecutor));
     this.logger   = logger ?? throw new ArgumentNullException(nameof(logger));
     this.metadata = metadata ?? throw new ArgumentNullException(nameof(metadata));
 }
Exemple #29
0
        public void Initialize()
        {
            root    = Helper.GetTestFolder <TestsDriverGit>();
            process = new BucketProcessExecutor()
            {
                Cwd = root
            };
            fileSystem = new FileSystemLocal(root);
            config     = new Config();

            fileSystem.Delete();
            Directory.CreateDirectory(root);
        }
Exemple #30
0
        public DotnetTestRunner(string path, IProcessExecutor processProxy, OptimizationFlags flags, IEnumerable <string> testBinariesPaths)
        {
            _logger            = ApplicationLogging.LoggerFactory.CreateLogger <DotnetTestRunner>();
            _flags             = flags;
            _projectFile       = FilePathUtils.NormalizePathSeparators(path);
            _processExecutor   = processProxy;
            _testBinariesPaths = testBinariesPaths;

            _server = new CommunicationServer("CoverageCollector");
            _server.SetLogger((msg) => _logger.LogDebug(msg));
            _server.RaiseNewClientEvent += ConnectionEstablished;
            _server.Listen();
        }
        private void RegisterProviders(CodeMetricsRunner runner, ILogger logger, IProcessExecutor processExecutor)
        {
            if (Providers.Length <= 0)
                throw new MSBuildCodeMetricsTaskException("At least one Provider must me informed in Providers property");

            foreach (ITaskItem item in Providers)
            {
                string typeName = item.ItemSpec;
                ICodeMetricsProvider provider = CreateProviderInstance(typeName, item);
                _providers.Add(provider.Name, provider);

                runner.RegisterProvider(provider);
                if (provider is ILoggableCodeMetricsProvider)
                    ((ILoggableCodeMetricsProvider)provider).Logger = logger;
                if (provider is IProcessExecutorCodeMetricsProvider)
                    ((IProcessExecutorCodeMetricsProvider)provider).ProcessExecutor = processExecutor;
            }
        }