示例#1
0
        public void Run(AgentConfig config, bool bDaemonMode)
        {
            if( config.UseDomainPool )
                mLog.Info("Agent using a domain pool to launch tests");

            mConfig = config;

            ConfigureRemoting.Configure(mConfig.Port);

            // publish
            RemotingServices.Marshal(this, PNUnit.Framework.Names.PNUnitAgentServiceName);

            // otherwise in .NET 2.0 memory grows continuosly
            FreeMemory();

            if( bDaemonMode )
            {
                // wait continously
                while (true)
                {
                    Thread.Sleep(10000);
                }
            }

            Shell shell = new Shell();

            shell.Run(mTestCounter);

            //RemotingServices.Disconnect(this);
        }
示例#2
0
        void DoRun(
            AgentConfig config, bool bDaemonMode, string preloadTestRunners)
        {
            mConfig = config;

            ConfigureRemoting.Configure(mConfig.Port);

            mProcessPool = new ProcessPool(
                preloadTestRunners,
                Path.GetFullPath(mConfig.PathToAssemblies),
                mConfig.NoTimeout);

            // publish
            RemotingServices.Marshal(this, PNUnit.Framework.Names.PNUnitAgentServiceName);

            // otherwise in .NET 2.0 memory grows continuosly
            FreeMemory();

            mProcessPool.Start();

            if (bDaemonMode)
            {
                // wait continously
                while (true)
                {
                    Thread.Sleep(10000);
                }
            }

            Shell shell = new Shell();

            shell.Run(mTestCounter);
        }
示例#3
0
 public PNUnitTestRunner(
     PNUnitTestInfo info,
     AgentConfig config)
 {
     mConfig = config;
     mPNUnitTestInfo = info;
     mbUseDomainPool = config.UseDomainPool;
 }
示例#4
0
 public PNUnitTestRunner(
     PNUnitTestInfo info,
     AgentConfig config)
 {
     mConfig         = config;
     mPNUnitTestInfo = info;
     mbUseDomainPool = config.UseDomainPool;
 }
示例#5
0
        public void Run(AgentConfig config, bool bDaemonMode)
        {
            mConfig = config;
            // init remoting
            BinaryClientFormatterSinkProvider clientProvider =
                new BinaryClientFormatterSinkProvider();
            BinaryServerFormatterSinkProvider serverProvider =
                new BinaryServerFormatterSinkProvider();

            serverProvider.TypeFilterLevel =
                System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;

            IDictionary props = new Hashtable();

            props["port"] = mConfig.Port;
            string s = System.Guid.NewGuid().ToString();

            props["name"]            = s;
            props["typeFilterLevel"] = TypeFilterLevel.Full;
            try
            {
                TcpChannel chan = new TcpChannel(
                    props, clientProvider, serverProvider);

                log.InfoFormat("Registering channel on port {0}", mConfig.Port);
#if NET_2_0
                ChannelServices.RegisterChannel(chan, false);
#else
                ChannelServices.RegisterChannel(chan);
#endif
            }
            catch (Exception e)
            {
                log.InfoFormat("Can't register channel.\n{0}", e.Message);
                return;
            }

            // publish
            RemotingServices.Marshal(this, PNUnit.Framework.Names.PNUnitAgentServiceName);

            // otherwise in .NET 2.0 memory grows continuosly
            FreeMemory();

            if (bDaemonMode)
            {
                // wait continously
                while (true)
                {
                    Thread.Sleep(10000);
                }
            }
            else
            {
                Console.ReadLine();
            }

            //RemotingServices.Disconnect(this);
        }
示例#6
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);
        }
示例#7
0
        public void Run(AgentConfig config, bool bDaemonMode)
        {
            mConfig = config;
            // init remoting
            BinaryClientFormatterSinkProvider clientProvider =
                new BinaryClientFormatterSinkProvider();
            BinaryServerFormatterSinkProvider serverProvider =
                new BinaryServerFormatterSinkProvider();
            serverProvider.TypeFilterLevel =
                System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;

            IDictionary props = new Hashtable();
            props["port"] = mConfig.Port;
            string s = System.Guid.NewGuid().ToString();
            props["name"] = s;
            props["typeFilterLevel"] = TypeFilterLevel.Full;
            try
            {
                TcpChannel chan = new TcpChannel(
                    props, clientProvider, serverProvider);

                log.InfoFormat("Registering channel on port {0}", mConfig.Port);
            #if NET_2_0
                ChannelServices.RegisterChannel(chan, false);
            #else
                ChannelServices.RegisterChannel(chan);
            #endif
            }
            catch (Exception e)
            {
                log.InfoFormat("Can't register channel.\n{0}", e.Message);
                return;
            }

            // publish
            RemotingServices.Marshal(this, PNUnit.Framework.Names.PNUnitAgentServiceName);

            // otherwise in .NET 2.0 memory grows continuosly
            FreeMemory();

            if (bDaemonMode)
            {
                // wait continously
                while (true)
                {
                    Thread.Sleep(10000);
                }
            }
            else
            {
                Console.ReadLine();
            }

            //RemotingServices.Disconnect(this);
        }
示例#8
0
 internal void Run(
     AgentConfig config, bool bDaemonMode, string preloadTestRunners)
 {
     try
     {
         DoRun(config, bDaemonMode, preloadTestRunners);
     }
     catch (Exception e)
     {
         mLog.ErrorFormat("PNUnit agent crashed!!! :{0} - {1}", e.Message, e.StackTrace);
     }
 }
示例#9
0
文件: agent.cs 项目: stantoxt/nunitv2
        public void Run(AgentConfig config, bool bDaemonMode)
        {
            if (config.UseDomainPool)
            {
                log.Info("Agent using a domain pool to launch tests");
            }
            mConfig = config;

            ConfigureRemoting(mConfig.Port);

            // publish
            RemotingServices.Marshal(this, PNUnit.Framework.Names.PNUnitAgentServiceName);

            // otherwise in .NET 2.0 memory grows continuosly
            FreeMemory();

            if (bDaemonMode)
            {
                // wait continously
                while (true)
                {
                    Thread.Sleep(10000);
                }
            }
            else
            {
                string line;
                while ((line = Console.ReadLine()) != "")
                {
                    switch (line)
                    {
                    case "gc":
                        Console.WriteLine("Cleaning up memory {0} Mb",
                                          GC.GetTotalMemory(true) / 1024 / 1024);
                        break;

                    case "collect":
                        Console.WriteLine("Collecting memory {0} Mb",
                                          GC.GetTotalMemory(false) / 1024 / 1024);
                        GC.Collect();
                        Console.WriteLine("Memory collected {0} Mb",
                                          GC.GetTotalMemory(false) / 1024 / 1024);
                        break;
                    }
                }
            }

            //RemotingServices.Disconnect(this);
        }
示例#10
0
        public void Run(AgentConfig config)
        {
            mConfig = config;
            // init remoting
            BinaryClientFormatterSinkProvider clientProvider =
                new BinaryClientFormatterSinkProvider();
            BinaryServerFormatterSinkProvider serverProvider =
                new BinaryServerFormatterSinkProvider();

            serverProvider.TypeFilterLevel =
                System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;

            IDictionary props = new Hashtable();

            props["port"] = mConfig.Port;
            string s = System.Guid.NewGuid().ToString();

            props["name"]            = s;
            props["typeFilterLevel"] = TypeFilterLevel.Full;
            try
            {
                TcpChannel chan = new TcpChannel(
                    props, clientProvider, serverProvider);

                log.InfoFormat("Registering channel on port {0}", mConfig.Port);
#if NET_2_0
                ChannelServices.RegisterChannel(chan, false);
#else
                ChannelServices.RegisterChannel(chan);
#endif
            }
            catch (Exception e)
            {
                log.InfoFormat("Can't register channel.\n{0}", e.Message);
                return;
            }

            // publish
            RemotingServices.Marshal(this, PNUnit.Framework.Names.PNUnitAgentServiceName);

            // wait for a key to finish
            Console.ReadLine();

            RemotingServices.Disconnect(this);
        }
示例#11
0
文件: agent.cs 项目: scottwis/eddie
        public void Run(AgentConfig config)
        {
            mConfig = config;
            // init remoting
            BinaryClientFormatterSinkProvider clientProvider =
                new BinaryClientFormatterSinkProvider();
            BinaryServerFormatterSinkProvider serverProvider =
                new BinaryServerFormatterSinkProvider();
            serverProvider.TypeFilterLevel =
                System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;

            IDictionary props = new Hashtable();
            props["port"] = mConfig.Port;
            string s = System.Guid.NewGuid().ToString();
            props["name"] = s;
            props["typeFilterLevel"] = TypeFilterLevel.Full;
            try
            {

                TcpChannel chan = new TcpChannel(
                    props,clientProvider,serverProvider);

                log.InfoFormat("Registering channel on port {0}", mConfig.Port);
            #if NET_2_0
                ChannelServices.RegisterChannel(chan, false);
            #else
                ChannelServices.RegisterChannel(chan);
            #endif
            }
            catch( Exception e )
            {
                log.InfoFormat("Can't register channel.\n{0}", e.Message);
                return;
            }

            // publish
            RemotingServices.Marshal(this, PNUnit.Framework.Names.PNUnitAgentServiceName);

            // wait for a key to finish
            Console.ReadLine();

            RemotingServices.Disconnect(this);
        }
示例#12
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);
		}
示例#13
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);
        }
示例#14
0
		public PNUnitTestRunner(TestInfo info, AgentConfig config)
		{
			mConfig = config;
			mTestInfo = info;
		}
示例#15
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);
        }
示例#16
0
 public PNUnitTestRunner(TestInfo info, AgentConfig config)
 {
     mConfig   = config;
     mTestInfo = info;
 }
示例#17
0
        public void Run(AgentConfig config, bool bDaemonMode)
        {
            if( config.UseDomainPool )
                log.Info("Agent using a domain pool to launch tests");
            mConfig = config;

            ConfigureRemoting(mConfig.Port);

            // publish
            RemotingServices.Marshal(this, PNUnit.Framework.Names.PNUnitAgentServiceName);

            // otherwise in .NET 2.0 memory grows continuosly
            FreeMemory();

            if( bDaemonMode )
            {
                // wait continously
                while (true)
                {
                    Thread.Sleep(10000);
                }
            }
            else
            {
                string line;
                while( (line = Console.ReadLine()) != "" )
                {
                    switch( line )
                    {
                        case "gc":
                            Console.WriteLine("Cleaning up memory {0} Mb",
                                GC.GetTotalMemory(true)/1024/1024);
                            break;
                        case "collect":
                            Console.WriteLine("Collecting memory {0} Mb",
                                GC.GetTotalMemory(false)/1024/1024);
                            GC.Collect();
                            Console.WriteLine("Memory collected {0} Mb",
                                GC.GetTotalMemory(false)/1024/1024);
                            break;
                    }
                }
            }

            //RemotingServices.Disconnect(this);
        }
示例#18
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);
        }