Esempio n. 1
0
        private bool PerformAttachGingerAgent()
        {
            string command      = string.Empty;
            string javaExecuter = string.Empty;

            try
            {
                if (WaitForAppWindowTitle() == false)
                {
                    Error = "Failed to find the Java application with title '" + mWaitForWindowTitle_Calc + "' after " + mWaitForWindowTitleMaxTime_Calc + " seconds.";
                    return(false);
                }

                //If Auto detect port then we get available port just before doing attach
                //So for parallel execution 2 runners won't get same Port
                ePortConfigType portConfigType = (ePortConfigType)GetInputParamValue <ePortConfigType>(Fields.PortConfigParam);
                if (portConfigType == ePortConfigType.AutoDetect)
                {
                    mPort_Calc = Fields.DynamicPortPlaceHolder;
                }

                //choosing executer
                javaExecuter = Path.Combine(mJavaWSEXEPath_Calc, "java.exe");

                //arrange java application command params
                string commandParams_OneLine = string.Empty;
                commandParams_OneLine += "\"" + "AgentJarPath=" + Path.Combine(mJavaAgentPath_Calc, "GingerAgent.jar") + "\"";
                commandParams_OneLine += " \"" + "PID=" + mProcessIDForAttach.ToString() + "\"";
                commandParams_OneLine += " \"" + "ShowGingerAgentConsole=" + ShowAgent.ToString() + "\"";
                commandParams_OneLine += " \"" + "Port=" + mPort_Calc + "\"";

                //command
                command = "-jar " + "\"" + Path.Combine(mJavaAgentPath_Calc, "GingerAgentStarter.jar") + "\" " + commandParams_OneLine;

                //run commnad
                ExecuteCommandAsync(new List <string> {
                    javaExecuter, command
                });

                if (String.IsNullOrEmpty(Error) != true)
                {
                    return(false);
                }

                return(true);
            }
            catch (Exception ex)
            {
                Error = "Failed to attach the Ginger Agent with the command '" + javaExecuter + " " + command + "'";
                Reporter.ToLog(eLogLevel.ERROR, ex.StackTrace);
                return(false);
            }
        }
Esempio n. 2
0
        private bool PerformAttachGingerAgent()
        {
            string command      = string.Empty;
            string javaExecuter = string.Empty;

            try
            {
                if (WaitForAppWindowTitle() == false)
                {
                    Error = "Failed to find the Java application with title '" + mWaitForWindowTitle_Calc + "' after " + mWaitForWindowTitleMaxTime_Calc + " seconds.";
                    return(false);
                }

                //choosing executer
                javaExecuter = Path.Combine(mJavaWSEXEPath_Calc, "java.exe");

                //arrange java application command params
                string commandParams_OneLine = string.Empty;
                commandParams_OneLine += "\"" + "AgentJarPath=" + Path.Combine(mJavaAgentPath_Calc, "GingerAgent.jar") + "\"";
                commandParams_OneLine += " \"" + "PID=" + mProcessIDForAttach.ToString() + "\"";
                commandParams_OneLine += " \"" + "ShowGingerAgentConsole=" + ShowAgent.ToString() + "\"";
                commandParams_OneLine += " \"" + "Port=" + mPort_Calc + "\"";

                //command
                command = "-jar " + "\"" + Path.Combine(mJavaAgentPath_Calc, "GingerAgentStarter.jar") + "\" " + commandParams_OneLine;

                //run commnad
                ExecuteCommandAsync(new List <string> {
                    javaExecuter, command
                });

                if (String.IsNullOrEmpty(Error) != true)
                {
                    return(false);
                }

                return(true);
            }
            catch (Exception ex)
            {
                Error = "Failed to attach the Ginger Agent with the command '" + javaExecuter + " " + command + "'";
                Reporter.ToLog(eLogLevel.ERROR, ex.StackTrace);
                return(false);
            }
        }