FileServer.getFileServer().setBaseForScript(f);
reader = new FileInputStream(f);
log.info("Loading file: " + f);
HashTree tree = SaveService.loadTree(reader);
@SuppressWarnings("deprecation") // Deliberate use of deprecated ctor
JMeterTreeModel treeModel = new JMeterTreeModel(new Object());// Create non-GUI version to avoid headless problems
JMeterTreeNode root = (JMeterTreeNode) treeModel.getRoot();
treeModel.addSubTree(tree, root);
// Hack to resolve ModuleControllers in non GUI mode
SearchByClass<ReplaceableController> replaceableControllers = new SearchByClass<ReplaceableController>(ReplaceableController.class);
tree.traverse(replaceableControllers);
Collection<ReplaceableController> replaceableControllersRes = replaceableControllers.getSearchResults();
for (Iterator<ReplaceableController> iter = replaceableControllersRes.iterator(); iter.hasNext();) {
ReplaceableController replaceableController = iter.next();
replaceableController.resolveReplacementSubTree(root);
}
// Remove the disabled items
// For GUI runs this is done in Start.java
convertSubTree(tree);
Summariser summer = null;
String summariserName = JMeterUtils.getPropDefault("summariser.name", "");//$NON-NLS-1$
if (summariserName.length() > 0) {
log.info("Creating summariser <" + summariserName + ">");
println("Creating summariser <" + summariserName + ">");
summer = new Summariser(summariserName);
}
if (logFile != null) {
ResultCollector logger = new ResultCollector(summer);
logger.setFilename(logFile);
tree.add(tree.getArray()[0], logger);
}
else {
// only add Summariser if it can not be shared with the ResultCollector
if (summer != null) {
tree.add(tree.getArray()[0], summer);
}
}
List<JMeterEngine> engines = new LinkedList<JMeterEngine>();
tree.add(tree.getArray()[0], new ListenToTest(parent, (remoteStart && remoteStop) ? engines : null));
println("Created the tree successfully using "+testFile);
JMeterEngine engine = null;
if (!remoteStart) {
engine = new StandardJMeterEngine();
engine.configure(tree);