Пример #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_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_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_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();
 }
 public void fixture_setup()
 {
     //setup robot service
     _service = new RemoteService(CLibrary,CType,CPort,CDocFile);
     _service.StartAsync();
     //setup client proxy
     _client = (IRemoteClient)XmlRpcProxyGen.Create(typeof(IRemoteClient));
     _client.Url = "http://127.0.0.1:" + CPort + "/" + CUrl;
 }
Пример #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();
 }
        public void fixture_setup()
        {
            //copy NRobotRemote.Test.Keywords.dll to a temp directory
            string tempDirectory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
               			Directory.CreateDirectory(tempDirectory);
               			string asmpath = Path.Combine(tempDirectory,CLibrary);
               			File.Copy(CLibrary,asmpath);

            //setup robot service
            _service = new RemoteService(asmpath,CType,CPort,CDocFile);
            _service.StartAsync();
        }
Пример #9
0
 /// <summary>
 /// Constructor
 /// </summary>
 public HTTPService(RemoteService service)
 {
     //check
     if (service==null) throw new Exception("Unable to instanciate HTTPService - Service instance not specified");
     _service = service;
     //setup http listener
     _listener = new HttpListener();
     _listener.Prefixes.Add(String.Format("http://*:{0}/", _service._config.port));
     //set statuses
     _islistening = false;
     _isprocessing = false;
 }
 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
        //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 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 config_noport()
 {
     var config = new RemoteServiceConfig();
     config.AddKeywordConfig(new KeywordMapConfig() {Library = CLibrary, Type = CType} );
     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_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 docfilenotfound()
 {
     var server = new RemoteService(CLibrary,CType,CPort,"c:\randomdocfile.xml");
     server.StartAsync();
     server.Stop();
 }
 public void librarynotfound()
 {
     var server = new RemoteService("c:\\randomlibrary.dll",CType,CPort,null);
     server.StartAsync();
     server.Stop();
 }
 public void startandstop()
 {
     var server = new RemoteService(CLibrary,CType,CPort,null);
     server.StartAsync();
     server.Stop();
     server.StartAsync();
     server.Stop();
 }
 public void nonnumericport()
 {
     var server = new RemoteService(CLibrary,CType,"notanumber",null);
     server.StartAsync();
     server.Stop();
 }
 public void nolibrary()
 {
     var server = new RemoteService(null,CType,CPort,null);
     server.StartAsync();
     server.Stop();
 }
 public void multipleservers()
 {
     var server1 = new RemoteService(CLibrary,CType,CPort,null);
     var server2 = new RemoteService(CLibrary,CType,"8272",null);
     server1.StartAsync();
     server2.StartAsync();
     server1.Stop();
     server2.Stop();
 }
 public void unknowntype()
 {
     var server = new RemoteService(CLibrary,"Not a valid type",CPort,null);
     server.StartAsync();
     server.Stop();
 }
 public void noport()
 {
     var server = new RemoteService(CLibrary,CType,null,null);
     server.StartAsync();
     server.Stop();
 }
 public void duplicatekeywords()
 {
     var server = new RemoteService(CLibrary,"NRobotRemote.Test.Keywords.DuplicateMethod",CPort,null);
     server.StartAsync();
     server.Stop();
 }
 public void notype()
 {
     var server = new RemoteService(CLibrary,null,CPort,null);
     server.StartAsync();
     server.Stop();
 }
Пример #26
0
    	//constructor
		public XmlRpcService(RemoteService service) 
		{
			if (service==null) throw new Exception("No service specified to XmlRpcService constructor");
			_service = service;
		}