Beispiel #1
0
        public void init(string exeName, string args)
        {
            UnitTestUtilities.CleanupExistingServers(exeName);
            executablePath = exeName + ".exe";
            ProcessStartInfo psInfo = createProcessStartInfo(args);

            try
            {
                p = Process.Start(psInfo);
                for (int i = 1; i <= 20; i++)
                {
                    Thread.Sleep(100 * i);
                    if (IsRunning())
                    {
                        break;
                    }
                }

                if (p.HasExited)
                {
                    throw new Exception("Unable to start process.");
                }

                Thread.Sleep(1000);
            }
            catch (Exception ex)
            {
                p = null;
                throw new Exception(string.Format("{0} {1} failure with error: {2}", psInfo.FileName, psInfo.Arguments, ex.Message));
            }
        }
Beispiel #2
0
        private ProcessStartInfo createProcessStartInfo(string args)
        {
            ProcessStartInfo ps = new ProcessStartInfo(executablePath);

            ps.Arguments        = args;
            ps.WorkingDirectory = UnitTestUtilities.GetConfigDir();
#if NET45
            ps.WindowStyle = ProcessWindowStyle.Hidden;
#else
            ps.CreateNoWindow        = false;
            ps.RedirectStandardError = true;
#endif
            return(ps);
        }
Beispiel #3
0
        private ProcessStartInfo createProcessStartInfo()
        {
            string           nss    = "nats-streaming-server.exe";
            ProcessStartInfo psInfo = new ProcessStartInfo(nss);

            if (debug)
            {
                psInfo.Arguments = " -SDV -DV";
            }
            else
            {
                psInfo.WindowStyle = ProcessWindowStyle.Hidden;
            }

            psInfo.WorkingDirectory = UnitTestUtilities.GetConfigDir();

            return(psInfo);
        }
Beispiel #4
0
        public void init(bool shouldDebug)
        {
            UnitTestUtilities.CleanupExistingServers();

            debug = shouldDebug;
            ProcessStartInfo psInfo = createProcessStartInfo();

            this.p = Process.Start(psInfo);
            for (int i = 0; i < 20; i++)
            {
                Thread.Sleep(500);
                if (isNatsServerRunning())
                {
                    break;
                }
            }
            // Allow the Nats streaming server to setup.
            Thread.Sleep(250);
        }
Beispiel #5
0
        private ProcessStartInfo createProcessStartInfo()
        {
            string           nss    = "nats-streaming-server.exe";
            ProcessStartInfo psInfo = new ProcessStartInfo(nss);

            if (debug)
            {
                psInfo.Arguments = " -SDV -DV";
            }
            else
            {
#if NET45
                psInfo.WindowStyle = ProcessWindowStyle.Hidden;
#else
                psInfo.CreateNoWindow        = false;
                psInfo.RedirectStandardError = true;
#endif
            }

            psInfo.WorkingDirectory = UnitTestUtilities.GetConfigDir();

            return(psInfo);
        }
Beispiel #6
0
        public void init(bool shouldDebug)
        {
            UnitTestUtilities.CleanupExistingServers();

            debug = shouldDebug;
            ProcessStartInfo psInfo = createProcessStartInfo();

            p = Process.Start(psInfo);
            for (int i = 1; i <= 20; i++)
            {
                Thread.Sleep(100 * i);
                if (isNatsServerRunning())
                {
                    break;
                }
            }

            if (p.HasExited)
            {
                throw new Exception("Server failure with exit code: " + p.ExitCode);
            }
            // Allow the Nats streaming server to setup.
            Thread.Sleep(1000);
        }