qat.parser.qashparser
Class QASHParser

java.lang.Object
  extended byqat.parser.qashparser.QASHParser
All Implemented Interfaces:
ParserInterface

public class QASHParser
extends java.lang.Object
implements ParserInterface

This file loads a single QAT file, and will attempt to resolve all keywords in this qat file * file by first including any .INC statements, and their parent statements etc, until all neccesary files * have been included. * * @author webhiker * @version 2.3, 17 June 1999 *


Field Summary
static java.lang.String BUG_INFO
           
static java.lang.String INCLUDE_MISC_LIST
          For internal use only.
static java.lang.String INCLUDE_PROPERTIES_LIST
           
static java.lang.String INTERNAL_TRACE_LIST
           
static java.lang.String KEYWORD_TAG
           
static java.lang.String TEST_AUTHOR_TAG
           
static java.lang.String TEST_BUGINFO_TAG
           
static java.lang.String TEST_DESCRIPTION_TAG
           
static java.lang.String TEST_NAME_TAG
           
 
Constructor Summary
QASHParser()
           
QASHParser(java.util.Properties p, QASHProperties qashProperties, java.lang.String testPath, java.io.PrintStream printStream, boolean evaluating)
          This form of the parser is used for the commandline interface.
 
Method Summary
 void finish()
          This method is called after a parser run on one * or more QASH files.
static int getClosingParenIndex(java.util.ArrayList expr, int openingParenPos)
          Returns the index of the closing parenthesis matching the opening parenthesis * passed in the parameter openingParenPos.
 java.lang.String[] getIncludeList()
          This should return the list of files other than standard java.util.Properties files which were included to parse this test file.
 java.lang.String[] getKeyWords()
          This method should return all keywords associated with this test.
 java.util.Properties getProperties()
          This method returns all the properties obtained by parsing this test file.
 java.lang.String[] getPropertiesIncludeList()
          This should return the list of standard java.util.Properties files which were included to parse this test file.
 java.lang.String getProperty(java.lang.String key)
          This method retrieves the specified property from the results of parsing this file.
 java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)
          This method retrieves the specified property from the results of parsing this file.
 java.lang.String[] getSyntaxKeyWords()
          This method lists all the keywords supported by this syntax, for use in the Notepad syntax highlighting.
 java.lang.String getTestAuthor()
          This method should return a test Author which will be used to display the test in the test tree.
 java.lang.String getTestBugInfo()
          This method should return a test BugInfo which will be used for displaying the test in the test tree.
 java.lang.String getTestDescription()
          This method should return a test Description which will be used to display the test in the test tree.
 java.lang.String getTestName()
          This method should return a test name which will be used to display the test in the test tree.
 java.lang.String[] getTraceList()
          This method should list all available output files produced by this test when run on the agent, but relative to the harness.
 boolean inEvaluationMode()
           
 void interrupt()
          This method is responsible for killing any processes already started on the agents, and immediately halt parsing any files.
static void main(java.lang.String[] args)
           
 java.io.PrintStream openPrintStream(java.lang.String fileName)
          Returns a handle to the Printstream the parser will use for any output resulting from parsing this test.
 int parseFile()
          This method is the main loop for parsing the QASH file
 void prepare(java.lang.String newProjectResultsDirectory)
          This method is called at the beginning of a parser run * on one or more QASH files.
 void printDebug(java.lang.String msg)
           
 void removeProperty(QASHToken key)
           
 void removeProperty(java.lang.String key)
           
 void resetVariables()
           
 void setEvaluationMode(boolean mode)
          If set to true, the parser does not actually make contact with the agents but merely simulates the agent responses to allow standalone parsing.
 void setPrintStream(java.io.PrintStream printStream, boolean useHtml)
          This method sets the PrintStream to use for reporting errors and other types of output from the script.
 void setProjectRoot(java.lang.String projectRoot)
          This method sets the path to root of the current project.
 void setProperties(java.util.Properties p)
          This method sets any default properties which will be required for parsing this file.
 void setProperty(QASHToken key, QASHToken value)
           
 void setProperty(QASHToken key, java.lang.String value)
           
 void setProperty(java.lang.String key, java.lang.String value)
           
 void setStatusLabel(javax.swing.JLabel status)
          This is the handle to to QAT parent GUI to display which commands the parser is processing in real-time.
 void setTestPath(java.lang.String testFileName)
          This method sets the path to file file containing the syntax which will be parsed.
 void setupSyntax()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEYWORD_TAG

public static final java.lang.String KEYWORD_TAG
See Also:
Constant Field Values

TEST_NAME_TAG

public static final java.lang.String TEST_NAME_TAG
See Also:
Constant Field Values

TEST_AUTHOR_TAG

public static final java.lang.String TEST_AUTHOR_TAG
See Also:
Constant Field Values

TEST_BUGINFO_TAG

public static final java.lang.String TEST_BUGINFO_TAG
See Also:
Constant Field Values

TEST_DESCRIPTION_TAG

public static final java.lang.String TEST_DESCRIPTION_TAG
See Also:
Constant Field Values

BUG_INFO

public static final java.lang.String BUG_INFO
See Also:
Constant Field Values

INCLUDE_MISC_LIST

public static final java.lang.String INCLUDE_MISC_LIST
For internal use only.

See Also:
Constant Field Values

INCLUDE_PROPERTIES_LIST

public static final java.lang.String INCLUDE_PROPERTIES_LIST
See Also:
Constant Field Values

INTERNAL_TRACE_LIST

public static final java.lang.String INTERNAL_TRACE_LIST
See Also:
Constant Field Values
Constructor Detail

QASHParser

public QASHParser()

QASHParser

public QASHParser(java.util.Properties p,
                  QASHProperties qashProperties,
                  java.lang.String testPath,
                  java.io.PrintStream printStream,
                  boolean evaluating)
This form of the parser is used for the commandline interface.

Method Detail

setProjectRoot

public void setProjectRoot(java.lang.String projectRoot)
This method sets the path to root of the current project.

Specified by:
setProjectRoot in interface ParserInterface

prepare

public void prepare(java.lang.String newProjectResultsDirectory)
This method is called at the beginning of a parser run * on one or more QASH files.

Specified by:
prepare in interface ParserInterface

finish

public void finish()
This method is called after a parser run on one * or more QASH files.

Specified by:
finish in interface ParserInterface

getSyntaxKeyWords

public java.lang.String[] getSyntaxKeyWords()
Description copied from interface: ParserInterface
This method lists all the keywords supported by this syntax, for use in the Notepad syntax highlighting. It must be declared static.

Specified by:
getSyntaxKeyWords in interface ParserInterface

resetVariables

public void resetVariables()

setTestPath

public void setTestPath(java.lang.String testFileName)
Description copied from interface: ParserInterface
This method sets the path to file file containing the syntax which will be parsed.

Specified by:
setTestPath in interface ParserInterface

openPrintStream

public java.io.PrintStream openPrintStream(java.lang.String fileName)
                                    throws java.io.FileNotFoundException
Description copied from interface: ParserInterface
Returns a handle to the Printstream the parser will use for any output resulting from parsing this test.

Specified by:
openPrintStream in interface ParserInterface
Throws:
java.io.FileNotFoundException

setPrintStream

public final void setPrintStream(java.io.PrintStream printStream,
                                 boolean useHtml)
Description copied from interface: ParserInterface
This method sets the PrintStream to use for reporting errors and other types of output from the script.

Specified by:
setPrintStream in interface ParserInterface

setProperties

public void setProperties(java.util.Properties p)
Description copied from interface: ParserInterface
This method sets any default properties which will be required for parsing this file.

Specified by:
setProperties in interface ParserInterface

setEvaluationMode

public final void setEvaluationMode(boolean mode)
Description copied from interface: ParserInterface
If set to true, the parser does not actually make contact with the agents but merely simulates the agent responses to allow standalone parsing.

Specified by:
setEvaluationMode in interface ParserInterface

inEvaluationMode

public final boolean inEvaluationMode()

parseFile

public int parseFile()
              throws java.lang.Exception
This method is the main loop for parsing the QASH file. * It reads the file token by token, and calls the relevant method for * each token type.

Specified by:
parseFile in interface ParserInterface
Throws:
java.lang.Exception

interrupt

public void interrupt()
Description copied from interface: ParserInterface
This method is responsible for killing any processes already started on the agents, and immediately halt parsing any files.

Specified by:
interrupt in interface ParserInterface

setupSyntax

public void setupSyntax()

getProperty

public java.lang.String getProperty(java.lang.String key)
Description copied from interface: ParserInterface
This method retrieves the specified property from the results of parsing this file.

Specified by:
getProperty in interface ParserInterface

getProperty

public java.lang.String getProperty(java.lang.String key,
                                    java.lang.String defaultValue)
Description copied from interface: ParserInterface
This method retrieves the specified property from the results of parsing this file. If the value is not found, the defaultValue is returned.

Specified by:
getProperty in interface ParserInterface

getProperties

public final java.util.Properties getProperties()
Description copied from interface: ParserInterface
This method returns all the properties obtained by parsing this test file.

Specified by:
getProperties in interface ParserInterface

setProperty

public void setProperty(QASHToken key,
                        QASHToken value)

setProperty

public void setProperty(QASHToken key,
                        java.lang.String value)

setProperty

public void setProperty(java.lang.String key,
                        java.lang.String value)

removeProperty

public void removeProperty(QASHToken key)

removeProperty

public void removeProperty(java.lang.String key)

printDebug

public void printDebug(java.lang.String msg)
Specified by:
printDebug in interface ParserInterface

getClosingParenIndex

public static int getClosingParenIndex(java.util.ArrayList expr,
                                       int openingParenPos)
                                throws java.lang.Exception
Returns the index of the closing parenthesis matching the opening parenthesis * passed in the parameter openingParenPos.

Throws:
java.lang.Exception

getTestName

public java.lang.String getTestName()
Description copied from interface: ParserInterface
This method should return a test name which will be used to display the test in the test tree.

Specified by:
getTestName in interface ParserInterface

getTestAuthor

public java.lang.String getTestAuthor()
Description copied from interface: ParserInterface
This method should return a test Author which will be used to display the test in the test tree.

Specified by:
getTestAuthor in interface ParserInterface

getTestBugInfo

public java.lang.String getTestBugInfo()
Description copied from interface: ParserInterface
This method should return a test BugInfo which will be used for displaying the test in the test tree.

Specified by:
getTestBugInfo in interface ParserInterface

getTestDescription

public java.lang.String getTestDescription()
Description copied from interface: ParserInterface
This method should return a test Description which will be used to display the test in the test tree.

Specified by:
getTestDescription in interface ParserInterface

getKeyWords

public java.lang.String[] getKeyWords()
Description copied from interface: ParserInterface
This method should return all keywords associated with this test. These will be used in using the keywords to select/deselect tests in the harness.

Specified by:
getKeyWords in interface ParserInterface

getIncludeList

public java.lang.String[] getIncludeList()
Description copied from interface: ParserInterface
This should return the list of files other than standard java.util.Properties files which were included to parse this test file.

Specified by:
getIncludeList in interface ParserInterface

getPropertiesIncludeList

public java.lang.String[] getPropertiesIncludeList()
Description copied from interface: ParserInterface
This should return the list of standard java.util.Properties files which were included to parse this test file.

Specified by:
getPropertiesIncludeList in interface ParserInterface

getTraceList

public java.lang.String[] getTraceList()
Description copied from interface: ParserInterface
This method should list all available output files produced by this test when run on the agent, but relative to the harness.

Specified by:
getTraceList in interface ParserInterface

main

public static final void main(java.lang.String[] args)

setStatusLabel

public void setStatusLabel(javax.swing.JLabel status)
Description copied from interface: ParserInterface
This is the handle to to QAT parent GUI to display which commands the parser is processing in real-time.

Specified by:
setStatusLabel in interface ParserInterface


See QAT project for licensing details