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

📄 staxjobaction.java

📁 Software Testing Automation Framework (STAF)的开发代码
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
                return;            }            // Set to the current date and time.            fStartTimestamp = new STAXTimestamp();            // Add the running STAX EXECUTE command to the subJobMap            TreeMap subJobs = (TreeMap)fThread.getJob().                               getData("subJobMap");            synchronized (subJobs)            {                subJobs.put(String.valueOf(fJobID), this);            }            // Set Current Block Name            try            {                fCurrentBlockName = fThread.pyStringEval("STAXCurrentBlock");            }            catch (STAXPythonEvaluationException e)            {                fCurrentBlockName = "";  //Shouldn't happen            }            // Generate a start event for a sub-job            HashMap subJobMap = new HashMap();            subJobMap.put("type", "subjob");            subJobMap.put("block", fCurrentBlockName);            subJobMap.put("status", "start");            subJobMap.put("jobID", String.valueOf(fJobID));            subJobMap.put("jobName", fName);            if (!fJobFile.equals(""))            {                subJobMap.put("jobfile", fJobFile);            }            else            {                subJobMap.put("jobfile", STAX.INLINE_DATA);            }            subJobMap.put("jobfilemachine", fJobFileMachine);            subJobMap.put("function", fStartFunction);            subJobMap.put("functionargs", fStartFunctionArgs);            subJobMap.put("clearlogs", fClearlogs);            subJobMap.put("monitor", fMonitor);            subJobMap.put("logtcelapsedtime", fLogTCElapsedTime);            subJobMap.put("logtcnumstarts", fLogTCNumStarts);            subJobMap.put("logtcstartstop", fLogTCStartStop);            subJobMap.put("scriptfilesmachine", fScriptFilesMachine);            // Convert the script file vector to a list            List scriptFileList = new ArrayList();            for (int i = 0; i < fScriptFiles.size(); i++)            {                scriptFileList.add((String)fScriptFiles.elementAt(i));            }            subJobMap.put("scriptFileList", STAFMarshallingContext.marshall(                scriptFileList, new STAFMarshallingContext()));            // Convert the script vector to a list            List scriptList = new ArrayList();            for (int i = 0; i < fScripts.size(); i++)            {                scriptList.add((String)fScripts.elementAt(i));            }            subJobMap.put("scriptList", STAFMarshallingContext.marshall(                scriptList, new STAFMarshallingContext()));            subJobMap.put("startdate",                          fSubJob.getStartTimestamp().getDateString());            subJobMap.put("starttime",                          fSubJob.getStartTimestamp().getTimeString());            fThread.getJob().generateEvent(                STAXJobActionFactory.STAX_SUBJOB_EVENT,                subJobMap);            fThread.addCondition(fHoldCondition);        }        else if (fState == SUBJOB_COMPLETE)        {            synchronized(this)            {                fState = COMPLETE;                fThread.popAction();                // Remove from map of currently executing sub-jobs                TreeMap subJobs = (TreeMap)fThread.getJob().                    getData("subJobMap");                                 synchronized (subJobs)                {                    subJobs.remove(String.valueOf(fJobID));                }            }        }        else if (fState == COMPLETE)        {            // Note: We shouldn't be called in this state.            fThread.popAction();        }    }    // Note that this entire method is synchronized since the state of the    // action can be changed on another thread (via the jobComplete method).    public synchronized void handleCondition(STAXThread thread,        STAXCondition cond)    {        // Terminate the job        if (fState == WAIT_SUBJOB)        {            thread.getJob().submitAsyncForget(                "local", fThread.getJob().getSTAX().getServiceName(),                "TERMINATE JOB " + fJobID);        }        // Generate an event to indicate that the sub-job is stopped        HashMap subJobMap = new HashMap();        subJobMap.put("type", "subjob");        subJobMap.put("block", fCurrentBlockName);        subJobMap.put("status", "stop");        subJobMap.put("jobID", String.valueOf(fJobID));        subJobMap.put("result", fThread.getJob().getResult().toString());        fThread.getJob().generateEvent(            STAXJobActionFactory.STAX_SUBJOB_EVENT,            subJobMap);        // Remove from map of currently executing sub-jobs        TreeMap subJobs = (TreeMap)fThread.getJob().                           getData("subJobMap");        synchronized (subJobs)        {            subJobs.remove(String.valueOf(fJobID));        }        fState = COMPLETE;        thread.removeCondition(fHoldCondition);        thread.popAction();    }    public STAXAction cloneAction()    {        STAXJobAction clone = new STAXJobAction();        clone.fUnevalName = fUnevalName;        clone.fUnevalClearlogs = fUnevalClearlogs;        clone.fUnevalMonitor = fUnevalMonitor;        clone.fUnevalLogTCElapsedTime = fUnevalLogTCElapsedTime;        clone.fUnevalLogTCNumStarts = fUnevalLogTCNumStarts;        clone.fUnevalLogTCStartStop = fUnevalLogTCStartStop;        clone.fUnevalJobFile = fUnevalJobFile;        clone.fUnevalJobFileMachine = fUnevalJobFileMachine;        clone.fUnevalJobData = fUnevalJobData;        clone.fUnevalFunction = fUnevalFunction;        clone.fUnevalFunctionArgs = fUnevalFunctionArgs;        clone.fUnevalScripts = fUnevalScripts;        clone.fUnevalScriptFiles = fUnevalScriptFiles;        clone.fUnevalScriptFilesMachine = fUnevalScriptFilesMachine;        clone.fCurrentBlockName = fCurrentBlockName;        clone.fFactory = fFactory;        clone.fName = fName;        clone.fClearlogs = fClearlogs;        clone.fMonitor = fMonitor;        clone.fJobFile = fJobFile;        clone.fJobFileMachine = fJobFileMachine;        clone.fJobData = fJobData;        clone.fJobDataEval = fJobDataEval;        clone.fFunction = fFunction;        clone.fFunctionIf = fFunctionIf;        clone.fFunctionArgs = fFunctionArgs;        clone.fFunctionArgsIf = fFunctionArgsIf;        clone.fFunctionArgsEval = fFunctionArgsEval;        clone.fScripts = fScripts;        clone.fScriptsIf = fScriptsIf;        clone.fScriptsEval = fScriptsEval;        clone.fScriptFiles = fScriptFiles;        clone.fScriptFilesIf = fScriptFilesIf;        clone.fScriptFilesMachine = fScriptFilesMachine;        clone.fJobAction = fJobAction;        clone.fJobActionIf = fJobActionIf;        return clone;    }    // jobComplete is a STAXJobCompleteListener interface method    //    // Called when the submitted sub-job copmletes so it can set variables    // RC and STAFResult with the result from the STAX EXECUTE request    // and remove the hold thread condition and schedule the thread to run.    // Generates an event to indicate that the submitted sub-job has completed.    //    // Note that this entire method is synchronized since its state can be    // changed on another thread (e.g. via the execute and handleCondition    // methods).    public synchronized void jobComplete(STAXJob job)    {        if (fState == COMPLETE) return;        // Assign STAXResult variable        fThread.pySetVar("STAXResult", job.getResult());        // Generate a stop event for the sub-job        HashMap subJobMap = new HashMap();        subJobMap.put("type", "subjob");        subJobMap.put("block", fCurrentBlockName);        subJobMap.put("status", "stop");        subJobMap.put("jobID", String.valueOf(fJobID));        subJobMap.put("result", job.getResult().toString());        fThread.getJob().generateEvent(            STAXJobActionFactory.STAX_SUBJOB_EVENT,            subJobMap);        if (fThreadMap.isEmpty())        {            fState = SUBJOB_COMPLETE;            fThread.removeCondition(fHoldCondition);            fThread.schedule();        }        else        {            fState = SUBJOB_COMPLETE_WAIT_ACTION;        }    }    public synchronized void threadComplete(STAXThread thread, int endCode)    {        synchronized(fThreadMap)        {            fThreadMap.remove(new Integer(thread.getThreadNumber()));            if (fThreadMap.isEmpty() &&                (fState == SUBJOB_COMPLETE_WAIT_ACTION))            {                fState = SUBJOB_COMPLETE;                fThread.removeCondition(fHoldCondition);                fThread.schedule();            }        }    }    STAXThread fThread = null;    int fState = INIT;    private STAXHoldThreadCondition fHoldCondition =         new STAXHoldThreadCondition("Job");    private String fName = new String();    private String fClearlogs = new String();    private String fMonitor = new String();    private String fLogTCElapsedTime = new String();    private String fLogTCNumStarts = new String();    private String fLogTCStartStop = new String();    private String fJobFile = new String();    private String fJobFileMachine = new String();    private String fJobData = new String();    private String fJobDataEval = new String();    private String fFunction = new String();    private String fFunctionIf = new String();    private String fFunctionArgs = new String();    private String fFunctionArgsIf = new String();    private String fFunctionArgsEval = new String();    private Vector fScripts = new Vector();    private Vector fScriptsIf = new Vector();    private Vector fScriptsEval = new Vector();    private Vector fScriptFiles = new Vector();    private String fScriptFilesIf = new String();    private String fScriptFilesMachine = new String();    private STAXAction fJobAction = null;    private String fJobActionIf = new String();    private boolean fJobActionFlag = true;    private String fUnevalName = new String();    private String fUnevalClearlogs = new String();    private String fUnevalMonitor = new String();    private String fUnevalLogTCElapsedTime = new String();    private String fUnevalLogTCNumStarts = new String();    private String fUnevalLogTCStartStop = new String();    private String fUnevalJobFile = new String();    private String fUnevalJobFileMachine = new String();    private String fUnevalJobData = new String();    private String fUnevalFunction = new String();    private String fUnevalFunctionArgs = new String();    private Vector fUnevalScripts = new Vector();    private String fUnevalScriptFiles = new String();    private String fUnevalScriptFilesMachine = new String();    private String fUnevalJobActionIf = new String();    private String fStartFunction = new String();    private String fStartFunctionArgs = new String();    private String fRequest = new String();    private int fRequestNumber = 0;    private int fSubmitRC = 0;    private String fSubmitResult = new String();    private STAXJob fSubJob = null;    private int fJobID = 0;    private STAXTimestamp fStartTimestamp;    private STAXJobActionFactory fFactory;    private String fCurrentBlockName = new String();    private HashMap fThreadMap = new HashMap();}

⌨️ 快捷键说明

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