Search in sources :

Example 1 with JMeterEngineException

use of org.apache.jmeter.engine.JMeterEngineException in project jmeter by apache.

the class Start method startEngine.

/**
     * Start JMeter engine
     * @param ignoreTimer flag to ignore timers
     * @param isValidationShot 
     * @param threadGroupsToRun Array of AbstractThreadGroup to run
     */
private void startEngine(boolean ignoreTimer, boolean isValidationShot, AbstractThreadGroup[] threadGroupsToRun) {
    GuiPackage gui = GuiPackage.getInstance();
    HashTree testTree = gui.getTreeModel().getTestPlan();
    JMeter.convertSubTree(testTree);
    if (threadGroupsToRun != null && threadGroupsToRun.length > 0) {
        removeThreadGroupsFromHashTree(testTree, threadGroupsToRun);
    }
    testTree.add(testTree.getArray()[0], gui.getMainFrame());
    if (log.isDebugEnabled()) {
        log.debug("test plan before cloning is running version: {}", ((TestPlan) testTree.getArray()[0]).isRunningVersion());
    }
    ListedHashTree clonedTree = null;
    if (isValidationShot) {
        TreeCloner cloner = createTreeClonerForValidation();
        testTree.traverse(cloner);
        clonedTree = cloner.getClonedTree();
    } else {
        TreeCloner cloner = cloneTree(testTree, ignoreTimer);
        clonedTree = cloner.getClonedTree();
    }
    if (popupCheckExistingFileListener(testTree)) {
        engine = new StandardJMeterEngine();
        engine.configure(clonedTree);
        try {
            engine.runTest();
        } catch (JMeterEngineException e) {
            JOptionPane.showMessageDialog(gui.getMainFrame(), e.getMessage(), JMeterUtils.getResString("error_occurred"), //$NON-NLS-1$
            JOptionPane.ERROR_MESSAGE);
        }
        if (log.isDebugEnabled()) {
            log.debug("test plan after cloning and running test is running version: {}", ((TestPlan) testTree.getArray()[0]).isRunningVersion());
        }
    }
}
Also used : ListedHashTree(org.apache.jorphan.collections.ListedHashTree) HashTree(org.apache.jorphan.collections.HashTree) ListedHashTree(org.apache.jorphan.collections.ListedHashTree) StandardJMeterEngine(org.apache.jmeter.engine.StandardJMeterEngine) GuiPackage(org.apache.jmeter.gui.GuiPackage) TreeCloner(org.apache.jmeter.engine.TreeCloner) JMeterEngineException(org.apache.jmeter.engine.JMeterEngineException)

Aggregations

JMeterEngineException (org.apache.jmeter.engine.JMeterEngineException)1 StandardJMeterEngine (org.apache.jmeter.engine.StandardJMeterEngine)1 TreeCloner (org.apache.jmeter.engine.TreeCloner)1 GuiPackage (org.apache.jmeter.gui.GuiPackage)1 HashTree (org.apache.jorphan.collections.HashTree)1 ListedHashTree (org.apache.jorphan.collections.ListedHashTree)1