use of org.apache.derbyTesting.junit.SystemPropertyTestSetup in project derby by apache.
the class StressMultiTest method embeddedSuite.
/**
* Get at testsuite that runs only the embedded suite with
* the given number of threads for the given number of minutes.
*
* @param threads
* @param minutes
*/
public static Test embeddedSuite(int threads, int minutes) {
THREADS = threads;
MINUTES = minutes;
Properties dbprops = new Properties();
dbprops.put("derby.locks.deadlockTimeout", "2");
dbprops.put("derby.locks.waitTimeout", "3");
dbprops.put("derby.language.logStatementText", "true");
dbprops.put("derby.storage.keepTransactionLog", "true");
Properties sysprops = new Properties();
sysprops.put("derby.storage.keepTransactionLog", "true");
sysprops.put("derby.language.logStatementText", "true");
sysprops.put("derby.infolog.append", "true");
Test embedded = new BaseTestSuite(StressMultiTest.class);
embedded = new SystemPropertyTestSetup(embedded, sysprops, true);
embedded = new DatabasePropertyTestSetup(embedded, dbprops);
embedded = TestConfiguration.singleUseDatabaseDecorator(newCleanDatabase(embedded));
return embedded;
}
use of org.apache.derbyTesting.junit.SystemPropertyTestSetup in project derby by apache.
the class NetIjTest method suite.
/**
* Return the suite that runs all the derbynet scripts.
*/
public static Test suite() {
BaseTestSuite suite = new BaseTestSuite("NetScripts");
// Set up the scripts run with the network client
BaseTestSuite clientTests = new BaseTestSuite("NetScripts:client");
clientTests.addTest(getSuite(CLIENT_TESTS));
int port = TestConfiguration.getCurrent().getPort();
Properties prop = new Properties();
prop.setProperty("ij.protocol", "jdbc:derby://localhost:" + port + "/");
Test client = new SystemPropertyTestSetup(TestConfiguration.clientServerDecoratorWithPort(clientTests, port), prop);
// add those client tests into the top-level suite.
suite.addTest(client);
return suite;
}
use of org.apache.derbyTesting.junit.SystemPropertyTestSetup in project derby by apache.
the class NetworkServerControlApiTest method decorateShutdownTest.
/**
* Decorate a test case that will attempt to shut down a network server
* using the supplied credentials. The network server will run with
* authentication enabled.
*
* @param testName name of the test case to decorate
* @param user the user that should attempt to shut down the server
* @param password the password to be used when shutting down the server
* @return the decorated test case
*/
private static Test decorateShutdownTest(String testName, String user, String password) {
Properties props = new Properties();
props.setProperty("derby.connection.requireAuthentication", "true");
props.setProperty("derby.authentication.provider", "BUILTIN");
props.setProperty("derby.user." + user, password);
Test test = new NetworkServerControlApiTest(testName);
test = TestConfiguration.clientServerDecorator(test);
test = new SystemPropertyTestSetup(test, props, true);
test = TestConfiguration.changeUserDecorator(test, user, password);
return test;
}
use of org.apache.derbyTesting.junit.SystemPropertyTestSetup in project derby by apache.
the class SysinfoTest method suite.
/**
* Creates a suite with two testcases, with and without some extra
* system properties.
*
* @return an empty suite if derbynet.jar is not available, and
* if the JVM only supports JSR169, otherwise, return a suite with
* 6 tests, 3 with properties set, 3 without.
*/
public static Test suite() {
BaseTestSuite suite = new BaseTestSuite("SysinfoTest");
// we need to be able to run the server
if (!Derby.hasServer())
return suite;
// don't run with JSR169 for this is a network server test
if (JDBC.vmSupportsJSR169())
return suite;
useProperties = false;
// the slashes adjusted.
if (!TestConfiguration.loadingFromJars()) {
Properties propstmp = new Properties();
propstmp.put("sysinfotest.classesdir", findClassDir());
suite.addTest(new SystemPropertyTestSetup(decorateTest(), propstmp));
} else
suite.addTest(decorateTest());
useProperties = true;
Properties sysprops = new Properties();
if (!TestConfiguration.loadingFromJars())
sysprops.put("sysinfotest.classesdir", findClassDir());
sysprops.put("derby.infolog.append", "true");
sysprops.put("derby.language.logStatementText", "true");
// #drda property ,test for it in sysinfo output
sysprops.put("derby.drda.securityMechanism", "USER_ONLY_SECURITY");
Test test = new SystemPropertyTestSetup(decorateTest(), sysprops);
Properties prop = new Properties();
prop.put("derby.locks.waitTimeout", "120");
test = new DatabasePropertyTestSetup(test, prop);
// suite.addTest(new SystemPropertyTestSetup(decorateTest(), props));
suite.addTest(test);
return suite;
}
use of org.apache.derbyTesting.junit.SystemPropertyTestSetup in project derby by apache.
the class RestrictiveFilePermissionsTest method suite.
public static Test suite() throws Exception {
File f = new File("system/testPermissions");
assertTrue(f.mkdirs());
supportsLaxTesting = checkAccessToOwner(f, false, UNKNOWN);
if (!supportsLaxTesting) {
println("warning: testing of lax file permissions in" + "RestrictiveFilePermissionsTest can not take place, " + "use a more liberal runtime default (umask) for the tests");
}
assertDirectoryDeleted(f);
// First collect the tests that check that, if we actually do restrict
// permissions, the files created by Derby actually *are*
// restricted. We test that with an embedded Derby with explicit
// setting of the property derby.storage.useDefaultFilePermissions.
// The extra setup file is for testJarFiles.
BaseTestSuite totalSuite = new BaseTestSuite("RestrictiveFilePermissionsTest");
Properties p = new Properties();
p.put("derby.storage.useDefaultFilePermissions", "false");
p.put("derby.stream.error.file", derbyDotLog);
totalSuite.addTest(new SystemPropertyTestSetup(TestConfiguration.singleUseDatabaseDecorator(new SupportFilesSetup(new BaseTestSuite(RestrictiveFilePermissionsTest.class, "haveWeGotAllCreatedFilesSuite"), new String[] { "functionTests/tests/lang/dcl_id.jar" }), dbName), p, true));
// permissions.
if (Derby.hasServer()) {
totalSuite.addTest(new NetworkServerTestSetup(new RestrictiveFilePermissionsTest("doTestCliServerIsRestrictive"), // system properties
new String[] {}, // non-default start up arguments
new String[] {}, true));
}
//
if (supportsLaxTesting) {
totalSuite.addTest(TestConfiguration.clientServerDecorator(new RestrictiveFilePermissionsTest("doTestNonCliServerIsLax")));
// For embedded, we should see lax permissions also.
//
p = new Properties();
p.put("derby.stream.error.file", derbyDotLog + ".lax");
totalSuite.addTest(new SystemPropertyTestSetup(new RestrictiveFilePermissionsTest("dotestEmbeddedIsLax"), p, true));
}
return totalSuite;
}
Aggregations