ClusterClient

public class ClusterClient
extends Object implements IClusterClient

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


用于与 TFC 后端交互的 IClusterClient 实现。

摘要

公共构造函数

ClusterClient()

公共方法

IClusterEventUploader<ClusterCommandEvent> getCommandEventUploader()

获取可用于上传 ClusterCommandEventIClusterEventUploader

ClusterCommand.State getCommandState(String requestId, String commandId)

确定集群命令的状态。

ClusterCommandStatus getCommandStatus(String requestId, String commandId)

获取集群命令的命令状态(状态和取消原因,如果已取消)。

IClusterEventUploader<ClusterHostEvent> getHostEventUploader()

获取可用于上传 ClusterHostEventIClusterEventUploader

TestContext getTestContext(String requestId, String commandId)

TestEnvironment getTestEnvironment(String requestId)

获取请求的 TestEnvironment

getTestResources(String requestId)

获取请求的 TestResource

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

为给定主机租用 ClusterCommand

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

公共构造函数

ClusterClient

public ClusterClient ()

公共方法

getCommandEventUploader

public IClusterEventUploader<ClusterCommandEvent> getCommandEventUploader ()

获取可用于上传 ClusterCommandEventIClusterEventUploader

返回
IClusterEventUploader<ClusterCommandEvent>

getCommandState

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

确定集群命令的状态。

参数
requestId String:集群请求 ID

commandId String:集群命令 ID

返回
ClusterCommand.State 集群命令的状态,如果无法确定状态,则为 ClusterCommand.State.UNKNOWN

getCommandStatus

public ClusterCommandStatus getCommandStatus (String requestId, 
                String commandId)

获取集群命令的命令状态(状态和取消原因,如果已取消)。

参数
requestId String:集群请求 ID

commandId String:集群命令 ID

返回
ClusterCommandStatus ClusterCommandStatus,表示命令的状态和取消原因(如果命令被取消)。如果无法确定状态,则状态为 ClusterCommand.State.UNKNOWN

getHostEventUploader

public IClusterEventUploader<ClusterHostEvent> getHostEventUploader ()

获取可用于上传 ClusterHostEventIClusterEventUploader

返回
IClusterEventUploader<ClusterHostEvent>

getTestContext

public TestContext getTestContext (String requestId, 
                String commandId)

参数
requestId String

commandId String

返回
TestContext

抛出
JSONException

getTestEnvironment

public TestEnvironment getTestEnvironment (String requestId)

获取请求的 TestEnvironment

返回
TestEnvironment TestEnvironment 对象。

抛出
JSONException

getTestResources

public  getTestResources (String requestId)

获取请求的 TestResource

返回
TestResource 的列表。

抛出
JSONException

leaseHostCommands

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

为给定主机租用 ClusterCommand

参数
clusterId String:主机的集群 ID

hostname String:主机名

deviceInfos :主机拥有的 deviceInfo

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

maxTasksTolease int:当前可租用的任务数上限

返回
ClusterCommand 列表

抛出
JSONException

updateTestContext

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

参数
requestId String

commandId String

testContext TestContext

抛出
JSONException