Search in sources :

Example 11 with BaseTestSuite

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

the class cdsXid method suite.

public static Test suite() {
    if (JDBC.vmSupportsJSR169()) {
        // test uses unsupported classes like DriverManager, XADataSource,
        // ConnectionPoolDataSource, ConnectionEvenListenere, as well as
        // unsupported methods, like Connection.setTypeMap()...
        BaseTestSuite suite = new BaseTestSuite("J2EEDatasourceTest cannot run with JSR169");
        return suite;
    } else {
        BaseTestSuite suite = new BaseTestSuite("J2EEDataSourceTest suite");
        // Add tests that will run with both embedded
        suite.addTest(baseSuite(":embedded"));
        // and network server/client
        suite.addTest(TestConfiguration.clientServerDecorator(baseSuite(":client")));
        // Add the tests that only run with client
        suite.addTest(new SupportFilesSetup(TestConfiguration.clientServerDecorator(getClientSuite())));
        // Add the tests that only run with embedded
        suite.addTest(getEmbeddedSuite("embedded"));
        // Add the tests relying on getting timeouts.
        suite.addTest(getTimeoutSuite(":embedded"));
        suite.addTest(TestConfiguration.clientServerDecorator(getTimeoutSuite(":client")));
        // Note that not all fixtures need (all of) these.
        return new CleanDatabaseTestSetup(suite) {

            /**
             * Create and populate database objects
             *
             * @see org.apache.derbyTesting.junit.CleanDatabaseTestSetup#decorateSQL(java.sql.Statement)
             */
            protected void decorateSQL(Statement s) throws SQLException {
                TestRoutines.installRoutines(getConnection());
                s.executeUpdate("create table autocommitxastart(i int)");
                s.executeUpdate("insert into autocommitxastart values 1,2,3,4,5");
                s.executeUpdate("create schema SCHEMA_Patricio");
                s.executeUpdate("create table " + "SCHEMA_Patricio.Patricio (id VARCHAR(255), value INTEGER)");
                s.executeUpdate("create table intTable(i int)");
                s.executeUpdate("create table hold_30 " + "(id int not null primary key, b char(30))");
                s.executeUpdate("create procedure checkConn2(in dsname varchar(20)) " + "parameter style java language java modifies SQL DATA " + "external name " + "'org.apache.derbyTesting.functionTests.tests.jdbcapi.J2EEDataSourceTest." + getNestedMethodName() + "'");
                s.execute("create table derby3799 (dClob clob)");
                s.executeUpdate("insert into derby3799 values (" + "'myLittleTestClob')");
            }
        };
    }
}
Also used : CleanDatabaseTestSetup(org.apache.derbyTesting.junit.CleanDatabaseTestSetup) PreparedStatement(java.sql.PreparedStatement) Statement(java.sql.Statement) CallableStatement(java.sql.CallableStatement) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) SupportFilesSetup(org.apache.derbyTesting.junit.SupportFilesSetup)

Example 12 with BaseTestSuite

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

the class cdsXid method getTimeoutSuite.

/**
 * Return a suite of tests that are run with a lower lock timeout.
 *
 * @param postfix suite name postfix
 * @return A suite of tests being run with a lower lock timeout.
 */
private static Test getTimeoutSuite(String postfix) {
    BaseTestSuite suite = new BaseTestSuite("Lower lock timeout" + postfix);
    suite.addTest(new J2EEDataSourceTest("timeoutTestDerby1144PooledDS"));
    suite.addTest(new J2EEDataSourceTest("timeoutTestDerby1144XADS"));
    // Reduce the timeout threshold to make the tests run faster.
    return DatabasePropertyTestSetup.setLockTimeouts(suite, 3, 5);
}
Also used : BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite)

Example 13 with BaseTestSuite

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

the class JDBCDriversPropertyTest method getSuite.

static final Test getSuite(String jdbcDrivers) throws Exception {
    BaseTestSuite suite = new BaseTestSuite("jdbc.drivers=" + jdbcDrivers);
    System.setProperty("jdbc.drivers", jdbcDrivers);
    suite.addTest(getAutoLoadSuite());
    return suite;
}
Also used : BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite)

Example 14 with BaseTestSuite

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

the class JDBCHarnessJavaTest method suite.

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

Example 15 with BaseTestSuite

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

the class LDAPAuthenticationTest method baseSuite.

public static Test baseSuite(String name, String fixture) {
    BaseTestSuite suite = new BaseTestSuite(name);
    Test test = new LDAPAuthenticationTest(fixture);
    setBaseProps(suite, test);
    // a number of properties
    return TestConfiguration.singleUseDatabaseDecorator(suite);
}
Also used : Test(junit.framework.Test) 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