Search in sources :

Example 16 with BaseTestSuite

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

the class ResultSetMiscTest method baseSuite.

public static Test baseSuite(String name) {
    BaseTestSuite suite = new BaseTestSuite(name);
    suite.addTestSuite(ResultSetMiscTest.class);
    // Some test cases expect lock timeouts, so reduce the timeout to
    // make the test go faster.
    Test test = DatabasePropertyTestSetup.setLockTimeouts(suite, 1, 3);
    return new CleanDatabaseTestSetup(test) {

        /**
         * Creates the table used in the test cases.
         */
        protected void decorateSQL(Statement s) throws SQLException {
            s.execute("create table t (i int, s smallint, r real, " + "d double precision, dt date, t time, ts timestamp, " + "c char(10), v varchar(40) not null, dc dec(10,2)," + "bi bigint, cbd char(10) for bit data," + "vbd varchar(10) for bit data,lvbd long varchar for bit data," + "cl clob(2G), bl blob(1G) )");
            s.execute("insert into t values(1,2,3.3,4.4,date('1990-05-05')," + "time('12:06:06'),timestamp('1990-07-07 07:07:07.000007')," + "'eight','nine', 10.1, 11," + Utilities.stringToHexLiteral("twelv") + "," + Utilities.stringToHexLiteral("3teen") + "," + Utilities.stringToHexLiteral("4teen") + ", null, null)");
            s.execute("CREATE PROCEDURE WAIT_FOR_POST_COMMIT() " + "LANGUAGE JAVA EXTERNAL NAME " + "'org.apache.derbyTesting.functionTests.util." + "T_Access.waitForPostCommitToFinish' " + "PARAMETER STYLE JAVA");
        }
    };
}
Also used : Test(junit.framework.Test) CleanDatabaseTestSetup(org.apache.derbyTesting.junit.CleanDatabaseTestSetup) PreparedStatement(java.sql.PreparedStatement) Statement(java.sql.Statement) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite)

Example 17 with BaseTestSuite

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

the class SURQueryMixTest method createTestCases.

private static BaseTestSuite createTestCases(final String modelName) {
    BaseTestSuite suite = new BaseTestSuite();
    for (int doPos = 0; doPos < 2; doPos++) {
        // true if to use positioned updates
        boolean positioned = doPos > 0;
        for (int i = 0; i < selectConditions.length; i++) {
            for (int j = 0; j < projectConditions.length; j++) {
                final String cursorName = "cursor_" + i + "_" + j;
                final String stmtString = "SELECT " + projectConditions[j] + " FROM T1 " + selectConditions[i];
                suite.addTest(new SURQueryMixTest(modelName, stmtString, cursorName, positioned));
            }
        }
    }
    return suite;
}
Also used : BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite)

Example 18 with BaseTestSuite

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

the class SURQueryMixTest method suite.

/**
 * Run in client and embedded.
 */
public static Test suite() {
    BaseTestSuite mainSuite = new BaseTestSuite("SURQueryMixTest suite");
    mainSuite.addTest(baseSuite("SURQueryMixTest:embedded"));
    mainSuite.addTest(TestConfiguration.clientServerDecorator(baseSuite("SURQueryMixTest:client")));
    return mainSuite;
}
Also used : BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite)

Example 19 with BaseTestSuite

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

the class SURTest method baseSuite.

/**
 * The suite contains all testcases in this class running on different
 * data models
 */
private static Test baseSuite(String name) {
    BaseTestSuite mainSuite = new BaseTestSuite(name);
    // Iterate over all data models and decorate the tests:
    for (Iterator i = SURDataModelSetup.SURDataModel.values().iterator(); i.hasNext(); ) {
        SURDataModelSetup.SURDataModel model = (SURDataModelSetup.SURDataModel) i.next();
        BaseTestSuite suite = new BaseTestSuite(SURTest.class);
        TestSetup decorator = new SURDataModelSetup(suite, model);
        mainSuite.addTest(decorator);
    }
    return mainSuite;
}
Also used : TestSetup(junit.extensions.TestSetup) Iterator(java.util.Iterator) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite)

Example 20 with BaseTestSuite

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

the class SURTest method suite.

/**
 * Run the base suite in embedded and client mode.
 */
public static Test suite() {
    BaseTestSuite mainSuite = new BaseTestSuite("SURTest");
    mainSuite.addTest(baseSuite("SURTest:embedded"));
    mainSuite.addTest(TestConfiguration.clientServerDecorator(baseSuite("SURTest:client")));
    return mainSuite;
}
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