org.teiid.test.client.ctc
Class XMLExpectedResults

java.lang.Object
  extended by org.teiid.test.client.ctc.XMLExpectedResults
All Implemented Interfaces:
ExpectedResults

public class XMLExpectedResults
extends java.lang.Object
implements ExpectedResults


Field Summary
protected  java.lang.String generateDir
           
protected  java.util.Map<java.lang.String,ResultsHolder> loadedResults
           
protected  java.util.Properties props
           
protected  java.lang.String querySetIdentifier
           
protected  java.lang.String resultMode
           
protected  java.lang.String results_dir_loc
           
 
Fields inherited from interface org.teiid.test.client.ExpectedResults
PROP_EXPECTED_RESULTS_DIR_LOC, PROP_EXPECTED_RESULTS_ROOT_DIR
 
Constructor Summary
XMLExpectedResults(java.lang.String querySetIdentifier, java.util.Properties properties)
           
 
Method Summary
protected  void assertStringsMatch(java.lang.String expectedStr, java.lang.String actualStr, int row, int col, java.lang.String eMsg)
           
protected  void compareIdentifiers(java.util.List actualIdentifiers, java.util.List expectedIdentifiers, java.util.List actualDataTypes, java.util.List expectedDatatypes)
           
protected  void compareResults(ResultsHolder actualResults, ResultsHolder expectedResults, java.lang.String eMsg, boolean isOrdered)
          Added primarily for public access to the compare code for testing.
 java.lang.Object compareResults(java.lang.String queryIdentifier, java.lang.String sql, java.sql.ResultSet resultSet, java.lang.Throwable actualException, int testStatus, boolean isOrdered, int batchSize, boolean resultFromQuery)
          Compare the results of a query with those that were expected.
protected  void compareResultSets(java.util.List actualResults, java.util.List actualDatatypes, java.util.List actualIdentifiers, java.util.List expectedResults, java.util.List expectedDatatypes, java.util.List expectedIdentifiers, java.lang.String eMsg)
          Compare actual results, identifiers and types with expected.
 java.lang.Object getMetaData(java.lang.String queryidentifier)
           
 java.lang.String getQuerySetID()
          Return the unique identifier for this query set.
 java.io.File getResultsFile(java.lang.String queryidentifier)
          Returns the File location for the actual results for the specified query identifier.
protected  java.lang.String getShortName(java.lang.String ident)
           
 boolean isExceptionExpected(java.lang.String queryidentifier)
          Indicates if a query expects to have an Exception to be thrown when the query is executed.
 boolean isExpectedResultsNeeded()
           
static void main(java.lang.String[] args)
           
protected  void validateResultsMode(java.util.Properties props)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

props

protected java.util.Properties props

resultMode

protected java.lang.String resultMode

generateDir

protected java.lang.String generateDir

querySetIdentifier

protected java.lang.String querySetIdentifier

results_dir_loc

protected java.lang.String results_dir_loc

loadedResults

protected java.util.Map<java.lang.String,ResultsHolder> loadedResults
Constructor Detail

XMLExpectedResults

public XMLExpectedResults(java.lang.String querySetIdentifier,
                          java.util.Properties properties)
Method Detail

validateResultsMode

protected void validateResultsMode(java.util.Properties props)

isExpectedResultsNeeded

public boolean isExpectedResultsNeeded()
Specified by:
isExpectedResultsNeeded in interface ExpectedResults
Returns:
See Also:
Return true if the expected results file is needed in the test. Either for comparison or generation. It will return false when the option TestProperties.RESULT_MODES.NONE

isExceptionExpected

public boolean isExceptionExpected(java.lang.String queryidentifier)
                            throws QueryTestFailedException
Description copied from interface: ExpectedResults
Indicates if a query expects to have an Exception to be thrown when the query is executed.

Specified by:
isExceptionExpected in interface ExpectedResults
Returns:
boolean true if the query expects an exception to be thrown
Throws:
QueryTestFailedException

getQuerySetID

public java.lang.String getQuerySetID()
Description copied from interface: ExpectedResults
Return the unique identifier for this query set.

Specified by:
getQuerySetID in interface ExpectedResults
Returns:

getResultsFile

public java.io.File getResultsFile(java.lang.String queryidentifier)
                            throws QueryTestFailedException
Description copied from interface: ExpectedResults
Returns the File location for the actual results for the specified query identifier.

Specified by:
getResultsFile in interface ExpectedResults
Returns:
File location for actual results for the specified query
Throws:
QueryTestFailedException

compareResults

public java.lang.Object compareResults(java.lang.String queryIdentifier,
                                       java.lang.String sql,
                                       java.sql.ResultSet resultSet,
                                       java.lang.Throwable actualException,
                                       int testStatus,
                                       boolean isOrdered,
                                       int batchSize,
                                       boolean resultFromQuery)
                                throws QueryTestFailedException
Compare the results of a query with those that were expected.

Specified by:
compareResults in interface ExpectedResults
Parameters:
expectedResults - The expected results.
results - The actual results - may be null if actualException.
actualException - The actual exception recieved durring query execution - may be null if results.
isOrdered - Are the actual results ordered?
batchSize - Size of the batch(es) used in determining when the first batch of results were read.
Returns:
The response time for comparing the first batch (sizes) of resutls.
Throws:
QueryTestFailedException - If comparison fails.

compareResults

protected void compareResults(ResultsHolder actualResults,
                              ResultsHolder expectedResults,
                              java.lang.String eMsg,
                              boolean isOrdered)
                       throws QueryTestFailedException
Added primarily for public access to the compare code for testing.

Parameters:
actualResults -
expectedResults -
eMsg -
isOrdered -
Throws:
QueryTestFailedException

compareResultSets

protected void compareResultSets(java.util.List actualResults,
                                 java.util.List actualDatatypes,
                                 java.util.List actualIdentifiers,
                                 java.util.List expectedResults,
                                 java.util.List expectedDatatypes,
                                 java.util.List expectedIdentifiers,
                                 java.lang.String eMsg)
                          throws QueryTestFailedException
Compare actual results, identifiers and types with expected.
Note : result list are expected to match element for element.

Parameters:
actualResults -
actualDatatypes -
actualIdentifiers -
expectedResults -
expectedDatatypes -
expectedIdentifiers -
eMsg -
Throws:
QueryTestFailedException - If comparison fails.

compareIdentifiers

protected void compareIdentifiers(java.util.List actualIdentifiers,
                                  java.util.List expectedIdentifiers,
                                  java.util.List actualDataTypes,
                                  java.util.List expectedDatatypes)
                           throws QueryTestFailedException
Throws:
QueryTestFailedException

getShortName

protected java.lang.String getShortName(java.lang.String ident)

assertStringsMatch

protected void assertStringsMatch(java.lang.String expectedStr,
                                  java.lang.String actualStr,
                                  int row,
                                  int col,
                                  java.lang.String eMsg)
                           throws QueryTestFailedException
Throws:
QueryTestFailedException

getMetaData

public java.lang.Object getMetaData(java.lang.String queryidentifier)
Specified by:
getMetaData in interface ExpectedResults

main

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


Copyright © 2011. All Rights Reserved.