集群客戶端

public class ClusterClient
extends Object implements IClusterClient

java.lang.Object
com.android.tradefed.cluster.ClusterClient


用於與 TFC 後端交互的IClusterClient實現。

概括

公共構造函數

ClusterClient ()

公共方法

IClusterEventUploader < ClusterCommandEvent > getCommandEventUploader ()

獲取可用於上傳ClusterCommandEvent IClusterEventUploader

ClusterCommand.State getCommandState (String requestId, String commandId)

確定集群命令的狀態。

ClusterCommandStatus getCommandStatus (String requestId, String commandId)

獲取集群命令的命令狀態(取消時的狀態和取消原因)。

IClusterEventUploader < ClusterHostEvent > getHostEventUploader ()

獲取可用於上傳ClusterHostEvent IClusterEventUploader

TestContext getTestContext (String requestId, String commandId)

TestEnvironment getTestEnvironment (String requestId)

獲取請求的TestEnvironment

getTestResources (String requestId)

獲取請求的TestResource

leaseHostCommands (String clusterId, String hostname, deviceInfos, nextClusterIds, int maxTasksTolease) leaseHostCommands (String clusterId, String hostname, deviceInfos, nextClusterIds, int maxTasksTolease) leaseHostCommands (String clusterId, String hostname, deviceInfos, nextClusterIds, int maxTasksTolease)

為給定主機租用ClusterCommand

void updateTestContext (String requestId, String commandId, TestContext testContext)

公共構造函數

集群客戶端

public ClusterClient ()

公共方法

getCommandEventUploader

public IClusterEventUploader<ClusterCommandEvent> getCommandEventUploader ()

獲取可用於上傳ClusterCommandEvent IClusterEventUploader

退貨
IClusterEventUploader < ClusterCommandEvent >

獲取命令狀態

public ClusterCommand.State getCommandState (String requestId, 
                String commandId)

確定集群命令的狀態。

參數
requestId String : 集群請求ID

commandId String : 集群命令 ID

退貨
ClusterCommand.State集群命令的狀態,如果無法確定狀態,則為ClusterCommand.State#UNKNOWN

獲取命令狀態

public ClusterCommandStatus getCommandStatus (String requestId, 
                String commandId)

獲取集群命令的命令狀態(取消時的狀態和取消原因)。

參數
requestId String : 集群請求ID

commandId String : 集群命令 ID

退貨
ClusterCommandStatus一個 ClusterCommandStatus,表示命令被取消時的狀態和取消原因。如果無法確定,則狀態為ClusterCommand.State#UNKNOWN

獲取主機事件上傳器

public IClusterEventUploader<ClusterHostEvent> getHostEventUploader ()

獲取可用於上傳ClusterHostEvent IClusterEventUploader

退貨
IClusterEventUploader < ClusterHostEvent >

獲取測試上下文

public TestContext getTestContext (String requestId, 
                String commandId)

參數
requestId String

commandId String

退貨
TestContext

投擲
JSONException

獲取測試環境

public TestEnvironment getTestEnvironment (String requestId)

獲取請求的TestEnvironment

退貨
TestEnvironment一個TestEnvironment對象。

投擲
JSONException

獲取測試資源

public  getTestResources (String requestId)

獲取請求的TestResource

退貨
TestResource的列表。

投擲
JSONException

租賃主機命令

public  leaseHostCommands (String clusterId, 
                String hostname, 
                 deviceInfos, 
                 nextClusterIds, 
                int maxTasksTolease)

為給定主機租用ClusterCommand

參數
clusterId String :主機的集群 ID

hostname String :主機名

deviceInfos : 主機擁有的設備信息

nextClusterIds :要從中租用命令的下一個集群 ID 的列表。

maxTasksTolease int : 當前可以租用的最大任務數

退貨
ClusterCommand列表

投擲
JSONException

更新測試環境

public void updateTestContext (String requestId, 
                String commandId, 
                TestContext testContext)

參數
requestId String

commandId String

testContext TestContext

投擲
JSONException