Send feedback
Class BaseEmulatorHelper<T> (2.7.1)
Stay organized with collections
Save and categorize content based on your preferences.
Version 2.7.1 keyboard_arrow_down
public abstract class BaseEmulatorHelper<T>
Utility class to start and stop a local service which is used by unit testing.
Type Parameter
Static Fields
DEFAULT_HOST
protected static final String DEFAULT_HOST
Field Value
DEFAULT_PORT
protected static final int DEFAULT_PORT
Field Value
PROJECT_ID_PREFIX
protected static final String PROJECT_ID_PREFIX
Field Value
Static Methods
findAvailablePort(int defaultPort)
protected static int findAvailablePort ( int defaultPort )
Parameter
Name Description defaultPort int
Returns
isWindows()
protected static boolean isWindows ()
Returns
Constructors
BaseEmulatorHelper(String emulator, int port, String projectId)
protected BaseEmulatorHelper ( String emulator , int port , String projectId )
Parameters
Methods
getEmulatorRunners()
protected abstract List<BaseEmulatorHelper . EmulatorRunner > getEmulatorRunners ()
Returns the emulator runners supported by this emulator. Runners are evaluated in order, the
first available runner is selected and executed
Returns
getLogger()
protected abstract Logger getLogger ()
Returns
getOptions()
public abstract T getOptions ()
Returns service options to access the local emulator.
Returns
getPort()
Returns the port to which the local emulator is listening.
Returns
getProjectId()
public String getProjectId ()
Returns the project ID associated with the local emulator.
Returns
reset()
public abstract void reset ()
Resets the internal state of the emulator.
Exceptions
sendPostRequest(String request)
protected final String sendPostRequest ( String request )
Parameter
Returns
Exceptions
start()
public abstract void start ()
Starts the local emulator.
Exceptions
startProcess(String blockUntilOutput)
protected final void startProcess ( String blockUntilOutput )
Starts the local service as a subprocess. Blocks the execution until blockUntilOutput
is found on stdout.
Parameter
Name Description blockUntilOutput String
Exceptions
stop(Duration timeout)
public abstract void stop ( Duration timeout )
Stops the local emulator.
Parameter
Name Description timeout org.threeten.bp.Duration
Exceptions
waitForProcess(Duration timeout)
protected final int waitForProcess ( Duration timeout )
Waits for the local service's subprocess to terminate, and stop any possible thread listening
for its output.
Parameter
Name Description timeout org.threeten.bp.Duration
Returns
Exceptions
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-11-06 UTC.
Need to tell us more?
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-11-06 UTC."],[],[]]