TestIdUtils
public
final
class
TestIdUtils
extends Object
| java.lang.Object | |
| ↳ | com.android.tradefed.result.resultdb.utils.TestIdUtils |
A utility class for sanitizing test IDs for ResultDB.
This class is copied from ResultDB codebase for compatibility.
Summary
Constants | |
|---|---|
String |
JUNIT_PACKAGE_PLACEHOLDER
|
String |
PYUNIT_PACKAGE_PLACEHOLDER
|
Public methods | |
|---|---|
static
String
|
escapeCaseName(String caseName)
Escapes a case name into a valid ResultDB case name. |
Constants
JUNIT_PACKAGE_PLACEHOLDER
public static final String JUNIT_PACKAGE_PLACEHOLDER
Constant Value: "no-package-name"
PYUNIT_PACKAGE_PLACEHOLDER
public static final String PYUNIT_PACKAGE_PLACEHOLDER
Constant Value: "__main__"
Public methods
escapeCaseName
public static String escapeCaseName (String caseName)
Escapes a case name into a valid ResultDB case name. This escaping does NOT support case name with ResultDB's extended depth hierarchy feature, which treats colon as a separator for case name parts.
The escaping is done as follows:
- If the case name contains non-printable characters, a disallowed leading character ([
!"#$%&'()*+,]), or ends with "\u2051", it undergoes special escaping:
- Backslashes (`\`) are escaped to `\\`.
- A leading character is escaped with a backslash if it is one of [ !"#$%&'()*+,] (U+0020 to U+002C).
- Non-printable characters are converted to their literal unicode escape sequence (\\uXXXX or \\UXXXXXXXX).
- A special suffix "\u2051" is appended.
- On the result of step 1 (or the original string if step 1 was skipped), the following
replacements are made:
- Backslashes (`\`) are escaped to `\\`.
- Colons (`:`) are escaped to `\:`.
This means backslashes can be double-escaped.
DON'T USE this function if you are using ResultDB's extended depth hierarchy feature.
This method is the Java equivalent of the EscapeCaseName function in chrome/engprod/resultdb/go/utils/test_id.go. The round-trip capability with the Go UnescapeCaseName function is tested in the Go codebase.
| Parameters | |
|---|---|
caseName |
String |
| Returns | |
|---|---|
String |
|