Search in sources :

Example 1 with DatabasePropertyTestSetup

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

the class DatabaseMetaDataTest method suite.

/**
 * Default suite for running this test.
 * @return the suite
 */
public static Test suite() {
    BaseTestSuite suite = new BaseTestSuite("DatabaseMetaDataTest");
    suite.addTest(TestConfiguration.defaultSuite(DatabaseMetaDataTest.class));
    // Add some tests to be run with connection pooling enabled.
    suite.addTest(connectionPoolingSuite("embedded"));
    suite.addTest(TestConfiguration.clientServerDecorator(connectionPoolingSuite("client")));
    // Test for DERBY-2584 needs a fresh database to ensure that the
    // meta-data queries haven't already been compiled. No need to run the
    // test in client/server mode since it only tests the compilation of
    // meta-data queries.
    suite.addTest(TestConfiguration.singleUseDatabaseDecorator(new DatabaseMetaDataTest("initialCompilationTest")));
    // The test for DERBY-4160 needs a fresh database to ensure that the
    // meta-data queries haven't already been compiled.
    suite.addTest(TestConfiguration.singleUseDatabaseDecorator(new DatabaseMetaDataTest("concurrentCompilationTest")));
    // Test for DERBY-3693 needs a fresh database to ensure that the size
    // of SYSTABLES is so small that creating a relatively small number of
    // tables will cause the query plan for getTables() to be invalidated.
    // Also, set a high lock timeout explicitly so that we can check that
    // an internal timeout followed by a retry didn't happen, and set
    // derby.language.stalePlanCheckInterval to a low value so that the
    // invalidation happens earlier.
    Properties props = new Properties();
    props.setProperty("derby.locks.waitTimeout", "90");
    props.setProperty("derby.language.stalePlanCheckInterval", "5");
    suite.addTest(TestConfiguration.singleUseDatabaseDecorator(new DatabasePropertyTestSetup(new DatabaseMetaDataTest("recompileTimeoutTest"), props, true)));
    return suite;
}
Also used : DatabasePropertyTestSetup(org.apache.derbyTesting.junit.DatabasePropertyTestSetup) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) Properties(java.util.Properties)

Example 2 with DatabasePropertyTestSetup

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

the class LDAPAuthenticationTest method setBaseProps.

protected static void setBaseProps(BaseTestSuite suite, Test test) {
    // set some debugging at database level properties
    Properties props = new Properties();
    props.setProperty("derby.infolog.append", "true");
    props.setProperty("derby.debug.true", "AuthenticationTrace");
    // add some users. these should not be defined on the ldap server
    props.setProperty("derby.user.system", "manager");
    props.setProperty("derby.user.Jamie", "theHooligan");
    suite.addTest(new DatabasePropertyTestSetup(test, props, true));
}
Also used : DatabasePropertyTestSetup(org.apache.derbyTesting.junit.DatabasePropertyTestSetup) Properties(java.util.Properties)

Example 3 with DatabasePropertyTestSetup

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

the class LazyDefaultSchemaCreationTest method suite.

public static Test suite() {
    BaseTestSuite suite = new BaseTestSuite("LazyDefaultSchemaCreationTest");
    BaseTestSuite[] suites = { new BaseTestSuite("LazyDefaultSchemaCreationTest:embedded"), new BaseTestSuite("LazyDefaultSchemaCreationTest:clientServer") };
    for (int i = 0; i < 2; i++) {
        suites[i].addTest(DatabasePropertyTestSetup.setLockTimeouts(new LazyDefaultSchemaCreationTest("testDerby48testNewSchemaHang"), 2, 1));
        suites[i].addTest(DatabasePropertyTestSetup.setLockTimeouts(new LazyDefaultSchemaCreationTest("testDerby48SelfLockingRecovery"), 2, 1));
        Properties p = new Properties();
        p.setProperty("derby.locks.deadlockTrace", "true");
        suites[i].addTest(DatabasePropertyTestSetup.setLockTimeouts(new DatabasePropertyTestSetup(new LazyDefaultSchemaCreationTest("testDerby48SelfLockingRecoveryDeadlockDetectionOn"), p, false), // deadlock timeout
        2, // wait timeout
        1));
        suites[i].addTest(DatabasePropertyTestSetup.setLockTimeouts(new DatabasePropertyTestSetup(new LazyDefaultSchemaCreationTest("testDerby3678"), p, false), // deadlock timeout
        2, // wait timeout
        1));
        suites[i].addTest(new CleanDatabaseTestSetup(new LazyDefaultSchemaCreationTest("testDerby3043CheckConstraint")));
        if (i == 0) {
            suite.addTest(suites[i]);
        } else {
            suite.addTest(TestConfiguration.clientServerDecorator(suites[i]));
        }
    }
    return suite;
}
Also used : DatabasePropertyTestSetup(org.apache.derbyTesting.junit.DatabasePropertyTestSetup) CleanDatabaseTestSetup(org.apache.derbyTesting.junit.CleanDatabaseTestSetup) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) Properties(java.util.Properties)

Example 4 with DatabasePropertyTestSetup

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

the class LockTableTest method suite.

/**
 * Construct top level suite in this JUnit test
 * The suite is wrapped in a DatabasePropertyTestSetup to
 * lower the locking times.
 *
 * @return A suite containing embedded fixtures
 */
public static Test suite() {
    Properties properties = new Properties();
    properties.setProperty("derby.storage.rowLocking", "false");
    properties.setProperty("derby.locks.waitTimeout", "7");
    properties.setProperty("derby.locks.deadlockTimeout", "5");
    Test suite = TestConfiguration.embeddedSuite(LockTableTest.class);
    suite = new DatabasePropertyTestSetup(suite, properties, true);
    return new CleanDatabaseTestSetup(suite) {

        /**
         * Creates the schemas and table used in the test cases.
         *
         * @throws SQLException
         */
        protected void decorateSQL(Statement s) throws SQLException {
            Connection conn = getConnection();
            conn.setAutoCommit(false);
            s.executeUpdate("create schema u1");
            s.executeUpdate("create schema u2");
            conn.commit();
        }
    };
}
Also used : Test(junit.framework.Test) DatabasePropertyTestSetup(org.apache.derbyTesting.junit.DatabasePropertyTestSetup) CleanDatabaseTestSetup(org.apache.derbyTesting.junit.CleanDatabaseTestSetup) Statement(java.sql.Statement) Connection(java.sql.Connection) Properties(java.util.Properties)

Example 5 with DatabasePropertyTestSetup

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

the class LuceneCoarseAuthorizationTest method suite.

// /////////////////////////////////////////////////////////////////////////////////
// 
// JUnit BEHAVIOR
// 
// /////////////////////////////////////////////////////////////////////////////////
/**
 * Construct top level suite in this JUnit test
 */
public static Test suite() {
    BaseTestSuite suite = (BaseTestSuite) TestConfiguration.embeddedSuite(LuceneCoarseAuthorizationTest.class);
    Test unsecureTest = SecurityManagerSetup.noSecurityManager(suite);
    Test authenticatedTest = DatabasePropertyTestSetup.builtinAuthentication(unsecureTest, LEGAL_USERS, "LuceneCoarsePermissions");
    Test coarseTest = new DatabasePropertyTestSetup(authenticatedTest, makeProperties());
    Test singleUseTest = TestConfiguration.singleUseDatabaseDecorator(coarseTest);
    return singleUseTest;
}
Also used : Test(junit.framework.Test) DatabasePropertyTestSetup(org.apache.derbyTesting.junit.DatabasePropertyTestSetup) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite)

Aggregations

DatabasePropertyTestSetup (org.apache.derbyTesting.junit.DatabasePropertyTestSetup)16 Properties (java.util.Properties)15 BaseTestSuite (org.apache.derbyTesting.junit.BaseTestSuite)11 Test (junit.framework.Test)9 CleanDatabaseTestSetup (org.apache.derbyTesting.junit.CleanDatabaseTestSetup)7 SystemPropertyTestSetup (org.apache.derbyTesting.junit.SystemPropertyTestSetup)6 Statement (java.sql.Statement)4 PreparedStatement (java.sql.PreparedStatement)2 Connection (java.sql.Connection)1 ResultSet (java.sql.ResultSet)1