com.atlassian.pageobjects.elements.timeout
Class PropertiesBasedTimeouts

java.lang.Object
  extended by com.atlassian.pageobjects.elements.timeout.PropertiesBasedTimeouts
All Implemented Interfaces:
Timeouts

public class PropertiesBasedTimeouts
extends Object
implements Timeouts

Timeouts implementation based on Java properties.

This implementation accepts a Properties instance that contains properties in the following form: 'com.atlassian.timeout.<TIMEOUT_TYPE>, where <TIMEOUT_TYPE> corresponds to a particular field name of the TimeoutType enum.

At the very least, the properties are supposed to contain the TimeoutType.DEFAULT value (which corresponds to the property key 'com.atlassian.timeout.DEFAULT'). If it is not present, an exception will be raised from the constructor. This value will be used in place of whatever other timeout type that does have corresponding value within the properties.


Field Summary
static String DEFAULT_PROPERTY_KEY
           
static String PROPERTY_PREFIX
           
 
Fields inherited from interface com.atlassian.pageobjects.elements.timeout.Timeouts
DEFAULT_INTERVAL
 
Constructor Summary
PropertiesBasedTimeouts(InputStream reader)
          Reads the properties from given reader.
PropertiesBasedTimeouts(Properties properties)
           
 
Method Summary
static PropertiesBasedTimeouts fromClassPath(String path)
          Load instance of PropertiesBasedTimeouts based on properties from a class path resource.
static PropertiesBasedTimeouts fromClassPath(String path, ClassLoader loader)
          Load instance of PropertiesBasedTimeouts based on properties from a class path resource.
static PropertiesBasedTimeouts fromFile(String path)
          Load instance of PropertiesBasedTimeouts based on properties from file on disk.
 long timeoutFor(TimeoutType timeoutType)
          Provide timeout (in milliseconds) for a given timeoutType.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_PREFIX

public static final String PROPERTY_PREFIX

DEFAULT_PROPERTY_KEY

public static final String DEFAULT_PROPERTY_KEY
Constructor Detail

PropertiesBasedTimeouts

public PropertiesBasedTimeouts(Properties properties)

PropertiesBasedTimeouts

public PropertiesBasedTimeouts(InputStream reader)
Reads the properties from given reader. The reader will not be closed.

Parameters:
reader - reader to load properties from
Method Detail

fromFile

public static PropertiesBasedTimeouts fromFile(String path)
Load instance of PropertiesBasedTimeouts based on properties from file on disk.

Parameters:
path - path of the properties file
Returns:
new instance of this class

fromClassPath

public static PropertiesBasedTimeouts fromClassPath(String path,
                                                    ClassLoader loader)
Load instance of PropertiesBasedTimeouts based on properties from a class path resource.

Parameters:
path - path of the resource
loader - class loader to use
Returns:
new instance of this class

fromClassPath

public static PropertiesBasedTimeouts fromClassPath(String path)
Load instance of PropertiesBasedTimeouts based on properties from a class path resource. The class loader that loaded this class will be used.

Parameters:
path - path of the resource
Returns:
new instance of this class

timeoutFor

public long timeoutFor(TimeoutType timeoutType)
Description copied from interface: Timeouts
Provide timeout (in milliseconds) for a given timeoutType.

Specified by:
timeoutFor in interface Timeouts
Parameters:
timeoutType - type of the timeout
Returns:
timeout value in milliseconds


Copyright © 2014 Atlassian. All rights reserved.