Search in sources :

Example 1 with SystemPropertyTestSetup

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

the class JoinDeadlockTest method suite.

public static Test suite() {
    final Properties systemProperties = new Properties();
    systemProperties.setProperty("derby.locks.waitTimeout", "7");
    systemProperties.setProperty("derby.locks.deadlockTimeout", "5");
    return new SystemPropertyTestSetup(TestConfiguration.defaultSuite(JoinDeadlockTest.class), systemProperties, true);
}
Also used : SystemPropertyTestSetup(org.apache.derbyTesting.junit.SystemPropertyTestSetup) Properties(java.util.Properties)

Example 2 with SystemPropertyTestSetup

use of org.apache.derbyTesting.junit.SystemPropertyTestSetup 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 3 with SystemPropertyTestSetup

use of org.apache.derbyTesting.junit.SystemPropertyTestSetup 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 4 with SystemPropertyTestSetup

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

the class Derby3980DeadlockTest method decorateTest.

/**
 * Decorate a test with SecurityManagerSetup, clientServersuite, and
 * SupportFilesSetup.
 *
 * @return the decorated test
 */
private static Test decorateTest() {
    Test test = TestConfiguration.clientServerSuite(Derby3980DeadlockTest.class);
    Properties diagProperties = new Properties();
    diagProperties.setProperty("derby.stream.error.extendedDiagSeverityLevel", "30000");
    diagProperties.setProperty("derby.infolog.append", "true");
    test = new SystemPropertyTestSetup(test, diagProperties, true);
    // Install a security manager using the initial policy file.
    return new SecurityManagerSetup(test, POLICY_FILE_NAME);
}
Also used : Test(junit.framework.Test) SystemPropertyTestSetup(org.apache.derbyTesting.junit.SystemPropertyTestSetup) SecurityManagerSetup(org.apache.derbyTesting.junit.SecurityManagerSetup) Properties(java.util.Properties)

Example 5 with SystemPropertyTestSetup

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

the class StressMultiTest method suite.

/**
 * Set up the testsuite to run in embedded, client and encryption mode.
 * Default run is 10 threads for 10 minutes in each mode
 */
public static Test suite() {
    Properties dbprops = new Properties();
    dbprops.put("derby.locks.deadlockTimeout", "2");
    dbprops.put("derby.locks.waitTimeout", "3");
    Properties sysprops = new Properties();
    sysprops.put("derby.storage.keepTransactionLog", "true");
    sysprops.put("derby.language.logStatementText", "true");
    sysprops.put("derby.infolog.append", "true");
    Test embedded = new BaseTestSuite(StressMultiTest.class);
    embedded = new SystemPropertyTestSetup(embedded, sysprops, true);
    embedded = new DatabasePropertyTestSetup(embedded, dbprops);
    // make this a singleUseDatabase so the datbase and
    // transaction log will be preserved.
    embedded = TestConfiguration.singleUseDatabaseDecorator(newCleanDatabase(embedded));
    // SystemPropertyTestSetup for static properties
    // does not work for client because shutting down the
    // engine causes protocol errors on the client. Run
    // with -Dderby.storage.keepTransactionLog=true if
    // you need to save the transaction log for client.
    Test client = TestConfiguration.clientServerDecorator(new BaseTestSuite(StressMultiTest.class));
    client = newCleanDatabase(new DatabasePropertyTestSetup(client, dbprops));
    Test encrypted = new BaseTestSuite(StressMultiTest.class);
    // SystemPropertyTestSetup for static properties
    // does not work for encrypted databases because the
    // database has to be rebooted and we don't have access
    // to the boot password (local to Decorator.encryptedDatabase()
    // Run with -Dderby.storage.keepTransactionLog=true if you
    // need to save the transaction log for encrypted.
    BaseTestSuite unencrypted = new BaseTestSuite("StressMultiTest:unencrypted");
    unencrypted.addTest((embedded));
    unencrypted.addTest((client));
    BaseTestSuite suite = new BaseTestSuite("StressMultiTest, " + THREADS + " Threads " + MINUTES + " Minutes");
    suite.addTest(newCleanDatabase(unencrypted));
    // Encrypted uses a different database so it needs its own newCleanDatabase
    suite.addTest(Decorator.encryptedDatabase(new DatabasePropertyTestSetup(newCleanDatabase(encrypted), dbprops)));
    return suite;
}
Also used : Test(junit.framework.Test) DatabasePropertyTestSetup(org.apache.derbyTesting.junit.DatabasePropertyTestSetup) SystemPropertyTestSetup(org.apache.derbyTesting.junit.SystemPropertyTestSetup) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) Properties(java.util.Properties)

Aggregations

SystemPropertyTestSetup (org.apache.derbyTesting.junit.SystemPropertyTestSetup)55 Properties (java.util.Properties)54 BaseTestSuite (org.apache.derbyTesting.junit.BaseTestSuite)34 Test (junit.framework.Test)33 CleanDatabaseTestSetup (org.apache.derbyTesting.junit.CleanDatabaseTestSetup)20 PreparedStatement (java.sql.PreparedStatement)8 Statement (java.sql.Statement)8 SupportFilesSetup (org.apache.derbyTesting.junit.SupportFilesSetup)8 DatabasePropertyTestSetup (org.apache.derbyTesting.junit.DatabasePropertyTestSetup)6 Connection (java.sql.Connection)3 TestSetup (junit.extensions.TestSetup)3 JDBCClientSetup (org.apache.derbyTesting.junit.JDBCClientSetup)2 NetworkServerTestSetup (org.apache.derbyTesting.junit.NetworkServerTestSetup)2 SecurityManagerSetup (org.apache.derbyTesting.junit.SecurityManagerSetup)2 File (java.io.File)1 URL (java.net.URL)1 CallableStatement (java.sql.CallableStatement)1 SQLException (java.sql.SQLException)1 Locale (java.util.Locale)1 Random (java.util.Random)1