use of org.apache.derbyTesting.junit.SecurityManagerSetup in project derby by apache.
the class SecurityPolicyReloadingTest method decorateTest.
// /////////////////////////////////////////////////////////////////////////////////
//
// TEST DECORATION
//
// /////////////////////////////////////////////////////////////////////////////////
/**
* Add decorators to a test run. Context is established in the reverse order
* that decorators are declared here. That is, decorators compose in reverse
* order. The order of the setup methods is:
*
* <ul>
* <li>Copy security policy to visible location.</li>
* <li>Setup authorization-enabling properties.</li>
* <li>Install a security manager.</li>
* <li>Run the tests.</li>
* </ul>
*/
private static Test decorateTest() {
Test test = new SecurityPolicyReloadingTest();
//
// Install a security manager using the initial policy file.
//
test = new SecurityManagerSetup(test, makeServerPolicyName());
//
// Set up authorization with a DBO and non-DBO user
//
test = TestConfiguration.sqlAuthorizationDecorator(test, new String[] { NON_DBO_USER }, PASSWORD_TOKEN);
//
// Copy over the initial policy file we want to use.
//
test = new SupportFilesSetup(test, null, new String[] { getSourcePolicy() }, null, new String[] { makeTargetPolicyStub() });
// No need to run with default testing policy file because we install our
// own initial policy file.
test = SecurityManagerSetup.noSecurityManager(test);
return test;
}
use of org.apache.derbyTesting.junit.SecurityManagerSetup in project derby by apache.
the class AssertFailureTest method suite.
public static Test suite() {
BaseTestSuite suite = new BaseTestSuite("AssertFailureTest");
try {
// Only add the tests if this is a sane build.
Class.forName("org.apache.derby.shared.common.sanity." + "AssertFailure");
// Run with thread dump permissions
suite.addTest(new SecurityManagerSetup(new AssertFailureTest("testAssertFailureThreadDump"), POLICY_FILENAME));
// Run WITHOUT thread dump permissions
suite.addTest(new SecurityManagerSetup(new AssertFailureTest("testAssertFailureNoThreadDump"), NO_DUMP_POLICY_FILENAME));
} catch (ClassNotFoundException e) {
// Ignore. Just return an empty suite.
}
return suite;
}
use of org.apache.derbyTesting.junit.SecurityManagerSetup in project derby by apache.
the class RuntimeInfoTest method decorateTest.
/**
* Decorate a test with SecurityManagerSetup, clientServersuite, and
* SupportFilesSetup.
*
* @return the decorated test
*/
private static Test decorateTest(Locale serverLocale, String testName) {
Test test = new RuntimeInfoTest(testName);
test = TestConfiguration.clientServerDecorator(test);
/* A single use database must be used to ensure the consistent output.
* The output would change whether the test was being ran for the first
* or subsequent times. */
test = TestConfiguration.singleUseDatabaseDecorator(test);
test = new LocaleTestSetup(test, serverLocale);
// Install a security manager using the initial policy file.
return new SecurityManagerSetup(test, POLICY_FILE_NAME);
}
use of org.apache.derbyTesting.junit.SecurityManagerSetup in project derby by apache.
the class SecureServerTest method makeDerby6619Test.
private static Test makeDerby6619Test() {
Test t = new SecureServerTest("test6619");
t = TestConfiguration.clientServerDecorator(t);
t = new SecurityManagerSetup(t, POLICY6619);
t = new ClassLoaderTestSetup(t);
return t;
}
use of org.apache.derbyTesting.junit.SecurityManagerSetup in project derby by apache.
the class _Suite method suite.
/**
* Returns the default set of compatibility tests, intended to be run
* as part of suites.All.
*
* @return A default suite of compatibility tests.
*/
public static Test suite() {
// run off of UNC paths (network drives).
if (suffersFromDerby5889()) {
String msg = ("tests.compatibility disabled on Windows " + "with UNC paths, see DERBY-5889");
println(msg);
return new BaseTestSuite(msg);
}
// from VersionCombinationConfigurator.getJarDirectoryOf
if (!TestConfiguration.loadingFromJars())
return new BaseTestSuite("Compatibility tests skipped becasue " + "they need to run from jars");
if (!Derby.hasClient() || !Derby.hasServer()) {
return new BaseTestSuite("Compatibility tests skipped because " + "client or server is missing");
}
BaseTestSuite suite = new BaseTestSuite();
addVersionCombinations(suite);
TestConfiguration config = TestConfiguration.getCurrent();
return new SecurityManagerSetup(new ServerSetup(suite, "localhost", config.getPort()), // to put on the classpath for the spawned process(es).
VersionCombinationConfigurator.class.getName().replaceAll("\\.", "/") + ".policy", true);
}
Aggregations