Search in sources :

Example 11 with SystemPropertyTestSetup

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

the class CollationTest2 method suite.

public static Test suite() {
    // only test in embedded mode, all tests are server side actions.
    BaseTestSuite suite = new BaseTestSuite("CollationTest2");
    suite.addTest(new CollationTest2("testDefaultCollation"));
    suite.addTest(collatedTest("en", "testEnglishCollation"));
    suite.addTest(caseInsensitiveCollationSuite());
    // Only add tests for other locales if they are in fact supported
    // by the jvm.
    Locale[] availableLocales = Collator.getAvailableLocales();
    boolean norwegian = false;
    boolean polish = false;
    for (int i = 0; i < availableLocales.length; i++) {
        if ("no".equals(availableLocales[i].getLanguage())) {
            norwegian = true;
        }
        if ("pl".equals(availableLocales[i].getLanguage())) {
            polish = true;
        }
    }
    if (norwegian) {
        suite.addTest(collatedTest("no_NO", "testNorwayCollation"));
    }
    if (polish) {
        suite.addTest(collatedTest("pl", "testPolishCollation"));
    }
    suite.addTest(collatedTest(null, "testDefaultJVMTerritoryCollation"));
    // add support to use external files for import/export calls.
    Test test = new SupportFilesSetup(suite);
    // turn on log statement text for sequence of statements in derby.log.
    if (verbose_debug) {
        Properties props = new Properties();
        props.setProperty("derby.language.logStatementText", "true");
        test = new SystemPropertyTestSetup(test, props);
    }
    return test;
}
Also used : Locale(java.util.Locale) Test(junit.framework.Test) SystemPropertyTestSetup(org.apache.derbyTesting.junit.SystemPropertyTestSetup) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) SupportFilesSetup(org.apache.derbyTesting.junit.SupportFilesSetup) Properties(java.util.Properties)

Example 12 with SystemPropertyTestSetup

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

the class SubqueryTest method suite.

public static Test suite() {
    Properties props = new Properties();
    props.setProperty("derby.language.statementCacheSize", "0");
    return new DatabasePropertyTestSetup(new SystemPropertyTestSetup(new CleanDatabaseTestSetup(new BaseTestSuite(SubqueryTest.class, "SubqueryTest")) {

        /**
         * @see org.apache.derbyTesting.junit.CleanDatabaseTestSetup#decorateSQL(java.sql.Statement)
         */
        protected void decorateSQL(Statement s) throws SQLException {
            s.execute("CREATE FUNCTION ConsistencyChecker() " + "RETURNS VARCHAR(128) " + "EXTERNAL NAME " + "'org.apache.derbyTesting.functionTests." + "util.T_ConsistencyChecker.runConsistencyChecker' " + "LANGUAGE JAVA PARAMETER STYLE JAVA");
            s.execute("create table s " + "(i int, s smallint, c char(30), " + "vc char(30), b bigint)");
            s.execute("create table t " + "(i int, s smallint, c char(30), " + "vc char(30), b bigint)");
            s.execute("create table tt " + "(ii int, ss smallint, cc char(30), " + "vcvc char(30), b bigint)");
            s.execute("create table ttt " + "(iii int, sss smallint, ccc char(30), " + "vcvcvc char(30))");
            // populate the tables
            s.execute("insert into s values " + "(null, null, null, null, null)");
            s.execute("insert into s values (0, 0, '0', '0', 0)");
            s.execute("insert into s values (1, 1, '1', '1', 1)");
            s.execute("insert into t values " + "(null, null, null, null, null)");
            s.execute("insert into t values (0, 0, '0', '0', 0)");
            s.execute("insert into t values (1, 1, '1', '1', 1)");
            s.execute("insert into t values (1, 1, '1', '1', 1)");
            s.execute("insert into t values (2, 2, '2', '2', 1)");
            s.execute("insert into tt values " + "(null, null, null, null, null)");
            s.execute("insert into tt values (0, 0, '0', '0', 0)");
            s.execute("insert into tt values (1, 1, '1', '1', 1)");
            s.execute("insert into tt values (1, 1, '1', '1', 1)");
            s.execute("insert into tt values (2, 2, '2', '2', 1)");
            s.execute("insert into ttt values (null, null, null, null)");
            s.execute("insert into ttt values (11, 11, '11', '11')");
            s.execute("insert into ttt values (11, 11, '11', '11')");
            s.execute("insert into ttt values (22, 22, '22', '22')");
        }
    }, props), props, true);
}
Also used : DatabasePropertyTestSetup(org.apache.derbyTesting.junit.DatabasePropertyTestSetup) CleanDatabaseTestSetup(org.apache.derbyTesting.junit.CleanDatabaseTestSetup) PreparedStatement(java.sql.PreparedStatement) Statement(java.sql.Statement) SystemPropertyTestSetup(org.apache.derbyTesting.junit.SystemPropertyTestSetup) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) Properties(java.util.Properties)

Example 13 with SystemPropertyTestSetup

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

the class SysDiagVTIMappingTest method suite.

public static Test suite() {
    BaseTestSuite suite = new BaseTestSuite("Diagnostic VTI Table Mappings");
    Test defaultSetup = TestConfiguration.defaultSuite(SysDiagVTIMappingTest.class);
    // turn on statement logging so there will be something in the error log
    // to run these vtis against
    Properties sysprops = new Properties();
    sysprops.put("derby.language.logStatementText", "true");
    Test verboseTest = new SystemPropertyTestSetup(defaultSetup, sysprops);
    suite.addTest(verboseTest);
    /* Some of the VTIs that are tested in this class require a derby.log
         * file.  We have a test log file stored in the tests/lang directory,
         * and since the VTIs are going to try to read it, the test log file
         * must be in a directory for which Derby has read access.  By
         * using a SupportFilesSetup wrapper, we copy the test log file to
         * the "extin" directory, which has the required permissions.
         */
    return SecurityManagerSetup.noSecurityManager(new SupportFilesSetup(suite, new String[] { "functionTests/tests/lang/" + testLogFile }));
}
Also used : Test(junit.framework.Test) SystemPropertyTestSetup(org.apache.derbyTesting.junit.SystemPropertyTestSetup) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) Properties(java.util.Properties) SupportFilesSetup(org.apache.derbyTesting.junit.SupportFilesSetup)

Example 14 with SystemPropertyTestSetup

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

the class InterruptResilienceTest method makeSuite.

protected static Test makeSuite(String name) {
    BaseTestSuite suite = new BaseTestSuite(name);
    Test est = TestConfiguration.embeddedSuite(InterruptResilienceTest.class);
    Test cst = TestConfiguration.clientServerSuite(InterruptResilienceTest.class);
    est = TestConfiguration.singleUseDatabaseDecorator(est);
    cst = TestConfiguration.singleUseDatabaseDecorator(cst);
    // Cut down on running time:
    Properties p = new Properties();
    p.put("derby.system.durability", "test");
    p.put("derby.infolog.append", "true");
    // we'll force interrupts and thus serious errors, which with
    // ibm jvms would result in javacore files, which aren't of
    // interest if the test passes. Setting the stream error level
    // so we don't get those javacores.
    p.put("derby.stream.error.extendedDiagSeverityLevel", "50000");
    suite.addTest(new SystemPropertyTestSetup(est, p, true));
    suite.addTest(new SystemPropertyTestSetup(cst, p, true));
    return suite;
}
Also used : Test(junit.framework.Test) SystemPropertyTestSetup(org.apache.derbyTesting.junit.SystemPropertyTestSetup) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) Properties(java.util.Properties)

Example 15 with SystemPropertyTestSetup

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

the class StoreScriptsTest 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(getSuite(EMBEDDED_TESTS), props);
    // Lock timeout settings that were set for the old harness store tests
    test = DatabasePropertyTestSetup.setLockTimeouts(test, 1, 4);
    BaseTestSuite suite = new BaseTestSuite("StoreScripts");
    suite.addTest(test);
    return getIJConfig(suite);
}
Also used : Test(junit.framework.Test) 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