Class ConcurrentTestCommandScript.CommandParser

  • Enclosing class:
    ConcurrentTestCommandScript

    private class ConcurrentTestCommandScript.CommandParser
    extends java.lang.Object
    Command parser.
    • Constructor Summary

      Constructors 
      Constructor Description
      CommandParser()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void addExtraCommands​(java.lang.Iterable<java.lang.String> commands, java.lang.String state)  
      private void applyVariableRebindings()  
      private void defineVariables​(java.lang.String line)  
      private void doEndOfState​(java.lang.String state)  
      private java.lang.String firstWord​(java.lang.String trimmedLine)
      Returns the first word of the given line, assuming the line is trimmed.
      private void load​(java.lang.String scriptFileName)
      Parses a multi-threaded script and converts it into test commands.
      private boolean loadCommand​(java.lang.String command, java.lang.String line, java.io.BufferedReader in)  
      private void loadSql​(java.lang.String sql)  
      private java.util.Map<java.lang.String,​java.lang.String> lookupState​(java.lang.String state)
      Manages state transitions.
      private void plugin​(java.lang.String pluginName)  
      private java.lang.String readLine​(java.lang.String line, java.io.BufferedReader in)
      Returns an input line, possible extended by the continuation character (\).
      private java.lang.String readSql​(java.lang.String startOfSql, java.io.BufferedReader in)
      Returns a block of SQL, starting with the given String.
      void rememberVariableRebindings​(java.util.List<java.lang.String> pairs)  
      private java.lang.String skipFirstWord​(java.lang.String trimmedLine)
      Returns everything but the first word of the given line, assuming the line is trimmed.
      private void trace​(java.lang.String message)  
      private void trace​(java.lang.String prefix, java.lang.Object message)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • splitWords

        final java.util.regex.Pattern splitWords
      • splitBinding

        final java.util.regex.Pattern splitBinding
      • matchesVarDefn

        final java.util.regex.Pattern matchesVarDefn
      • state

        private java.lang.String state
      • threadId

        private int threadId
      • nextThreadId

        private int nextThreadId
      • order

        private int order
      • repeatCount

        private int repeatCount
      • scriptHasVars

        private boolean scriptHasVars
      • currentDirectory

        private final java.util.Deque<java.io.File> currentDirectory
    • Constructor Detail

      • CommandParser

        CommandParser()
    • Method Detail

      • rememberVariableRebindings

        public void rememberVariableRebindings​(java.util.List<java.lang.String> pairs)
      • applyVariableRebindings

        private void applyVariableRebindings()
      • trace

        private void trace​(java.lang.String prefix,
                           java.lang.Object message)
      • trace

        private void trace​(java.lang.String message)
      • load

        private void load​(java.lang.String scriptFileName)
                   throws java.io.IOException
        Parses a multi-threaded script and converts it into test commands.
        Throws:
        java.io.IOException
      • loadSql

        private void loadSql​(java.lang.String sql)
      • loadCommand

        private boolean loadCommand​(java.lang.String command,
                                    java.lang.String line,
                                    java.io.BufferedReader in)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • doEndOfState

        private void doEndOfState​(java.lang.String state)
      • defineVariables

        private void defineVariables​(java.lang.String line)
      • plugin

        private void plugin​(java.lang.String pluginName)
                     throws java.io.IOException
        Throws:
        java.io.IOException
      • addExtraCommands

        private void addExtraCommands​(java.lang.Iterable<java.lang.String> commands,
                                      java.lang.String state)
      • lookupState

        private java.util.Map<java.lang.String,​java.lang.String> lookupState​(java.lang.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 java.lang.String firstWord​(java.lang.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 java.lang.String skipFirstWord​(java.lang.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 java.lang.String readLine​(java.lang.String line,
                                          java.io.BufferedReader in)
                                   throws java.io.IOException
        Returns an input line, possible extended by the continuation character (\). Scans the script until it finds an un-escaped newline.
        Throws:
        java.io.IOException
      • readSql

        private java.lang.String readSql​(java.lang.String startOfSql,
                                         java.io.BufferedReader in)
                                  throws java.io.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:
        java.io.IOException