Search in sources :

Example 31 with SupportFilesSetup

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

the class Changes10_5 method suite.

/**
 * Return the suite of tests to test the changes made in 10.5.
 * @param phase an integer that indicates the current phase in
 *              the upgrade test.
 * @return the test suite created.
 */
public static Test suite(int phase) {
    BaseTestSuite suite = new BaseTestSuite("Upgrade test for 10.5");
    suite.addTestSuite(Changes10_5.class);
    return new SupportFilesSetup((Test) suite);
}
Also used : BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) SupportFilesSetup(org.apache.derbyTesting.junit.SupportFilesSetup)

Example 32 with SupportFilesSetup

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

the class MissingPermissionsTest method suite.

public static Test suite() {
    inSubProcess = Boolean.getBoolean("inSubProcess");
    final BaseTestSuite suite = new BaseTestSuite("SystemPrivilegesPermissionTest");
    if (!inSubProcess && !TestConfiguration.loadingFromJars()) {
        // level
        return suite;
    }
    if (!inSubProcess) {
        suite.addTest(new SupportFilesSetup(makeTest("testMissingFilePermission", POLICY_MINUS_FILEPERMISSION_T), new String[] { POLICY_MINUS_FILEPERMISSION_R }));
        suite.addTest(makeTest("testPresentPropertiesPermission", OK_POLICY_T));
        suite.addTest(makeTest("testMissingPropertiesPermission", POLICY_MINUS_PROPERTYPERMISSION_T));
    }
    // This test runs in both the top process and a subprocess since it has
    // two parts:
    suite.addTest(new SupportFilesSetup(makeTest("testModifyThreadGroup", OK_POLICY_T), new String[] { OK_POLICY_R }));
    return suite;
}
Also used : BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) SupportFilesSetup(org.apache.derbyTesting.junit.SupportFilesSetup)

Example 33 with SupportFilesSetup

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

the class ConnectionMethodsTest method baseSuite.

public static Test baseSuite(String name) {
    BaseTestSuite suite = new BaseTestSuite(ConnectionMethodsTest.class, name);
    Test test = new SupportFilesSetup(suite, new String[] { "functionTests/testData/ConnectionMethods/short.txt" });
    return new CleanDatabaseTestSetup(test) {

        protected void decorateSQL(Statement s) throws SQLException {
            s.execute("create table clobtable2(n int,clobcol CLOB)");
            s.execute("create table blobtable2(n int,blobcol BLOB)");
            s.execute("create table abort_table(a int)");
            s.execute("create schema foo");
            s.execute("create table foo.set_schema_table( a int )");
        }
    };
}
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) SupportFilesSetup(org.apache.derbyTesting.junit.SupportFilesSetup)

Example 34 with SupportFilesSetup

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

the class UrlLocaleTest method suite.

public static Test suite() {
    BaseTestSuite suite = new BaseTestSuite();
    suite.addTestSuite(UrlLocaleTest.class);
    suite.addTest(new LocaleTestSetup(new UrlLocaleTest("messageLocale_unknown"), new Locale("rr", "TT")));
    suite.addTest(new LocaleTestSetup(new UrlLocaleTest("messageLocale_Germany"), Locale.GERMANY));
    Test tsuite = new CleanDatabaseTestSetup(suite) {

        /**
         * Creates the table used in the test cases.
         */
        protected void decorateSQL(Statement s) throws SQLException {
            createLocaleProcedures(s.getConnection());
        }
    };
    tsuite = new SupportFilesSetup(tsuite);
    return tsuite;
}
Also used : Locale(java.util.Locale) Test(junit.framework.Test) CleanDatabaseTestSetup(org.apache.derbyTesting.junit.CleanDatabaseTestSetup) Statement(java.sql.Statement) LocaleTestSetup(org.apache.derbyTesting.junit.LocaleTestSetup) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) SupportFilesSetup(org.apache.derbyTesting.junit.SupportFilesSetup)

Example 35 with SupportFilesSetup

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

the class NativeAuthenticationServiceTest method decorate.

/**
 * <p>
 * Wrap base test with standard decorators in order to setup system
 * properties and allow for the creation of multiple databases with
 * stored properties that can't be removed at tearDown time.
 * </p>
 */
private Test decorate(boolean clientServer) throws Exception {
    String credentialsDBPhysicalName = TestConfiguration.generateUniqueDatabaseName();
    Test result = this;
    // 
    if (clientServer) {
        result = TestConfiguration.clientServerDecorator(result);
    }
    // 
    // Turn on the property which enables NATIVE authentication. This will trigger
    // an engine shutdown at the end of the test. We want to shutdown the engine
    // before deleting the physical databases. This is because we need one of the
    // databases (the credentials db) in order to authenticate engine shutdown.
    // 
    Properties systemProperties = null;
    try {
        systemProperties = systemProperties(credentialsDBPhysicalName);
    } catch (Exception e) {
        printStackTrace(e);
    }
    println(nameOfTest());
    println("    NativeAuthenticationServiceTest.decorate() systemProperties = " + systemProperties);
    result = new SystemPropertyTestSetup(result, systemProperties, true);
    // 
    if (enableSubprotocolTests()) {
        // Add a jar file to the classpath so that we can test the classpath subprotocol.
        URL nast2Jar = SupportFilesSetup.getReadOnlyURL(NAST2_JAR_FILE);
        result = new ClasspathSetup(result, nast2Jar);
        // Add the jar files needed for testing jar and classpath subprotocols.
        result = new SupportFilesSetup(result, SUPPORT_FILES_SOURCE, null, SUPPORT_FILES_TARGET, null);
    }
    // 
    // Register temporary databases, where the test will do its work.
    // We can't use the default, re-usable database because NATIVE authentication stores
    // persistent properties which cannot be turned off.
    // 
    result = TestConfiguration.additionalDatabaseDecoratorNoShutdown(result, CREDENTIALS_DB, credentialsDBPhysicalName);
    result = TestConfiguration.additionalDatabaseDecoratorNoShutdown(result, SECOND_DB);
    result = TestConfiguration.additionalDatabaseDecoratorNoShutdown(result, THIRD_DB);
    result = _fourthDBSetup = TestConfiguration.additionalDatabaseDecoratorNoShutdown(result, FOURTH_DB, true);
    result = _fifthDBSetup = TestConfiguration.additionalDatabaseDecoratorNoShutdown(result, FIFTH_DB, true);
    result = _sixthDBSetup = TestConfiguration.additionalDatabaseDecoratorNoShutdown(result, SIXTH_DB, true);
    result = _seventhDBSetup = TestConfiguration.additionalDatabaseDecoratorNoShutdown(result, SEVENTH_DB, true);
    result = _eighthDBSetup = TestConfiguration.additionalDatabaseDecoratorNoShutdown(result, EIGHTH_DB, true);
    result = _ninthDBSetup = TestConfiguration.additionalDatabaseDecoratorNoShutdown(result, NINTH_DB, true);
    result = TestConfiguration.additionalDatabaseDecoratorNoShutdown(result, TENTH_DB);
    result = TestConfiguration.additionalDatabaseDecoratorNoShutdown(result, ELEVENTH_DB);
    result = TestConfiguration.additionalDatabaseDecoratorNoShutdown(result, TWELTH_DB);
    result = TestConfiguration.additionalDatabaseDecoratorNoShutdown(result, THIRTEENTH_DB);
    result = TestConfiguration.additionalDatabaseDecoratorNoShutdown(result, FOURTEENTH_DB);
    result = _fifteenthDBSetup = TestConfiguration.additionalDatabaseDecoratorNoShutdown(result, FIFTEENTH_DB, true);
    result = TestConfiguration.changeUserDecorator(result, DBO, getPassword(DBO));
    return result;
}
Also used : Test(junit.framework.Test) SystemPropertyTestSetup(org.apache.derbyTesting.junit.SystemPropertyTestSetup) ClasspathSetup(org.apache.derbyTesting.junit.ClasspathSetup) Properties(java.util.Properties) SupportFilesSetup(org.apache.derbyTesting.junit.SupportFilesSetup) SQLException(java.sql.SQLException) URL(java.net.URL)

Aggregations

SupportFilesSetup (org.apache.derbyTesting.junit.SupportFilesSetup)58 BaseTestSuite (org.apache.derbyTesting.junit.BaseTestSuite)49 Test (junit.framework.Test)34 CleanDatabaseTestSetup (org.apache.derbyTesting.junit.CleanDatabaseTestSetup)19 Statement (java.sql.Statement)13 PreparedStatement (java.sql.PreparedStatement)11 Properties (java.util.Properties)9 SystemPropertyTestSetup (org.apache.derbyTesting.junit.SystemPropertyTestSetup)8 SecurityManagerSetup (org.apache.derbyTesting.junit.SecurityManagerSetup)4 CallableStatement (java.sql.CallableStatement)3 LocaleTestSetup (org.apache.derbyTesting.junit.LocaleTestSetup)3 NetworkServerTestSetup (org.apache.derbyTesting.junit.NetworkServerTestSetup)3 URL (java.net.URL)2 Locale (java.util.Locale)2 ClasspathSetup (org.apache.derbyTesting.junit.ClasspathSetup)2 BufferedReader (java.io.BufferedReader)1 File (java.io.File)1 InputStreamReader (java.io.InputStreamReader)1 Connection (java.sql.Connection)1 SQLException (java.sql.SQLException)1