TradefedSandbox

public class TradefedSandbox
extends Object implements ISandbox

java.lang.Object
   ↳ com.android.tradefed.sandbox.TradefedSandbox


קונטיינר של ארגז חול שיכול להריץ קריאה לפונקציה של Trade Federation. TODO: Allow Options to be passed to the sandbox.

סיכום

ערכים קבועים

String EXTRA_TARGET_LAB

String GENERAL_TESTS_ZIP

String SANDBOX_ENABLED

‫Constructors ציבוריים

TradefedSandbox()

‫methods ציבוריים

String createClasspath(File workingDir)

יוצרים נתיב מחלקות על סמך הסביבה וספריית העבודה שמוחזרות על ידי getTradefedSandboxEnvironment(IInvocationContext,IConfiguration,String[]).

IConfiguration createThinLauncherConfig(String[] args, IKeyStoreClient keyStoreClient, IRunUtil runUtil, File globalConfig)

מצב מיוחד שבו אין חיבור לריצה הראשית: אם נראה שההגדרה לא קיימת בתיקיית האב, המערכת חוזרת להפעלה דקה שבה היא מנסה להגדיר את ארגז החול עם המידע שזמין כרגע, וממלאת את ספריית העבודה כדי ליצור את ההגדרה באופן מלא בספרייה עם הגרסה.

File getTradefedSandboxEnvironment(IInvocationContext context, IConfiguration nonVersionedConfig, ITestLogger logger, String[] args)
static Set<String> matchSandboxExtraBuildTargetByConfigName(String configName)

בהינתן שם הגדרת הבדיקה, צריך להתאים את יעדי הבנייה הנוספים מתוך יעדי הבנייה הנוספים של Sandbox.

Exception prepareEnvironment(IInvocationContext context, IConfiguration config, ITestInvocationListener listener)

מכינים את הסביבה כדי שארגז החול יפעל בצורה תקינה.

static String[] removeIncompatibleFlags(String[] args)
CommandResult run(TestInformation info, IConfiguration config, ITestLogger logger)

מריצים את ארגז החול עם הסביבה שהוגדרה.

void tearDown()

מנקים את כל המצבים, הקבצים או הסביבה שאולי השתנו.

שיטות מוגנות

File dumpGlobalConfig(IConfiguration config, Set<String> exclusionPatterns)

הצגת התצורה הגלובלית אחרי סינון של חלק מהאובייקטים.

String getJava()
Exception prepareConfiguration(IInvocationContext context, IConfiguration config, ITestInvocationListener listener)

מכינים את IConfiguration שיועבר לתהליך המשנה ויפעיל את קובץ ה-Docker.

File prepareContext(IInvocationContext context, IConfiguration config)

מכינים את IInvocationContext ומבצעים סריאליזציה.

ערכים קבועים

EXTRA_TARGET_LAB

public static final String EXTRA_TARGET_LAB

ערך קבוע: "lab"

GENERAL_TESTS_ZIP

public static final String GENERAL_TESTS_ZIP

ערך קבוע: "general-tests.zip"

SANDBOX_ENABLED

public static final String SANDBOX_ENABLED

ערך קבוע: "SANDBOX_ENABLED"

‫constructors ציבוריים

TradefedSandbox

public TradefedSandbox ()

‫methods ציבוריים

createClasspath

public String createClasspath (File workingDir)

יוצרים נתיב מחלקות על סמך הסביבה וספריית העבודה שמוחזרות על ידי getTradefedSandboxEnvironment(IInvocationContext,IConfiguration,String[]).

פרמטרים
workingDir File: ספריית העבודה הנוכחית של ארגז החול.

החזרות
String נתיב המחלקה לשימוש.

הקפצת הודעות שגיאה (throw)
ConfigurationException

createThinLauncherConfig

public IConfiguration createThinLauncherConfig (String[] args, 
                IKeyStoreClient keyStoreClient, 
                IRunUtil runUtil, 
                File globalConfig)

מצב מיוחד שבו אין חיבור לריצה הראשית: אם נראה שההגדרה לא קיימת בתיקיית האב, המערכת חוזרת להפעלה דקה שבה היא מנסה להגדיר את ארגז החול עם המידע שזמין כרגע, וממלאת את ספריית העבודה כדי ליצור את ההגדרה באופן מלא בספרייה עם הגרסה.

פרמטרים
args String: הארגומנטים המקוריים של שורת הפקודה.

keyStoreClient IKeyStoreClient: לקוח מאגר המפתחות הנוכחי שמשמש ליצירת תצורות.

runUtil IRunUtil: IRunUtil הנוכחי להרצת פקודות במארח.

globalConfig File: ההגדרה הגלובלית שמשמשת להרצת תהליכי משנה של TF.

החזרות
IConfiguration קובץ שמפנה ל-XML של ההגדרות של TF לאובייקטים מסוג NON_VERSIONED. הפונקציה מחזירה null אם לא ניתן ליצור הגדרות של משגר דק.

getTradefedSandboxEnvironment

public File getTradefedSandboxEnvironment (IInvocationContext context, 
                IConfiguration nonVersionedConfig, 
                ITestLogger logger, 
                String[] args)

פרמטרים
context IInvocationContext

nonVersionedConfig IConfiguration

logger ITestLogger

args String

החזרות
File

הקפצת הודעות שגיאה (throw)
Exception

matchSandboxExtraBuildTargetByConfigName

public static Set<String> matchSandboxExtraBuildTargetByConfigName (String configName)

בהינתן שם הגדרת הבדיקה, צריך להתאים את יעדי הבנייה הנוספים מתוך יעדי הבנייה הנוספים של Sandbox.

פרמטרים
configName String

החזרות
Set<String>

prepareEnvironment

public Exception prepareEnvironment (IInvocationContext context, 
                IConfiguration config, 
                ITestInvocationListener listener)

מכינים את הסביבה כדי שארגז החול יפעל בצורה תקינה.

פרמטרים
context IInvocationContext: ההפעלה הנוכחית IInvocationContext.

config IConfiguration: IConfiguration של הפקודה להרצה.

listener ITestInvocationListener: ההפעלה הנוכחית ITestInvocationListener שבה צריך להעביר את התוצאות הסופיות.

החזרות
Exception אובייקט Exception שמכיל את הכישלון, או Null אם הפעולה הצליחה.

removeIncompatibleFlags

public static String[] removeIncompatibleFlags (String[] args)

פרמטרים
args String

החזרות
String[]

ראן

public CommandResult run (TestInformation info, 
                IConfiguration config, 
                ITestLogger logger)

מריצים את ארגז החול עם הסביבה שהוגדרה.

פרמטרים
info TestInformation: ה-TestInformation שמתאר את ההפעלה

config IConfiguration: IConfiguration של הפקודה להרצה.

logger ITestLogger: ITestLogger שבו אפשר לרשום קובצי יומן.

החזרות
CommandResult CommandResult עם הסטטוס של ההרצה בסביבת הארגז ויומנים.

הקפצת הודעות שגיאה (throw)
Throwable

tearDown

public void tearDown ()

מנקים את כל המצבים, הקבצים או הסביבה שאולי השתנו.

שיטות מוגנות

dumpGlobalConfig

protected File dumpGlobalConfig (IConfiguration config, 
                Set<String> exclusionPatterns)

הצגת התצורה הגלובלית אחרי סינון של חלק מהאובייקטים.

פרמטרים
config IConfiguration

exclusionPatterns Set

החזרות
File

הקפצת הודעות שגיאה (throw)
ConfigurationException
IOException

getJava

protected String getJava ()

החזרות
String

prepareConfiguration

protected Exception prepareConfiguration (IInvocationContext context, 
                IConfiguration config, 
                ITestInvocationListener listener)

מכינים את IConfiguration שיועבר לתהליך המשנה ויפעיל את קובץ ה-Docker.

פרמטרים
context IInvocationContext: IInvocationContext הנוכחי.

config IConfiguration: IConfiguration שצריך להכין.

listener ITestInvocationListener: ההפעלה הנוכחית ITestInvocationListener.

החזרות
Exception ‫Exception אם משהו השתבש, אחרת null.

prepareContext

protected File prepareContext (IInvocationContext context, 
                IConfiguration config)

מכינים את IInvocationContext ומבצעים סריאליזציה.

פרמטרים
context IInvocationContext: IInvocationContext שצריך להכין.

config IConfiguration: IConfiguration של ארגז החול.

החזרות
File ה-IInvocationContext שעבר סריאליזציה.

הקפצת הודעות שגיאה (throw)
java.io.IOException
IOException