ICommandScheduler
public
interface
ICommandScheduler
com.android.tradefed.command.ICommandScheduler |
用于运行 TradeFederation 命令的调度器。
摘要
嵌套类 | |
---|---|
interface |
ICommandScheduler.IScheduledInvocationListener
在调用完成时监听调用事件。 |
公共方法 | |
---|---|
abstract
boolean
|
addCommand(String[] args)
向调度器添加命令。 |
abstract
void
|
addCommandFile(String cmdFile,
将给定文件中的所有命令添加到调度器 |
abstract
void
|
await()
等待调度器开始运行,包括等待从旧 TF 的切换完成 (如果适用)。 |
abstract
void
|
completeHandover()
通知命令调度程序,发起的切换序列已全部完成,并且 应在默认端口上重新初始化其远程管理器。 |
abstract
void
|
displayCommandQueue(PrintWriter printWriter)
输出有关命令执行队列状态的详细调试信息。 |
abstract
void
|
displayCommandsInfo(PrintWriter printWriter, String regex)
输出当前命令的列表。 |
abstract
void
|
displayInvocationsInfo(PrintWriter printWriter)
显示当前调用的列表。 |
abstract
void
|
dumpCommandsXml(PrintWriter printWriter, String regex)
转储命令的展开后 xml 文件,其中包含
为所有当前命令指定了 |
abstract
void
|
execCommand(IInvocationContext context, ICommandScheduler.IScheduledInvocationListener listener, String[] args)
直接分配设备并执行命令,无需将其添加到命令队列
使用现有的 |
abstract
void
|
execCommand(ICommandScheduler.IScheduledInvocationListener listener, String[] args)
直接分配设备并执行命令,无需将其添加到命令队列。 |
abstract
void
|
execCommand(ICommandScheduler.IScheduledInvocationListener listener, ITestDevice device, String[] args)
在已分配的设备上直接执行命令。 |
abstract
CommandFileWatcher
|
getCommandFileWatcher()
获取此调度器的相应 |
abstract
int
|
getExecutingCommandCount()
返回处于执行状态的命令数量。 |
abstract
String
|
getInvocationInfo(int invocationId)
返回指定调用 ID 的调用相关信息。 |
abstract
CommandRunner.ExitCode
|
getLastInvocationExitCode()
返回上次运行的调用的错误代码。 |
abstract
Throwable
|
getLastInvocationThrowable()
返回上次运行的调用中的 |
abstract
int
|
getReadyCommandCount()
返回队列中处于就绪状态的命令数量。 |
abstract
void
|
handoverInitiationComplete()
通知命令调度程序,其初始切换交换正在使用的设备和命令 就可以开始安排操作了 |
abstract
boolean
|
handoverShutdown(int handoverPort)
启动 |
abstract
void
|
join()
等待调度器完成。 |
abstract
void
|
join(long millis)
等待调度程序在达到指定的持续时间(以毫秒为单位)后完成或超时。 |
abstract
void
|
removeAllCommands()
从调度器中移除所有命令 |
abstract
void
|
setClearcutClient(ClearcutClient client)
将客户端设置为报告自动化测试框架数据 |
abstract
boolean
|
shouldShutdownOnCmdfileError()
如果由于命令错误而需要关闭调度器,则返回 true |
abstract
void
|
shutdown()
尝试正常关闭命令调度器。 |
abstract
void
|
shutdownHard(boolean killAdb)
尝试强制关闭命令调度程序。 |
abstract
void
|
shutdownHard()
尝试强制关闭命令调度程序。 |
abstract
void
|
shutdownOnEmpty()
与 |
abstract
void
|
start()
|
abstract
boolean
|
stopInvocation(int invocationId, String cause)
通过指定其 ID 来停止正在运行的调用。 |
default
boolean
|
stopInvocation(int invocationId)
通过指定其 ID 来停止正在运行的调用。 |
abstract
boolean
|
stopInvocation(ITestInvocation invocation)
停止正在运行的调用。 |
公共方法
addCommand
public abstract boolean addCommand (String[] args)
向调度器添加命令。
命令实质上是要运行的配置及其相关参数的实例。
如果为“--help”参数是以下部分的帮助文本: 配置将输出到 stdout。否则,系统会将配置添加到队列中 运行。
参数 | |
---|---|
args |
String :配置参数。 |
返回 | |
---|---|
boolean |
如果命令已成功添加,则为 true |
抛出 | |
---|---|
ConfigurationException |
如果无法解析命令 |
addCommandFile
public abstract void addCommandFile (String cmdFile,extraArgs)
将给定文件中的所有命令添加到调度器
参数 | |
---|---|
cmdFile |
String :命令文件的文件系统路径 |
extraArgs |
:要附加到解析的每个命令的 ERROR(/List) (包含 String 个参数)
来自文件。可以为空,但不得为 null。 |
抛出 | |
---|---|
ConfigurationException |
如果无法解析命令文件 |
等待
public abstract void await ()
等待调度器开始运行,包括等待从旧 TF 的切换完成 (如果适用)。
完整交接
public abstract void completeHandover ()
通知命令调度程序,发起的切换序列已全部完成,并且 应在默认端口上重新初始化其远程管理器。
displayCommandQueue
public abstract void displayCommandQueue (PrintWriter printWriter)
输出有关命令执行队列状态的详细调试信息。
displayCommandsInfo
public abstract void displayCommandsInfo (PrintWriter printWriter, String regex)
输出当前命令的列表。
参数 | |
---|---|
printWriter |
PrintWriter :要输出到的 ERROR(/PrintWriter) 。 |
regex |
String :要与命令匹配的正则表达式,
。如果为 null,将输出所有命令。
|
displayInvocationsInfo
public abstract void displayInvocationsInfo (PrintWriter printWriter)
显示当前调用的列表。
参数 | |
---|---|
printWriter |
PrintWriter :要输出到的 ERROR(/PrintWriter) 。
|
dumpCommandsXml
public abstract void dumpCommandsXml (PrintWriter printWriter, String regex)
转储命令的展开后 xml 文件,其中包含
为所有当前命令指定了 Option
值。
参数 | |
---|---|
printWriter |
PrintWriter :要向其中输出状态的 ERROR(/PrintWriter) 。 |
regex |
String :为了让
xml 文件。如果为 null,将转储所有命令。
|
execCommand
public abstract void execCommand (IInvocationContext context, ICommandScheduler.IScheduledInvocationListener listener, String[] args)
直接分配设备并执行命令,无需将其添加到命令队列
使用现有的 IInvocationContext
。
参数 | |
---|---|
context |
IInvocationContext :现有的 IInvocationContext 。 |
listener |
ICommandScheduler.IScheduledInvocationListener :要通知的 ICommandScheduler.IScheduledInvocationListener |
args |
String :命令参数 |
抛出 | |
---|---|
ConfigurationException |
if 命令无效 |
NoDeviceException |
如果没有设备可供使用 |
execCommand
public abstract void execCommand (ICommandScheduler.IScheduledInvocationListener listener, String[] args)
直接分配设备并执行命令,无需将其添加到命令队列。
参数 | |
---|---|
listener |
ICommandScheduler.IScheduledInvocationListener :要通知的 ICommandScheduler.IScheduledInvocationListener |
args |
String :命令参数 |
抛出 | |
---|---|
ConfigurationException |
if 命令无效 |
NoDeviceException |
如果没有设备可供使用 |
execCommand
public abstract void execCommand (ICommandScheduler.IScheduledInvocationListener listener, ITestDevice device, String[] args)
在已分配的设备上直接执行命令。
参数 | |
---|---|
listener |
ICommandScheduler.IScheduledInvocationListener :要通知的 ICommandScheduler.IScheduledInvocationListener |
device |
ITestDevice :要使用的 ITestDevice |
args |
String :命令参数 |
抛出 | |
---|---|
ConfigurationException |
if 命令无效 |
getCommandFileWatcher
public abstract CommandFileWatcher getCommandFileWatcher ()
获取此调度器的相应 CommandFileWatcher
返回 | |
---|---|
CommandFileWatcher |
getExecutingCommandCount
public abstract int getExecutingCommandCount ()
返回处于执行状态的命令数量。
返回 | |
---|---|
int |
getInvocationInfo
public abstract String getInvocationInfo (int invocationId)
返回指定调用 ID 的调用相关信息。
参数 | |
---|---|
invocationId |
int :调用的跟踪 ID。 |
返回 | |
---|---|
String |
包含调用相关信息的 String 。
|
getLastInvocationExitCode
public abstract CommandRunner.ExitCode getLastInvocationExitCode ()
返回上次运行的调用的错误代码。 如果还没有运行任何调用,则返回 0(无错误)。
返回 | |
---|---|
CommandRunner.ExitCode |
getLastInvocationThrowable
public abstract Throwable getLastInvocationThrowable ()
返回上次运行的调用中的 Throwable
。
如果没有可抛出对象,则返回 null。
返回 | |
---|---|
Throwable |
getReadyCommandCount
public abstract int getReadyCommandCount ()
返回队列中处于就绪状态的命令数量。
返回 | |
---|---|
int |
移交初始化完成
public abstract void handoverInitiationComplete ()
通知命令调度程序,其初始切换交换正在使用的设备和命令 就可以开始安排操作了
关闭切换
public abstract boolean handoverShutdown (int handoverPort)
启动 shutdown()
并切换到同一主机上的另一个 tradefed 进程。
调度器将通知监听已释放设备的端口的远程 tradefed 进程 。
参数 | |
---|---|
handoverPort |
int |
返回 | |
---|---|
boolean |
如果切换启动成功,则为 true ;false
否则
|
join
public abstract void join (long millis)
等待调度程序在达到指定的持续时间(以毫秒为单位)后完成或超时。
参数 | |
---|---|
millis |
long |
removeAllCommands
public abstract void removeAllCommands ()
从调度器中移除所有命令
setClearcutClient
public abstract void setClearcutClient (ClearcutClient client)
将客户端设置为报告自动化测试框架数据
参数 | |
---|---|
client |
ClearcutClient |
shouldShutdownOnCmdfileError
public abstract boolean shouldShutdownOnCmdfileError ()
如果由于命令错误而需要关闭调度器,则返回 true
返回 | |
---|---|
boolean |
关停
public abstract void shutdown ()
尝试正常关闭命令调度器。
清除等待测试的命令,并请求所有正在进行的调用 自动关停
调用关停后,调度器主循环将等待所有正在进行的调用 完成后再完全退出。
关停硬
public abstract void shutdownHard (boolean killAdb)
尝试强制关闭命令调度程序。
与 shutdown()
类似,但也可以选择性地终止 adb 连接,
试图“启发”更快地完成。
参数 | |
---|---|
killAdb |
boolean |
关停硬
public abstract void shutdownHard ()
尝试强制关闭命令调度程序。与 closeHard(true) 相同。
关闭在空白处
public abstract void shutdownOnEmpty ()
与 shutdown()
类似,但会等待所有命令都执行完毕
然后下车。
请注意,如果任何命令处于循环模式,则调度器将永远不会退出。
stopInvocation
public abstract boolean stopInvocation (int invocationId, String cause)
通过指定其 ID 来停止正在运行的调用。
参数 | |
---|---|
invocationId |
int :调用的跟踪 ID。 |
cause |
String :停止调用的原因。 |
返回 | |
---|---|
boolean |
如果调用已停止,则为 true,否则为 false |
抛出 | |
---|---|
UnsupportedOperationException |
如果实现不支持 |
stopInvocation
public boolean stopInvocation (int invocationId)
通过指定其 ID 来停止正在运行的调用。
参数 | |
---|---|
invocationId |
int |
返回 | |
---|---|
boolean |
如果调用已停止,则为 true,否则为 false |
抛出 | |
---|---|
UnsupportedOperationException |
如果实现不支持 |
stopInvocation
public abstract boolean stopInvocation (ITestInvocation invocation)
停止正在运行的调用。
参数 | |
---|---|
invocation |
ITestInvocation |
返回 | |
---|---|
boolean |
如果调用已停止,则为 true,否则为 false |
抛出 | |
---|---|
UnsupportedOperationException |
如果实现不支持 |