public interface ShellTest
Shell in an asynchronous manner, providing methods to perform blocking
writes, reads, and other test functions.| Modifier and Type | Method and Description |
|---|---|
void |
clearScreen()
Clear the screen and reset the buffer.
|
void |
execute(String line)
Execute the given line without waiting for it to run to completion.
|
org.jboss.forge.addon.ui.result.Result |
execute(String line,
int quantity,
TimeUnit unit)
Execute the given line and return the
Result. |
String |
getBuffer()
Get the
Console buffer object. |
org.jboss.forge.addon.shell.Shell |
getShell()
Get the underlying test
Shell object. |
String |
getStdErr()
Get the current contents of STDERR since the last time it was cleared.
|
OutputStream |
getStdIn()
Get the STDIN
OutputStream for writing. |
String |
getStdOut()
Get the current contents of STDOUT since the last time it was cleared.
|
void |
sendCompletionSignal()
Initiate completion by sending the appropriate signal or character sequence to the
Shell. |
void |
waitForBufferChanged(Callable<?> task,
int quantity,
TimeUnit unit)
Wait for the console
Buffer to be updated after the given task is executed. |
void |
waitForBufferValue(Callable<?> task,
String expected,
int quantity,
TimeUnit unit)
Wait for the console
Buffer to be updated after the given task is executed, and assert that it matches the
given String. |
String |
waitForCompletion(int quantity,
TimeUnit unit)
Clear STDOUT, then send the completion signal.
|
String |
waitForCompletion(String expected,
String write,
int quantity,
TimeUnit unit)
Clear STDOUT, then write the given string to the buffer and assert that the full buffer is equal to the expected
content.
|
String |
waitForStdErrChanged(Callable<?> callable,
int quantity,
TimeUnit unit)
Clear STDERR, execute the given
Callable task, waiting for STDERR and returning the resultant output. |
void |
waitForStdErrChanged(String input,
int quantity,
TimeUnit unit)
Clear and wait for the next write to STDOUT.
|
void |
waitForStdErrValue(Callable<Void> task,
String expected,
int timeout,
TimeUnit unit)
Clear STDERR, execute the given
Callable task, waiting for STDERR to be updated, and assert that it
matches the given value. |
void |
waitForStdErrValue(String expected,
int timeout,
TimeUnit unit)
Wait for STDERR to write the expected value.
|
String |
waitForStdOutChanged(Callable<?> task,
int quantity,
TimeUnit unit)
lear and wait for the next write to STDOUT.
|
void |
waitForStdOutChanged(String input,
int quantity,
TimeUnit unit)
Clear and wait for the next write to STDOUT.
|
void |
waitForStdOutValue(Callable<Void> task,
String expected,
int timeout,
TimeUnit unit)
Execute the given
Callable task, waiting for STDOUT to be updated, and assert that it matches the given
value. |
void |
waitForStdOutValue(String expected,
int timeout,
TimeUnit unit)
Wait for STDOUT to write the expected value.
|
void |
write(String string)
Write to STDIN.
|
String getBuffer()
Console buffer object.org.jboss.forge.addon.shell.Shell getShell()
Shell object.void execute(String line)
org.jboss.forge.addon.ui.result.Result execute(String line, int quantity, TimeUnit unit) throws TimeoutException
Result. Fail if not complete within the given quantity of
TimeUnit. (Appends the newline character to the given input if necessary, and calls
OutputStream.flush() on getStdIn()).TimeoutException - if the given command was not executed successfully within the allotted timeout.void waitForBufferChanged(Callable<?> task, int quantity, TimeUnit unit) throws TimeoutException
Buffer to be updated after the given task is executed.TimeoutException - if the timeout is reached without detecting a buffer value change.void waitForBufferValue(Callable<?> task, String expected, int quantity, TimeUnit unit) throws TimeoutException
Buffer to be updated after the given task is executed, and assert that it matches the
given String.TimeoutException - if the timeout is reached without detecting the appropriate value.void waitForStdOutChanged(String input, int quantity, TimeUnit unit) throws TimeoutException
TimeoutException - if the timeout is reached without detecting the expected write to STDOUT.String waitForStdOutChanged(Callable<?> task, int quantity, TimeUnit unit) throws TimeoutException
Callable task, waiting for STDOUT and
returning the resultant output.TimeoutException - if the timeout is reached without detecting the expected write to STDOUT.void waitForStdOutValue(Callable<Void> task, String expected, int timeout, TimeUnit unit) throws TimeoutException
Callable task, waiting for STDOUT to be updated, and assert that it matches the given
value.TimeoutException - if the timeout is reached without detecting the expected write to STDOUT.void waitForStdErrChanged(String input, int quantity, TimeUnit unit) throws TimeoutException
TimeUnitTimeoutException - if the timeout is reached without detecting a write to STDERR.void waitForStdOutValue(String expected, int timeout, TimeUnit unit) throws TimeoutException
TimeoutException - if the timeout is reached without detecting the expected write to STDOUT.void waitForStdErrValue(String expected, int timeout, TimeUnit unit) throws TimeoutException
TimeoutException - if the timeout is reached without detecting the expected write to STDERR.String waitForStdErrChanged(Callable<?> callable, int quantity, TimeUnit unit) throws TimeoutException
Callable task, waiting for STDERR and returning the resultant output.TimeoutException - if the timeout is reached without detecting a write to STDERR.void waitForStdErrValue(Callable<Void> task, String expected, int timeout, TimeUnit unit) throws TimeoutException
Callable task, waiting for STDERR to be updated, and assert that it
matches the given value.TimeoutException - if the timeout is reached without detecting the expected write to STDERR.OutputStream getStdIn()
OutputStream for writing.String getStdOut()
String getStdErr()
void write(String string) throws IOException
OutputStream.flush() on getStdIn().)IOExceptionvoid sendCompletionSignal()
throws IOException
Shell.IOExceptionvoid clearScreen()
throws IOException
IOExceptionString waitForCompletion(String expected, String write, int quantity, TimeUnit unit) throws TimeoutException
TimeoutException - if the buffer did not match STDOUT within the given timeout.String waitForCompletion(int quantity, TimeUnit unit) throws TimeoutException
TimeoutException - if the buffer did not match STDOUT within the given timeout.Copyright © 2014 JBoss by Red Hat. All rights reserved.