@Singleton public class DefaultShellTest extends Object implements ShellTest
| Modifier and Type | Class and Description |
|---|---|
class |
DefaultShellTest.TestCommandListener |
| Constructor and Description |
|---|
DefaultShellTest() |
| Modifier and Type | Method and Description |
|---|---|
void |
clearScreen()
Clear the screen and reset the buffer.
|
org.jboss.forge.addon.ui.result.Result |
execute(String line,
int quantity,
TimeUnit unit)
Execute the given line and return the
Result. |
org.jboss.aesh.console.Buffer |
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 |
init() |
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 the given task is executed. |
void |
waitForBufferValue(Callable<?> task,
int quantity,
TimeUnit unit,
String expected)
Wait for the console
Buffer to be updated 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<?> task,
int quantity,
TimeUnit unit)
Execute the given
Callable task, waiting for STDERR and returning the resultant output. |
void |
waitForStdErrChanged(String value,
int quantity,
TimeUnit unit)
Clear and wait for the next write to STDOUT.
|
void |
waitForStdErrValue(Callable<Void> task,
int timeout,
TimeUnit unit,
String expected)
Execute the given
Callable task, waiting for STDERR to be updated, and assert that it matches the given
value. |
String |
waitForStdOutChanged(Callable<?> task,
int quantity,
TimeUnit unit)
Execute the given
Callable task, waiting for STDOUT and returning the resultant output. |
void |
waitForStdOutChanged(String value,
int quantity,
TimeUnit unit)
Clear and wait for the next write to STDOUT.
|
void |
waitForStdOutValue(Callable<Void> task,
int timeout,
TimeUnit unit,
String expected)
Execute the given
Callable task, waiting for STDOUT to be updated, and assert that it matches the given
value. |
void |
write(String string)
Write to STDIN.
|
public org.jboss.forge.addon.shell.Shell getShell()
ShellTestShell object.@PostConstruct public void init()
public org.jboss.aesh.console.Buffer getBuffer()
ShellTestConsole buffer object.public org.jboss.forge.addon.ui.result.Result execute(String line, int quantity, TimeUnit unit) throws TimeoutException
ShellTestResult. Fail if not complete within the given quantity of
TimeUnit. Clears STDOUT and STDERR before execution.execute in interface ShellTestTimeoutException - if the given command was not executed successfully within the allotted timeout.public void waitForStdOutChanged(String value, int quantity, TimeUnit unit) throws TimeoutException
ShellTestTimeUnitwaitForStdOutChanged in interface ShellTestTimeoutException - if the timeout is reached without detecting a write to STDOUT.public void waitForStdErrChanged(String value, int quantity, TimeUnit unit) throws TimeoutException
ShellTestTimeUnitwaitForStdErrChanged in interface ShellTestTimeoutException - if the timeout is reached without detecting a write to STDERR.public String waitForStdOutChanged(Callable<?> task, int quantity, TimeUnit unit) throws TimeoutException
ShellTestCallable task, waiting for STDOUT and returning the resultant output.waitForStdOutChanged in interface ShellTestTimeoutException - if the timeout is reached without detecting a write to STDOUT.public String waitForStdErrChanged(Callable<?> task, int quantity, TimeUnit unit) throws TimeoutException
ShellTestCallable task, waiting for STDERR and returning the resultant output.waitForStdErrChanged in interface ShellTestTimeoutException - if the timeout is reached without detecting a write to STDERR.public void waitForStdOutValue(Callable<Void> task, int timeout, TimeUnit unit, String expected) throws TimeoutException
ShellTestCallable task, waiting for STDOUT to be updated, and assert that it matches the given
value.waitForStdOutValue in interface ShellTestTimeoutException - if the timeout is reached without detecting the expected write to STDOUT.public void waitForStdErrValue(Callable<Void> task, int timeout, TimeUnit unit, String expected) throws TimeoutException
ShellTestCallable task, waiting for STDERR to be updated, and assert that it matches the given
value.waitForStdErrValue in interface ShellTestTimeoutException - if the timeout is reached without detecting the expected write to STDERR.public void waitForBufferChanged(Callable<?> task, int quantity, TimeUnit unit) throws TimeoutException
ShellTestBuffer to be updated the given task is executed.waitForBufferChanged in interface ShellTestTimeoutException - if the timeout is reached without detecting a buffer value change.public void waitForBufferValue(Callable<?> task, int quantity, TimeUnit unit, String expected) throws TimeoutException
ShellTestBuffer to be updated the given task is executed, and assert that it matches the given
String.waitForBufferValue in interface ShellTestTimeoutException - if the timeout is reached without detecting the appropriate value.public OutputStream getStdIn()
ShellTestOutputStream for writing.public String getStdOut()
ShellTestpublic String getStdErr()
ShellTestpublic void write(String string) throws IOException
ShellTestwrite in interface ShellTestIOExceptionpublic void sendCompletionSignal()
throws IOException
ShellTestShell.sendCompletionSignal in interface ShellTestIOExceptionpublic void clearScreen()
throws IOException
ShellTestclearScreen in interface ShellTestIOExceptionpublic String waitForCompletion(String expected, String write, int quantity, TimeUnit unit) throws TimeoutException
ShellTestwaitForCompletion in interface ShellTestTimeoutException - if the buffer did not match STDOUT within the given timeout.public String waitForCompletion(int quantity, TimeUnit unit) throws TimeoutException
ShellTestwaitForCompletion in interface ShellTestTimeoutException - if the buffer did not match STDOUT within the given timeout.Copyright © 2013 JBoss by Red Hat. All Rights Reserved.