org.eigenbase.test.concurrent
Class ConcurrentTestCommandGenerator.FetchAndCompareCommand

java.lang.Object
  extended by org.eigenbase.test.concurrent.ConcurrentTestCommandGenerator.AbstractCommand
      extended by org.eigenbase.test.concurrent.ConcurrentTestCommandGenerator.CommandWithTimeout
          extended by org.eigenbase.test.concurrent.ConcurrentTestCommandGenerator.FetchAndCompareCommand
All Implemented Interfaces:
ConcurrentTestCommand
Enclosing class:
ConcurrentTestCommandGenerator

private static class ConcurrentTestCommandGenerator.FetchAndCompareCommand
extends ConcurrentTestCommandGenerator.CommandWithTimeout

FetchAndCompareCommand executes a previously prepared statement stored in the ConcurrentTestCommandExecutor and then validates the returned rows against expected data.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.eigenbase.test.concurrent.ConcurrentTestCommand
ConcurrentTestCommand.ShouldHaveFailedException
 
Field Summary
private  List<List<Object>> expected
           
private  List<List<Object>> result
           
 
Constructor Summary
private ConcurrentTestCommandGenerator.FetchAndCompareCommand(int timeout, String expected)
           
 
Method Summary
protected  void doExecute(ConcurrentTestCommandExecutor executor)
           
private  void dumpData(String message)
          Outputs expected and result data in tabular format.
private  void parseExpected(String expected)
          Parses expected values.
private  void reportError(String expected, String got, int rowNum, int colNum)
           
private  void test(double expected, double got, int rowNum, int colNum)
           
private  void test(float expected, float got, int rowNum, int colNum)
           
private  void test(int expected, int got, int rowNum, int colNum)
           
private  void test(long expected, long got, int rowNum, int colNum)
           
private  void test(Object expected, Object got, int rowNum, int colNum)
           
private  void testValues()
          Validates expected data against retrieved data.
private  void testValues(List<Object> expectedRow, List<Object> resultRow, int rowNum)
          Validates ResultSet against expected data.
 
Methods inherited from class org.eigenbase.test.concurrent.ConcurrentTestCommandGenerator.CommandWithTimeout
setTimeout
 
Methods inherited from class org.eigenbase.test.concurrent.ConcurrentTestCommandGenerator.AbstractCommand
execute, isFailureExpected, markToFail, markToFail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

expected

private List<List<Object>> expected

result

private List<List<Object>> result
Constructor Detail

ConcurrentTestCommandGenerator.FetchAndCompareCommand

private ConcurrentTestCommandGenerator.FetchAndCompareCommand(int timeout,
                                                              String expected)
Method Detail

doExecute

protected void doExecute(ConcurrentTestCommandExecutor executor)
                  throws SQLException
Specified by:
doExecute in class ConcurrentTestCommandGenerator.AbstractCommand
Throws:
SQLException

parseExpected

private void parseExpected(String expected)
Parses expected values. See ConcurrentTestCommandGenerator.addFetchAndCompareCommand(int, int, int, String) for details on format of expected.

Throws:
IllegalStateException - if there are formatting errors in expected

testValues

private void testValues()
Validates expected data against retrieved data.


testValues

private void testValues(List<Object> expectedRow,
                        List<Object> resultRow,
                        int rowNum)
Validates ResultSet against expected data.


test

private void test(Object expected,
                  Object got,
                  int rowNum,
                  int colNum)

test

private void test(int expected,
                  int got,
                  int rowNum,
                  int colNum)

test

private void test(long expected,
                  long got,
                  int rowNum,
                  int colNum)

test

private void test(float expected,
                  float got,
                  int rowNum,
                  int colNum)

test

private void test(double expected,
                  double got,
                  int rowNum,
                  int colNum)

reportError

private void reportError(String expected,
                         String got,
                         int rowNum,
                         int colNum)

dumpData

private void dumpData(String message)
Outputs expected and result data in tabular format.