Package com.vaadin.base.devserver
Class DevServerOutputTracker
- java.lang.Object
-
- com.vaadin.base.devserver.DevServerOutputTracker
-
public class DevServerOutputTracker extends Object
Tracks the output of a dev server and scans for given success and/or failure patterns while copying the dev server output to standard output.Triggers an event whenever a success or failure pattern is found on a row.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDevServerOutputTracker.ResultEncapsulates the result of a find operation.
-
Constructor Summary
Constructors Constructor Description DevServerOutputTracker(InputStream inputStream, Pattern success, Pattern failure, Consumer<DevServerOutputTracker.Result> onMatch)Creates a new finder that scans for the given success and/or failure pattern.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanawaitFirstMatch(int timeoutInSeconds)Blocks until the first match is found and the callback has been run.voidfind()Runs the find operation.
-
-
-
Constructor Detail
-
DevServerOutputTracker
public DevServerOutputTracker(InputStream inputStream, Pattern success, Pattern failure, Consumer<DevServerOutputTracker.Result> onMatch)
Creates a new finder that scans for the given success and/or failure pattern.- Parameters:
inputStream- the stream to scansuccess- the pattern indicating successfailure- the pattern indicating failureonMatch- callback triggered when either success or failure is found
-
-
Method Detail
-
find
public void find()
Runs the find operation.
-
awaitFirstMatch
public boolean awaitFirstMatch(int timeoutInSeconds) throws InterruptedExceptionBlocks until the first match is found and the callback has been run.- Parameters:
timeoutInSeconds- the maximum number of seconds to wait- Returns:
trueif a match was found,falseif a timeout occurred- Throws:
InterruptedException- if the finder thread is interrupted
-
-