ResultDBUtil

public final class ResultDBUtil
extends Object

java.lang.Object
   ↳ com.android.tradefed.result.resultdb.ResultDBUtil


Classe utilitaire pour le rapporteur ResultDB.

Résumé

Constructeurs publics

ResultDBUtil()

Méthodes publiques

static String bytesToHex(byte[] bytes)

Convertit un tableau d'octets en chaîne hexadécimale.

static String makeValidKey(String key)

Assurez-vous que la clé est valide pour ResultDB.

static String testSkipReasonToSummaryHtml(SkipReason reason, String skipReasonType)

Convertit une raison d'ignorer un test en chaîne HTML récapitulative.

static TestIdentifier toTestIdentifier(String moduleName, Variant moduleVariant, TestDescription testDescription)

Convertit une TestDescription en TestIdentifier.

static String truncateString(String input, int maxBytes)

Tronque la chaîne au nombre maximal d'octets indiqué, en évitant de couper un caractère multi-octets.

Constructeurs publics

ResultDBUtil

public ResultDBUtil ()

Méthodes publiques

bytesToHex

public static String bytesToHex (byte[] bytes)

Convertit un tableau d'octets en chaîne hexadécimale.

Paramètres
bytes byte

Renvoie
String

makeValidKey

public static String makeValidKey (String key)

Assurez-vous que la clé est valide pour ResultDB.

La clé doit correspondre à l'expression régulière : ^[a-z][a-z0-9_]*(/[a-z][a-z0-9_]*)*$

Paramètres
key String

Renvoie
String

testSkipReasonToSummaryHtml

public static String testSkipReasonToSummaryHtml (SkipReason reason, 
                String skipReasonType)

Convertit une raison d'ignorer un test en chaîne HTML récapitulative. ResultDB ne dispose pas encore d'un champ de motif d'ignorance. Pour le moment, nous les plaçons dans le champ HTML récapitulatif et dans l'artefact de test. La chaîne de retour peut être plus longue que la limite du champ HTML récapitulatif. L'appelant doit la tronquer si nécessaire.

Paramètres
reason SkipReason

skipReasonType String

Renvoie
String

toTestIdentifier

public static TestIdentifier toTestIdentifier (String moduleName, 
                Variant moduleVariant, 
                TestDescription testDescription)

Convertit une TestDescription en TestIdentifier.

Paramètres
moduleName String : nom du module

moduleVariant Variant : variante du module

testDescription TestDescription : description du test

Renvoie
TestIdentifier Identifiant du test ResultDB. Cet identifiant de test n'est pas garanti comme étant valide (c'est-à-dire que ResultDB peut le refuser et renvoyer une erreur invalid_argument). En effet, ResultDB impose des exigences plus strictes concernant l'identifiant de test, comme la longueur du champ et le jeu de caractères.

truncateString

public static String truncateString (String input, 
                int maxBytes)

Tronque la chaîne au nombre maximal d'octets indiqué, en évitant de couper un caractère multi-octets.

Paramètres
input String : chaîne à tronquer

maxBytes int : nombre maximal d'octets (en encodage UTF-8) à tronquer

Renvoie
String la chaîne tronquée