use of org.apache.derbyTesting.junit.DatabasePropertyTestSetup in project derby by apache.
the class StressMultiTest method suite.
/**
* Set up the testsuite to run in embedded, client and encryption mode.
* Default run is 10 threads for 10 minutes in each mode
*/
public static Test suite() {
Properties dbprops = new Properties();
dbprops.put("derby.locks.deadlockTimeout", "2");
dbprops.put("derby.locks.waitTimeout", "3");
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);
// make this a singleUseDatabase so the datbase and
// transaction log will be preserved.
embedded = TestConfiguration.singleUseDatabaseDecorator(newCleanDatabase(embedded));
// SystemPropertyTestSetup for static properties
// does not work for client because shutting down the
// engine causes protocol errors on the client. Run
// with -Dderby.storage.keepTransactionLog=true if
// you need to save the transaction log for client.
Test client = TestConfiguration.clientServerDecorator(new BaseTestSuite(StressMultiTest.class));
client = newCleanDatabase(new DatabasePropertyTestSetup(client, dbprops));
Test encrypted = new BaseTestSuite(StressMultiTest.class);
// SystemPropertyTestSetup for static properties
// does not work for encrypted databases because the
// database has to be rebooted and we don't have access
// to the boot password (local to Decorator.encryptedDatabase()
// Run with -Dderby.storage.keepTransactionLog=true if you
// need to save the transaction log for encrypted.
BaseTestSuite unencrypted = new BaseTestSuite("StressMultiTest:unencrypted");
unencrypted.addTest((embedded));
unencrypted.addTest((client));
BaseTestSuite suite = new BaseTestSuite("StressMultiTest, " + THREADS + " Threads " + MINUTES + " Minutes");
suite.addTest(newCleanDatabase(unencrypted));
// Encrypted uses a different database so it needs its own newCleanDatabase
suite.addTest(Decorator.encryptedDatabase(new DatabasePropertyTestSetup(newCleanDatabase(encrypted), dbprops)));
return suite;
}
use of org.apache.derbyTesting.junit.DatabasePropertyTestSetup 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.DatabasePropertyTestSetup 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.DatabasePropertyTestSetup in project derby by apache.
the class SQLAuthorizationPropTest method suite.
public static Test suite() {
BaseTestSuite suite = new BaseTestSuite(SQLAuthorizationPropTest.class, "SQLAuthorizationPropTest");
// Use DatabasePropertyTestSetup decorator to set the property
// required by this test (and shutdown the database for the
// property to take effect.
Properties props = new Properties();
props.setProperty("derby.database.sqlAuthorization", "true");
Test test = new SQLAuthorizationPropTest("grantRevokeAfterSettingSQLAuthProperty");
suite.addTest(new DatabasePropertyTestSetup(test, props, true));
// This test has to be run after SQL authorization property has been
// set to true.
suite.addTest(new SQLAuthorizationPropTest("resetSQLAuthProperty"));
// which cannot be undone.
return TestConfiguration.singleUseDatabaseDecorator(suite);
}
use of org.apache.derbyTesting.junit.DatabasePropertyTestSetup in project derby by apache.
the class SubqueryTest method suite.
public static Test suite() {
Properties props = new Properties();
props.setProperty("derby.language.statementCacheSize", "0");
return new DatabasePropertyTestSetup(new SystemPropertyTestSetup(new CleanDatabaseTestSetup(new BaseTestSuite(SubqueryTest.class, "SubqueryTest")) {
/**
* @see org.apache.derbyTesting.junit.CleanDatabaseTestSetup#decorateSQL(java.sql.Statement)
*/
protected void decorateSQL(Statement s) throws SQLException {
s.execute("CREATE FUNCTION ConsistencyChecker() " + "RETURNS VARCHAR(128) " + "EXTERNAL NAME " + "'org.apache.derbyTesting.functionTests." + "util.T_ConsistencyChecker.runConsistencyChecker' " + "LANGUAGE JAVA PARAMETER STYLE JAVA");
s.execute("create table s " + "(i int, s smallint, c char(30), " + "vc char(30), b bigint)");
s.execute("create table t " + "(i int, s smallint, c char(30), " + "vc char(30), b bigint)");
s.execute("create table tt " + "(ii int, ss smallint, cc char(30), " + "vcvc char(30), b bigint)");
s.execute("create table ttt " + "(iii int, sss smallint, ccc char(30), " + "vcvcvc char(30))");
// populate the tables
s.execute("insert into s values " + "(null, null, null, null, null)");
s.execute("insert into s values (0, 0, '0', '0', 0)");
s.execute("insert into s values (1, 1, '1', '1', 1)");
s.execute("insert into t values " + "(null, null, null, null, null)");
s.execute("insert into t values (0, 0, '0', '0', 0)");
s.execute("insert into t values (1, 1, '1', '1', 1)");
s.execute("insert into t values (1, 1, '1', '1', 1)");
s.execute("insert into t values (2, 2, '2', '2', 1)");
s.execute("insert into tt values " + "(null, null, null, null, null)");
s.execute("insert into tt values (0, 0, '0', '0', 0)");
s.execute("insert into tt values (1, 1, '1', '1', 1)");
s.execute("insert into tt values (1, 1, '1', '1', 1)");
s.execute("insert into tt values (2, 2, '2', '2', 1)");
s.execute("insert into ttt values (null, null, null, null)");
s.execute("insert into ttt values (11, 11, '11', '11')");
s.execute("insert into ttt values (11, 11, '11', '11')");
s.execute("insert into ttt values (22, 22, '22', '22')");
}
}, props), props, true);
}
Aggregations