Search in sources :

Example 51 with CleanDatabaseTestSetup

use of org.apache.derbyTesting.junit.CleanDatabaseTestSetup in project derby by apache.

the class GrantRevokeDDLTest method suite.

public static Test suite() {
    if (JDBC.vmSupportsJSR169()) {
        // return empty suite;
        return new BaseTestSuite("GrantRevokeDDLTest");
    }
    // test uses triggers and procedures that use DriverManager.
    BaseTestSuite suite = new BaseTestSuite(GrantRevokeDDLTest.class, "GrantRevokeDDL Test");
    Test test = new SupportFilesSetup(suite);
    test = new CleanDatabaseTestSetup(test);
    test = DatabasePropertyTestSetup.builtinAuthentication(test, users, "grantrevokeddl");
    test = TestConfiguration.sqlAuthorizationDecorator(test);
    return test;
}
Also used : Test(junit.framework.Test) CleanDatabaseTestSetup(org.apache.derbyTesting.junit.CleanDatabaseTestSetup) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) SupportFilesSetup(org.apache.derbyTesting.junit.SupportFilesSetup)

Example 52 with CleanDatabaseTestSetup

use of org.apache.derbyTesting.junit.CleanDatabaseTestSetup in project derby by apache.

the class DateTimeTest method baseSuite.

protected static Test baseSuite(String name) {
    BaseTestSuite suite = new BaseTestSuite(name);
    suite.addTestSuite(DateTimeTest.class);
    return new CleanDatabaseTestSetup(suite) {

        /**
         * Creates the tables used in the test cases.
         * @exception SQLException if a database error occurs
         */
        protected void decorateSQL(Statement stmt) throws SQLException {
            createTableForArithmeticTest(stmt);
            createTableForSyntaxTest(stmt);
            createTableForConversionTest(stmt);
            createTableForISOFormatTest(stmt);
        }
    };
}
Also used : CleanDatabaseTestSetup(org.apache.derbyTesting.junit.CleanDatabaseTestSetup) PreparedStatement(java.sql.PreparedStatement) Statement(java.sql.Statement) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite)

Example 53 with CleanDatabaseTestSetup

use of org.apache.derbyTesting.junit.CleanDatabaseTestSetup in project derby by apache.

the class DeadlockDetectionTest method suite.

public static Test suite() {
    // Deadlock detection is engine functionality, so only test embedded.
    Test test = TestConfiguration.embeddedSuite(DeadlockDetectionTest.class);
    // Reduce the deadlock timeout since this test expects deadlocks, and
    // we want to detect them quickly in order to reduce the test time.
    // We don't expect any wait timeouts, so set the wait timeout
    // sufficiently high to prevent that queries time out before we have
    // set up the deadlock on slow machines.
    test = DatabasePropertyTestSetup.setLockTimeouts(test, 1, 30);
    return new CleanDatabaseTestSetup(test);
}
Also used : Test(junit.framework.Test) CleanDatabaseTestSetup(org.apache.derbyTesting.junit.CleanDatabaseTestSetup)

Example 54 with CleanDatabaseTestSetup

use of org.apache.derbyTesting.junit.CleanDatabaseTestSetup in project derby by apache.

the class DeadlockModeTest method baseSuite.

protected static Test baseSuite(String name) {
    BaseTestSuite suite = new BaseTestSuite(name);
    suite.addTestSuite(DeadlockModeTest.class);
    return new CleanDatabaseTestSetup(DatabasePropertyTestSetup.setLockTimeouts(suite, 2, 4)) {

        /**
         * Creates the tables used in the test cases.
         * @exception SQLException if a database error occurs
         */
        protected void decorateSQL(Statement stmt) throws SQLException {
            stmt.execute("create table t (i int)");
            stmt.executeUpdate("insert into t values (1956)");
            stmt.executeUpdate("insert into t values (180)");
            stmt.executeUpdate("insert into t values (3)");
        }
    };
}
Also used : CleanDatabaseTestSetup(org.apache.derbyTesting.junit.CleanDatabaseTestSetup) Statement(java.sql.Statement) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite)

Example 55 with CleanDatabaseTestSetup

use of org.apache.derbyTesting.junit.CleanDatabaseTestSetup in project derby by apache.

the class ForBitDataTest method baseSuite.

protected static Test baseSuite(String name) {
    BaseTestSuite suite = new BaseTestSuite(name);
    suite.addTestSuite(ForBitDataTest.class);
    return new CleanDatabaseTestSetup(suite) {

        protected void decorateSQL(Statement s) throws SQLException {
            for (int i = 0; i < TABLES.length; i++) {
                s.execute(TABLES[i]);
            }
        }
    };
}
Also used : CleanDatabaseTestSetup(org.apache.derbyTesting.junit.CleanDatabaseTestSetup) PreparedStatement(java.sql.PreparedStatement) Statement(java.sql.Statement) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite)

Aggregations

CleanDatabaseTestSetup (org.apache.derbyTesting.junit.CleanDatabaseTestSetup)147 BaseTestSuite (org.apache.derbyTesting.junit.BaseTestSuite)118 Statement (java.sql.Statement)95 PreparedStatement (java.sql.PreparedStatement)77 Test (junit.framework.Test)77 Properties (java.util.Properties)25 CallableStatement (java.sql.CallableStatement)21 Connection (java.sql.Connection)20 SystemPropertyTestSetup (org.apache.derbyTesting.junit.SystemPropertyTestSetup)20 SupportFilesSetup (org.apache.derbyTesting.junit.SupportFilesSetup)19 SQLException (java.sql.SQLException)7 DatabasePropertyTestSetup (org.apache.derbyTesting.junit.DatabasePropertyTestSetup)7 UnsupportedEncodingException (java.io.UnsupportedEncodingException)3 Random (java.util.Random)3 TestSetup (junit.extensions.TestSetup)3 LocaleTestSetup (org.apache.derbyTesting.junit.LocaleTestSetup)3 ResultSet (java.sql.ResultSet)2 Locale (java.util.Locale)2 PrepareStatementTest (org.apache.derbyTesting.functionTests.tests.derbynet.PrepareStatementTest)2 AnsiTrimTest (org.apache.derbyTesting.functionTests.tests.lang.AnsiTrimTest)2