Search in sources :

Example 41 with BaseTestSuite

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

the class LangHarnessJavaTest method suite.

public static Test suite() {
    BaseTestSuite suite = new BaseTestSuite("jdbcapi: old harness java tests");
    suite.addTest(baseSuite("embedded", LANG_TESTS_BOTH));
    suite.addTest(baseSuite("embedded", LANG_TESTS_EMEBDDED));
    suite.addTest(TestConfiguration.clientServerDecorator(baseSuite("clientserver", LANG_TESTS_BOTH)));
    return suite;
}
Also used : BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite)

Example 42 with BaseTestSuite

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

the class LangScripts method suite.

/**
 * Return the suite that runs all the langauge SQL scripts.
 */
public static Test suite() {
    BaseTestSuite suite = new BaseTestSuite("LangScripts");
    suite.addTest(getSuite(CLIENT_AND_EMBEDDED_TESTS));
    suite.addTest(getSuite(EMBEDDED_TESTS));
    if (JDBC.vmSupportsJDBC3())
        suite.addTest(getSuite(JDBC3_TESTS));
    // Set up the scripts run with the network client
    BaseTestSuite clientTests = new BaseTestSuite("LangScripts:client");
    clientTests.addTest(getSuite(CLIENT_AND_EMBEDDED_TESTS));
    Test client = TestConfiguration.clientServerDecorator(clientTests);
    // add those client tests into the top-level suite.
    suite.addTest(client);
    return suite;
}
Also used : Test(junit.framework.Test) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite)

Example 43 with BaseTestSuite

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

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

the class OrderByAndSortAvoidance method makeSuite.

/**
 * Construct suite of tests
 *
 * @return A suite containing the test cases.
 */
private static Test makeSuite() {
    return new CleanDatabaseTestSetup(new BaseTestSuite(OrderByAndSortAvoidance.class)) {

        protected void decorateSQL(Statement st) throws SQLException {
            st.executeUpdate("create table a(col1 int, col2 int)");
            st.executeUpdate("insert into a values(1,1),(1,1)");
            st.executeUpdate("create table b(col1 int, col2 int)");
            st.executeUpdate("insert into b values(2,2),(2,2)");
            st.executeUpdate("create table c(col1 int, col2 int)");
            st.executeUpdate("insert into c values(3,3),(3,3)");
            st.executeUpdate("create TABLE table1 (id BIGINT NOT NULL, PRIMARY KEY(id))");
            st.executeUpdate("CREATE INDEX key1 ON table1(id)");
            st.executeUpdate("CREATE TABLE table2 (id BIGINT NOT NULL, name " + "VARCHAR(40) NOT NULL, value VARCHAR(1024), PRIMARY " + "KEY(id, name))");
            st.executeUpdate("CREATE UNIQUE INDEX key2 ON table2(id, name)");
            st.executeUpdate("CREATE INDEX key3 ON table2(value)");
            populateTestTables(getConnection());
            // Start of tables creation for DERBY-4240 repro
            st.executeUpdate("CREATE TABLE test1 (id BIGINT NOT NULL, name VARCHAR(255), " + "PRIMARY KEY (id))");
            st.executeUpdate("CREATE TABLE test2 (entity_id BIGINT, rel_id BIGINT)");
            st.executeUpdate("CREATE INDEX idx_test2 ON test2 (entity_id)");
            st.executeUpdate("INSERT INTO test1 (id, name) VALUES (102, 'Tom')");
            st.executeUpdate("INSERT INTO test1 (id, name) VALUES (1, null)");
            st.executeUpdate("INSERT INTO test1 (id, name) VALUES (103, 'Jerry')");
            st.executeUpdate("INSERT INTO test1 (id, name) VALUES (101, 'Pupy')");
            st.executeUpdate("INSERT INTO test2 (entity_id, rel_id) VALUES (1, 102)");
            st.executeUpdate("INSERT INTO test2 (entity_id, rel_id) VALUES (1, 101)");
            st.executeUpdate("INSERT INTO test2 (entity_id, rel_id) VALUES (1, 103)");
            // End of tables creation for DERBY-4240 repro
            // Start of tables creation for DERBY-4331 repro
            st.executeUpdate("CREATE TABLE REPOSITORIES ( ID INT CONSTRAINT " + "REPOSITORIES_PRIMARY_ID PRIMARY KEY GENERATED ALWAYS " + "AS IDENTITY, " + "PATH VARCHAR(32672) CONSTRAINT REPOSITORIES_PATH " + "UNIQUE NOT NULL)");
            st.executeUpdate("CREATE TABLE FILES ( ID INT CONSTRAINT FILES_PRIMARY_ID " + "PRIMARY KEY GENERATED ALWAYS AS IDENTITY, " + "PATH VARCHAR(32672) NOT NULL, REPOSITORY INT NOT NULL " + "REFERENCES REPOSITORIES ON DELETE CASCADE, " + "CONSTRAINT FILES_REPOSITORY_PATH UNIQUE " + "(REPOSITORY, PATH))");
            st.executeUpdate("CREATE TABLE AUTHORS ( " + "ID INT CONSTRAINT AUTHORS_PRIMARY_ID PRIMARY KEY " + "GENERATED ALWAYS AS IDENTITY, REPOSITORY INT NOT NULL " + "REFERENCES REPOSITORIES ON DELETE CASCADE, " + "NAME VARCHAR(32672) NOT NULL, " + "CONSTRAINT AUTHORS_REPOSITORY_NAME UNIQUE (REPOSITORY, NAME))");
            st.executeUpdate("CREATE TABLE CHANGESETS ( " + "ID INT CONSTRAINT CHANGESETS_PRIMARY_ID PRIMARY KEY " + "GENERATED ALWAYS AS IDENTITY, " + "REPOSITORY INT NOT NULL REFERENCES REPOSITORIES " + "ON DELETE CASCADE, REVISION VARCHAR(1024) NOT NULL, " + "AUTHOR INT NOT NULL REFERENCES AUTHORS ON DELETE CASCADE, " + "TIME TIMESTAMP NOT NULL, MESSAGE VARCHAR(32672) NOT NULL, " + "CONSTRAINT CHANGESETS_REPOSITORY_REVISION UNIQUE " + "(REPOSITORY, REVISION))");
            st.executeUpdate("CREATE UNIQUE INDEX IDX_CHANGESETS_ID_DESC ON " + "CHANGESETS(ID DESC)");
            st.executeUpdate("CREATE TABLE FILECHANGES ( " + "ID INT CONSTRAINT FILECHANGES_PRIMARY_ID PRIMARY KEY " + "GENERATED ALWAYS AS IDENTITY, FILE INT NOT NULL " + "REFERENCES FILES ON DELETE CASCADE, " + "CHANGESET INT NOT NULL REFERENCES CHANGESETS " + "ON DELETE CASCADE, " + "CONSTRAINT FILECHANGES_FILE_CHANGESET " + "UNIQUE (FILE, CHANGESET))");
            st.executeUpdate("insert into repositories(path) values " + "'/var/tmp/source5923202038296723704opengrok/mercurial'");
            st.executeUpdate("insert into files(path, repository) values " + "('/mercurial/Makefile', 1), " + "('/mercurial/main.c', 1), " + "('/mercurial/header.h', 1), " + "('/mercurial/.hgignore', 1)");
            st.executeUpdate("insert into authors(repository, name) values " + "(1, 'Trond Norbye <trond.norbye@sun.com>')");
            st.executeUpdate("insert into changesets(repository, revision, author, " + "time, message) values (1,'0:816b6279ae9c',1," + "'2008-08-12 22:00:00.0','Add .hgignore file')," + "(1,'1:f24a5fd7a85d',1,'2008-08-12 22:03:00.0'," + "'Created a small dummy program')," + "(1,'2:585a1b3f2efb',1,'2008-08-12 22:13:00.0'," + "'Add lint make target and fix lint warnings')");
            st.executeUpdate("insert into filechanges(file, changeset) values " + "(4,1),(1,2),(3,2),(2,2),(1,3),(2,3)");
        // End of tables creation for DERBY-4331 repro
        }
    };
}
Also used : CleanDatabaseTestSetup(org.apache.derbyTesting.junit.CleanDatabaseTestSetup) PreparedStatement(java.sql.PreparedStatement) Statement(java.sql.Statement) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite)

Example 45 with BaseTestSuite

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

the class OrderByAndSortAvoidance method suite.

/**
 * Construct top level suite in this JUnit test
 *
 * @return A suite containing embedded and client suites.
 */
public static Test suite() {
    BaseTestSuite suite = new BaseTestSuite("OrderByAndSortAvoidance");
    suite.addTest(makeSuite());
    suite.addTest(TestConfiguration.clientServerDecorator(makeSuite()));
    return suite;
}
Also used : BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite)

Aggregations

BaseTestSuite (org.apache.derbyTesting.junit.BaseTestSuite)476 Test (junit.framework.Test)136 CleanDatabaseTestSetup (org.apache.derbyTesting.junit.CleanDatabaseTestSetup)118 Statement (java.sql.Statement)81 PreparedStatement (java.sql.PreparedStatement)68 SupportFilesSetup (org.apache.derbyTesting.junit.SupportFilesSetup)49 Properties (java.util.Properties)43 SystemPropertyTestSetup (org.apache.derbyTesting.junit.SystemPropertyTestSetup)34 CallableStatement (java.sql.CallableStatement)19 Connection (java.sql.Connection)14 SecurityManagerSetup (org.apache.derbyTesting.junit.SecurityManagerSetup)13 DatabasePropertyTestSetup (org.apache.derbyTesting.junit.DatabasePropertyTestSetup)11 TestSetup (junit.extensions.TestSetup)10 SQLException (java.sql.SQLException)7 LocaleTestSetup (org.apache.derbyTesting.junit.LocaleTestSetup)7 Method (java.lang.reflect.Method)5 Locale (java.util.Locale)5 BaseJDBCTestSetup (org.apache.derbyTesting.junit.BaseJDBCTestSetup)4 NetworkServerTestSetup (org.apache.derbyTesting.junit.NetworkServerTestSetup)4 ResultSet (java.sql.ResultSet)3