use of org.apache.derbyTesting.junit.CleanDatabaseTestSetup in project derby by apache.
the class IJRunScriptTest method suite.
public static Test suite() {
if (Derby.hasTools()) {
BaseTestSuite suite = new BaseTestSuite("IJRunScriptTest");
suite.addTestSuite(IJRunScriptTest.class);
return new CleanDatabaseTestSetup(suite);
}
return new BaseTestSuite("empty: no tools support");
}
use of org.apache.derbyTesting.junit.CleanDatabaseTestSetup in project derby by apache.
the class IjConnNameTest method suite.
public static Test suite() {
BaseTestSuite suite = new BaseTestSuite("IjConnNameTest");
// Test does not run on J2ME
if (JDBC.vmSupportsJSR169())
return suite;
Properties props = new Properties();
props.setProperty("ij.connection.connOne", "jdbc:derby:wombat;create=true");
props.setProperty("ij.connection.connFour", "jdbc:derby:nevercreated");
props.setProperty("ij.showNoConnectionsAtStart", "true");
props.setProperty("ij.showNoCountForSelect", "true");
Test test = new SystemPropertyTestSetup(new IjConnNameTest(test_script), props);
// test = SecurityManagerSetup.noSecurityManager(test);
test = new CleanDatabaseTestSetup(test);
return getIJConfig(test);
}
use of org.apache.derbyTesting.junit.CleanDatabaseTestSetup in project derby by apache.
the class ImportExportIJTest method suite.
/**
* Return the suite that runs the script.
*/
public static Test suite() {
BaseTestSuite suite = new BaseTestSuite("importExportIJ");
// only run with embedded
// network server makes slightly different output
// ('statement executed' instead of '# rows inserted/deteled', etc.)
// and this test would never work if the server were on
// a remote system because the export file would be on the
// server side, and import would be looking on the client.
// Also, running client & embedded would require some cleanup magic to
// remove the exported files (see e.g. ImportExportTest).
Test test = new ImportExportIJTest("importExportIJ");
// This test should run in English locale since it compares error
// messages against a canon based on the English message text. Also,
// run the test in a fresh database, since the language of the message
// text is determined when the database is created.
test = new LocaleTestSetup(test, Locale.ENGLISH);
test = TestConfiguration.singleUseDatabaseDecorator(test);
suite.addTest(new CleanDatabaseTestSetup(test));
return new SupportFilesSetup(suite, new String[] { "functionTests/testData/ImportExport/TwoLineBadEOF.dat", "functionTests/testData/ImportExport/NoEOR.dat", "functionTests/testData/ImportExport/Access1.txt", "functionTests/testData/ImportExport/AccountData_defaultformat.dat", "functionTests/testData/ImportExport/AccountData_format1.dat", "functionTests/testData/ImportExport/AccountData_format2.dat", "functionTests/testData/ImportExport/AccountData_format2oops.dat", "functionTests/testData/ImportExport/AccountData_NullFields.dat", "functionTests/testData/ImportExport/UnsupportedFormat1.dat", "functionTests/testData/ImportExport/UnsupportedFormat2.dat", "functionTests/testData/ImportExport/derby-2193.txt", "functionTests/testData/ImportExport/derby-2193-linenumber.txt" });
}
use of org.apache.derbyTesting.junit.CleanDatabaseTestSetup in project derby by apache.
the class ImportExportLobTest method suite.
/**
* Runs the tests in the default embedded configuration and then
* the client server configuration.
*/
public static Test suite() {
BaseTestSuite suite = new BaseTestSuite(ImportExportLobTest.class);
suite.addTest(TestConfiguration.clientServerSuite(ImportExportLobTest.class));
Test test = suite;
test = new SupportFilesSetup(test);
return new CleanDatabaseTestSetup(test) {
protected void decorateSQL(Statement s) throws SQLException {
// table used to test export.
s.execute("CREATE TABLE BOOKS(id int," + "name varchar(30)," + "content clob, " + "pic blob )");
// load some data into the above table.
loadData(s);
// table used to test import.
s.execute("CREATE TABLE BOOKS_IMP(id int," + "name varchar(30)," + "content clob," + "pic blob )");
// table that holds some invalid hex strings.
s.execute("CREATE TABLE hex_tab(id int," + "C1 varchar(20)," + "C2 varchar(20)," + "C3 varchar(20))");
s.execute("CREATE TABLE derby_2925_lob(id int," + "name varchar(30), content clob," + "pic blob)");
}
};
}
use of org.apache.derbyTesting.junit.CleanDatabaseTestSetup in project derby by apache.
the class LargeDataLocksTest method baseSuite.
public static Test baseSuite(String name) {
BaseTestSuite suite = new BaseTestSuite(name);
suite.addTestSuite(LargeDataLocksTest.class);
return new CleanDatabaseTestSetup(suite) {
/**
* Create and populate table
* @see org.apache.derbyTesting.junit.CleanDatabaseTestSetup#decorateSQL(java.sql.Statement)
*/
protected void decorateSQL(Statement s) throws SQLException {
Connection conn = getConnection();
conn.setAutoCommit(false);
PreparedStatement ps = null;
String sql;
sql = "CREATE TABLE t1 (bc CLOB(1M), bincol BLOB(1M), datalen int)";
s.executeUpdate(sql);
// Insert big and little values
sql = "INSERT into t1 values(?,?,?)";
ps = conn.prepareStatement(sql);
ps.setCharacterStream(1, new java.io.StringReader(Utilities.repeatChar("a", 38000)), 38000);
try {
ps.setBytes(2, Utilities.repeatChar("a", 38000).getBytes("US-ASCII"));
} catch (UnsupportedEncodingException ue) {
// Shouldn't happen US-ASCII should always be supported
BaseTestCase.fail(ue.getMessage(), ue);
}
ps.setInt(3, 38000);
ps.executeUpdate();
ps.close();
// Create a procedure for use by assertLockCount() to ensure
// that the background worker thread has completed all the
// post-commit work.
s.execute("CREATE PROCEDURE WAIT_FOR_POST_COMMIT() " + "LANGUAGE JAVA EXTERNAL NAME " + "'org.apache.derbyTesting.functionTests.util." + "T_Access.waitForPostCommitToFinish' " + "PARAMETER STYLE JAVA");
conn.commit();
}
};
}
Aggregations