use of org.apache.derbyTesting.junit.CleanDatabaseTestSetup in project derby by apache.
the class RollBackWrappingWhenFailOnImportTest method suite.
public static Test suite() {
BaseTestSuite suite = new BaseTestSuite("RollBackWrappingWhenFailOnImportTest");
if (!JDBC.vmSupportsJDBC3()) {
return suite;
}
Test test = new CleanDatabaseTestSetup(TestConfiguration.embeddedSuite(RollBackWrappingWhenFailOnImportTest.class));
suite.addTest(test);
return suite;
}
use of org.apache.derbyTesting.junit.CleanDatabaseTestSetup in project derby by apache.
the class ToolScripts method getAuthorizationSuite.
/**
* Return a suite of tool tests from the list of script names. Each test is
* surrounded in a decorator that cleans the database, and adds
* authentication and authorization for each script.
* @param list <ul><li>list[i][0][0]: script name,
* <li>list[i][1]: users,
* <li>list[i][2][0]: run-as-user
* </ul>
*/
private static Test getAuthorizationSuite(String[][][] list) {
BaseTestSuite suite = new BaseTestSuite("Tool scripts w/authorization");
final String PWSUFFIX = "pwSuffix";
for (int i = 0; i < list.length; i++) {
Test clean;
if (list[i][0][0].startsWith("ij_show_roles")) {
clean = new CleanDatabaseTestSetup(new ToolScripts(list[i][0][0], list[i][2][0])) {
protected void decorateSQL(Statement s) throws SQLException {
s.execute("create role a");
s.execute("create role b");
s.execute("create role \"\"\"eve\"\"\"");
s.execute("create role publicrole");
s.execute("grant a to b");
s.execute("grant publicrole to public");
s.execute("grant b to donald");
}
};
} else {
clean = new CleanDatabaseTestSetup(new ToolScripts(list[i][0][0], list[i][2][0]));
}
suite.addTest(TestConfiguration.sqlAuthorizationDecorator(DatabasePropertyTestSetup.builtinAuthentication(clean, list[i][1], PWSUFFIX)));
}
return getIJConfig(suite);
}
use of org.apache.derbyTesting.junit.CleanDatabaseTestSetup in project derby by apache.
the class HoldCursorExternalSortJDBC30Test method suite.
public static Test suite() {
Properties sysProps = new Properties();
sysProps.put("derby.storage.sortBufferMax", "5");
sysProps.put("derby.debug.true", "testSort");
Test suite = TestConfiguration.embeddedSuite(HoldCursorExternalSortJDBC30Test.class);
return new CleanDatabaseTestSetup(new SystemPropertyTestSetup(suite, sysProps, true)) {
/**
* Creates the table used in the test cases.
*/
protected void decorateSQL(Statement s) throws SQLException {
Connection conn = s.getConnection();
conn.setAutoCommit(false);
/* This table is used by testOrder_Hold and testOrder_NoHold */
s.executeUpdate("create table foo (a int, data varchar(2000))");
/* This one is specific for testOrderWithMultipleLevel since
* it requires some more records to be inserted */
s.executeUpdate("create table bar (a int, data varchar(2000))");
PreparedStatement ps = conn.prepareStatement("insert into foo values(?,?), (?,?), (?,?), (?,?), (?,?), " + "(?,?), (?,?), (?,?), (?,?), (?,?)");
for (int i = 0; i <= 9; i++) {
ps.setInt(i * 2 + 1, i + 1);
ps.setString(i * 2 + 2, Formatters.padString("" + (i + 1), 2000));
}
ps.executeUpdate();
ps.close();
s.execute("INSERT INTO bar SELECT * FROM foo");
}
};
}
use of org.apache.derbyTesting.junit.CleanDatabaseTestSetup in project derby by apache.
the class UpdateLocksTest method suite.
public static Test suite() {
Test suite = TestConfiguration.defaultSuite(UpdateLocksTest.class);
Properties p = new Properties();
p.put("derby.storage.pageSize", "4096");
return new CleanDatabaseTestSetup(new SystemPropertyTestSetup(suite, p, false));
}
use of org.apache.derbyTesting.junit.CleanDatabaseTestSetup in project derby by apache.
the class Derby94Test method suite.
public static Test suite() {
Test test = TestConfiguration.embeddedSuite(Derby94Test.class);
// Reduce lock escalation threshold to make it possible to test
// with fewer rows.
test = DatabasePropertyTestSetup.singleProperty(test, "derby.locks.escalationThreshold", "102");
test = new CleanDatabaseTestSetup(test);
return test;
}
Aggregations