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);
if (!remoteStart) {
JMeterEngine engine = new StandardJMeterEngine();
engine.configure(tree);
long now=System.currentTimeMillis();
println("Starting the test @ "+new Date(now)+" ("+now+")");
engine.runTest();
engines.add(engine);
} else {
java.util.StringTokenizer st = new java.util.StringTokenizer(remote_hosts_string, ",");//$NON-NLS-1$
List<String> failingEngines = new ArrayList<String>(st.countTokens());
while (st.hasMoreElements()) {
String el = (String) st.nextElement();
println("Configuring remote engine for " + el);
log.info("Configuring remote engine for " + el);
JMeterEngine eng = doRemoteInit(el.trim(), tree);
if (null != eng) {
engines.add(eng);
} else {
failingEngines.add(el);
println("Failed to configure "+el);
}
}
if (engines.isEmpty()) {
println("No remote engines were started.");
return;
}
if(failingEngines.size()>0) {
throw new IllegalArgumentException("The following remote engines could not be configured:"+failingEngines);
}
println("Starting remote engines");
log.info("Starting remote engines");
long now=System.currentTimeMillis();
println("Starting the test @ "+new Date(now)+" ("+now+")");
for (JMeterEngine engine : engines) {
engine.runTest();
}
println("Remote engines have been started");
log.info("Remote engines have been started");
}
startUdpDdaemon(engines);