ResultDBUtil
public
final
class
ResultDBUtil
extends Object
| java.lang.Object | |
| ↳ | com.android.tradefed.result.resultdb.ResultDBUtil |
ResultDB 報告工具的公用程式類別。
摘要
巢狀類別 | |
|---|---|
class |
ResultDBUtil.TruncationResult
這個簡單的類別會保留截斷作業的結果。 |
常數 | |
|---|---|
String |
NO_MODULE_NAME
|
公用建構函式 | |
|---|---|
ResultDBUtil()
|
|
公用方法 | |
|---|---|
static
String
|
bytesToHex(byte[] bytes)
將位元組陣列轉換為十六進位字串。 |
static
String
|
makeValidKey(String key)
確認金鑰適用於 ResultDB。 |
static
String
|
makeWorkUnitName(String rootInvocationId, String workUnitId)
從根叫用 ID 和工作單元 ID 建立工作單元資源名稱。 |
static
StringPair
|
primaryErrorTypeTag(TestRecordProto.FailureStatus failureStatus)
傳回可用於在 `tags` 集合中記錄錯誤類型的 StringPair。 |
static
TestIdentifier
|
toTestIdentifier(ModuleIdentifier moduleIdentifier, TestDescription testDescription)
將 TestDescription 轉換為 TestIdentifier。 |
static
ResultDBUtil.TruncationResult
|
truncateString(String input, int maxBytes)
Truncates the string to the given max bytes, avoiding breaking up a multi-byte character. |
常數
NO_MODULE_NAME
public static final String NO_MODULE_NAME
常數值: "no-module-name"
公用建構函式
ResultDBUtil
public ResultDBUtil ()
公用方法
bytesToHex
public static String bytesToHex (byte[] bytes)
將位元組陣列轉換為十六進位字串。
| 參數 | |
|---|---|
bytes |
byte |
| 傳回 | |
|---|---|
String |
|
makeValidKey
public static String makeValidKey (String key)
確認金鑰適用於 ResultDB。
鍵必須符合規則運算式:^[a-z][a-z0-9_]*(/[a-z][a-z0-9_]*)*$
| 參數 | |
|---|---|
key |
String |
| 傳回 | |
|---|---|
String |
|
makeWorkUnitName
public static String makeWorkUnitName (String rootInvocationId,
String workUnitId)從根叫用 ID 和工作單元 ID 建立工作單元資源名稱。
| 參數 | |
|---|---|
rootInvocationId |
String:根叫用 ID。 |
workUnitId |
String:工作單元 ID。 |
| 傳回 | |
|---|---|
String |
工作單元資源名稱。 |
primaryErrorTypeTag
public static StringPair primaryErrorTypeTag (TestRecordProto.FailureStatus failureStatus)
傳回可用於在 `tags` 集合中記錄錯誤類型的 StringPair。值符合 AnTS 錯誤類型值。
| 參數 | |
|---|---|
failureStatus |
TestRecordProto.FailureStatus |
| 傳回 | |
|---|---|
StringPair |
|
toTestIdentifier
public static TestIdentifier toTestIdentifier (ModuleIdentifier moduleIdentifier,
TestDescription testDescription)將 TestDescription 轉換為 TestIdentifier。
| 參數 | |
|---|---|
moduleIdentifier |
ModuleIdentifier |
testDescription |
TestDescription:測試說明 |
| 傳回 | |
|---|---|
TestIdentifier |
ResultDB 測試 ID。我們無法保證這個測試 ID 有效 (也就是說,ResultDB 可能會拒絕這個 ID,並傳回 invalid_argument 錯誤)。這是因為 ResultDB 對測試 ID 的要求較嚴格,例如欄位長度和字元集。 |
truncateString
public static ResultDBUtil.TruncationResult truncateString (String input, int maxBytes)
將字串截斷至指定位元組數上限,避免截斷多位元組字元。
| 參數 | |
|---|---|
input |
String:要截斷的字串 |
maxBytes |
int:要截斷的位元組數量上限 (採用 UTF-8 編碼) |
| 傳回 | |
|---|---|
ResultDBUtil.TruncationResult |
TruncationResult,內含截斷的字串和布林值,指出是否發生截斷。 |