Search in sources :

Example 16 with SystemPropertyTestSetup

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

the class SysinfoLocaleTest method createTest.

/**
 * Create a single test case.
 *
 * @param loc default locale for the test case
 * @param ui <code>derby.ui.locale</code> for the test case
 * @param german whether output is expected to be German
 */
private static Test createTest(Locale loc, String ui, boolean german) {
    Properties prop = new Properties();
    if (ui != null) {
        prop.setProperty("derby.ui.locale", ui);
    }
    // always set the encoding so that we can reliably read the output
    prop.setProperty("derby.ui.codeset", ENCODING);
    String info = "defaultLocale=" + loc + ",uiLocale=" + ui;
    Test test = new SysinfoLocaleTest(loc, german, info);
    return new SystemPropertyTestSetup(test, prop);
}
Also used : Test(junit.framework.Test) SystemPropertyTestSetup(org.apache.derbyTesting.junit.SystemPropertyTestSetup) Properties(java.util.Properties)

Example 17 with SystemPropertyTestSetup

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

the class st_derby1939 method suite.

public static Test suite() {
    Properties sysprops = new Properties();
    sysprops.setProperty("derby.language.maxMemoryPerTable", "140");
    sysprops.setProperty("derby.optimizer.noTimeout", "true");
    return new SystemPropertyTestSetup(new CleanDatabaseTestSetup(TestConfiguration.embeddedSuite(st_derby1939.class)), sysprops, true);
}
Also used : CleanDatabaseTestSetup(org.apache.derbyTesting.junit.CleanDatabaseTestSetup) SystemPropertyTestSetup(org.apache.derbyTesting.junit.SystemPropertyTestSetup) Properties(java.util.Properties)

Example 18 with SystemPropertyTestSetup

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

the class LoginTimeoutTest method suite.

// /////////////////////////////////////////////////////////////////////////////////
// 
// JUnit MACHINERY
// 
// /////////////////////////////////////////////////////////////////////////////////
/**
 * Return suite with all tests of the class.
 */
public static Test suite() {
    BaseTestSuite suite = new BaseTestSuite();
    Test embedded = new BaseTestSuite(LoginTimeoutTest.class, "embedded LoginTimeoutTest");
    embedded = TestConfiguration.singleUseDatabaseDecorator(embedded);
    embedded = new SystemPropertyTestSetup(embedded, systemProperties());
    suite.addTest(embedded);
    if (Derby.hasServer() && Derby.hasClient()) {
        Test clientServer = new BaseTestSuite(LoginTimeoutTest.class, "client/server LoginTimeoutTest");
        clientServer = TestConfiguration.singleUseDatabaseDecorator(clientServer);
        clientServer = new JDBCClientSetup(clientServer, JDBCClient.DERBYNETCLIENT);
        clientServer = new NetworkServerTestSetup(clientServer, systemPropertiesArray(), new String[] {}, true);
        suite.addTest(clientServer);
    }
    return suite;
}
Also used : Test(junit.framework.Test) SystemPropertyTestSetup(org.apache.derbyTesting.junit.SystemPropertyTestSetup) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) JDBCClientSetup(org.apache.derbyTesting.junit.JDBCClientSetup) NetworkServerTestSetup(org.apache.derbyTesting.junit.NetworkServerTestSetup)

Example 19 with SystemPropertyTestSetup

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

the class DistinctTest method suite.

public static Test suite() {
    Test s = new BaseTestSuite(DistinctTest.class);
    Properties p = new Properties();
    p.put("derby.optimizer.noTimeout", "true");
    Test t = new SystemPropertyTestSetup(s, p);
    return new CleanDatabaseTestSetup(t) {

        protected void decorateSQL(Statement s) throws SQLException {
            s.execute("create table t (i int, s smallint, r real, f float, d date, t time, ts timestamp, c char(10), v varchar(20))");
            // for tests from distinctElimination
            s.execute("create table one(c1 int, c2 int, c3 int, c4 int, c5 int)");
            s.execute("create unique index one_c1 on one(c1)");
            s.execute("create table two(c1 int, c2 int, c3 int, c4 int, c5 int)");
            s.execute("create unique index two_c1c3 on two(c1, c3)");
            s.execute("create table three(c1 int, c2 int, c3 int, c4 int, c5 int)");
            s.execute("create unique index three_c1 on three(c1)");
            s.execute("create table four(c1 int, c2 int, c3 int, c4 int, c5 int)");
            s.execute("create unique index four_c1c3 on four(c1, c3)");
            s.execute("CREATE TABLE \"APP\".\"IDEPT\" (\"DISCRIM_DEPT\" VARCHAR(32), \"NO1\" INTEGER NOT NULL, " + "\"NAME\" VARCHAR(50), \"AUDITOR_NO\" INTEGER, \"REPORTTO_NO\" INTEGER, \"HARDWAREASSET\"" + " VARCHAR(15), \"SOFTWAREASSET\" VARCHAR(15))");
            s.execute("ALTER TABLE \"APP\".\"IDEPT\" ADD CONSTRAINT \"PK_IDEPT\" PRIMARY KEY (\"NO1\")");
            s.execute("insert into one values (1, 1, 1, 1, 1)");
            s.execute("insert into one values (2, 1, 1, 1, 1)");
            s.execute("insert into one values (3, 1, 1, 1, 1)");
            s.execute("insert into one values (4, 1, 1, 1, 1)");
            s.execute("insert into one values (5, 1, 1, 1, 1)");
            s.execute("insert into one values (6, 1, 1, 1, 1)");
            s.execute("insert into one values (7, 1, 1, 1, 1)");
            s.execute("insert into one values (8, 1, 1, 1, 1)");
            s.execute("insert into two values (1, 1, 1, 1, 1)");
            s.execute("insert into two values (1, 1, 2, 1, 1)");
            s.execute("insert into two values (1, 1, 3, 1, 1)");
            s.execute("insert into two values (2, 1, 1, 1, 1)");
            s.execute("insert into two values (2, 1, 2, 1, 1)");
            s.execute("insert into two values (2, 1, 3, 1, 1)");
            s.execute("insert into two values (3, 1, 1, 1, 1)");
            s.execute("insert into two values (3, 1, 2, 1, 1)");
            s.execute("insert into two values (3, 1, 3, 1, 1)");
            s.execute("insert into three values (1, 1, 1, 1, 1)");
            s.execute("insert into three values (2, 1, 1, 1, 1)");
            s.execute("insert into three values (3, 1, 1, 1, 1)");
            s.execute("insert into three values (4, 1, 1, 1, 1)");
            s.execute("insert into three values (5, 1, 1, 1, 1)");
            s.execute("insert into three values (6, 1, 1, 1, 1)");
            s.execute("insert into three values (7, 1, 1, 1, 1)");
            s.execute("insert into three values (8, 1, 1, 1, 1)");
            s.execute("insert into four values (1, 1, 1, 1, 1)");
            s.execute("insert into four values (1, 1, 2, 1, 1)");
            s.execute("insert into four values (1, 1, 3, 1, 1)");
            s.execute("insert into four values (2, 1, 1, 1, 1)");
            s.execute("insert into four values (2, 1, 2, 1, 1)");
            s.execute("insert into four values (2, 1, 3, 1, 1)");
            s.execute("insert into four values (3, 1, 1, 1, 1)");
            s.execute("insert into four values (3, 1, 2, 1, 1)");
            s.execute("insert into four values (3, 1, 3, 1, 1)");
            s.execute("insert into idept values ('Dept', 1, 'Department1', null, null, null, null)");
            s.execute("insert into idept values ('HardwareDept', 2, 'Department2', 25, 1, 'hardwareaset2', null)");
            s.execute("insert into idept values ('HardwareDept', 3, 'Department3', 25, 2, 'hardwareaset3', null)");
            s.execute("insert into idept values ('SoftwareDept', 4, 'Department4', 25, 1, null, 'softwareasset4')");
            s.execute("insert into idept values ('SoftwareDept', 5, 'Department5', 30, 4, null, 'softwareasset5')");
        }
    };
}
Also used : Test(junit.framework.Test) 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 20 with SystemPropertyTestSetup

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

the class MultiByteClobTest method suite.

/**
 * Runs the test fixtures in embedded and client.
 *
 * @return test suite
 */
public static Test suite() {
    BaseTestSuite suite = new BaseTestSuite("MultiByteClobTest");
    suite.addTest(baseSuite("MultiByteClobTest:embedded"));
    suite.addTest(TestConfiguration.clientServerDecorator(baseSuite("MultiByteClobTest:client")));
    Properties p = new Properties();
    // use small pageCacheSize so we don't run out of memory on the insert.
    p.setProperty("derby.storage.pageCacheSize", "100");
    return new SystemPropertyTestSetup(suite, p);
}
Also used : 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