use of org.apache.derbyTesting.junit.SystemPropertyTestSetup in project derby by apache.
the class AccessTest method suite.
public static Test suite() {
Properties sysProps = new Properties();
sysProps.put("derby.optimizer.optimizeJoinOrder", "false");
sysProps.put("derby.optimizer.ruleBasedOptimization", "true");
sysProps.put("derby.optimizer.noTimeout", "true");
Test suite = TestConfiguration.embeddedSuite(AccessTest.class);
return new CleanDatabaseTestSetup(new SystemPropertyTestSetup(suite, sysProps, true)) {
/**
* Creates the table used in the test cases.
*/
protected void decorateSQL(Statement s) throws SQLException {
Connection conn = s.getConnection();
conn.setAutoCommit(false);
s.execute("CREATE FUNCTION PADSTRING (DATA VARCHAR(32000), " + "LENGTH INTEGER) RETURNS VARCHAR(32000) EXTERNAL NAME " + "'org.apache.derbyTesting.functionTests.util.Formatters" + ".padString' LANGUAGE JAVA PARAMETER STYLE JAVA");
}
};
}
use of org.apache.derbyTesting.junit.SystemPropertyTestSetup in project derby by apache.
the class BootAllTest method suite.
public static Test suite() {
BaseTestSuite suite = new BaseTestSuite("BootAllTest");
// Test uses driver manager so JDBC 2 required.
if (JDBC.vmSupportsJDBC3()) {
// Suite to create the third (inner) database and
// perform the actual test (will be run last)
BaseTestSuite db3 = new BaseTestSuite("db3");
db3.addTest(new BootAllTest("createShutdownDatabase"));
db3.addTest(new BootAllTest("shutdownDerby"));
Properties ba = new Properties();
ba.setProperty("derby.system.bootAll", "true");
db3.addTest(new SystemPropertyTestSetup(new BootAllTest("testSettingBootAllPropertyWithHomePropertySet"), ba));
// Suite to create the second database (middle) and
// embed in it the third database suite.
BaseTestSuite db2 = new BaseTestSuite("db2");
db2.addTest(new BootAllTest("createShutdownDatabase"));
db2.addTest(TestConfiguration.singleUseDatabaseDecorator(db3));
// Suite to create the first database (outer) and
// embed in it the second database suite.
BaseTestSuite db1 = new BaseTestSuite("db1");
db1.addTest(new BootAllTest("createShutdownDatabase"));
db1.addTest(TestConfiguration.singleUseDatabaseDecorator(db2));
// Add the default database in as well, this will ensure
// that databases at the root level get booted as well
// as those at sub-levels
suite.addTest(new BootAllTest("createShutdownDatabase"));
// add the first database into the actual suite.
suite.addTest(TestConfiguration.singleUseDatabaseDecorator(db1));
}
return suite;
}
use of org.apache.derbyTesting.junit.SystemPropertyTestSetup in project derby by apache.
the class ij2Test method suite.
public static Test suite() {
Properties props = new Properties();
props.setProperty("derby.infolog.append", "true");
props.setProperty("ij.protocol", "jdbc:derby:");
props.setProperty("ij.database", "wombat;create=true");
Test test = new SystemPropertyTestSetup(new ij2Test("ij2"), props);
test = new LocaleTestSetup(test, Locale.ENGLISH);
test = TestConfiguration.singleUseDatabaseDecorator(test, "wombat1");
test = new CleanDatabaseTestSetup(test);
BaseTestSuite suite = new BaseTestSuite("ij2Scripts");
suite.addTest(test);
if (JDBC.vmSupportsJDBC3()) {
props.setProperty("ij.protocol", "jdbc:derby:");
props.setProperty("ij.showNoConnectionsAtStart", "true");
Test testb = new SystemPropertyTestSetup(new ij2Test("ij2b"), props);
testb = new LocaleTestSetup(testb, Locale.ENGLISH);
testb = TestConfiguration.singleUseDatabaseDecorator(testb, "wombat1");
testb = new CleanDatabaseTestSetup(testb);
suite.addTest(testb);
}
return getIJConfig(suite);
}
use of org.apache.derbyTesting.junit.SystemPropertyTestSetup in project derby by apache.
the class ij5Test method suite.
public static Test suite() {
Properties props = new Properties();
// return an empty suite (i.e. don't run with JSR 169).
if (JDBC.vmSupportsJSR169()) {
return new BaseTestSuite("empty: cannot obtain expected output with JSR169");
}
props.setProperty("ij.showNoConnectionsAtStart", "false");
props.setProperty("ij.showNoCountForSelect", "false");
Test test = new SystemPropertyTestSetup(new ij5Test("ij5"), props);
test = new CleanDatabaseTestSetup(test);
return getIJConfig(test);
}
use of org.apache.derbyTesting.junit.SystemPropertyTestSetup in project derby by apache.
the class AdditionalDb method suite.
public static Test suite(final int[] version, boolean useCreateOnUpgrade) {
ClassLoader oldLoader = makeClassLoader(version);
// If no jars then just skip.
if (oldLoader == null) {
BaseTestSuite suite = new BaseTestSuite("Empty: Skipped upgrade Tests (no jars) for " + getTextVersion(version));
return suite;
}
BaseTestSuite suite = new BaseTestSuite("Upgrade Tests from " + getTextVersion(version));
BaseTestCase.traceit("Prepare to run upgrade tests from " + getTextVersion(version));
for (int phase = 0; phase < UpgradeChange.PHASES.length; phase++) {
ClassLoader loader = null;
switch(phase) {
case UpgradeChange.PH_CREATE:
case UpgradeChange.PH_POST_SOFT_UPGRADE:
case UpgradeChange.PH_POST_HARD_UPGRADE:
loader = oldLoader;
break;
case UpgradeChange.PH_SOFT_UPGRADE:
case UpgradeChange.PH_HARD_UPGRADE:
break;
}
Test phaseTests = baseSuite(getTextVersion(version) + " Upgrade Phase: " + UpgradeChange.PHASES[phase] + " ", phase, version);
Test phaseSet = new PhaseChanger(phaseTests, phase, loader, version, useCreateOnUpgrade);
phaseSet = handleJavaSE6(phase, version, phaseSet);
suite.addTest(phaseSet);
}
TestSetup setup = TestConfiguration.singleUseDatabaseDecorator(suite);
for (int i = 0; i < ADDITIONAL_DBS.length; i++) {
if (ADDITIONAL_DBS[i].shutDown) {
setup = TestConfiguration.additionalDatabaseDecorator(setup, ADDITIONAL_DBS[i].logicalName);
} else {
setup = TestConfiguration.additionalDatabaseDecoratorNoShutdown(setup, ADDITIONAL_DBS[i].logicalName);
}
}
Properties preReleaseUpgrade = new Properties();
preReleaseUpgrade.setProperty("derby.database.allowPreReleaseUpgrade", "true");
setup = new SystemPropertyTestSetup(setup, preReleaseUpgrade);
return SecurityManagerSetup.noSecurityManager(setup);
}
Aggregations