⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 staxjobaction.java

📁 Software Testing Automation Framework (STAF)的开发代码
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
                               String scriptFilesIf)    {        fUnevalScriptFiles = scriptFiles;        fScriptFilesMachine = machine;        fUnevalScriptFilesMachine = machine;        fScriptFilesIf = scriptFilesIf;    }    /**     * Gets the STAXAction object to be executed after the sub-job has started.     * @return the STAXAction object for the STAX job     */    public STAXAction getJobAction() { return fJobAction; }    /**     * Sets the name of the function to call to start the STAX job.     * @param  function    the name of the STAF service     * @param  functionIf  indicates to ignore the function specified if it     *                     evaluates to false     */    public void setJobAction(STAXAction jobAction, String jobActionIf)    {        fJobAction = jobAction;        fJobActionIf = jobActionIf;    }    /**     * Gets the request string to submit to the STAF service.     * @return the request string     */    public String getRequest() { return fRequest; }    /**     * Gets the STAX-Thread instance where this action is being executed.     * @return the STAX-Thread instance where this action is being executed     */    public STAXThread getThread() { return fThread; }    /**     * Gets the STAX-Thread instance where this action is being executed.     * @return the STAX-Thread instance where this action is being executed     */    public String getCurrentBlockName() { return fCurrentBlockName; }    /**     * Gets the timestamp for when this action was started.     * @return the timestamp for when this action was started     */    public STAXTimestamp getStartTimestamp() { return fStartTimestamp; }    /**     * Gets the job ID for the sub-job that is submitted.     * @return the job ID for the sub-job     */    public int getJobID() { return fJobID; }    /**     * Gets the name of the function used to start the STAX job     * @return the starting function name for the STAX job     */    public String getStartFunction() { return fStartFunction; }    /**     * Sets the name of the function to call to start the STAX job.     * @parm function    the name of starting function     */    public void setStartFunction(String function)    {        fStartFunction = function;    }    /**     * Gets the arguments to pass to the function called to start the STAX job.     * @return the starting function arguments for the STAX job     */    public String getStartFuncArgs() { return fStartFunctionArgs; }    /**     * Sets the arguments to pass to the function called to start the STAX job.     * @param  args    the arguments passed to the starting function     */    public void setStartFuncArgs(String args)    {        fStartFunctionArgs = args;    }    /**     * Gets a string identifying the state of this action.  It could be     * "INIT", "WAIT_REQUEST", "SUBJOB_COMPLETE", "SUBJOB_COMPLETE_WAIT_ACTION",     * "COMPLETE", or "UNKNOWN".     * @return a string identifying the state of this action.     */    public String getStateAsString()    {        switch (fState)        {            case INIT:                return INIT_STRING;            case WAIT_SUBJOB:                return WAIT_SUBJOB_STRING;            case SUBJOB_COMPLETE:                return SUBJOB_COMPLETE_STRING;            case SUBJOB_COMPLETE_WAIT_ACTION:                return SUBJOB_COMPLETE_WAIT_ACTION_STRING;            case COMPLETE:                return COMPLETE_STRING;            default:                return STATE_UNKNOWN_STRING;        }    }    public String getInfo()    {        return fName;    }    public String getDetails()    {        return "JobName:" + fName +               ";JobID:" + fJobID +               ";Request:" + fRequest +               ";State:" + getStateAsString() +               ";BlockName:" + fCurrentBlockName +               ";StartTimestamp:" + fStartTimestamp +               ";HoldThreadCondition:" + fHoldCondition;    }    // Submits an EXECUTE request to the STAX service by doing an asynchronous    // submit of the request to the local STAX machine, adds a hold thread    // condition, and waits for the submitted job to complete.    //    // If in its INIT state, it does the following:    // - Evaluates (using Python) values as needed. If a Python evaluation    //   exception occurs, it raises a STAXPythonEvaluationError signal and    //   pops itself off the action stack.    // - Submits the STAX EXECUTE request asyncronously.  If an error occurs    //   submitting the request, it sets RC and STAFResult and pops itself    //   off the action stack.    // - Adds a hold thread condition while waiting for the job to complete    //   so that another thread can become active.    // - Adds the running job to the subJobMap so that it can be listed.    // - Generates an event is generated to indicate that the sub-job has    //   been started.    //    // If in its SUBJOB_COMPLETE state, it does the following:    // - Removes its entry from the subJobMap so that it no longer will show    //   up in the list of sub-jobs.    // - Pops itself off the action stack since it is now complete.    //    // Note that this entire method is synchronized since its state can be    // changed on another thread (e.g. via the jobComplete method).    public synchronized void execute(STAXThread thread)    {        if (fState == INIT)        {            fThread = thread;            StringBuffer request = new StringBuffer("execute");            String evalElem = "";            String evalAttr = "";            try            {                // Set RC initially so if an error occurs (that does not                // terminate the job) before a STAF request is                // submitted, <if expr="RC != 0"> won't fail.                fThread.pySetVar("RC", new Integer(-1));                // Set STAFResult and STAXResult initially to Py.None                fThread.pySetVar("STAFResult", Py.None);                fThread.pySetVar("STAXResult", Py.None);                // Set STAXSubJobID initially to 0                fThread.pySetVar("STAXSubJobID", new Integer(0));                if (!fUnevalJobFile.equals(""))                {                    evalElem = "job-file";                    evalAttr = "";                    fJobFile = thread.pyStringEval(fJobFile);                    request.append(" file ").append(STAFUtil.wrapData(fJobFile));                    if (!fJobFileMachine.equals(""))                    {                        evalAttr = "machine";                        fJobFileMachine =                            thread.pyStringEval(fUnevalJobFileMachine);                        request.append(" machine ").append(                            STAFUtil.wrapData(fJobFileMachine));                    }                }                else if (!fUnevalJobData.equals(""))                {                    evalElem = "job-data";                    evalAttr = "eval";                    if (thread.pyBoolEval(fJobDataEval))                    {                        evalAttr = "";                        fJobData = thread.pyStringEval(fUnevalJobData);                    }                    request.append(" data ").append(                        STAFUtil.wrapData(fJobData));                }                if (!fUnevalName.equals(""))                {                    evalElem = "job";                    evalAttr = "name";                    fName = thread.pyStringEval(fUnevalName);                    request.append(" jobname ").append(                        STAFUtil.wrapData(fName));                }                // Evaluate the clearlogs attribute                evalElem = "job";                evalAttr = "clearlogs";                if (fUnevalClearlogs.equals(""))                {                    // Default to parent job's option if not specified                    fClearlogs = thread.getJob().getClearLogsAsString();                }                else                {                    fClearlogs = thread.pyStringEval(fUnevalClearlogs);                    if (fClearlogs.equalsIgnoreCase("parent"))                    {                        fClearlogs = thread.getJob().getClearLogsAsString();                    }                    else if (fClearlogs.equalsIgnoreCase("default"))                    {                        fClearlogs = thread.getJob().getSTAX().                                            getClearLogsAsString();                    }                    else if (fClearlogs.equalsIgnoreCase("Enabled") ||                             fClearlogs.equalsIgnoreCase("Disabled"))                    {                        // Do nothing - already set to Enabled or Disabled                    }                    else if (thread.pyBoolEval(fUnevalClearlogs))                    {                        fClearlogs = "Enabled";                    }                    else                    {                        fClearlogs = "Disabled";                    }                }                request.append(" clearlogs ").append(fClearlogs);                // Evaluate the monitor attribute                evalElem = "job";                evalAttr = "monitor";                if (fUnevalMonitor.equals(""))                {                    fMonitor = "false";                }                else if (thread.pyBoolEval(fUnevalMonitor))                {                    fMonitor = "true";                }                else                {                    fMonitor = "false";                }                // Evaluate the logtcelapsedtime attribute                evalElem = "job";                evalAttr = "logtcelapsedtime";                if (fUnevalLogTCElapsedTime.equals(""))                {                    // Default to parent job's option if not specified                    fLogTCElapsedTime =                        thread.getJob().getLogTCElapsedTimeAsString();                }                else                {                    fLogTCElapsedTime =                        thread.pyStringEval(fUnevalLogTCElapsedTime);                    if (fLogTCElapsedTime.equalsIgnoreCase("parent"))                    {                        fLogTCElapsedTime =                            thread.getJob().getLogTCElapsedTimeAsString();                    }                    else if (fLogTCElapsedTime.equalsIgnoreCase("default"))                    {                        fLogTCElapsedTime = thread.getJob().getSTAX().                                            getLogTCElapsedTimeAsString();                    }                    else if (fLogTCElapsedTime.equalsIgnoreCase("Enabled") ||                             fLogTCElapsedTime.equalsIgnoreCase("Disabled"))                    {                        // Do nothing - already set to Enabled or Disabled                    }                    else if (thread.pyBoolEval(fUnevalLogTCElapsedTime))                    {                        fLogTCElapsedTime = "Enabled";                    }                    else                    {                        fLogTCElapsedTime = "Disabled";                    }                }                request.append(" logtcelapsedtime ").append(fLogTCElapsedTime);                // Evaluate the logtcnumstarts attribute                evalElem = "job";

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -