Search in sources :

Example 11 with SecurityManagerSetup

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

the class derbyrunjartest method suite.

public static Test suite() {
    Class cl = derbyrunjartest.class;
    BaseTestSuite suite = new BaseTestSuite(cl);
    // the network server.
    if (Derby.hasServer()) {
        suite.addTest(new derbyrunjartest("xtestServer"));
    }
    return new SecurityManagerSetup(suite, cl.getName().replace('.', '/') + ".policy", true);
}
Also used : BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) SecurityManagerSetup(org.apache.derbyTesting.junit.SecurityManagerSetup)

Example 12 with SecurityManagerSetup

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

the class MissingPermissionsTest method makeTest.

private static Test makeTest(String fixture, String policy) {
    Test t = new MissingPermissionsTest(fixture);
    t = new SecurityManagerSetup(t, policy);
    final Properties props = new Properties();
    props.setProperty("derby.connection.requireAuthentication", "true");
    props.setProperty("derby.database.sqlAuthorization", "true");
    props.setProperty("derby.authentication.provider", "BUILTIN");
    props.setProperty("derby.user.APP", "APPPW");
    t = new SystemPropertyTestSetup(t, props, true);
    t = TestConfiguration.changeUserDecorator(t, "APP", "APPPW");
    t = TestConfiguration.singleUseDatabaseDecorator(t);
    return t;
}
Also used : Test(junit.framework.Test) SystemPropertyTestSetup(org.apache.derbyTesting.junit.SystemPropertyTestSetup) SecurityManagerSetup(org.apache.derbyTesting.junit.SecurityManagerSetup) Properties(java.util.Properties)

Example 13 with SecurityManagerSetup

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

the class AbortTest method baseSuite.

public static Test baseSuite(boolean hasSecurityManager) {
    AbortTest abortTest = new AbortTest("test_basic", hasSecurityManager);
    Test test = new CleanDatabaseTestSetup(abortTest) {

        protected void decorateSQL(Statement s) throws SQLException {
            s.execute("create table abort_table( a int )");
        }
    };
    if (hasSecurityManager) {
        return new SecurityManagerSetup(test, "org/apache/derbyTesting/functionTests/tests/jdbc4/noAbortPermission.policy");
    } else {
        return SecurityManagerSetup.noSecurityManager(test);
    }
}
Also used : Test(junit.framework.Test) CleanDatabaseTestSetup(org.apache.derbyTesting.junit.CleanDatabaseTestSetup) PreparedStatement(java.sql.PreparedStatement) Statement(java.sql.Statement) SecurityManagerSetup(org.apache.derbyTesting.junit.SecurityManagerSetup)

Example 14 with SecurityManagerSetup

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

the class NewOptimizerOverridesTest method suite.

// /////////////////////////////////////////////////////////////////////////////////
// 
// JUnit BEHAVIOR
// 
// /////////////////////////////////////////////////////////////////////////////////
/**
 * Construct top level suite in this JUnit test
 */
public static Test suite() {
    BaseTestSuite suite = new BaseTestSuite("NewOptimizerOverridesTest");
    suite.addTest(TestConfiguration.embeddedSuite(NewOptimizerOverridesTest.class));
    // use a policy file which allows the xml-based plan reader to access fields in the ResultSet graph
    return new SecurityManagerSetup(suite, "org/apache/derbyTesting/functionTests/tests/lang/resultSetReader.policy");
}
Also used : BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) SecurityManagerSetup(org.apache.derbyTesting.junit.SecurityManagerSetup)

Example 15 with SecurityManagerSetup

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

the class LDAPAuthenticationTest method suite.

public static Test suite() {
    if (JDBC.vmSupportsJSR169())
        return new BaseTestSuite("cannot run with JSR169 - missing functionality" + " for org.apache.derby.iapi.jdbc.AuthenticationService");
    ldapUser = getSystemProperty("derbyTesting.ldapUser");
    if (ldapUser == null || ldapUser.length() < 1)
        return new BaseTestSuite("LDAPAuthenticationTest requires property " + "derbyTesting.ldapUser set to a valid user set up on the " + "ldapServer, eg: -DderbyTesting.ldapUser=CharliesPwd. In addition," + "test requires a user 'kathy', pwd 'kathyS' to be set up");
    ldapPassword = getSystemProperty("derbyTesting.ldapPassword");
    if (ldapPassword == null || ldapPassword.length() < 1)
        return new BaseTestSuite("LDAPAuthenticationTest requires property " + "derbyTesting.ldapPassword set the password of a valid user set" + " up on the ldapServer, eg: -DderbyTesting.ldapPassword=Charlie");
    ldapServer = getSystemProperty("derbyTesting.ldapServer");
    if (ldapServer == null || ldapServer.length() < 1)
        return new BaseTestSuite("LDAPAuthenticationTest requires property " + "derbyTesting.ldapServer set, eg: " + "-DderbyTesting.ldapServer=myldapserver.myorg.org");
    ldapPort = getSystemProperty("derbyTesting.ldapPort");
    if (ldapPort == null || ldapPort.length() < 1)
        return new BaseTestSuite("LDAPAuthenticationTest requires property " + "derbyTesting.ldapPort set, eg: -DderbyTesting.ldapPort=333");
    dnString = getSystemProperty("derbyTesting.dnString");
    if (dnString == null || dnString.length() < 1)
        return new BaseTestSuite("LDAPAuthenticationTest requires property " + "derbyTesting.dnString for setting o=, eg: " + "-DderbyTesting.dnString=myJNDIstring");
    ldapContextFactory = getSystemProperty("derbyTesting.ldapContextFactory");
    BaseTestSuite suite = new BaseTestSuite("LDAPAuthenticationTest");
    suite.addTest(baseSuite("LDAPAuthenticationTest:embedded", "testLDAPConnection"));
    suite.addTest(TestConfiguration.clientServerDecorator(baseSuite("LDAPAuthenticationTest:client", "testLDAPConnection")));
    // resolve/connect for the LDAP server identified with the property.
    return new SecurityManagerSetup(suite, POLICY_FILE_NAME);
}
Also used : BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) SecurityManagerSetup(org.apache.derbyTesting.junit.SecurityManagerSetup)

Aggregations

SecurityManagerSetup (org.apache.derbyTesting.junit.SecurityManagerSetup)20 Test (junit.framework.Test)13 BaseTestSuite (org.apache.derbyTesting.junit.BaseTestSuite)13 SupportFilesSetup (org.apache.derbyTesting.junit.SupportFilesSetup)4 Properties (java.util.Properties)2 LocaleTestSetup (org.apache.derbyTesting.junit.LocaleTestSetup)2 SystemPropertyTestSetup (org.apache.derbyTesting.junit.SystemPropertyTestSetup)2 BufferedReader (java.io.BufferedReader)1 InputStreamReader (java.io.InputStreamReader)1 URL (java.net.URL)1 PreparedStatement (java.sql.PreparedStatement)1 Statement (java.sql.Statement)1 ArrayList (java.util.ArrayList)1 Locale (java.util.Locale)1 ClassLoaderTestSetup (org.apache.derbyTesting.junit.ClassLoaderTestSetup)1 CleanDatabaseTestSetup (org.apache.derbyTesting.junit.CleanDatabaseTestSetup)1 ServerSetup (org.apache.derbyTesting.junit.ServerSetup)1 TestConfiguration (org.apache.derbyTesting.junit.TestConfiguration)1