com.opera.core.systems.runner.launcher
Class OperaLauncherRunner

java.lang.Object
  extended by com.opera.core.systems.runner.OperaRunner
      extended by com.opera.core.systems.runner.launcher.OperaLauncherRunner
All Implemented Interfaces:
OperaRunner

public class OperaLauncherRunner
extends OperaRunner
implements OperaRunner

OperaLauncherRunner implements an interface in C++ with a Java API for controlling the Opera binary.


Field Summary
static String LAUNCHER_ENV_VAR
           
 
Fields inherited from class com.opera.core.systems.runner.OperaRunner
logger, settings
 
Constructor Summary
OperaLauncherRunner()
           
OperaLauncherRunner(OperaSettings s)
           
 
Method Summary
static void assertLauncherGood(File launcher)
          Asserts whether given launcher exists, is a file and that it's executable.
protected  com.google.common.collect.ImmutableList<String> buildArguments()
           
 String getOperaCrashlog()
          If Opera crashed there should be a crashlog.
 boolean hasOperaCrashed()
          Did Opera crash? This is reset on next call, so if you don't check you won't know.
 boolean isOperaRunning()
          Is Opera running?
 boolean isOperaRunning(int processId)
           
static File launcherDefaultLocation()
           
 ScreenShotReply saveScreenshot(long timeout, String... hashes)
          Take screenshots!
 void shutdown()
          Handles safe shutdown of the OperaRunner class.
 void startOpera()
          Start Opera, does nothing if Opera is already started.
 void stopOpera()
          Stops Opera, does nothing if Opera isn't running.
protected static Level toLauncherLoggingLevel(Level level)
          The launcher allows for the following logging levels: "FINEST", "FINE", "INFO", "WARNING", "SEVERE".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LAUNCHER_ENV_VAR

public static final String LAUNCHER_ENV_VAR
See Also:
Constant Field Values
Constructor Detail

OperaLauncherRunner

public OperaLauncherRunner()

OperaLauncherRunner

public OperaLauncherRunner(OperaSettings s)
Method Detail

buildArguments

protected com.google.common.collect.ImmutableList<String> buildArguments()

startOpera

public void startOpera()
Description copied from interface: OperaRunner
Start Opera, does nothing if Opera is already started.

Specified by:
startOpera in interface OperaRunner
Overrides:
startOpera in class OperaRunner

stopOpera

public void stopOpera()
Description copied from interface: OperaRunner
Stops Opera, does nothing if Opera isn't running. Typically we'll use the exec service to stop Opera, but this method will _ensure_ that Opera is quit from an external process controller.

Specified by:
stopOpera in interface OperaRunner
Overrides:
stopOpera in class OperaRunner

isOperaRunning

public boolean isOperaRunning()
Description copied from interface: OperaRunner
Is Opera running?

Specified by:
isOperaRunning in interface OperaRunner
Overrides:
isOperaRunning in class OperaRunner
Returns:
true if running, false if not running or crashed

isOperaRunning

public boolean isOperaRunning(int processId)
Specified by:
isOperaRunning in interface OperaRunner
Overrides:
isOperaRunning in class OperaRunner

hasOperaCrashed

public boolean hasOperaCrashed()
Description copied from interface: OperaRunner
Did Opera crash? This is reset on next call, so if you don't check you won't know.

Specified by:
hasOperaCrashed in interface OperaRunner
Overrides:
hasOperaCrashed in class OperaRunner
Returns:
true if opera has crashed

getOperaCrashlog

public String getOperaCrashlog()
Description copied from interface: OperaRunner
If Opera crashed there should be a crashlog.

Specified by:
getOperaCrashlog in interface OperaRunner
Overrides:
getOperaCrashlog in class OperaRunner
Returns:
the crashlog, or null if it does not exist

shutdown

public void shutdown()
Description copied from class: OperaRunner
Handles safe shutdown of the OperaRunner class.

Specified by:
shutdown in interface OperaRunner
Overrides:
shutdown in class OperaRunner

saveScreenshot

public ScreenShotReply saveScreenshot(long timeout,
                                      String... hashes)
Take screenshots!

Specified by:
saveScreenshot in interface OperaRunner
Overrides:
saveScreenshot in class OperaRunner
Parameters:
timeout - attempt to take the screenshot until the timeout is reached
hashes - an arbitrary list of hashes to compare with
Returns:
a ScreenshotReply object containing MD5 hash sums and bytes

launcherDefaultLocation

public static File launcherDefaultLocation()

assertLauncherGood

public static void assertLauncherGood(File launcher)
                               throws IOException
Asserts whether given launcher exists, is a file and that it's executable.

Parameters:
launcher - the launcher to assert
Throws:
IOException - if there is a problem with the provided launcher

toLauncherLoggingLevel

protected static Level toLauncherLoggingLevel(Level level)
The launcher allows for the following logging levels: "FINEST", "FINE", "INFO", "WARNING", "SEVERE". Since the launcher is unusually chatty, we don't want it to use the same logging level as OperaDriver. Besides, it doesn't have the same logging levels as Java. This method accepts a Java logging level and converts it to something sensible to pass on to the launcher.

Parameters:
level - the Java logging level
Returns:
a sensible, non-chatty logging level


Copyright © 2012. All Rights Reserved.