org.speakright.itest
Class SRInteractiveTester

java.lang.Object
  extended by org.speakright.itest.SRInteractiveTester
All Implemented Interfaces:
ISRExtensionFactory

public class SRInteractiveTester
extends java.lang.Object
implements ISRExtensionFactory

An interactive tester for console applications. Pass it the application IFLow (and an optional IModel object), and then invoke the run method. InteractiveTester presents a command prompt '>' where you can type 'q' to quit 'g' or 'go' to generate the next voicexml page. You can pass user input as well, such as "g boston" The input simulates the results of running the previous page on a VoiceXML server, where it would send user input back to the web app hosting the SpeakRight application. 'bye' disconnect the session. You can test this class using org.speakright.core.tests.TestInteractive

Author:
Ian Rae

Nested Class Summary
static interface SRInteractiveTester.CommandReader
          Interface for supplying input to the tester.
static interface SRInteractiveTester.ContentChecker
           
 
Constructor Summary
SRInteractiveTester()
           
SRInteractiveTester(SRInteractiveTester.CommandReader reader)
           
 
Method Summary
 ISpeechPageWriter createPageWriter()
          Create a page writer that renders SpeakRight output content into VoiceXML or whatever markup text you want.
protected  void execute()
          Process the console input.
 void init(IFlow flow, SRInstance run)
          init the runner.
protected  boolean isDone()
          Check if finished.
 boolean isFinished()
           
protected  void readLine()
          Read the next line from the console.
 void run()
          Runs the application.
 void run(SRRunner run, IFlow flow)
          THIS ONE!
 SRInstance runner()
           
 void setChecker(SRInteractiveTester.ContentChecker checker)
           
 void setCommandReader(SRInteractiveTester.CommandReader reader)
           
 void setOutputDir(java.lang.String path)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SRInteractiveTester

public SRInteractiveTester()

SRInteractiveTester

public SRInteractiveTester(SRInteractiveTester.CommandReader reader)
Method Detail

setOutputDir

public void setOutputDir(java.lang.String path)

runner

public SRInstance runner()

setCommandReader

public void setCommandReader(SRInteractiveTester.CommandReader reader)

isFinished

public boolean isFinished()

setChecker

public void setChecker(SRInteractiveTester.ContentChecker checker)

init

public void init(IFlow flow,
                 SRInstance run)
init the runner.

Parameters:
flow - the application flow object
run - the runner object that has already been initialized

createPageWriter

public ISpeechPageWriter createPageWriter()
Description copied from interface: ISRExtensionFactory
Create a page writer that renders SpeakRight output content into VoiceXML or whatever markup text you want.

Specified by:
createPageWriter in interface ISRExtensionFactory
Returns:

isDone

protected boolean isDone()
Check if finished.

Returns:
whether app has finished

readLine

protected void readLine()
Read the next line from the console.


execute

protected void execute()
Process the console input.


run

public void run(SRRunner run,
                IFlow flow)
THIS ONE!

Parameters:
run -
app -

run

public void run()
Runs the application. start() MUST have been called already.