org.pentaho.di.trans.steps.databaselookup
Class DatabaseLookupTest

java.lang.Object
  extended by org.pentaho.di.trans.steps.databaselookup.DatabaseLookupTest

public class DatabaseLookupTest
extends Object

Test class for database lookup. H2 is used as database in memory to get an easy playground for database tests. H2 does not support all SQL features but it should proof enough for most of our tests. Still to do: - cache testing. - Do not pass rows functionality/eat rows on failed lookup - Fail on multiple rows - Order by - Different comparators

Author:
Sven Boden

Field Summary
static String[] databasesXML
           
static LoggingObjectInterface loggingObject
           
 
Constructor Summary
DatabaseLookupTest()
           
 
Method Summary
 void basicDatabaseLookup()
          Basic Test case for database lookup.
 void CacheAndLoadAllRowsDatabaseLookup()
          Test "Load All Rows" version of BasicDatabaseLookup test.
 void checkRows(List<RowMetaAndData> rows1, List<RowMetaAndData> rows2)
          Check the 2 lists comparing the rows in order.
static void createDatabase()
           
 List<RowMetaAndData> createDataRows()
          Create the input rows used for a unit test.
 List<RowMetaAndData> createResultDataRows()
          Create the result rows for a test.
 RowMetaInterface createResultRowMetaInterface()
           
 RowMetaInterface createRowMetaInterface()
           
static RowMetaInterface createSourceRowMetaInterface()
           
static void createTables(Database db)
          Create source table.
 void NOTCachedAndLoadAllRowsDatabaseLookup()
          Test with cache turned off but "Load All Rows" enabled (Load all rows should have no effect) See JIRA PDI-1910
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

loggingObject

public static final LoggingObjectInterface loggingObject

databasesXML

public static final String[] databasesXML
Constructor Detail

DatabaseLookupTest

public DatabaseLookupTest()
Method Detail

createSourceRowMetaInterface

public static RowMetaInterface createSourceRowMetaInterface()

createTables

public static void createTables(Database db)
                         throws Exception
Create source table.

Throws:
Exception

createRowMetaInterface

public RowMetaInterface createRowMetaInterface()

createDataRows

public List<RowMetaAndData> createDataRows()
Create the input rows used for a unit test.


createResultRowMetaInterface

public RowMetaInterface createResultRowMetaInterface()

createResultDataRows

public List<RowMetaAndData> createResultDataRows()
Create the result rows for a test.


checkRows

public void checkRows(List<RowMetaAndData> rows1,
                      List<RowMetaAndData> rows2)
Check the 2 lists comparing the rows in order. If they are not the same fail the test.


createDatabase

public static void createDatabase()
                           throws Exception
Throws:
Exception

basicDatabaseLookup

public void basicDatabaseLookup()
                         throws Exception
Basic Test case for database lookup.

Throws:
Exception

CacheAndLoadAllRowsDatabaseLookup

public void CacheAndLoadAllRowsDatabaseLookup()
                                       throws Exception
Test "Load All Rows" version of BasicDatabaseLookup test.

Throws:
Exception

NOTCachedAndLoadAllRowsDatabaseLookup

public void NOTCachedAndLoadAllRowsDatabaseLookup()
                                           throws Exception
Test with cache turned off but "Load All Rows" enabled (Load all rows should have no effect) See JIRA PDI-1910

Throws:
Exception