📄 staxjobaction.java
字号:
/*****************************************************************************//* Software Testing Automation Framework (STAF) *//* (C) Copyright IBM Corp. 2002, 2004 *//* *//* This software is licensed under the Common Public License (CPL) V1.0. *//*****************************************************************************/package com.ibm.staf.service.stax;import com.ibm.staf.*;import com.ibm.staf.service.*;import com.ibm.staf.STAFUtil;import java.util.TreeMap;import java.util.HashMap;import java.util.Vector;import java.util.List;import java.util.ArrayList;import org.python.core.Py;/** * The representation of the action to take when a sub-job, <job>, * element is encountered. * <p> * This is produced by the STAXJobActionFactory. The resulting STAXJobAction * object describes a <job> element. It contains the job-file or job-data * to be executed and other optional data, as well as a name for the sub-job * to be executed. * * @see STAXJobActionFactory */public class STAXJobAction implements STAXAction, STAXJobCompleteListener, STAXThreadCompleteListener{ // Initial state of the action static final int INIT = 0; // State where the STAX EXECUTE request command has been submitted, and // now it's waiting for it to complete static final int WAIT_SUBJOB = 1; // State where the action has been notified that the STAX EXECUTE command // is complete static final int SUBJOB_COMPLETE = 2; // State where the job-action has completed. static final int SUBJOB_COMPLETE_WAIT_ACTION = 3; // Completion state of the action static final int COMPLETE = 4; static final String INIT_STRING = "INIT"; static final String WAIT_SUBJOB_STRING = "WAIT_SUBJOB"; static final String SUBJOB_COMPLETE_STRING = "SUBJOB_COMPLETE"; static final String SUBJOB_COMPLETE_WAIT_ACTION_STRING = "SUBJOB_COMPLETE_WAIT_ACTION"; static final String COMPLETE_STRING = "COMPLETE"; static final String STATE_UNKNOWN_STRING = "UNKNOWN"; /** * Creates a new STAXJobAction instance. */ public STAXJobAction() { } /** * Gets the factory for the action. * @return an instance of the action's factory */ public STAXJobActionFactory getActionFactory() { return fFactory; } /** * Sets the factory for the action. * @param factory an instance of the action's factory */ public void setActionFactory(STAXJobActionFactory factory) { fFactory = factory; } /** * Gets the name specified for the sub-job. * @return the name of the sub-job */ public String getName() { return fName; } /** * Sets a name used to identify the sub-job. It defaults to * the value of the function name called to start the job. * @param name the name used to identify the sub-job */ public void setName(String name) { fName = name; fUnevalName = name; } /** * Gets the clear logs option specified for the sub-job. * @return the clear log option specified for the sub-job */ public String getClearlogs() { return fClearlogs; } /** * Sets the clearlogs option which is used to determine whether * to delete the STAX Job and Job User logs before the job is * executed to ensure that only one job's contents are in the logs. * It defaults to the same value specified for its parent job. * @param clearlogs the clearlog option for the sub-job */ public void setClearlogs(String clearlogs) { fClearlogs = clearlogs; fUnevalClearlogs = clearlogs; } /** * Gets the monitor option specified for the sub-job. * @return the monitor option specified for the sub-job */ public String getMonitor() { return fMonitor; } /** * Sets the monitor option which is used to determine whether * to automatically monitor the sub-job * @param monitor the monitor option for the sub-job */ public void setMonitor(String monitor) { fMonitor = monitor; fUnevalMonitor = monitor; } /** * Gets the Log TC Elapsed Time option specified for the sub-job. * @return the Log TC Elapsed Time option specified for the sub-job */ public String getLogTCElapsedTime() { return fLogTCElapsedTime; } /** * Sets the Log TC Elapsed Time option which is used to determine whether * to log the elapsed time for testcases in summary records in the STAX * Job log and for a LIST TESTCASES request. * It defaults to the same value specified for its parent job. * @param logTCElapsedTime the logTCElapsedTime option for the sub-job */ public void setLogTCElapsedTime(String logTCElapsedTime) { fLogTCElapsedTime = logTCElapsedTime; fUnevalLogTCElapsedTime = logTCElapsedTime; } /** * Gets the Log TC Num Starts option specified for the sub-job. * @return the Log TC Num Starts option specified for the sub-job */ public String getLogTCNumStarts() { return fLogTCNumStarts; } /** * Sets the Log TC Num Starts option which is used to determine whether * to log the number of starts for testcases in summary records in the * STAX * Job log and for a LIST TESTCASES request. * It defaults to the same value specified for its parent job. * @param logTCNumStarts the logTCNumStarts option for the sub-job */ public void setLogTCNumStarts(String logTCNumStarts) { fLogTCNumStarts = logTCNumStarts; fUnevalLogTCNumStarts = logTCNumStarts; } /** * Gets the Log TC Start/Stop option specified for the sub-job. * @return the Log TC Start/Stop option specified for the sub-job */ public String getLogTCStartStop() { return fLogTCStartStop; } /** * Sets the Log TC Start/Stop option which is used to determine whether * to log start and stop status records for testcases in the STAX Job log. * It defaults to the same value specified for its parent job. * @param logTCStartStop the logTCStartStop option for the sub-job */ public void setLogTCStartStop(String logTCStartStop) { fLogTCStartStop = logTCStartStop; fUnevalLogTCStartStop = logTCStartStop; } /** * Gets the fully-qualified name of a file containing the XML document * for the STAX job to be executed. * @return the job file name */ public String getJobFile() { return fJobFile; } /** * Gets the name of the machine where the XML job file is located * @return the job file machine name */ public String getJobFileMachine() { return fJobFileMachine; } /** * Sets the fully-qualified name of a file containing the XML document * for the STAX job to be executed. * @param jobXMLFile a string containing the fully-qualified name of the * file containing the XML document for the STAX job * to be executed * @param machine a string containing the name of the machine where * the XML file is located */ public void setJobFile(String jobFile, String machine) { fJobFile = jobFile; fUnevalJobFile = jobFile; fJobFileMachine = machine; fUnevalJobFileMachine = machine; } /** * Gets the string containing the XML document for the STAX job to be * executed. * @return the job data */ public String getJobData() { return fJobData; } /** * Gets the indicator of whether the XML data is to be evaluated by Python * in the parent job. * @return the job data eval indicator */ public String getJobDataEval() { return fJobDataEval; } /** * Sets a string containing the XML document for the STAX job to be * executed. * @param jobData a string containing the XML document for the * STAX job to be executed * @param eval indicates the XML data is to be evaluated by Python * in the parent job if it evaluates to true * */ public void setJobData(String jobData, String eval) { fJobData = jobData; fUnevalJobData = jobData; fJobDataEval = eval; } /** * Gets the name of function to call to start the STAX job. * @return the starting function name for the STAX job */ public String getFunction() { return fFunction; } /** * Sets the name of the function to call to start the STAX job. * @param function the name of the starting function * @param functionIf indicates to ignore the function specified if it * evaluates to false */ public void setFunction(String function, String functionIf) { fFunction = function; fUnevalFunction = function; fFunctionIf = functionIf; } /** * 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 getFunctionArgs() { return fFunctionArgs; } /** * Sets the arguments to pass to the function called to start the STAX job. * @param args the arguments passed to the starting function * @param eval indicates the arguments are to be evaluated by Python * in the parent job if it evaluates to true * @param argsIf indicates to ignore the function args specified if it * evaluates to false */ public void setFunctionArgs(String args, String eval, String argsIf) { fFunctionArgs = args; fUnevalFunctionArgs = args; fFunctionArgsEval = eval; fFunctionArgsIf = argsIf; } /** * Gets a vector containing the scripts (Python code) specified for the job. * @return a vector containing the scripts specified for the STAX job */ public Vector getScripts() { return fScripts; } /** * Adds a script (Python code) to the scripts vector. * @param script a script consist of Python code * @param eval indicates the script is to be evaluated by Python * in the parent job if it evaluates to true * @param scriptIf indicates to ignore the script if it evaluates to * false */ public void setScripts(String script, String eval, String scriptIf) { fUnevalScripts.add(script); fScriptsEval.add(eval); fScriptsIf.add(scriptIf); } /** * Gets a vector containing the script file names specified for the job. * @return a vector containing the names of the script files */ public Vector getScriptFiles() { return fScriptFiles; } /** * Sets the name(s) of the script file(s) containing Python code to be * executed in the STAX job. * @param scriptFiles the name(s) of the script file(s) * @param machine the name of the machine where the script file(s) * are located * @param scriptFilesIf indicates to ignore the scriptfiles if it * evaluates to false */ public void setScriptFiles(String scriptFiles, String machine,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -