예제 #1
0
	/// <summary>
	/// Entry point
	/// </summary>
    public static int Main(string[] args)
    {
      
		//log
		Console.Title = "NRobotRemote";
		log.Info(String.Format("NRobotRemote v{0}",Assembly.GetExecutingAssembly().GetName().Version));
		try
		{
			//get options
			log.Debug("Parsing command line arguments");
			var config = new RemoteServiceConfig(args);
	        	
	        //start service
			RemoteService srv = new RemoteService(config);
			srv.StopRequested += OnStopHandler;
			srv.StartAsync();
				
			//wait
			System.Threading.Thread.Sleep(Timeout.Infinite);
			return 0;
		}
		catch (Exception e)
		{
			log.Error(e.ToString());
		}
		
		//abnormal exit
		System.Threading.Thread.Sleep(6000);
		return 1;

    }
 public void cmdline_valid_multiple()
 {
     var cmdline = new String[] {"-k","NRobotRemote.Test.Keywords.dll:NRobotRemote.Test.Keywords.FirstClass:NRobotRemote.Test.Keywords.xml","NRobotRemote.Test.Keywords.dll:NRobotRemote.Test.Keywords.SecondClass:NRobotRemote.Test.Keywords.xml","-p","8271"};
     var config = new RemoteServiceConfig(cmdline);
     var server = new RemoteService(config);
     server.StartAsync();
     server.Stop();
 }
 public void cmdline_valid_nodoc()
 {
     var cmdline = new String[] {"-k","NRobotRemote.Test.Keywords.dll:NRobotRemote.Test.Keywords.PublicClass","-p","8271"};
     var config = new RemoteServiceConfig(cmdline);
     var server = new RemoteService(config);
     server.StartAsync();
     server.Stop();
 }
 public void cmdline_nolibraries()
 {
     var cmdline = new String[] {"-p","8271"};
     var config = new RemoteServiceConfig(cmdline);
     var server = new RemoteService(config);
     server.StartAsync();
     server.Stop();
 }
 public void cmdline_oneitem()
 {
     var cmdline = new String[] {"NRobotRemote.Test.Keywords.dll:NRobotRemote.Test.Keywords.PublicClass"};
     var config = new RemoteServiceConfig(cmdline);
     var server = new RemoteService(config);
     server.StartAsync();
     server.Stop();
 }
 public void cmdline_gac_assembly()
 {
     var cmdline = new String[] {"-k","mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089:System.IO.File","-p","8271"};
     var config = new RemoteServiceConfig(cmdline);
     var server = new RemoteService(config);
     server.StartAsync();
     server.Stop();
 }
예제 #7
0
 public void fixture_setup()
 {
     //setup robot service
     RemoteServiceConfig config = new RemoteServiceConfig();
     config.port = 8271;
     config.AddKeywordConfig(new KeywordMapConfig() {Library = CLibrary, Type = CFirstType, DocFile = CDocFile});
     config.AddKeywordConfig(new KeywordMapConfig() {Library = CLibrary, Type = CSecondType});
     _service = new RemoteService(config);
     _service.StartAsync();
 }
예제 #8
0
 /// <summary>
 /// Creates a new instance of the robot service
 /// </summary>
 public RemoteService(RemoteServiceConfig config)
 {
     //check config
     if (config==null) throw new ArgumentException("No configuration specified");
     config.VerifyConfig();
     _config = config;
     //setup services
     _xmlrpcservice = new XmlRpcService(this);
     _httpservice = new HTTPService(this);
     //setup collection
     _keywordmaps = new KeywordMapCollection();
 }
 /// <summary>
 /// Loads config file into standard config class
 /// </summary>
 public static RemoteServiceConfig GetConfiguration()
 {
     var xmlconfig = NRobotRemoteConfiguration.GetConfig();
     var result = new RemoteServiceConfig();
     //get port
     result.port = int.Parse(xmlconfig.Port.Number);
     //get keyword assemblies
     foreach(AssemblyElement xmlasm in xmlconfig.Assemblies)
     {
         result.AddKeywordConfig(new KeywordMapConfig() { Library = xmlasm.Name, Type = xmlasm.Type, DocFile = xmlasm.DocFile } );
     }
     return result;
 }
 public void fixture_setup()
 {
     //setup robot service
     RemoteServiceConfig config = new RemoteServiceConfig();
     config.port = 8271;
     config.AddKeywordConfig(new KeywordMapConfig() {Library = CLibrary, Type = CFirstType});
     config.AddKeywordConfig(new KeywordMapConfig() {Library = CLibrary, Type = CSecondType});
     _service = new RemoteService(config);
     _service.StartAsync();
     //setup client proxies
     _firstclient = (IRemoteClient)XmlRpcProxyGen.Create(typeof(IRemoteClient));
     _secondclient = (IRemoteClient)XmlRpcProxyGen.Create(typeof(IRemoteClient));
     _firstclient.Url = "http://127.0.0.1:8271/NRobotRemote/Test/Keywords/FirstClass";
     _secondclient.Url = "http://127.0.0.1:8271/NRobotRemote/Test/Keywords/SecondClass";
 }
예제 #11
0
        /// <summary>
        /// Loads config file into standard config class
        /// </summary>
        public static RemoteServiceConfig GetConfiguration()
        {
            var xmlconfig = NRobotRemoteConfiguration.GetConfig();
            var result    = new RemoteServiceConfig();

            //get port
            result.port = int.Parse(xmlconfig.Port.Number);
            //get keyword assemblies
            foreach (AssemblyElement xmlasm in xmlconfig.Assemblies)
            {
                result.AddKeywordConfig(new KeywordMapConfig()
                {
                    Library = xmlasm.Name, Type = xmlasm.Type, DocFile = xmlasm.DocFile
                });
            }
            return(result);
        }
예제 #12
0
        //constructor
        public TrayApplication()
        {
            //setup controls
            _contextmenu = new ContextMenuStrip();
            _exitoption = new ToolStripMenuItem("Exit");
            _aboutoption = new ToolStripMenuItem("About");
            _keywordsoption = new ToolStripMenuItem("Keywords");
            _trayicon = new NotifyIcon();
            //setup tray icon and tooltip
            System.IO.Stream st;
            System.Reflection.Assembly a = Assembly.GetExecutingAssembly();
            st = a.GetManifestResourceStream("LogoIcon");
            _trayicon.Icon = new System.Drawing.Icon(st);
            _trayicon.Text = String.Format("NRobotRemoteTray version {0}",Assembly.GetExecutingAssembly().GetName().Version);
            //setup context menu
            _contextmenu.Items.Add(_keywordsoption);
            _contextmenu.Items.Add(_aboutoption);
            _contextmenu.Items.Add(_exitoption);
            //setup events
            _exitoption.Click += ExitOptionClick;
            _aboutoption.Click += AboutOptionClick;
            _keywordsoption.Click += KeywordsOptionClick;
            //display
            _trayicon.ContextMenuStrip = _contextmenu;
            _trayicon.Visible = true;

            //setup nrobotremote
            try
            {
                //get config
                _config = ConfigurationLoader.GetConfiguration();

                //start service
                RemoteService srv = new RemoteService(_config);
                srv.StopRequested += OnStopHandler;
                srv.StartAsync();
                IsRunning = true;

            }
            catch (Exception e)
            {
                MessageBox.Show(String.Format("Unable to start Remote Server: \n\n{0}",e.ToString()),"Error",MessageBoxButtons.OK);
                IsRunning = false;
            }
        }
 public void config_unknowndoc()
 {
     var config = new RemoteServiceConfig();
     config.AddKeywordConfig(new KeywordMapConfig() {Library = CLibrary, Type = CType, DocFile="unknown.xml"} );
     config.port = int.Parse(CPort);
     var server = new RemoteService(config);
     server.StartAsync();
     server.Stop();
 }
 public void config_sametype()
 {
     var config = new RemoteServiceConfig();
     config.AddKeywordConfig(new KeywordMapConfig() {Library = CLibrary, Type = CType} );
     config.AddKeywordConfig(new KeywordMapConfig() {Library = CLibrary, Type = CType} );
     config.port = int.Parse(CPort);
     var server = new RemoteService(config);
     server.StartAsync();
     server.Stop();
 }
 public void config_noport()
 {
     var config = new RemoteServiceConfig();
     config.AddKeywordConfig(new KeywordMapConfig() {Library = CLibrary, Type = CType} );
     var server = new RemoteService(config);
     server.StartAsync();
     server.Stop();
 }