Search in sources :

Example 56 with BaseTestSuite

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

the class BootLockTest method decorateTest.

/**
 * Decorate test with singleUseDatabaseDecorator and noSecurityManager.
 *
 * @return the decorated test
 */
private static Test decorateTest() {
    Test test = new BaseTestSuite(BootLockTest.class);
    if (JDBC.vmSupportsJSR169() && !isJ9Platform()) {
        // PhoneME requires forceDatabaseLock
        Properties props = new Properties();
        props.setProperty("derby.database.forceDatabaseLock", "true");
        test = new SystemPropertyTestSetup(test, props, true);
    }
    test = TestConfiguration.singleUseDatabaseDecorator(test, dbName);
    test = SecurityManagerSetup.noSecurityManager(test);
    return test;
}
Also used : Test(junit.framework.Test) SystemPropertyTestSetup(org.apache.derbyTesting.junit.SystemPropertyTestSetup) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) Properties(java.util.Properties)

Example 57 with BaseTestSuite

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

the class ClassLoaderBootTest method suite.

/**
 * Runs the tests in the default embedded configuration and then
 * the client server configuration.
 */
public static Test suite() {
    BaseTestSuite suite = new BaseTestSuite(ClassLoaderBootTest.class);
    Test test = suite;
    TestSetup setup = new CleanDatabaseTestSetup(test) {

        protected void setUp() throws Exception {
            super.setUp();
            // shutdown the database.
            DataSource ds = JDBCDataSource.getDataSource();
            JDBCDataSource.shutdownDatabase(ds);
        }
    };
    Properties p = new Properties();
    p.setProperty("derby.infolog.append", "true");
    setup = new SystemPropertyTestSetup(setup, p);
    // on. Have to run without security manager for now.
    return SecurityManagerSetup.noSecurityManager(setup);
// return setup;
}
Also used : TestSetup(junit.extensions.TestSetup) CleanDatabaseTestSetup(org.apache.derbyTesting.junit.CleanDatabaseTestSetup) SystemPropertyTestSetup(org.apache.derbyTesting.junit.SystemPropertyTestSetup) Test(junit.framework.Test) CleanDatabaseTestSetup(org.apache.derbyTesting.junit.CleanDatabaseTestSetup) SystemPropertyTestSetup(org.apache.derbyTesting.junit.SystemPropertyTestSetup) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) Properties(java.util.Properties) DataSource(javax.sql.DataSource) JDBCDataSource(org.apache.derbyTesting.junit.JDBCDataSource)

Example 58 with BaseTestSuite

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

the class DecryptDatabaseTest method suite.

public static Test suite() {
    BaseTestSuite suite = new BaseTestSuite("DecryptDatabaseTest suite");
    suite.addTest(wrapTest());
    suite.addTest(wrapTest("AES/OFB/NoPadding"));
    return suite;
}
Also used : BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite)

Example 59 with BaseTestSuite

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

the class Derby3625Test method suite.

public static Test suite() {
    BaseTestSuite suite = new BaseTestSuite("Derby3625Test");
    suite.addTest(baseSuite("Derby36625Test:embedded"));
    return suite;
}
Also used : BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite)

Example 60 with BaseTestSuite

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

the class Derby4577Test method baseSuite.

protected static Test baseSuite(String name) {
    BaseTestSuite suite = new BaseTestSuite(name);
    suite.addTestSuite(Derby4577Test.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 {
            Connection conn = stmt.getConnection();
            // create a table, with blob it will be 32k page size
            stmt.executeUpdate("CREATE TABLE testBadUpdate (id int, value blob(1M))");
            stmt.executeUpdate("CREATE TABLE testSmallRow1 (id char(1))");
            stmt.executeUpdate("CREATE TABLE testSmallRow2 (id char(1))");
            stmt.executeUpdate("CREATE TABLE testSmallRow3 (id char(20), id2 int)");
            conn.setAutoCommit(false);
        }
    };
}
Also used : CleanDatabaseTestSetup(org.apache.derbyTesting.junit.CleanDatabaseTestSetup) Statement(java.sql.Statement) PreparedStatement(java.sql.PreparedStatement) Connection(java.sql.Connection) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite)

Aggregations

BaseTestSuite (org.apache.derbyTesting.junit.BaseTestSuite)476 Test (junit.framework.Test)136 CleanDatabaseTestSetup (org.apache.derbyTesting.junit.CleanDatabaseTestSetup)118 Statement (java.sql.Statement)81 PreparedStatement (java.sql.PreparedStatement)68 SupportFilesSetup (org.apache.derbyTesting.junit.SupportFilesSetup)49 Properties (java.util.Properties)43 SystemPropertyTestSetup (org.apache.derbyTesting.junit.SystemPropertyTestSetup)34 CallableStatement (java.sql.CallableStatement)19 Connection (java.sql.Connection)14 SecurityManagerSetup (org.apache.derbyTesting.junit.SecurityManagerSetup)13 DatabasePropertyTestSetup (org.apache.derbyTesting.junit.DatabasePropertyTestSetup)11 TestSetup (junit.extensions.TestSetup)10 SQLException (java.sql.SQLException)7 LocaleTestSetup (org.apache.derbyTesting.junit.LocaleTestSetup)7 Method (java.lang.reflect.Method)5 Locale (java.util.Locale)5 BaseJDBCTestSetup (org.apache.derbyTesting.junit.BaseJDBCTestSetup)4 NetworkServerTestSetup (org.apache.derbyTesting.junit.NetworkServerTestSetup)4 ResultSet (java.sql.ResultSet)3