集群主机工具

public class ClusterHostUtil
extends Object

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


TF Cluster 的静态 util 函数用于获取全局配置实例、主机信息等。

概括

公共构造函数

ClusterHostUtil ()

公共方法

static IClusterClient getClusterClient ()

获取用于与 TFC 后端交互的IClusterClient实例。

static IClusterOptions getClusterOptions ()

获取用于存储集群相关设置的IClusterOptions实例。

static long getCurrentTimeMillis ()

返回当前系统时间。

static String getHostIpAddress ()

获取IP地址。

static String getHostName ()

获取主机名。

static String getLocalDeviceSerial (String serial)

返回给定唯一设备序列号的本地设备序列号。

static String getRunTarget ( DeviceDescriptor device, String runTargetFormat, deviceTags) getRunTarget ( DeviceDescriptor device, String runTargetFormat, deviceTags)

返回给定设备描述符的运行目标。

static String getTestHarness ()
static long getTfStartTimeMillis ()
static String getTfVersion ()

获取该主机上运行的 TF 版本。

static String getUniqueDeviceSerial ( DeviceDescriptor device)

返回设备的唯一设备序列号。

static boolean isLocalhostIpPort (String input)

检查给定输入是否为本地主机 IP:PORT 字符串。

受保护的方法

static String toValidTfVersion (String version)

验证 TF 版本,如果正常则返回。

公共构造函数

集群主机工具

public ClusterHostUtil ()

公共方法

获取集群客户端

public static IClusterClient getClusterClient ()

获取用于与 TFC 后端交互的IClusterClient实例。

退货
IClusterClient

获取集群选项

public static IClusterOptions getClusterOptions ()

获取用于存储集群相关设置的IClusterOptions实例。

退货
IClusterOptions

获取当前时间毫秒

public static long getCurrentTimeMillis ()

返回当前系统时间。

退货
long时间(以毫秒为单位)。

获取主机IP地址

public static String getHostIpAddress ()

获取IP地址。

退货
String IPV4 地址字符串或“未知”(如果我们无法获取它)。

获取主机名

public static String getHostName ()

获取主机名。

1. 尝试从 InetAddress 获取主机名。 2. 如果失败,尝试从 HOSTNAME env 获取主机名。 3. 如果未设置,则生成唯一的主机名。

退货
String主机名或 null(如果我们无法获取它)。

获取本地设备序列号

public static String getLocalDeviceSerial (String serial)

返回给定唯一设备序列号的本地设备序列号。

TFC 发送 TF 无法理解的非物理设备的唯一设备序列号。此方法将它们转换回本地设备序列号。

参数
serial String :来自 TFC 的唯一设备序列号。

退货
String本地设备序列号。

获取运行目标

public static String getRunTarget (DeviceDescriptor device, 
                String runTargetFormat, 
                 deviceTags)

返回给定设备描述符的运行目标。

参数
device DeviceDescriptor :要获取其运行目标的DeviceDescriptor

runTargetFormat String

deviceTags

退货
String运行目标。

获取测试工具

public static String getTestHarness ()

退货
String

getTfStartTimeMillis

public static long getTfStartTimeMillis ()

退货
long

获取Tf版本

public static String getTfVersion ()

获取该主机上运行的 TF 版本。

退货
String本主机的TF版本。

获取唯一设备序列号

public static String getUniqueDeviceSerial (DeviceDescriptor device)

返回设备的唯一设备序列号。

非物理设备(例如模拟器)具有伪串行,这些伪串行在主机之间不是唯一的。此方法为这些主机名添加前缀以使其唯一。

参数
device DeviceDescriptor :设备描述符。

退货
String独特的设备序列。

是本地主机IP端口

public static boolean isLocalhostIpPort (String input)

检查给定输入是否为本地主机 IP:PORT 字符串。

参数
input String : 要检查的字符串

退货
boolean true 如果给定的输入是本地主机 IP:PORT 字符串

受保护的方法

有效Tf版本

protected static String toValidTfVersion (String version)

验证 TF 版本,如果正常则返回。

参数
version String : VersionParser提供的 TF 版本的字符串

退货
String版本(如果有效)或默认版本(如果无效)。