org.eigenbase.test.concurrent
Class ConcurrentTestCommandScript.CommandParser

java.lang.Object
  extended by org.eigenbase.test.concurrent.ConcurrentTestCommandScript.CommandParser
Enclosing class:
ConcurrentTestCommandScript

private class ConcurrentTestCommandScript.CommandParser
extends Object


Nested Class Summary
private  class ConcurrentTestCommandScript.CommandParser.Binding
           
 
Field Summary
private  Stack<File> currentDirectory
           
private  List<ConcurrentTestCommandScript.CommandParser.Binding> deferredBindings
           
(package private)  Pattern matchesVarDefn
           
private  int nextThreadId
           
private  int order
           
private  int repeatCount
           
private  boolean scriptHasVars
           
(package private)  Pattern splitBinding
           
(package private)  Pattern splitWords
           
private  String state
           
private  int threadId
           
 
Constructor Summary
ConcurrentTestCommandScript.CommandParser()
           
 
Method Summary
private  void applyVariableRebindings()
           
private  void defineVariables(String line)
           
private  void doEndOfState(String state)
           
private  String firstWord(String trimmedLine)
          Returns the first word of the given line, assuming the line is trimmed.
private  void load(String scriptFileName)
          Parses a multi-threaded script and converts it into test commands.
private  Map<String,String> lookupState(String state)
          Manages state transitions.
private  String readLine(String line, BufferedReader in)
          Returns an input line, possible extended by the continuation character (\).
private  String readSql(String startOfSql, BufferedReader in)
          Returns a block of SQL, starting with the given String.
 void rememberVariableRebindings(List<String> pairs)
           
private  String skipFirstWord(String trimmedLine)
          Returns everything but the first word of the given line, assuming the line is trimmed.
private  void trace(String message)
           
private  void trace(String prefix, Object message)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

splitWords

final Pattern splitWords

splitBinding

final Pattern splitBinding

matchesVarDefn

final Pattern matchesVarDefn

state

private String state

threadId

private int threadId

nextThreadId

private int nextThreadId

order

private int order

repeatCount

private int repeatCount

scriptHasVars

private boolean scriptHasVars

currentDirectory

private Stack<File> currentDirectory

deferredBindings

private List<ConcurrentTestCommandScript.CommandParser.Binding> deferredBindings
Constructor Detail

ConcurrentTestCommandScript.CommandParser

public ConcurrentTestCommandScript.CommandParser()
Method Detail

rememberVariableRebindings

public void rememberVariableRebindings(List<String> pairs)

applyVariableRebindings

private void applyVariableRebindings()

trace

private void trace(String prefix,
                   Object message)

trace

private void trace(String message)

load

private void load(String scriptFileName)
           throws IOException
Parses a multi-threaded script and converts it into test commands.

Throws:
IOException

doEndOfState

private void doEndOfState(String state)

defineVariables

private void defineVariables(String line)

lookupState

private Map<String,String> lookupState(String state)
Manages state transitions. Converts a state name into a map. Map keys are the names of available commands (e.g. @sync), and map values are the state to switch to open seeing the command.


firstWord

private String firstWord(String trimmedLine)
Returns the first word of the given line, assuming the line is trimmed. Returns the characters up the first non-whitespace character in the line.


skipFirstWord

private String skipFirstWord(String trimmedLine)
Returns everything but the first word of the given line, assuming the line is trimmed. Returns the characters following the first series of consecutive whitespace characters in the line.


readLine

private String readLine(String line,
                        BufferedReader in)
                 throws IOException
Returns an input line, possible extended by the continuation character (\). Scans the script until it finds an un-escaped newline.

Throws:
IOException

readSql

private String readSql(String startOfSql,
                       BufferedReader in)
                throws IOException
Returns a block of SQL, starting with the given String. Returns startOfSql concatenated with each line from in until a line ending with a semicolon is found.

Throws:
IOException