public abstract class AbstractBinaryHandler extends Object implements BinaryHandler
Modifier and Type | Field and Description |
---|---|
static String |
DOWNLOAD_BINARIES_PROPERTY
Capability property that sets downloading on or off.
|
Constructor and Description |
---|
AbstractBinaryHandler() |
Modifier and Type | Method and Description |
---|---|
String |
checkAndSetBinary(boolean performExecutableValidations)
Checks system properties and capabilities, whether a path to binary is already set there
(see
getSystemBinaryProperty() and getBinaryProperty() ). |
File |
downloadAndPrepare()
This method consist of four steps:
|
protected File |
downloadAndPrepare(File targetDir,
String from)
Takes care of all steps but the first one of the method
downloadAndPrepare() |
protected File |
downloadAndPrepare(File targetDir,
URL from)
Takes care of all steps but the first one of the method
downloadAndPrepare() |
protected abstract String |
getArquillianCacheSubdirectory()
Name of the subdirectory that should be used for this binary handler in the Drone cache directory
($HOME/.arquillian/drone) |
protected abstract String |
getBinaryProperty()
This method should return a capability property name which a path to an executable binary could be stored under
|
protected abstract org.openqa.selenium.remote.DesiredCapabilities |
getCapabilities()
This method should return a desired capabilities with stored properties
|
protected abstract String |
getDesiredVersionProperty()
This method should return a capability property name which a desired version of a binary could be stored under
|
protected abstract ExternalBinarySource |
getExternalBinarySource()
This method should return an instance of an
ExternalBinary that should be used for retrieving available
releases of a binary |
abstract String |
getSystemBinaryProperty()
This method should return a system property name which a path to an executable binary should be stored under
|
protected abstract String |
getUrlToDownloadProperty()
This method should return a capability property name which a url pointing to a desired binary could be stored under
|
protected File |
markAsExecutable(File binaryFile)
Sets the given binary to be executable
|
protected void |
setBinaryAsSystemProperty(boolean performExecutableValidations,
String binary)
Sets binary as a system property that is returned by method
getSystemBinaryProperty() |
public static final String DOWNLOAD_BINARIES_PROPERTY
public String checkAndSetBinary(boolean performExecutableValidations)
getSystemBinaryProperty()
and getBinaryProperty()
).
If not and the downloading is not set off (DOWNLOAD_BINARIES_PROPERTY
), then the
binary is downloaded. Resulting binary is then set as system property that is returned by the method
getSystemBinaryProperty()
checkAndSetBinary
in interface BinaryHandler
performExecutableValidations
- If it should be checked whether the binary points to an executable file.protected void setBinaryAsSystemProperty(boolean performExecutableValidations, String binary)
getSystemBinaryProperty()
performExecutableValidations
- If it should be checked whether the binary points to an executable file.binary
- Path to the binarypublic File downloadAndPrepare() throws Exception
getUrlToDownloadProperty()
and
getDesiredVersionProperty()
.
If there is set only the desired version, then a binary with the specified version is downloaded using an external
binary source (getExternalBinarySource()
)
If there is set neither a url nor a desired version, then a binary with the latest version is downloaded using the external binary source.
Directory where the downloaded file is stored depends on set properties. If there is set the desired version,
or if the latest version is downloaded then the file is stored in:
$HOME/.arquillian/drone/ +
getArquillianCacheSubdirectory()
+ / + version
If the version is not set, then the file is stored in: target/drone/downloaded
target/drone/md5hash(downloaded_file)/
downloadAndPrepare
in interface BinaryHandler
Exception
- If anything bad happensprotected File downloadAndPrepare(File targetDir, String from) throws Exception
downloadAndPrepare()
targetDir
- A directory where a downloaded binary should be storedfrom
- A url a binary should be downloaded fromException
- If anything bad happensprotected File downloadAndPrepare(File targetDir, URL from) throws Exception
downloadAndPrepare()
targetDir
- A directory where a downloaded binary should be storedfrom
- A url a binary should be downloaded fromException
- If anything bad happensprotected File markAsExecutable(File binaryFile)
binaryFile
- A binary file that should be set to be executableprotected abstract String getBinaryProperty()
public abstract String getSystemBinaryProperty()
getSystemBinaryProperty
in interface BinaryHandler
protected abstract String getArquillianCacheSubdirectory()
($HOME/.arquillian/drone)
protected abstract String getDesiredVersionProperty()
protected abstract String getUrlToDownloadProperty()
protected abstract ExternalBinarySource getExternalBinarySource()
ExternalBinary
that should be used for retrieving available
releases of a binaryExternalBinary
that should be used for retrieving available releases of a binaryprotected abstract org.openqa.selenium.remote.DesiredCapabilities getCapabilities()
Copyright © 2017 JBoss by Red Hat. All rights reserved.