27 Mart 2025'ten itibaren AOSP'yi derlemek ve AOSP'ye katkıda bulunmak için aosp-main
yerine android-latest-release
kullanmanızı öneririz. Daha fazla bilgi için AOSP'de yapılan değişiklikler başlıklı makaleyi inceleyin.
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
HostUtils
public
final
class
HostUtils
extends Object
java.lang.Object
|
↳ |
com.android.tradefed.lite.HostUtils
|
Ana makine testleri çalıştırmak için bazı yararlı yardımcı program yöntemlerini uygular.
Bu, ana makinede testleri bulmak ve JUnit testlerinin yürütülmesini taklit etmek için birkaç yöntem uygular. Böylece testleri "kuru çalıştırabiliriz".
Özet
Herkese açık yöntemler |
static
|
getJUnitClasses( classNames, jarAbsPaths, ClassLoader pcl)
|
static
|
getJUnitClasses( classNames, jarAbsPaths, excludePaths, ClassLoader pcl)
Sağlanan sınıf adlarından ve jar yollarından JUnit4 test durumlarını alır.
|
static
boolean
|
hasJUnitAnnotation(Class<?> classObj)
Bir sınıfın JUnit testi gibi görünüp görünmediğini kontrol eder.
|
static
boolean
|
testLoadClass(String className, URLClassLoader cl, String jarName)
Sınıfın uygun bir test sınıfı olup olmadığını test eder.
|
Herkese açık yöntemler
getJUnitClasses
public static getJUnitClasses ( classNames,
jarAbsPaths,
ClassLoader pcl)
Parametreler |
classNames |
|
jarAbsPaths |
|
pcl |
ClassLoader |
getJUnitClasses
public static getJUnitClasses ( classNames,
jarAbsPaths,
excludePaths,
ClassLoader pcl)
Sağlanan sınıf adlarından ve jar yollarından JUnit4 test durumlarını alır.
Parametreler |
classNames |
: JUnit testlerini kontrol etmek için geçerli sınıf yolunda bulunan sınıflar |
jarAbsPaths |
: Test ek açıklamaları içeren sınıfları aranacak jar dosyaları. |
excludePaths |
|
pcl |
ClassLoader |
İlerlemeler |
|
Çalıştırılacağı test sınıfları olan sınıf nesnelerinin listesi. |
Atışlar |
|
IllegalArgumentException |
hasJUnitAnnotation
public static boolean hasJUnitAnnotation (Class<?> classObj)
Bir sınıfın JUnit testi gibi görünüp görünmediğini kontrol eder.
Parametreler |
classObj |
Class : Ek açıklama için incelenecek sınıf |
İlerlemeler |
boolean |
sınıf nesnesinde JUnit4 test ek açıklaması olup olmadığı |
testLoadClass
public static boolean testLoadClass (String className,
URLClassLoader cl,
String jarName)
Sınıfın uygun bir test sınıfı olup olmadığını test eder.
Bu durumda uygun, standart çalıştırıcılardan birini veya bunların alt sınıflarından birini kullanan geçerli bir JUnit test sınıfı anlamına gelir. Sınıfın da yüklenmesi gerekir.
İlerlemeler |
boolean |
Bu sınıfı test sınıfı olarak kabul etmemiz gerekiyorsa true, aksi takdirde false değerini alır. |
Bu sayfadaki içerik ve kod örnekleri, İçerik Lisansı sayfasında açıklanan lisanslara tabidir. Java ve OpenJDK, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-07-27 UTC.
[[["Anlaması kolay","easyToUnderstand","thumb-up"],["Sorunumu çözdü","solvedMyProblem","thumb-up"],["Diğer","otherUp","thumb-up"]],[["İhtiyacım olan bilgiler yok","missingTheInformationINeed","thumb-down"],["Çok karmaşık / çok fazla adım var","tooComplicatedTooManySteps","thumb-down"],["Güncel değil","outOfDate","thumb-down"],["Çeviri sorunu","translationIssue","thumb-down"],["Örnek veya kod sorunu","samplesCodeIssue","thumb-down"],["Diğer","otherDown","thumb-down"]],["Son güncelleme tarihi: 2025-07-27 UTC."],[],[],null,["# HostUtils\n=========\n\n\n`\npublic\n\nfinal\n\nclass\nHostUtils\n`\n\n\n`\n\nextends Object\n\n\n`\n\n`\n\n\n`\n\n|---|-------------------------------------|\n| java.lang.Object ||\n| ↳ | com.android.tradefed.lite.HostUtils |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nImplements some useful utility methods for running host tests.\n\nThis implements a few methods for finding tests on the host and faking execution of JUnit\ntests so we can \"dry run\" them.\n\nSummary\n-------\n\n| ### Public methods ||\n|-------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` static ` | ` `[getJUnitClasses](../../../../../../reference/tradefed/com/android/tradefed/lite/HostUtils.html#getJUnitClasses(\u003cany\u003e,%20\u003cany\u003e,%20java.lang.ClassLoader))`(` classNames, jarAbsPaths, ClassLoader pcl) |\n| ` static ` | ` `[getJUnitClasses](../../../../../../reference/tradefed/com/android/tradefed/lite/HostUtils.html#getJUnitClasses(\u003cany\u003e,%20\u003cany\u003e,%20\u003cany\u003e,%20java.lang.ClassLoader))`(` classNames, jarAbsPaths, excludePaths, ClassLoader pcl) Gets JUnit4 test cases from provided classnames and jar paths. |\n| ` static boolean` | ` `[hasJUnitAnnotation](../../../../../../reference/tradefed/com/android/tradefed/lite/HostUtils.html#hasJUnitAnnotation(java.lang.Class\u003c?\u003e))`(Class\u003c?\u003e classObj) ` Checks whether a class looks like a JUnit test or not. |\n| ` static boolean` | ` `[testLoadClass](../../../../../../reference/tradefed/com/android/tradefed/lite/HostUtils.html#testLoadClass(java.lang.String,%20URLClassLoader,%20java.lang.String))`(String className, URLClassLoader cl, String jarName) ` Tests whether the class is a suitable test class or not. |\n\nPublic methods\n--------------\n\n### getJUnitClasses\n\n```\npublic static getJUnitClasses ( classNames, \n jarAbsPaths, \n ClassLoader pcl)\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Parameters ||\n|---------------|----------------------|\n| `classNames` | \u003cbr /\u003e |\n| `jarAbsPaths` | \u003cbr /\u003e |\n| `pcl` | `ClassLoader` \u003cbr /\u003e |\n\n| Returns ||\n|---|--------|\n| | \u003cbr /\u003e |\n\n### getJUnitClasses\n\n```\npublic static getJUnitClasses ( classNames, \n jarAbsPaths, \n excludePaths, \n ClassLoader pcl)\n```\n\nGets JUnit4 test cases from provided classnames and jar paths.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|----------------|--------------------------------------------------------------------------------|\n| `classNames` | : Classes that exist in the current class path to check for JUnit tests \u003cbr /\u003e |\n| `jarAbsPaths` | : Jars to search for classes with the test annotations. \u003cbr /\u003e |\n| `excludePaths` | \u003cbr /\u003e |\n| `pcl` | `ClassLoader` \u003cbr /\u003e |\n\n| Returns ||\n|---|------------------------------------------------------------------|\n| | a list of class objects that are test classes to execute. \u003cbr /\u003e |\n\n| Throws ||\n|---|--------------------------|\n| | IllegalArgumentException |\n\n### hasJUnitAnnotation\n\n```\npublic static boolean hasJUnitAnnotation (Class\u003c?\u003e classObj)\n```\n\nChecks whether a class looks like a JUnit test or not.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|------------|-----------------------------------------------------|\n| `classObj` | `Class`: Class to examine for the annotation \u003cbr /\u003e |\n\n| Returns ||\n|-----------|----------------------------------------------------------------|\n| `boolean` | whether the class object has the JUnit4 test annotation \u003cbr /\u003e |\n\n### testLoadClass\n\n```\npublic static boolean testLoadClass (String className, \n URLClassLoader cl, \n String jarName)\n```\n\nTests whether the class is a suitable test class or not.\n\nIn this case, suitable means it is a valid JUnit test class using one of the standard\nrunners or a subclass thereof. The class should also load, obviously.\n\n\u003cbr /\u003e\n\n| Returns ||\n|-----------|----------------------------------------------------------------------------|\n| `boolean` | true if we should consider this class a test class, false otherwise \u003cbr /\u003e |"]]