Search in sources :

Example 51 with SystemPropertyTestSetup

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

the class AccessTest method suite.

public static Test suite() {
    Properties sysProps = new Properties();
    sysProps.put("derby.optimizer.optimizeJoinOrder", "false");
    sysProps.put("derby.optimizer.ruleBasedOptimization", "true");
    sysProps.put("derby.optimizer.noTimeout", "true");
    Test suite = TestConfiguration.embeddedSuite(AccessTest.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);
            s.execute("CREATE FUNCTION  PADSTRING (DATA VARCHAR(32000), " + "LENGTH INTEGER) RETURNS VARCHAR(32000) EXTERNAL NAME " + "'org.apache.derbyTesting.functionTests.util.Formatters" + ".padString' LANGUAGE JAVA PARAMETER STYLE JAVA");
        }
    };
}
Also used : Test(junit.framework.Test) CleanDatabaseTestSetup(org.apache.derbyTesting.junit.CleanDatabaseTestSetup) PreparedStatement(java.sql.PreparedStatement) Statement(java.sql.Statement) CallableStatement(java.sql.CallableStatement) SystemPropertyTestSetup(org.apache.derbyTesting.junit.SystemPropertyTestSetup) Connection(java.sql.Connection) Properties(java.util.Properties)

Example 52 with SystemPropertyTestSetup

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

the class BootAllTest method suite.

public static Test suite() {
    BaseTestSuite suite = new BaseTestSuite("BootAllTest");
    // Test uses driver manager so JDBC 2 required.
    if (JDBC.vmSupportsJDBC3()) {
        // Suite to create the third (inner) database and
        // perform the actual test (will be run last)
        BaseTestSuite db3 = new BaseTestSuite("db3");
        db3.addTest(new BootAllTest("createShutdownDatabase"));
        db3.addTest(new BootAllTest("shutdownDerby"));
        Properties ba = new Properties();
        ba.setProperty("derby.system.bootAll", "true");
        db3.addTest(new SystemPropertyTestSetup(new BootAllTest("testSettingBootAllPropertyWithHomePropertySet"), ba));
        // Suite to create the second database (middle) and
        // embed in it the third database suite.
        BaseTestSuite db2 = new BaseTestSuite("db2");
        db2.addTest(new BootAllTest("createShutdownDatabase"));
        db2.addTest(TestConfiguration.singleUseDatabaseDecorator(db3));
        // Suite to create the first database (outer) and
        // embed in it the second database suite.
        BaseTestSuite db1 = new BaseTestSuite("db1");
        db1.addTest(new BootAllTest("createShutdownDatabase"));
        db1.addTest(TestConfiguration.singleUseDatabaseDecorator(db2));
        // Add the default database in as well, this will ensure
        // that databases at the root level get booted as well
        // as those at sub-levels
        suite.addTest(new BootAllTest("createShutdownDatabase"));
        // add the first database into the actual suite.
        suite.addTest(TestConfiguration.singleUseDatabaseDecorator(db1));
    }
    return suite;
}
Also used : SystemPropertyTestSetup(org.apache.derbyTesting.junit.SystemPropertyTestSetup) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) Properties(java.util.Properties)

Example 53 with SystemPropertyTestSetup

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

the class ij2Test method suite.

public static Test suite() {
    Properties props = new Properties();
    props.setProperty("derby.infolog.append", "true");
    props.setProperty("ij.protocol", "jdbc:derby:");
    props.setProperty("ij.database", "wombat;create=true");
    Test test = new SystemPropertyTestSetup(new ij2Test("ij2"), props);
    test = new LocaleTestSetup(test, Locale.ENGLISH);
    test = TestConfiguration.singleUseDatabaseDecorator(test, "wombat1");
    test = new CleanDatabaseTestSetup(test);
    BaseTestSuite suite = new BaseTestSuite("ij2Scripts");
    suite.addTest(test);
    if (JDBC.vmSupportsJDBC3()) {
        props.setProperty("ij.protocol", "jdbc:derby:");
        props.setProperty("ij.showNoConnectionsAtStart", "true");
        Test testb = new SystemPropertyTestSetup(new ij2Test("ij2b"), props);
        testb = new LocaleTestSetup(testb, Locale.ENGLISH);
        testb = TestConfiguration.singleUseDatabaseDecorator(testb, "wombat1");
        testb = new CleanDatabaseTestSetup(testb);
        suite.addTest(testb);
    }
    return getIJConfig(suite);
}
Also used : Test(junit.framework.Test) CleanDatabaseTestSetup(org.apache.derbyTesting.junit.CleanDatabaseTestSetup) SystemPropertyTestSetup(org.apache.derbyTesting.junit.SystemPropertyTestSetup) LocaleTestSetup(org.apache.derbyTesting.junit.LocaleTestSetup) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) Properties(java.util.Properties)

Example 54 with SystemPropertyTestSetup

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

the class ij5Test method suite.

public static Test suite() {
    Properties props = new Properties();
    // return an empty suite (i.e. don't run with JSR 169).
    if (JDBC.vmSupportsJSR169()) {
        return new BaseTestSuite("empty: cannot obtain expected output with JSR169");
    }
    props.setProperty("ij.showNoConnectionsAtStart", "false");
    props.setProperty("ij.showNoCountForSelect", "false");
    Test test = new SystemPropertyTestSetup(new ij5Test("ij5"), props);
    test = new CleanDatabaseTestSetup(test);
    return getIJConfig(test);
}
Also used : 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)

Example 55 with SystemPropertyTestSetup

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

the class AdditionalDb method suite.

public static Test suite(final int[] version, boolean useCreateOnUpgrade) {
    ClassLoader oldLoader = makeClassLoader(version);
    // If no jars then just skip.
    if (oldLoader == null) {
        BaseTestSuite suite = new BaseTestSuite("Empty: Skipped upgrade Tests (no jars) for " + getTextVersion(version));
        return suite;
    }
    BaseTestSuite suite = new BaseTestSuite("Upgrade Tests from " + getTextVersion(version));
    BaseTestCase.traceit("Prepare to run upgrade tests from " + getTextVersion(version));
    for (int phase = 0; phase < UpgradeChange.PHASES.length; phase++) {
        ClassLoader loader = null;
        switch(phase) {
            case UpgradeChange.PH_CREATE:
            case UpgradeChange.PH_POST_SOFT_UPGRADE:
            case UpgradeChange.PH_POST_HARD_UPGRADE:
                loader = oldLoader;
                break;
            case UpgradeChange.PH_SOFT_UPGRADE:
            case UpgradeChange.PH_HARD_UPGRADE:
                break;
        }
        Test phaseTests = baseSuite(getTextVersion(version) + " Upgrade Phase: " + UpgradeChange.PHASES[phase] + " ", phase, version);
        Test phaseSet = new PhaseChanger(phaseTests, phase, loader, version, useCreateOnUpgrade);
        phaseSet = handleJavaSE6(phase, version, phaseSet);
        suite.addTest(phaseSet);
    }
    TestSetup setup = TestConfiguration.singleUseDatabaseDecorator(suite);
    for (int i = 0; i < ADDITIONAL_DBS.length; i++) {
        if (ADDITIONAL_DBS[i].shutDown) {
            setup = TestConfiguration.additionalDatabaseDecorator(setup, ADDITIONAL_DBS[i].logicalName);
        } else {
            setup = TestConfiguration.additionalDatabaseDecoratorNoShutdown(setup, ADDITIONAL_DBS[i].logicalName);
        }
    }
    Properties preReleaseUpgrade = new Properties();
    preReleaseUpgrade.setProperty("derby.database.allowPreReleaseUpgrade", "true");
    setup = new SystemPropertyTestSetup(setup, preReleaseUpgrade);
    return SecurityManagerSetup.noSecurityManager(setup);
}
Also used : TestSetup(junit.extensions.TestSetup) SystemPropertyTestSetup(org.apache.derbyTesting.junit.SystemPropertyTestSetup) Test(junit.framework.Test) DatabaseMetaDataTest(org.apache.derbyTesting.functionTests.tests.jdbcapi.DatabaseMetaDataTest) 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