@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.
|
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 |
init() |
void |
sendCompletionSignal()
Initiate completion by sending the appropriate signal or character sequence to the
Shell. |
void |
teardown(org.jboss.forge.furnace.event.PreShutdown event) |
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<?> task,
int quantity,
TimeUnit unit)
Clear STDERR, 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,
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 value,
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.
|
public org.jboss.forge.addon.shell.Shell getShell()
ShellTestShell object.@PostConstruct public void init()
public void teardown(@Observes@Local
org.jboss.forge.furnace.event.PreShutdown event)
throws Exception
Exceptionpublic String getBuffer()
ShellTestConsole buffer object.public void execute(String line)
ShellTestpublic 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. (Appends the newline character to the given input if necessary, and calls
OutputStream.flush() on ShellTest.getStdIn()).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
ShellTestwaitForStdOutChanged in interface ShellTestTimeoutException - if the timeout is reached without detecting the expected 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 the expected 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(String expected, int timeout, TimeUnit unit) throws TimeoutException
ShellTestwaitForStdOutValue in interface ShellTestTimeoutException - if the timeout is reached without detecting the expected write to STDOUT.public void waitForStdErrValue(String expected, int timeout, TimeUnit unit) throws TimeoutException
ShellTestwaitForStdErrValue in interface ShellTestTimeoutException - if the timeout is reached without detecting the expected write to STDERR.public void waitForStdOutValue(Callable<Void> task, String expected, int timeout, TimeUnit unit) 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, String expected, int timeout, TimeUnit unit) 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 after 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, String expected, int quantity, TimeUnit unit) throws TimeoutException
ShellTestBuffer to be updated after 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
ShellTestOutputStream.flush() on ShellTest.getStdIn().)write 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 © 2014 JBoss by Red Hat. All rights reserved.