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

📄 staxmonitorframe.java

📁 Software Testing Automation Framework (STAF)的开发代码
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
                if (queryResult.rc != 0)                {                    // Ignore since the stafcmd may have already completed                    continue;                }                mc = STAFMarshallingContext.unmarshall(queryResult.result);                stafcmdMap = (HashMap)mc.getRootObject();                String block = (String)stafcmdMap.get("blockName");                handleCommand(commandName, block, location, requestNumber,                              service, cmdRequest);            }            request = "LIST JOB " + fJobNumber + " SUBJOBS";            listResult = fHandle.submit2(fStaxMachine, fStaxServiceName,                                         request);            if (listResult.rc != 0)            {                throw new STAFException(listResult.rc,                                        "Error listing Job SUBJOBS\n"                                        + listResult.result);            }            mc = STAFMarshallingContext.unmarshall(listResult.result);            java.util.List subjobList = (java.util.List)mc.getRootObject();            iter = subjobList.iterator();                        while (iter.hasNext())            {                Map subjobMap = (Map)iter.next();                String jobID = (String)subjobMap.get("jobID");                jobName = (String)subjobMap.get("jobName");                String jobBlock = (String)subjobMap.get("blockName");                                request = "QUERY JOB " + jobID;                STAFResult queryResult = fHandle.submit2(                    fStaxMachine, fStaxServiceName, request);                if (queryResult.rc != 0)                    continue;                mc = STAFMarshallingContext.unmarshall(queryResult.result);                Map jobMap = (HashMap)mc.getRootObject();                String jobFile        = (String)jobMap.get("xmlFileName");                String jobFileMachine = (String)jobMap.get("fileMachine");                String subjobFunction = (String)jobMap.get("function");                String functionArgs   = (String)jobMap.get("arguments");                String scriptFileMachine = (String)jobMap.get("scriptMachine");                // Convert the list of scripts to a vector of scripts                java.util.List scriptList =                    (java.util.List)jobMap.get("scriptList");                scripts = new Vector();                iter = scriptList.iterator();                while (iter.hasNext())                {                    scripts.add((String)iter.next());                }                // Convert the list of scriptfiles to a vector of scriptfiles                java.util.List scriptFileList =                    (java.util.List)jobMap.get("scriptFileList");                Vector scriptFiles = new Vector();                iter = scriptFileList.iterator();                while (iter.hasNext())                {                    scriptFiles.add((String)iter.next());                }                // startTimestamp format is YYYYMMDD-HH:MM:SS                String startTimestamp = (String)jobMap.get("startTimestamp");                String startDate = startTimestamp.substring(0, 8);                String startTime = startTimestamp.substring(9);                String clearLogsString = (String)jobMap.get("clearLogs");                String logTCElapsedTimeString =                    (String)jobMap.get("logTCElapsedTime");                String logTCNumStartsString =                    (String)jobMap.get("logTCNumStarts");                String logTCStartStopString =                    (String)jobMap.get("logTCStartStop");                String subjobText = "Job " + jobID + " - " + jobName;                STAXMonitorTreeNode newNode = new STAXMonitorTreeNode(                    subjobText, STAXMonitorTreeNode.subjobNodeType);                STAXMonitorTreeNode parentNode =                     (STAXMonitorTreeNode)fMonitorTreeBlocks.get(jobBlock);                // parentNode can be null if the block has ended                if (parentNode != null)                {                    fMonitorTreeModel.insertNodeInto(newNode, parentNode,                        parentNode.getChildCount());                    TreeNode[] parentNodes =                        fMonitorTreeModel.getPathToRoot(parentNode);                    fMonitorTree.expandPath(new TreePath(parentNodes));                    fSubjobIDHashtable.put(jobID, newNode);                    fMonitorTreeSubjobNodes.put(newNode, jobID);                    fMonitorTreeSubjobStartTimes.put(                        newNode,                        STAXMonitorUtil.getCalendar2(startDate, startTime));                }                Vector subjobDataVector = new Vector();                addRow(subjobDataVector, "Job ID", jobID);                addRow(subjobDataVector, "Job Name", jobName);                addRow(subjobDataVector, "Clear Logs", clearLogsString);                addRow(subjobDataVector, "Log TC Elapsed Time",                       logTCElapsedTimeString);                addRow(subjobDataVector, "Log TC Num Starts",                       logTCNumStartsString);                addRow(subjobDataVector, "Log TC Start/Stop",                       logTCStartStopString);                addRow(subjobDataVector, "Job File", jobFile);                if (!jobFileMachine.equals(""))                {                    addRow(subjobDataVector,                           "Job File Machine", jobFileMachine);                }                addRow(subjobDataVector, "Function", subjobFunction);                addRow(subjobDataVector, "Function Args", functionArgs);                for (int i = 0; i < scriptFiles.size(); ++i)                {                    if (i == 0)                    {                        addRow(subjobDataVector, "Script Files Machine",                               scriptFileMachine);                    }                    addRow(subjobDataVector, "Script File #" + (i + 1),                           (String)scriptFiles.elementAt(i));                }                for (int i = 0; i < scripts.size(); ++i)                {                    addRow(subjobDataVector, "Script #" + (i + 1),                           (String)scripts.elementAt(i));                }                addRow(subjobDataVector, "Start Date", startDate);                addRow(subjobDataVector, "Start Time", startTime);                addRow(subjobDataVector, "Block", jobBlock);                synchronized(fDataHashtable)                {                    fDataHashtable.put(subjobText, subjobDataVector);                }            }        }        try        {            Thread.sleep(500);        }        catch (InterruptedException ex)        {        }        fInfoPane.add("Current Selection", fSelectionDetailsPanel);        fViewableComponents.put("Current Selection", fSelectionDetailsPanel);        index = fInfoPane.getTabCount();        fInfoPane.setBackgroundAt(index - 1, Color.white);        fInfoPane.setForegroundAt(index - 1, Color.darkGray);        // Get monitor extension (plugin) classes        Vector pluginClasses = parentMonitor.getPluginClasses();        // Handle external extensions (plugins)        for (int p = 0; p < pluginClasses.size(); p++)        {            try            {                Class pluginClass = (Class)pluginClasses.elementAt(p);                Object pluginObj = null;                // Try using a constructor that accepts a STAX object                Class [] parameterTypes = new Class[1];                parameterTypes[0] = this.getClass();                try                {                    Constructor construct =                        pluginClass.getConstructor(parameterTypes);                    Object [] initArgs = new Object[1];                    initArgs[0] = this;                    pluginObj = construct.newInstance(initArgs);                }                catch (NoSuchMethodException e)                {                    // Extension does not have a constructor that accepts                    // a STAX object, so use constructor without parameters                    pluginObj = pluginClass.newInstance();                }                STAXMonitorExtension plugin = (STAXMonitorExtension)pluginObj;                JComponent pluginComponent =                    plugin.init(this, newJob, fStaxMachine,                    fStaxServiceName, fJobNumber);                JScrollPane pluginScrollPane = null;                pluginComponent.setVisible(true);                Vector notificationTypes = new Vector();                StringTokenizer types = new                    StringTokenizer(plugin.getNotificationEventTypes(), " ");                while (types.hasMoreElements())                {                    String type = types.nextToken().toLowerCase();                    notificationTypes.add(type);                    fExternalPluginNotificationTypes.add(type);                }                fRegisteredPlugins.put(plugin, notificationTypes);                pluginScrollPane =                    new JScrollPane(plugin.getComponent());                pluginScrollPane.setVerticalScrollBarPolicy(                    JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);                pluginScrollPane.setHorizontalScrollBarPolicy(                    JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);                fViewableComponents.put(plugin.getTitle(), pluginScrollPane);                pluginComponent.setVisible(true);                int pluginType = plugin.getExtensionType();                if (pluginType == STAXMonitorFrame.EXTENSION_ACTIVE)                {                    fActiveElementsPane.addTab(plugin.getTitle(),                        pluginScrollPane);                    int i = fActiveElementsPane.getTabCount();                    fActiveElementsPane.setBackgroundAt(i - 1, Color.white);                    fActiveElementsPane.setForegroundAt(i - 1, Color.darkGray);                }                else if (pluginType == STAXMonitorFrame.EXTENSION_STATUS)                {                    fStatusPane.addTab(plugin.getTitle(), pluginScrollPane);                    int i = fStatusPane.getTabCount();                    fStatusPane.setBackgroundAt(i - 1, Color.white);                    fStatusPane.setForegroundAt(i - 1, Color.darkGray);                }                else if (pluginType == STAXMonitorFrame.EXTENSION_INFO)                {                    fInfoPane.addTab(plugin.getTitle(), pluginScrollPane);                    int i = fInfoPane.getTabCount();                    fInfoPane.setBackgroundAt(i - 1, Color.white);                    fInfoPane.setForegroundAt(i - 1, Color.darkGray);                }            }            catch (InvocationTargetException e)            {                System.out.println("InvocationTargetException thrown during " +                                   "STAXMonitor plugin initialization\n" +                                   e.getMessage());                e.printStackTrace();            }            catch (InstantiationException e)            {                System.out.println("InstantiationException thrown during " +                                   "STAXMonitor plugin initialization\n" +                                   e.getMessage());                e.printStackTrace();            }            catch (IllegalAccessException e)            {                System.out.println("IllegalAccessException thrown during " +                                   "STAXMonitor plugin initialization\n" +                                   e.getMessage());                e.printStackTrace();            }            catch (STAFException ex)            {                System.out.println("STAFException thrown during " +                                   "STAXMonitor plugin initialization.  RC: " +                                   ex.rc);            }        }        getContentPane().add(BorderLayout.CENTER, monitorPanel);        pack();        setSize(new Dimension(950, 600));        setLocation(50, 30);        show();            // the calls to invalidate and validate are needed so that            // the dividers will be located correctly on Linux systems        horizPane.setDividerLocation(.55);        invalidate();        validate();        vertPane.setDividerLocation(.68);        invalidate();        validate();        startMonitor();        if (!jobAlreadyHeld)        {            STAFResult releaseResult = fHandle.submit2(                fStaxMachine, fStaxServiceName, "RELEASE JOB " + fJobNumber);            if ((releaseResult.rc == STAFResult.DoesNotExist) ||                (releaseResult.rc == BlockNotHeld))            {                // need to wait for slower machines                for (int i = 0; i < 15; i++)

⌨️ 快捷键说明

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