예제 #1
0
        public string ConfigureHostFile(string hostFileLocation)
        {
            StreamReader reader =new StreamReader(hostFileLocation);
            string hostFileInfo = reader.ReadToEnd();
            reader.Close();
            reader.Dispose();

            string sXml = "<RequestData xmlns=\"http://uri.org\"><details>" + hostFileInfo + "</details></RequestData>";
            string url = string.Format("http://{0}:8001/KryptonGridService/ConfigureHostFile", _ip); //System.Web.HttpUtility.UrlEncode(hostFileInfo));
            RestClient rest = new RestClient(url, HttpVerb.POST, sXml);
            string strRes = rest.MakeRequest("", true);
            return strRes;
        }
예제 #2
0
        public string InitializeSeleniumDriver(string browser, string browserInfo, string hostIp)
        {
            //string sXml = "<IntializeSeleniumGridDriveRequestData xmlns=\"http://uri.org\"><browser>" + browser + "</browser><browserInfo>" + browserInfo + "</browserInfo><hostIp>" + hostIp + "</hostIp></IntializeSeleniumGridDriveRequestData>";
            StringBuilder sXml = new StringBuilder();

            sXml.Append("<IntializeSeleniumGridDriveRequestData xmlns=\"http://uri.org\">");
            sXml.Append("<hostIp>hostip</hostIp>");
            sXml.Append("<Browsers>");
            sXml.Append("<Browser>");
            sXml.Append("<browser>browser</browser>");
            sXml.Append("<browserInfo>browserInfo</browserInfo>");
            sXml.Append("</Browser>");
            sXml.Append("<Browser>");
            sXml.Append("	<browser>browser</browser>");
            sXml.Append("	<browserInfo>browserInfo</browserInfo>");
            sXml.Append("</Browser>");
            sXml.Append("</Browsers>");
            sXml.Append("</IntializeSeleniumGridDriveRequestData>");

            string url = string.Format("http://{0}:8001/KryptonGridService/InitializeSeleniumDriver", _ip);
            RestClient rest = new RestClient(url, HttpVerb.POST, sXml.ToString());

            string returnStr = rest.MakeRequest("", true);

            bool status = CheckNodeRegistration(hostIp);
            Console.WriteLine(status);
            return status.ToString();
        }
예제 #3
0
 public string GetMachineName()
 {
     string url = string.Format("http://{0}:8001/KryptonGridService/GetMachineName", _ip);
     RestClient rest = new RestClient(url, HttpVerb.GET);
     return rest.MakeRequest();
 }
예제 #4
0
 public string StopNode()
 {
     string url = string.Format("http://{0}:8001/KryptonGridService/StopNode", _ip);
     RestClient rest = new RestClient(url, HttpVerb.POST, "<StopNode></StopNode>");
     return rest.MakeRequest();
 }
예제 #5
0
 public void StartExecutableByName(string path, string fileNameToBeUploaded)
 {
     string fileContent =Convert.ToBase64String(File.ReadAllBytes(fileNameToBeUploaded));
     string sXml = "<Executable xmlns=\"http://uri.org\"><fileNameToBeUploaded>" + Path.GetFileName(fileNameToBeUploaded) + "</fileNameToBeUploaded><fileToBeUploaded>" + fileContent + "</fileToBeUploaded><path>" + path + "</path></Executable>";
     //string sXml = "<Executable xmlns=\"http://uri.org\"><fileNameToBeUploaded>" + Path.GetFileName(fileNameToBeUploaded) + "</fileNameToBeUploaded><path>" + path + "</path><fileToBeUploaded></fileToBeUploaded></Executable>";
     string url = string.Format("http://{0}:8001/KryptonGridService/StartExecutableByName", _ip);
     RestClient rest = new RestClient(url, HttpVerb.POST, sXml);
     rest.MakeRequest("", true);
 }
예제 #6
0
 public string RestoreHostFile()
 {
     string url = string.Format("http://{0}:8001/KryptonGridService/RestoreHostFile", _ip);
     RestClient rest = new RestClient(url, HttpVerb.POST, "<resotre></resotre>");
     return rest.MakeRequest();
 }
예제 #7
0
 public string KillProcessByName(string processName)
 {
     string url = string.Format("http://{0}:8001/KryptonGridService/KillProcessByName", _ip);
     RestClient rest = new RestClient(url, HttpVerb.POST, "<ProcessInfo xmlns=\"http://uri.org\"><ProcessName>" + processName + "</ProcessName></ProcessInfo>");
     return rest.MakeRequest();
 }