예제 #1
0
        /// <see cref="IWDClientServices.StopRemoteStreamingSink"></see>
        async Task IWDClientServices.StopRemoteStreamingSink()
        {
            // A process-ID of 0 means, that the remote process has not been started yet.
            if (_processIdStreamingSink != 0)
            {
                await _remoteScriptRunner.StopScript(_processIdStreamingSink);

                _logger?.LogInformation($"Stopped remote streaming-sink with process-ID {_processIdStreamingSink}");
                _processIdStreamingSink = 0;
            }
        }
예제 #2
0
        public async Task StartQueryAndStopScript_NormalUsecase_everythingOk()
        {
            // Start script
            int processId = await _scriptRunner.StartScript(
                scriptName : TEST_SCRIPT_FOR_START_STOP,
                scriptArgs : string.Join(" ", TEST_SCRIPT_ARGS),
                stdin :      TEST_SCRIPT_STDIN
                );

            Assert.NotZero(processId);

            System.Diagnostics.Debug.Write("Waiting 11 seconds");
            for (int i = 0; i < 11; i++)
            {
                System.Threading.Thread.Sleep(1000);
                System.Diagnostics.Debug.Write(".");
            }

            // Query, if script is still running
            bool isRunning = await _scriptRunner.IsScriptRunning(processId);

            Assert.True(isRunning);

            // Stop script
            (int exitCode, List <string> stdoutLines, List <string> stderrLines) = await
                                                                                   _scriptRunner.StopScript(processId);

            // Exit code is not 5, because "sleep"-command is killed and produces an
            // exit-codes like 137.
            Assert.NotZero(exitCode);

            // The following assertions only appy, if "LetShellWindowsPopUpWhenStartScript"
            // in config.json of the ScritingRestApiServer is set to "false", so leave them
            // commented out generally:

            // The testscript writes the first two arguments to stdout
            //Assert.AreEqual( stdoutLines[0], TEST_SCRIPT_ARGS[0]);
            //Assert.AreEqual( stdoutLines[1], TEST_SCRIPT_ARGS[1]);

            // The testsript writes the third and fourth argument to stderr
            //Assert.AreEqual( stderrLines[0], TEST_SCRIPT_ARGS[2]);
            //Assert.AreEqual( stderrLines[1], TEST_SCRIPT_ARGS[3]);
        }