* @return An instance of <code>Test</code> with the implemented tests to
* run.
*/
public static Test suite() {
// suite of tests with light load on the tables
BaseTestSuite light = new BaseTestSuite();
// suite of tests with heavy load on the tables
BaseTestSuite heavy = new BaseTestSuite();
light.addTest(new SpillHashTest("testJoinLight"));
light.addTest(new SpillHashTest("testDistinctLight"));
light.addTest(new SpillHashTest("testCursorLight"));
heavy.addTest(new SpillHashTest("testJoinHeavy"));
heavy.addTest(new SpillHashTest("testDistinctHeavy"));
heavy.addTest(new SpillHashTest("testCursorHeavy"));
Test lightSetup = new BaseJDBCTestSetup(light) {
protected void setUp() throws Exception {
super.setUp();
Statement stmt = getConnection().createStatement();
PreparedStatement insA = stmt.getConnection().prepareStatement("insert into ta(ca1,ca2) values(?,?)");
PreparedStatement insB = stmt.getConnection().prepareStatement("insert into tb(cb1,cb2) values(?,?)");
insertDups(insA, insB, initDupVals);
getConnection().commit();
stmt.close();
//System.out.println("2");
}
};
Test heavySetup = new BaseJDBCTestSetup(heavy) {
protected void setUp() throws Exception {
super.setUp();
Statement stmt = getConnection().createStatement();
PreparedStatement insA = stmt.getConnection().prepareStatement("insert into ta(ca1,ca2) values(?,?)");
PreparedStatement insB = stmt.getConnection().prepareStatement("insert into tb(cb1,cb2) values(?,?)");
for (int i = 1; i <= LOTS_OF_ROWS; i++) {
insA.setInt(1, i);
insA.setString(2, ca2Val(i));
insA.executeUpdate();
insB.setInt(1, i);
insB.setString(2, cb2Val(i));
insB.executeUpdate();
if ((i & 0xff) == 0)
stmt.getConnection().commit();
}
insertDups(insA, insB, spillDupVals);
getConnection().commit();
stmt.close();
//System.out.println("3");
}
};
BaseTestSuite mainSuite = new BaseTestSuite();
mainSuite.addTest(lightSetup);
mainSuite.addTest(heavySetup);
return new CleanDatabaseTestSetup(mainSuite) {
protected void decorateSQL(Statement stmt) throws SQLException {
for(int i = 0; i < prep.length; i++) {
stmt.executeUpdate(prep[i]);