to top
public class

Configuration

extends Object
implements IConfiguration
java.lang.Object
   ↳ com.android.tradefed.config.Configuration

Class Overview

A concrete IConfiguration implementation that stores the loaded config objects in a map

Summary

Constants
String BUILD_PROVIDER_TYPE_NAME
String CMD_OPTIONS_TYPE_NAME
String DEVICE_OPTIONS_TYPE_NAME
String DEVICE_RECOVERY_TYPE_NAME
String DEVICE_REQUIREMENTS_TYPE_NAME
String LOGGER_TYPE_NAME
String LOG_SAVER_TYPE_NAME
String RESULT_REPORTER_TYPE_NAME
String TARGET_PREPARER_TYPE_NAME
String TEST_TYPE_NAME
Public Constructors
Configuration(String name, String description)
Creates an Configuration with default config objects.
Public Methods
Configuration clone()
Creates a shallow copy of this object.
void dumpXml(PrintWriter output)
Gets the expanded XML file for the config with all options shown for this IConfiguration as a String.
IBuildProvider getBuildProvider()
Gets the IBuildProvider from the configuration.
String getCommandLine()
Gets the the command line used to create this IConfiguration.
ICommandOptions getCommandOptions()
Gets the ICommandOptions to use from the configuration.
Object getConfigurationObject(String typeName)
Generic interface to get the configuration object with the given type name.
List<?> getConfigurationObjectList(String typeName)
Similar to getConfigurationObject(String), but for configuration object types that support multiple objects.
String getDescription()
TestDeviceOptions getDeviceOptions()
Gets the TestDeviceOptions to use from the configuration.
IDeviceRecovery getDeviceRecovery()
Gets the IDeviceRecovery to use from the configuration.
IDeviceSelection getDeviceRequirements()
Gets the IDeviceSelection to use from the configuration.
JSONArray getJsonCommandUsage()
Returns a JSON representation of this configuration.
ILeveledLogOutput getLogOutput()
Gets the ILeveledLogOutput to use from the configuration.
ILogSaver getLogSaver()
Gets the ILogSaver to use from the configuration.
String getName()
List<ITargetPreparer> getTargetPreparers()
Gets the ITargetPreparers from the configuration.
List<ITestInvocationListener> getTestInvocationListeners()
Gets the ITestInvocationListeners to use from the configuration.
List<IRemoteTest> getTests()
Gets the IRemoteTests to run from the configuration.
void injectOptionValue(String optionName, String optionKey, String optionValue)
Inject a option value into the set of configuration objects.
void injectOptionValue(String optionName, String optionValue)
Inject a option value into the set of configuration objects.
void printCommandUsage(boolean importantOnly, PrintStream out)
Outputs a command line usage help text for this configuration to given printStream.
void setBuildProvider(IBuildProvider provider)
Replace the current IBuildProvider in the configuration.
void setCommandLine(String[] arrayArgs)
Sets the command line used to create this IConfiguration.
void setCommandOptions(ICommandOptions cmdOptions)
Set the ICommandOptions, replacing any existing values
synchronized void setConfigurationObject(String typeName, Object configObject)
Generic method to set the config object with the given name, replacing any existing value.
synchronized void setConfigurationObjectList(String typeName, List<?> configList)
Generic method to set the config object list for the given name, replacing any existing value.
void setDeviceOptions(TestDeviceOptions devOptions)
Set the TestDeviceOptions, replacing any existing values
void setDeviceRecovery(IDeviceRecovery recovery)
Set the IDeviceRecovery, replacing any existing value.
void setDeviceRequirements(IDeviceSelection devRequirements)
Set the IDeviceSelection, replacing any existing values
void setLogOutput(ILeveledLogOutput logger)
Set the ILeveledLogOutput, replacing any existing value.
void setLogSaver(ILogSaver logSaver)
Set the ILogSaver, replacing any existing value.
List<String> setOptionsFromCommandLineArgs(List<String> listArgs)
Set the config Option fields with given set of command line arguments

void setTargetPreparer(ITargetPreparer preparer)
Set the ITargetPreparer, replacing any existing value.
void setTest(IRemoteTest test)
Convenience method to set a single IRemoteTest in this configuration, replacing any existing values
void setTestInvocationListener(ITestInvocationListener listener)
Convenience method to set a single ITestInvocationListener
void setTestInvocationListeners(List<ITestInvocationListener> listeners)
Set the list of ITestInvocationListeners, replacing any existing values
void setTests(List<IRemoteTest> tests)
Set the list of IRemoteTests in this configuration, replacing any existing values
void validateOptions()
Validate option values.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.android.tradefed.config.IConfiguration

Constants

public static final String BUILD_PROVIDER_TYPE_NAME

Constant Value: "build_provider"

public static final String CMD_OPTIONS_TYPE_NAME

Constant Value: "cmd_options"

public static final String DEVICE_OPTIONS_TYPE_NAME

Constant Value: "device_options"

public static final String DEVICE_RECOVERY_TYPE_NAME

Constant Value: "device_recovery"

public static final String DEVICE_REQUIREMENTS_TYPE_NAME

Constant Value: "device_requirements"

public static final String LOGGER_TYPE_NAME

Constant Value: "logger"

public static final String LOG_SAVER_TYPE_NAME

Constant Value: "log_saver"

public static final String RESULT_REPORTER_TYPE_NAME

Constant Value: "result_reporter"

public static final String TARGET_PREPARER_TYPE_NAME

Constant Value: "target_preparer"

public static final String TEST_TYPE_NAME

Constant Value: "test"

Public Constructors

public Configuration (String name, String description)

Creates an Configuration with default config objects.

Public Methods

public Configuration clone ()

Creates a shallow copy of this object.

public void dumpXml (PrintWriter output)

Gets the expanded XML file for the config with all options shown for this IConfiguration as a String.

Parameters
output the writer to print the xml to.
Throws
IOException

public IBuildProvider getBuildProvider ()

Gets the IBuildProvider from the configuration.

Returns

public String getCommandLine ()

Gets the the command line used to create this IConfiguration.

Returns

public ICommandOptions getCommandOptions ()

Gets the ICommandOptions to use from the configuration.

Returns

public Object getConfigurationObject (String typeName)

Generic interface to get the configuration object with the given type name.

Parameters
typeName the unique type of the configuration object
Returns
  • the configuration object or null if the object type with given name does not exist.

public List<?> getConfigurationObjectList (String typeName)

Similar to getConfigurationObject(String), but for configuration object types that support multiple objects.

Parameters
typeName the unique type name of the configuration object
Returns
  • the list of configuration objects or null if the object type with given name does not exist.

public String getDescription ()

Returns

public TestDeviceOptions getDeviceOptions ()

Gets the TestDeviceOptions to use from the configuration.

Returns

public IDeviceRecovery getDeviceRecovery ()

Gets the IDeviceRecovery to use from the configuration.

Returns

public IDeviceSelection getDeviceRequirements ()

Gets the IDeviceSelection to use from the configuration.

Returns

public JSONArray getJsonCommandUsage ()

Returns a JSON representation of this configuration.

Throws
JSONException

public ILeveledLogOutput getLogOutput ()

Gets the ILeveledLogOutput to use from the configuration.

Returns

public ILogSaver getLogSaver ()

Gets the ILogSaver to use from the configuration.

Returns
  • the ILogSaver provided in the configuration.

public String getName ()

Returns

public List<ITargetPreparer> getTargetPreparers ()

Gets the ITargetPreparers from the configuration.

Returns

public List<ITestInvocationListener> getTestInvocationListeners ()

Gets the ITestInvocationListeners to use from the configuration.

Returns

public List<IRemoteTest> getTests ()

Gets the IRemoteTests to run from the configuration.

Returns
  • the tests provided in the configuration

public void injectOptionValue (String optionName, String optionKey, String optionValue)

Inject a option value into the set of configuration objects.

Useful to provide values for options that are generated dynamically.

Parameters
optionName the map option name
optionKey the map option key
optionValue the map option value

public void injectOptionValue (String optionName, String optionValue)

Inject a option value into the set of configuration objects.

Useful to provide values for options that are generated dynamically.

Parameters
optionName the option name
optionValue the option value

public void printCommandUsage (boolean importantOnly, PrintStream out)

Outputs a command line usage help text for this configuration to given printStream.

Parameters
importantOnly if true only print help for the important options
out the PrintStream to use.
Throws
ConfigurationException}
ConfigurationException

public void setBuildProvider (IBuildProvider provider)

Replace the current IBuildProvider in the configuration.

Parameters
provider the new IBuildProvider

public void setCommandLine (String[] arrayArgs)

Sets the command line used to create this IConfiguration. This stores the whole command line, including the configuration name, unlike setOptionsFromCommandLineArgs.

Parameters
arrayArgs the command line

public void setCommandOptions (ICommandOptions cmdOptions)

Set the ICommandOptions, replacing any existing values

public synchronized void setConfigurationObject (String typeName, Object configObject)

Generic method to set the config object with the given name, replacing any existing value.

Parameters
typeName the unique name of the config object type.
configObject the config object

public synchronized void setConfigurationObjectList (String typeName, List<?> configList)

Generic method to set the config object list for the given name, replacing any existing value.

Parameters
typeName the unique name of the config object type.
configList the config object list

public void setDeviceOptions (TestDeviceOptions devOptions)

Set the TestDeviceOptions, replacing any existing values

public void setDeviceRecovery (IDeviceRecovery recovery)

Set the IDeviceRecovery, replacing any existing value.

public void setDeviceRequirements (IDeviceSelection devRequirements)

Set the IDeviceSelection, replacing any existing values

public void setLogOutput (ILeveledLogOutput logger)

Set the ILeveledLogOutput, replacing any existing value.

public void setLogSaver (ILogSaver logSaver)

Set the ILogSaver, replacing any existing value.

public List<String> setOptionsFromCommandLineArgs (List<String> listArgs)

Set the config Option fields with given set of command line arguments

Parameters
listArgs the command line arguments
Returns
  • the unconsumed arguments

public void setTargetPreparer (ITargetPreparer preparer)

Set the ITargetPreparer, replacing any existing value.

public void setTest (IRemoteTest test)

Convenience method to set a single IRemoteTest in this configuration, replacing any existing values

public void setTestInvocationListener (ITestInvocationListener listener)

Convenience method to set a single ITestInvocationListener

public void setTestInvocationListeners (List<ITestInvocationListener> listeners)

Set the list of ITestInvocationListeners, replacing any existing values

public void setTests (List<IRemoteTest> tests)

Set the list of IRemoteTests in this configuration, replacing any existing values

public void validateOptions ()

Validate option values.

Currently this will just validate that all mandatory options have been set