ICommandScheduler

public interface ICommandScheduler

com.android.tradefed.command.ICommandScheduler


執行 TradeFederation 指令的排程器。

摘要

巢狀類別

interface ICommandScheduler.IScheduledInvocationListener

叫用完成後的叫用事件接聽程式。 

公用方法

abstract boolean addCommand(String[] args)

在排程器中新增指令。

abstract void addCommandFile(String cmdFile, extraArgs)

將指定檔案的所有指令新增至排程器

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 檔案 已為所有目前指令指定的 Option 值。

abstract void execCommand(IInvocationContext context, ICommandScheduler.IScheduledInvocationListener listener, String[] args)

直接分配裝置並執行指令,且不會將裝置新增至指令佇列 使用現有的 IInvocationContext

abstract void execCommand(ICommandScheduler.IScheduledInvocationListener listener, String[] args)

直接分配裝置並執行指令,且不會將裝置新增至指令佇列。

abstract void execCommand(ICommandScheduler.IScheduledInvocationListener listener, ITestDevice device, String[] args)

直接在已分配的裝置上執行指令。

abstract CommandFileWatcher getCommandFileWatcher()

取得這個排程器適用的 CommandFileWatcher

abstract int getExecutingCommandCount()

傳回執行中狀態的指令數量。

abstract String getInvocationInfo(int invocationId)

傳回指定叫用 ID 的叫用耳機資訊。

abstract CommandRunner.ExitCode getLastInvocationExitCode()

傳回上次執行叫用的錯誤代碼。

abstract Throwable getLastInvocationThrowable()

從上次執行的叫用中傳回 Throwable

abstract int getReadyCommandCount()

傳回佇列中處於就緒狀態的指令數量。

abstract void handoverInitiationComplete()

向指令排程器告知初始交接裝置與使用中的指令 完成後,即可開始安排作業。

abstract boolean handoverShutdown(int handoverPort)

啟動 shutdown() 並轉移至同一主機的其他交易程序。

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()

shutdown() 類似,但會等待所有指令執行完畢 。

abstract void start()

啟動 ICommandScheduler

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 無法剖析 if 指令

addCommandFile

public abstract void addCommandFile (String cmdFile, 
                 extraArgs)

將指定檔案的所有指令新增至排程器

參數
cmdFile String:comand 檔案的檔案系統路徑

extraArgs String 引數的 ERROR(/List),附加在剖析的每個指令上 。可以是空白,但不能為空值。

擲回
ConfigurationException if 指令檔案無法剖析

另請參閱:

等人

public abstract void await ()

等待排程器開始執行,包括等待舊 TF 轉換完成 (如適用)。

完整 Handover

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:為求相符指令的規則運算式 如果值為空值,則所有指令都會顯示。

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 檔案如果為空值,系統會傾印所有指令。

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。 如果沒有可用的 Throwable,則傳回空值。

傳回
Throwable

getReadyCommandCount

public abstract int getReadyCommandCount ()

傳回佇列中處於就緒狀態的指令數量。

傳回
int

移交完成

public abstract void handoverInitiationComplete ()

向指令排程器告知初始交接裝置與使用中的指令 完成後,即可開始安排作業。

關機

public abstract boolean handoverShutdown (int handoverPort)

啟動 shutdown() 並轉移至同一主機的其他交易程序。

排程器會通知遠端交易程序在監聽該釋出裝置的通訊埠 及時採用。

參數
handoverPort int

傳回
boolean true 如果交替啟動成功,false 否則

加入

public abstract void 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 ()

嘗試強制關閉指令排程器。與 ShutHard(true) 相同。

關閉

public abstract void shutdownOnEmpty ()

shutdown() 類似,但會等待所有指令執行完畢 。

請注意,如果任何指令處於循環模式,排程器一律不會結束。

start

public abstract void start ()

啟動 ICommandScheduler

必須先呼叫才能呼叫其他方法。

將持續執行到呼叫 shutdown() 為止。 請參閱 Thread.start()

停止叫用

public abstract boolean stopInvocation (int invocationId, 
                String cause)

指定 ID 即可停止執行中的叫用。

參數
invocationId int:叫用的追蹤 ID。

cause String:停止叫用的原因。

傳回
boolean 如果叫用已停止,傳回 true,否則傳回 false

擲回
UnsupportedOperationException 如果實作不支援這項功能

停止叫用

public boolean stopInvocation (int invocationId)

指定 ID 即可停止執行中的叫用。

參數
invocationId int

傳回
boolean 如果叫用已停止,傳回 true,否則傳回 false

擲回
UnsupportedOperationException 如果實作不支援這項功能

停止叫用

public abstract boolean stopInvocation (ITestInvocation invocation)

停止執行中的叫用。

參數
invocation ITestInvocation

傳回
boolean 如果叫用已停止,傳回 true,否則傳回 false

擲回
UnsupportedOperationException 如果實作不支援這項功能