Package net.morimekta.testing
Class IntegrationExecutor
- java.lang.Object
-
- net.morimekta.testing.IntegrationExecutor
-
public class IntegrationExecutor extends java.lang.Object
Helper to handle process forking related to testing a jar file.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
IntegrationExecutor(java.io.File jarFile)
IntegrationExecutor(java.lang.String module, java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getError()
java.lang.String
getOutput()
int
run(java.lang.String... args)
Run the program with the specified arguments.void
setDeadlineMs(long deadlineMs)
Set the program deadline.void
setInput(java.io.InputStream in)
Set input stream to write to the process as program input.
-
-
-
Method Detail
-
getOutput
public java.lang.String getOutput()
- Returns:
- The programs stdout content.
-
getError
public java.lang.String getError()
- Returns:
- The programs stderr content.
-
setInput
public void setInput(java.io.InputStream in)
Set input stream to write to the process as program input.- Parameters:
in
- The program input.
-
setDeadlineMs
public void setDeadlineMs(long deadlineMs)
Set the program deadline. If not finished in this time interval, the run fails with an IOException.- Parameters:
deadlineMs
- The new deadline in milliseconds. 0 means to wait forever. Default is 1 second.
-
run
public int run(java.lang.String... args) throws java.io.IOException
Run the program with the specified arguments.- Parameters:
args
- The arguments.- Returns:
- The programs exit code.
- Throws:
java.io.IOException
- If the run times out or is interrupted.
-
-