Search in sources :

Example 1 with LoginTimeoutTestSetup

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

the class DatabaseClassLoadingTest method loginTimeoutSuite.

/**
 * Create a test suite that verifies the fix for DERBY-6107. Connection
 * attempts used to fail when trying to access a classpath database that
 * lived in the context class loader, if a login timeout was used and a
 * previous connection attempt had been made from a thread that did not
 * have the database in its context class loader.
 */
private static Test loginTimeoutSuite() throws Exception {
    BaseTestSuite suite = new BaseTestSuite("Class loading with login timeout");
    // First run a test when the database is not in the classpath.
    // Expect the connection attempt to fail.
    suite.addTest(new DatabaseClassLoadingTest("testLoginTimeoutNotInClasspath"));
    // afterwards. (DERBY-2162)
    if (ClasspathSetup.supportsClose()) {
        suite.addTest(new ClasspathSetup(new DatabaseClassLoadingTest("testLoginTimeoutInClasspath"), SupportFilesSetup.getReadOnlyURL("dclt.jar")));
    }
    // Finally, check that the database cannot be found anymore after
    // it has been removed from the classpath.
    suite.addTest(new DatabaseClassLoadingTest("testLoginTimeoutNotInClasspath"));
    // time out.
    return new LoginTimeoutTestSetup(suite, 100);
}
Also used : BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) ClasspathSetup(org.apache.derbyTesting.junit.ClasspathSetup) LoginTimeoutTestSetup(org.apache.derbyTesting.junit.LoginTimeoutTestSetup)

Aggregations

BaseTestSuite (org.apache.derbyTesting.junit.BaseTestSuite)1 ClasspathSetup (org.apache.derbyTesting.junit.ClasspathSetup)1 LoginTimeoutTestSetup (org.apache.derbyTesting.junit.LoginTimeoutTestSetup)1