叢集主機工具
public class ClusterHostUtil
extends Object
java.lang.Object | |
↳ | com.android.tradefed.cluster.ClusterHostUtil |
TF Cluster 的靜態 util 函數用於取得全域設定實例、主機資訊等。
概括
公共構造函數 | |
---|---|
ClusterHostUtil () |
公共方法 | |
---|---|
static IClusterClient | getClusterClient () 取得用於與 TFC 後端互動的 |
static IClusterOptions | getClusterOptions () 取得用於儲存叢集相關設定的 |
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 | 版本(如果有效)或預設版本(如果無效)。 |