*
*/
private static final long serialVersionUID = 2047557797415325512L;
public String invoke(File f, VirtualChannel channel) throws IOException {
RemoteRunningStatus status = (RemoteRunningStatus) PropertyUtils.getMapProperty(SeleniumConstants.PROPERTY_STATUS, config);
if (status != null && status.isRunning()) {
// listener.getLogger().println("Skipping Selenium RC execution because this slave has already started its RCs");
return null;
}
// listener.getLogger().println("Copy grid jar");
File localJar = new File(f, seleniumJar.getName());
if (localJar.lastModified() != jarTimestamp) {
try {
seleniumJar.copyTo(new FilePath(localJar));
localJar.setLastModified(jarTimestamp);
} catch (InterruptedException e) {
throw new IOException2("Failed to copy grid jar", e);
}
}
try {
// listener.getLogger().println("Creating selenium VM");
Channel jvm = SeleniumProcessUtils.createSeleniumRCVM(localJar, listener, options.getJVMArguments(), options.getEnvironmentVariables());
status = new RemoteRunningStatus(jvm, options);
status.setStatus(SeleniumConstants.STARTING);
List<String> arguments = new ArrayList<String>(options.getSeleniumArguments().size());
for (ProcessArgument arg : options.getSeleniumArguments()) {
arguments.addAll(arg.toArgumentsList());
}
// listener.getLogger().println("Starting the selenium process");
jvm.callAsync(new RemoteControlLauncher(nodeName, (String[]) ArrayUtils.addAll(defaultArgs, arguments.toArray(new String[0]))));
status.setStatus(SeleniumConstants.STARTED);
status.setRunning(true);
} catch (Exception t) {
status.setRunning(false);
status.setStatus(SeleniumConstants.ERROR);
LOGGER.log(Level.WARNING, "Selenium launch failed", t);
// listener.getLogger().println( "Selenium launch failed" + t.getMessage());
throw new IOException2("Selenium launch interrupted", t);
}