Search in sources :

Example 36 with BaseTestSuite

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

the class NativeAuthenticationServiceTest method allConfigurations.

/**
 * <p>
 * Create a suite of all test configurations.
 * </p>
 */
private static Test allConfigurations(boolean clientServer) throws Exception {
    BaseTestSuite suite = new BaseTestSuite();
    // 
    // No authentication.
    // 
    suite.addTest((new NativeAuthenticationServiceTest(NONE, NO_AUTH, SYSTEM_WIDE, DONT_DISABLE_AUTH)).decorate(clientServer));
    // 
    // NATIVE/LOCAL authentication with credentials in read/write dbs
    // 
    suite.addTest((new NativeAuthenticationServiceTest(FILE, NATIVE, LOCAL, DISABLE_AUTHORIZATION)).decorate(clientServer));
    suite.addTest((new NativeAuthenticationServiceTest(FILE, NATIVE, LOCAL, DONT_DISABLE_AUTH)).decorate(clientServer));
    // 
    // NATIVE system-wide authentication with credentials in read/write dbs
    // 
    suite.addTest((new NativeAuthenticationServiceTest(FILE, NATIVE, SYSTEM_WIDE, DISABLE_AUTHORIZATION)).decorate(clientServer));
    suite.addTest((new NativeAuthenticationServiceTest(FILE, NATIVE, SYSTEM_WIDE, DONT_DISABLE_AUTH)).decorate(clientServer));
    // 
    if (enableSubprotocolTests()) {
        // 
        // NATIVE authentication with credentials in read-only databases accessed via jar subprotocol
        // 
        suite.addTest((new NativeAuthenticationServiceTest(JAR, NATIVE, SYSTEM_WIDE, DONT_DISABLE_AUTH)).decorate(clientServer));
        suite.addTest((new NativeAuthenticationServiceTest(JAR, NATIVE, LOCAL, DONT_DISABLE_AUTH)).decorate(clientServer));
        // 
        // NATIVE authentication with credentials in read-only databases accessed via classpath subprotocol
        // 
        suite.addTest((new NativeAuthenticationServiceTest(CLASSPATH, NATIVE, SYSTEM_WIDE, DONT_DISABLE_AUTH)).decorate(clientServer));
        suite.addTest((new NativeAuthenticationServiceTest(CLASSPATH, NATIVE, LOCAL, DONT_DISABLE_AUTH)).decorate(clientServer));
    }
    return suite;
}
Also used : BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite)

Example 37 with BaseTestSuite

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

the class NativeAuthenticationServiceTest method suite.

// /////////////////////////////////////////////////////////////////////////////////
// 
// JUnit BEHAVIOR
// 
// /////////////////////////////////////////////////////////////////////////////////
/**
 * Construct top level suite in this JUnit test
 */
public static Test suite() throws Exception {
    BaseTestSuite suite = new BaseTestSuite();
    // 
    if (enableSubprotocolTests()) {
        suite.addTest((new NativeAuthenticationServiceTest(JAR_ENCRYPTED, NATIVE, LOCAL, DONT_DISABLE_AUTH)).decorate(false));
    }
    suite.addTest(allConfigurations(false));
    if (!JDBC.vmSupportsJSR169()) {
        suite.addTest(allConfigurations(true));
    }
    // should be OK to run in the local time zone.
    return new TimeZoneTestSetup(suite, "GMT");
}
Also used : BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) TimeZoneTestSetup(org.apache.derbyTesting.junit.TimeZoneTestSetup)

Example 38 with BaseTestSuite

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

the class NoDBInternalsPermissionTest method suite.

// /////////////////////////////////////////////////////////////////////////////////
// 
// JUnit BEHAVIOR
// 
// /////////////////////////////////////////////////////////////////////////////////
/**
 * Construct top level suite in this JUnit test
 */
public static Test suite() {
    BaseTestSuite suite = (BaseTestSuite) TestConfiguration.embeddedSuite(NoDBInternalsPermissionTest.class);
    Test secureTest = new SecurityManagerSetup(suite, POLICY_FILE);
    return secureTest;
}
Also used : Test(junit.framework.Test) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) SecurityManagerSetup(org.apache.derbyTesting.junit.SecurityManagerSetup)

Example 39 with BaseTestSuite

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

the class NullIfTest method baseSuite.

public static Test baseSuite(String name) {
    BaseTestSuite suite = new BaseTestSuite(name);
    suite.addTestSuite(NullIfTest.class);
    return new CleanDatabaseTestSetup(suite) {

        /**
         * Creates the table used in the test cases.
         */
        protected void decorateSQL(Statement s) throws SQLException {
            SQLUtilities.createAndPopulateAllDataTypesTable(s);
        }
    };
}
Also used : CleanDatabaseTestSetup(org.apache.derbyTesting.junit.CleanDatabaseTestSetup) PreparedStatement(java.sql.PreparedStatement) Statement(java.sql.Statement) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite)

Example 40 with BaseTestSuite

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

the class NullIfTest method suite.

/**
 * Runs the test fixtures in embedded and client.
 *
 * @return test suite
 */
public static Test suite() {
    BaseTestSuite suite = new BaseTestSuite("NullIfTest");
    suite.addTest(baseSuite("NullIfTest:embedded"));
    suite.addTest(TestConfiguration.clientServerDecorator(baseSuite("NullIfTest:client")));
    return suite;
}
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