AndroidCompatibility
public
final
class
AndroidCompatibility
extends Object
| java.lang.Object | |
| ↳ | com.android.tradefed.result.resultdb.utils.AndroidCompatibility |
Provides methods to facilitate uploading Android-specific fields to ResultDB.
This class is copied from ResultDB codebase for compatibility. Some functions are removed due to lack of dependencies.
Summary
Constants | |
|---|---|
int |
MAX_TAG_KEY_BYTES
The maximum size of a tag key in bytes. |
String |
PRIMARY_ERROR_CODE_TAG_KEY
The tag key used to record an error code associated with the error name associated with the primary error (failure_reason.errors[0]). |
String |
PRIMARY_ERROR_NAME_TAG_KEY
The tag key used to record an error identifier (e.g. OUT_OF_QUOTA, MOBLY_TEST_CASE_ERROR, EXPECTED_TESTS_MISMATCH) associated with the primary error (failure_reason.errors[0]). |
String |
PRIMARY_ERROR_ORIGIN_TAG_KEY
The tag key used to record the fully qualified Java class name that created and threw the exception associated with the primary error (failure_reason.errors[0]). |
String |
PRIMARY_ERROR_TYPE_TAG_KEY
The tag key used to record an error type for the primary error (failure_reason.errors[0]). |
String |
SKIP_BUG_TAG_KEY
The tag key used to store the buganizer ID for the issue that caused the tests to be skipped. |
String |
SKIP_TRIGGER_TAG_KEY
The tag key used to store the condition that caused the test to be skipped. |
Public methods | |
|---|---|
static
String
|
makeValidTagKey(String key)
MakeValidTagKey converts the key of an AnTS property to a valid ResultDB tag key. |
static
Struct
|
marshalTestResultProperties(TestResultProperties properties)
Marshals a TestResultProperties proto (a copy of wireless.android.busytown.proto.TestResultProperties) to a google.protobuf.Struct for storage in ResultDB. |
static
StringPair
|
primaryErrorCodeTag(long code)
Returns a StringPair that can be used to record an error code associated with the primary error (failure_reason.errors[0]). |
static
StringPair
|
primaryErrorNameTag(String name)
Returns a StringPair that can be used to record an error identifier (e.g. OUT_OF_QUOTA, MOBLY_TEST_CASE_ERROR, EXPECTED_TESTS_MISMATCH) associated with the primary error (failure_reason.errors[0]). |
static
StringPair
|
primaryErrorOriginTag(String origin)
Returns a StringPair that can be used to record] the fully qualified java class name that created and threw the exception associated with the primary error (failure_reason.errors[0]). |
static
StringPair
|
skipBugTag(String bugId)
Returns a StringPair that can be used to record the buganizer ID for the issue that caused the tests to be skipped. |
static
StringPair
|
skipTriggerTag(String trigger)
Returns a StringPair that can be used to record the condition that caused the test to be skipped. |
Constants
MAX_TAG_KEY_BYTES
public static final int MAX_TAG_KEY_BYTES
The maximum size of a tag key in bytes.
Constant Value: 64 (0x00000040)
PRIMARY_ERROR_CODE_TAG_KEY
public static final String PRIMARY_ERROR_CODE_TAG_KEY
The tag key used to record an error code associated with the error name associated with the primary error (failure_reason.errors[0]).
Constant Value: "primary_error_code"
PRIMARY_ERROR_NAME_TAG_KEY
public static final String PRIMARY_ERROR_NAME_TAG_KEY
The tag key used to record an error identifier (e.g. OUT_OF_QUOTA, MOBLY_TEST_CASE_ERROR, EXPECTED_TESTS_MISMATCH) associated with the primary error (failure_reason.errors[0]).
Constant Value: "primary_error_name"
PRIMARY_ERROR_ORIGIN_TAG_KEY
public static final String PRIMARY_ERROR_ORIGIN_TAG_KEY
The tag key used to record the fully qualified Java class name that created and threw the exception associated with the primary error (failure_reason.errors[0]).
Constant Value: "primary_error_origin"
PRIMARY_ERROR_TYPE_TAG_KEY
public static final String PRIMARY_ERROR_TYPE_TAG_KEY
The tag key used to record an error type for the primary error (failure_reason.errors[0]).
Constant Value: "primary_error_type"
SKIP_BUG_TAG_KEY
public static final String SKIP_BUG_TAG_KEY
The tag key used to store the buganizer ID for the issue that caused the tests to be skipped.
Constant Value: "skip_bug_id"
SKIP_TRIGGER_TAG_KEY
public static final String SKIP_TRIGGER_TAG_KEY
The tag key used to store the condition that caused the test to be skipped.
Constant Value: "skip_trigger"
Public methods
makeValidTagKey
public static String makeValidTagKey (String key)
MakeValidTagKey converts the key of an AnTS property to a valid ResultDB tag key.
This is necessary because ResultDB tag keys are limited to matching ^[a-z][a-z0-9_]*(/[a-z][a-z0-9_]*)*$.
Note: ResultDB applies a length limit of 64 bytes to keys. If your keys are longer than this you might have to upload the data via other means to avoid data loss. See go/resultdb-uploader-guidance#ants-field-properties for options.
| Parameters | |
|---|---|
key |
String |
| Returns | |
|---|---|
String |
|
marshalTestResultProperties
public static Struct marshalTestResultProperties (TestResultProperties properties)
Marshals a TestResultProperties proto (a copy of wireless.android.busytown.proto.TestResultProperties) to a google.protobuf.Struct for storage in ResultDB.
| Parameters | |
|---|---|
properties |
TestResultProperties |
| Returns | |
|---|---|
Struct |
|
| Throws | |
|---|---|
InvalidProtocolBufferException |
|
primaryErrorCodeTag
public static StringPair primaryErrorCodeTag (long code)
Returns a StringPair that can be used to record an error code associated with the primary error (failure_reason.errors[0]).
| Parameters | |
|---|---|
code |
long |
| Returns | |
|---|---|
StringPair |
|
primaryErrorNameTag
public static StringPair primaryErrorNameTag (String name)
Returns a StringPair that can be used to record an error identifier (e.g. OUT_OF_QUOTA, MOBLY_TEST_CASE_ERROR, EXPECTED_TESTS_MISMATCH) associated with the primary error (failure_reason.errors[0]).
| Parameters | |
|---|---|
name |
String |
| Returns | |
|---|---|
StringPair |
|
primaryErrorOriginTag
public static StringPair primaryErrorOriginTag (String origin)
Returns a StringPair that can be used to record] the fully qualified java class name that created and threw the exception associated with the primary error (failure_reason.errors[0]).
| Parameters | |
|---|---|
origin |
String |
| Returns | |
|---|---|
StringPair |
|
skipBugTag
public static StringPair skipBugTag (String bugId)
Returns a StringPair that can be used to record the buganizer ID for the issue that caused the tests to be skipped.
| Parameters | |
|---|---|
bugId |
String |
| Returns | |
|---|---|
StringPair |
|
skipTriggerTag
public static StringPair skipTriggerTag (String trigger)
Returns a StringPair that can be used to record the condition that caused the test to be skipped.
| Parameters | |
|---|---|
trigger |
String |
| Returns | |
|---|---|
StringPair |
|