Esempio n. 1
0
        static void Main(string[] args)
        {
            AgentConfig config = new AgentConfig();

            // read --daemon
            bool bDaemonMode = ReadFlag(args, "--daemon");

            string configfile = ReadArg(args);

            int port = -1;

            string pathtoassemblies = ReadArg(args);

            if (pathtoassemblies != null)
            {
                port       = int.Parse(configfile);
                configfile = null;
            }

            // Load the test configuration file
            if (pathtoassemblies == null && configfile == null)
            {
                Console.WriteLine("Usage: agent [configfile | port path_to_assemblies] [--daemon]");
                return;
            }

            if (configfile != null)
            {
                config = AgentConfigLoader.LoadFromFile(configfile);

                if (config == null)
                {
                    Console.WriteLine("No agent.conf file found");
                }
            }
            else
            {
                config.Port             = port;
                config.PathToAssemblies = pathtoassemblies;
            }

            ConfigureLogging();

            // initialize NUnit services
            // Add Standard Services to ServiceManager
            ServiceManager.Services.AddService(new SettingsService());
            ServiceManager.Services.AddService(new DomainManager());
            ServiceManager.Services.AddService(new ProjectService());

            // Initialize Services
            ServiceManager.Services.InitializeServices();


            PNUnitAgent agent = new PNUnitAgent();

            agent.Run(config, bDaemonMode);
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            AgentConfig config = new AgentConfig();

#if NUNIT_2_5
            // Start required services
            ServiceManager.Services.AddService(new SettingsService());
            ServiceManager.Services.AddService(new DomainManager());
            // TODO: We use ProjectService in DomainManager - try to eliminate
            ServiceManager.Services.AddService(new ProjectService());
#endif

            // Load the test configuration file
            if (args.Length != 1 && args.Length != 2)
            {
                Console.WriteLine("Usage: agent [configfile | port path_to_assemblies]");
                return;
            }
            else if (args.Length == 1)
            {
                string configfile = args[0];

                config = AgentConfigLoader.LoadFromFile(configfile);

                if (config == null)
                {
                    Console.WriteLine("No agent.conf file found");
                }
            }
            else if (args.Length == 2)
            {
                config.Port             = int.Parse(args[0]);
                config.PathToAssemblies = args[1];
            }

            ConfigureLogging();

            PNUnitAgent agent = new PNUnitAgent();
            agent.Run(config);
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            ProcessNameSetter.SetProcessName("agent");

            ConfigureLogging();

            AgentConfig config = new AgentConfig();

            // read --daemon
            bool bDaemonMode = ReadFlag(args, "--daemon");

            bool bNoTimeout = ReadFlag(args, "--notimeout");

            string preloadTestRunners = ReadKeyVal(args, "--preloadrunners");

            string configfile = ReadArg(args);

            int port = DEFAULT_PORT;

            string pathtoassemblies = ReadArg(args);

            if (pathtoassemblies != null)
            {
                port       = int.Parse(configfile);
                configfile = null;
            }

            // Load the test configuration file
            if (pathtoassemblies == null && configfile == null)
            {
                Console.WriteLine(
                    "Usage: agent [configfile | port path_to_assemblies]" +
                    " [--daemon] [--noTimeout]");
                return;
            }

            if (configfile != null)
            {
                config = AgentConfigLoader.LoadFromFile(configfile);

                if (config == null)
                {
                    Console.WriteLine("No agent.conf file found");
                }
            }
            else
            {
                config.Port             = port;
                config.PathToAssemblies = pathtoassemblies;
            }

            if (bNoTimeout)
            {
                config.NoTimeout = true;
            }

            InitNUnitServices();

            PNUnitAgent agent = new PNUnitAgent();

            agent.Run(config, bDaemonMode, preloadTestRunners);
        }