public class Config extends Object
It is backed by a PropertyLoader, which hides
the low-level details of retrieving properties.
This implementation reads properties from the following sources (in the given order):
mvn commandA property may be:
ConfigException
null
ConfigException
Clients extending this framework, needing their own configurable settings, should extend this class, and:
NAMESPACE
with their own namespacegetOptionalProperty(String) or getRequiredProperty(String),
or to the more generic getProperty(String, boolean), for those properties
that are required by some tasks, but may not be so for some other task.
propLoader| Modifier and Type | Field and Description |
|---|---|
static String |
CUSTOM_PROPS_RESOURCE |
static String |
DEFAULT_PROPS_RESOURCE |
static String |
NAMESPACE |
static String |
PROP_BASE_URL |
static String |
PROP_BROWSERS |
static String |
PROP_GRID_BROWSER_VERSION |
static String |
PROP_GRID_HUB_URL |
static String |
PROP_GRID_PLATFORM |
static String |
PROP_KEEP_BROWSERS_OPEN |
static String |
PROP_MAX_EXECUTIONS |
protected static String |
PROP_PREFIX |
static String |
PROP_REPORTS_DIR |
static String |
PROP_TIMEOUT_EXPLICIT_WAIT |
static String |
PROP_TIMEOUT_IMPLICIT_WAIT |
protected static PropertyLoader |
propLoader |
| Modifier | Constructor and Description |
|---|---|
protected |
Config()
This is a static class: as such, it cannot be instantiated.
|
| Modifier and Type | Method and Description |
|---|---|
static String |
getBaseUrl() |
static List<SupportedBrowser> |
getBrowsers() |
static int |
getExplicitWait() |
static String |
getGridBrowserVersion() |
static URL |
getGridHubUrl() |
static org.openqa.selenium.Platform |
getGridPlatform() |
static Long |
getImplicitWait() |
static boolean |
getKeepBrowsersOpen() |
static int |
getMaxExecutions() |
protected static String |
getOptionalProperty(String key)
Load the given property from one of the known sources.
|
protected static String |
getProperty(String propertyName,
boolean required) |
static String |
getReportsDir() |
protected static String |
getRequiredProperty(String propertyName) |
public static final String NAMESPACE
protected static final String PROP_PREFIX
public static final String PROP_BASE_URL
public static final String PROP_TIMEOUT_IMPLICIT_WAIT
public static final String PROP_TIMEOUT_EXPLICIT_WAIT
public static final String PROP_KEEP_BROWSERS_OPEN
public static final String PROP_MAX_EXECUTIONS
public static final String PROP_REPORTS_DIR
public static final String PROP_BROWSERS
public static final String PROP_GRID_PLATFORM
public static final String PROP_GRID_HUB_URL
public static final String PROP_GRID_BROWSER_VERSION
public static final String CUSTOM_PROPS_RESOURCE
public static final String DEFAULT_PROPS_RESOURCE
protected static PropertyLoader propLoader
protected Config()
public static String getBaseUrl()
SettingNotFoundException - if the property is not definedpublic static Long getImplicitWait()
public static int getExplicitWait()
SettingNotFoundException - if the property is not definedInteger.parseInt(String)public static boolean getKeepBrowsersOpen()
false.SettingNotFoundException - if the property is not definedBoolean.parseBoolean(String)public static int getMaxExecutions()
SettingNotFoundException - if the property is not definedInteger.parseInt(String)public static String getReportsDir()
SettingNotFoundException - if the property is not definedpublic static List<SupportedBrowser> getBrowsers()
SupportedBrowser's specified in the property
"tinafw.browsers"SettingNotFoundException - if the property can't be found,ConfigException - if the property is emptyIllegalArgumentException - if one of the values cannot be converted to
SupportedBrowserPropertiesUtils.split(String),
PropertiesUtils.toSupportedBrowsers(String[])public static org.openqa.selenium.Platform getGridPlatform()
Platform specified in the property "tinafw.grid.platform";
null, if not definedpublic static String getGridBrowserVersion()
public static URL getGridHubUrl()
URL with the property "tinafw.grid.hub_url";
null, if not defined.PropertiesUtils.toURL(String)protected static String getProperty(String propertyName, boolean required)
getRequiredProperty(String) if required is true;
getOptionalProperty(String) otherwise.protected static String getRequiredProperty(String propertyName)
propertyName - the name of the propertySettingNotFoundException - if the property cannot be foundprotected static String getOptionalProperty(String key)
The order of precedence is as follows:
mvn commandkey - the name of the propertyCopyright © 2015. All rights reserved.