Search in sources :

Example 6 with BaseTestSuite

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

the class _Suite method suite.

public static Test suite() throws Exception {
    BaseTestSuite suite = new BaseTestSuite("client.am package-private");
    suite.addTest(LogicalStatementEntityTest.suite());
    return suite;
}
Also used : BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite)

Example 7 with BaseTestSuite

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

the class DatabaseMetaDataTest method connectionPoolingSuite.

/**
 * Returns a suite of tests to be run with connection pooling enabled.
 *
 * @param jdbcClient name of the client being used (for verbosity only)
 * @return A suite of tests.
 */
private static Test connectionPoolingSuite(String jdbcClient) {
    // Return an empty suite if running in JavaME environment.
    if (JDBC.vmSupportsJSR169()) {
        return new BaseTestSuite("Base connection pooling suite:DISABLED");
    }
    BaseTestSuite baseCpSuite = new BaseTestSuite("Base connection pooling suite");
    // Add the tests here.
    baseCpSuite.addTest(new DatabaseMetaDataTest("testConnectionSpecific"));
    // Setup the two configurations; CPDS and XADS.
    BaseTestSuite fullCpSuite = new BaseTestSuite("DatabaseMetaData with connection pooling:" + jdbcClient);
    BaseTestSuite cpSuite = new BaseTestSuite("ConnectionPoolDataSource");
    BaseTestSuite xaSuite = new BaseTestSuite("XADataSource");
    cpSuite.addTest(TestConfiguration.connectionCPDecorator(baseCpSuite));
    xaSuite.addTest(TestConfiguration.connectionXADecorator(baseCpSuite));
    fullCpSuite.addTest(cpSuite);
    fullCpSuite.addTest(xaSuite);
    return fullCpSuite;
}
Also used : BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite)

Example 8 with BaseTestSuite

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

the class DatabaseMetaDataTest method suite.

/**
 * Default suite for running this test.
 * @return the suite
 */
public static Test suite() {
    BaseTestSuite suite = new BaseTestSuite("DatabaseMetaDataTest");
    suite.addTest(TestConfiguration.defaultSuite(DatabaseMetaDataTest.class));
    // Add some tests to be run with connection pooling enabled.
    suite.addTest(connectionPoolingSuite("embedded"));
    suite.addTest(TestConfiguration.clientServerDecorator(connectionPoolingSuite("client")));
    // Test for DERBY-2584 needs a fresh database to ensure that the
    // meta-data queries haven't already been compiled. No need to run the
    // test in client/server mode since it only tests the compilation of
    // meta-data queries.
    suite.addTest(TestConfiguration.singleUseDatabaseDecorator(new DatabaseMetaDataTest("initialCompilationTest")));
    // The test for DERBY-4160 needs a fresh database to ensure that the
    // meta-data queries haven't already been compiled.
    suite.addTest(TestConfiguration.singleUseDatabaseDecorator(new DatabaseMetaDataTest("concurrentCompilationTest")));
    // Test for DERBY-3693 needs a fresh database to ensure that the size
    // of SYSTABLES is so small that creating a relatively small number of
    // tables will cause the query plan for getTables() to be invalidated.
    // Also, set a high lock timeout explicitly so that we can check that
    // an internal timeout followed by a retry didn't happen, and set
    // derby.language.stalePlanCheckInterval to a low value so that the
    // invalidation happens earlier.
    Properties props = new Properties();
    props.setProperty("derby.locks.waitTimeout", "90");
    props.setProperty("derby.language.stalePlanCheckInterval", "5");
    suite.addTest(TestConfiguration.singleUseDatabaseDecorator(new DatabasePropertyTestSetup(new DatabaseMetaDataTest("recompileTimeoutTest"), props, true)));
    return suite;
}
Also used : DatabasePropertyTestSetup(org.apache.derbyTesting.junit.DatabasePropertyTestSetup) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) Properties(java.util.Properties)

Example 9 with BaseTestSuite

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

the class DboPowersTest 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("DboPowersTest");
    /* Database shutdown powers */
    suite.addTest(dboShutdownSuite("suite: shutdown powers, embedded"));
    suite.addTest(TestConfiguration.clientServerDecorator(dboShutdownSuite("suite: shutdown powers, client")));
    // the specification for JSR169 support in DERBY-97.
    if (!JDBC.vmSupportsJSR169()) {
        suite.addTest(dboCryptoSuite("suite: cryptographic powers, embedded"));
        suite.addTest(TestConfiguration.clientServerDecorator(dboCryptoSuite("suite: cryptographic powers, client")));
    }
    /* Database hard upgrade powers */
    suite.addTest(dboHardUpgradeSuite("suite: hard upgrade powers, embedded"));
    suite.addTest(TestConfiguration.clientServerDecorator(dboHardUpgradeSuite("suite: hard upgrade powers, client")));
    return suite;
}
Also used : BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite)

Example 10 with BaseTestSuite

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

the class DboPowersTest method dboShutdownSuite.

/**
 * Construct suite of tests for shutdown database action
 *
 * @param framework Derby framework name
 * @return A suite containing the test case for shutdown
 * incarnated for the three security levels no authentication,
 * authentication, and authentication plus sqlAuthorization, The
 * latter two has an instance for dbo, and one for an ordinary user,
 * so there are in all five incarnations of tests.
 */
private static Test dboShutdownSuite(String framework) {
    // one per authLevel
    Test[] tests = new Test[SQLAUTHORIZATION + 1];
    /* Tests without any authorization active (level ==
         * NOAUTHENTICATION).
         */
    BaseTestSuite noauthSuite = new BaseTestSuite("suite: security level=" + secLevelNames[NOAUTHENTICATION]);
    noauthSuite.addTest(new DboPowersTest("testShutDown", NOAUTHENTICATION));
    tests[NOAUTHENTICATION] = noauthSuite;
    /* First decorate with users, then with authentication. Do this
         * twice, once for authentication only, and once for
         * authentication + sqlAuthorization (see extra decorator
         * added below).
         */
    for (int autLev = AUTHENTICATION; autLev <= SQLAUTHORIZATION; autLev++) {
        tests[autLev] = wrapShutdownUserTests(autLev);
    }
    BaseTestSuite suite = new BaseTestSuite("dboPowers:" + framework);
    /* run tests with no authentication enabled */
    suite.addTest(tests[NOAUTHENTICATION]);
    /* run test for all users with only authentication enabled */
    suite.addTest(tests[AUTHENTICATION]);
    /* run test for all users with authentication and
         * sqlAuthorization enabled
         */
    suite.addTest(TestConfiguration.sqlAuthorizationDecorator(tests[SQLAUTHORIZATION]));
    return 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