public AgentRecord(int id, Process p, RemoteTestAgent a, AgentStatus s)
 {
     this.Id      = id;
     this.Process = p;
     this.Agent   = a;
     this.Status  = s;
 }
        public void Register(RemoteTestAgent agent, int pid)
        {
            AgentRecord r = agentData[pid];

            if (r == null)
            {
                throw new ArgumentException("Specified process is not in the agency database", "pid");
            }
            r.Agent = agent;
        }
            public AgentRecord this[RemoteTestAgent agent]
            {
                get
                {
                    foreach (System.Collections.DictionaryEntry entry in agentData)
                    {
                        AgentRecord r = (AgentRecord)entry.Value;
                        if (r.Agent == agent)
                        {
                            return(r);
                        }
                    }

                    return(null);
                }
            }
Ejemplo n.º 4
0
			public AgentRecord this[RemoteTestAgent agent]
			{
				get
				{
					foreach( System.Collections.DictionaryEntry entry in agentData )
					{
						AgentRecord r = (AgentRecord)entry.Value;
						if ( r.Agent == agent )
							return r;
					}

					return null;
				}
			}
Ejemplo n.º 5
0
			public AgentRecord( int id, Process p, RemoteTestAgent a, AgentStatus s )
			{
				this.Id = id;
				this.Process = p;
				this.Agent = a;
				this.Status = s;
			}
Ejemplo n.º 6
0
		public void Register( RemoteTestAgent agent, int pid )
		{
			AgentRecord r = agentData[pid];
			if ( r == null )
				throw new ArgumentException( "Specified process is not in the agency database", "pid" );
			r.Agent = agent;
		}
Ejemplo n.º 7
0
		public static int Main(string[] args)
		{
            AgentId = new Guid(args[0]);
            AgencyUrl = args[1];

#if DEBUG
            if ( args.Length > 2 && args[2] == "--pause" )
                System.Windows.Forms.MessageBox.Show( "Attach debugger if desired, then press OK", "NUnit-Agent");
#endif

            // Create SettingsService early so we know the trace level right at the start
            SettingsService settingsService = new SettingsService(false);
            InternalTrace.Initialize("nunit-agent_%p.log", (InternalTraceLevel)settingsService.GetSetting("Options.InternalTraceLevel", InternalTraceLevel.Default));

			log.Info("Agent process {0} starting", Process.GetCurrentProcess().Id);
            log.Info("Running under version {0}, {1}", 
                Environment.Version, 
                RuntimeFramework.CurrentFramework.DisplayName);

			// Add Standard Services to ServiceManager
            log.Info("Adding Services");
            ServiceManager.Services.AddService(settingsService);
            ServiceManager.Services.AddService(new ProjectService());
			ServiceManager.Services.AddService( new DomainManager() );
			//ServiceManager.Services.AddService( new RecentFilesService() );
			//ServiceManager.Services.AddService( new TestLoader() );
			ServiceManager.Services.AddService( new AddinRegistry() );
			ServiceManager.Services.AddService( new AddinManager() );

			// Initialize Services
            log.Info("Initializing Services");
            ServiceManager.Services.InitializeServices();

            Channel = ServerUtilities.GetTcpChannel();

            log.Info("Connecting to TestAgency at {0}", AgencyUrl);
            try
            {
                Agency = Activator.GetObject(typeof(TestAgency), AgencyUrl) as TestAgency;
            }
            catch (Exception ex)
            {
                log.Error("Unable to connect", ex);
            }

            if (Channel != null)
            {
                log.Info("Starting RemoteTestAgent");
                RemoteTestAgent agent = new RemoteTestAgent(AgentId, Agency);

                try
                {
                    if (agent.Start())
                    {
                        log.Debug("Waiting for stopSignal");
                        agent.WaitForStop();
                        log.Debug("Stop signal received");
                    }
                    else
                        log.Error("Failed to start RemoteTestAgent");
                }
                catch (Exception ex)
                {
                    log.Error("Exception in RemoteTestAgent", ex);
                }

                log.Info("Unregistering Channel");
                try
                {
                    ChannelServices.UnregisterChannel(Channel);
                }
                catch (Exception ex)
                {
                    log.Error("ChannelServices.UnregisterChannel threw an exception", ex);
                }
            }

            log.Info("Stopping all services");
            ServiceManager.Services.StopAllServices();
            log.Info("Agent process {0} exiting", Process.GetCurrentProcess().Id);
            InternalTrace.Close();

			return 0;
		}
Ejemplo n.º 8
0
		public TestAgent( TestAgency agency, int agentId, RemoteTestAgent remoteAgent )
		{
			this.agency = agency;
			this.agentId = agentId;
			this.remoteAgent = remoteAgent;
		}
Ejemplo n.º 9
0
        public static int Main(string[] args)
        {
            AgentId = new Guid(args[0]);
            AgencyUrl = args[1];

            InternalTrace.Initialize("nunit-agent_%p.log");
            log.Info("Agent process {0} starting", Process.GetCurrentProcess().Id);
            log.Info("Running under version {0}, {1}",
                Environment.Version,
                RuntimeFramework.CurrentFramework.DisplayName);

            // Add Standard Services to ServiceManager
            log.Info("Adding Services");
            ServiceManager.Services.AddService(new SettingsService(false));
            ServiceManager.Services.AddService(new ProjectService());
            ServiceManager.Services.AddService( new DomainManager() );
            //ServiceManager.Services.AddService( new RecentFilesService() );
            //ServiceManager.Services.AddService( new TestLoader() );
            ServiceManager.Services.AddService( new AddinRegistry() );
            ServiceManager.Services.AddService( new AddinManager() );

            // Initialize Services
            log.Info("Initializing Services");
            ServiceManager.Services.InitializeServices();

            Channel = ServerUtilities.GetTcpChannel();

            log.Info("Connecting to TestAgency at {0}", AgencyUrl);
            try
            {
                Agency = Activator.GetObject(typeof(TestAgency), AgencyUrl) as TestAgency;
            }
            catch (Exception ex)
            {
                log.Error("Unable to connect", ex);
            }

            if (Channel != null)
            {
                log.Info("Starting RemoteTestAgent");
                RemoteTestAgent agent = new RemoteTestAgent(AgentId, Agency);

                try
                {
                    if (agent.Start())
                    {
                        log.Debug("Waiting for stopSignal");
                        agent.WaitForStop();
                        log.Debug("Stop signal received");
                    }
                    else
                        log.Error("Failed to start RemoteTestAgent");
                }
                catch (Exception ex)
                {
                    log.Error("Exception in RemoteTestAgent", ex);
                }

                log.Info("Unregistering Channel");
                try
                {
                    ChannelServices.UnregisterChannel(Channel);
                }
                catch (Exception ex)
                {
                    log.Error("ChannelServices.UnregisterChannel threw an exception", ex);
                }
            }

            log.Info("Stopping all services");
            ServiceManager.Services.StopAllServices();
            log.Info("Agent process {0} exiting", Process.GetCurrentProcess().Id);
            InternalTrace.Close();

            return 0;
        }
Ejemplo n.º 10
0
 public TestAgent(TestAgency agency, int agentId, RemoteTestAgent remoteAgent)
 {
     this.agency      = agency;
     this.agentId     = agentId;
     this.remoteAgent = remoteAgent;
 }