use of org.apache.derbyTesting.junit.CleanDatabaseTestSetup in project derby by apache.
the class TimeHandlingTest method suite.
/**
* Runs the tests in the default embedded configuration and then
* the client server configuration.
*/
public static Test suite() {
BaseTestSuite suite = new BaseTestSuite(TimeHandlingTest.class);
suite.addTest(TestConfiguration.clientServerSuite(TimeHandlingTest.class));
return new CleanDatabaseTestSetup(suite) {
protected void decorateSQL(Statement s) throws SQLException {
s.execute("CREATE FUNCTION SLEEP() RETURNS INTEGER" + " LANGUAGE JAVA PARAMETER STYLE JAVA" + " NO SQL " + " EXTERNAL NAME '" + TimeHandlingTest.class.getName().concat(".sleep'"));
s.execute("CREATE TABLE TIME_ALL (ID INT," + " C_T TIME," + " C_D DATE," + " C_TS TIMESTAMP)");
for (int f = 0; f < CURRENT_TIME_FUNCTIONS.length; f++) {
s.execute("ALTER TABLE TIME_ALL ADD COLUMN" + " D_T" + f + " TIME WITH DEFAULT " + CURRENT_TIME_FUNCTIONS[f]);
}
for (int f = 0; f < CURRENT_TIMESTAMP_FUNCTIONS.length; f++) {
s.execute("ALTER TABLE TIME_ALL ADD COLUMN" + " D_TS" + f + " TIMESTAMP WITH DEFAULT " + CURRENT_TIMESTAMP_FUNCTIONS[f]);
}
}
};
}
use of org.apache.derbyTesting.junit.CleanDatabaseTestSetup in project derby by apache.
the class LockTableVtiTest method suite.
/**
* Construct top level suite in this JUnit test
* The suite is wrapped in a DatabasePropertyTestSetup to set
* the lock wait timeout.
*
* @return A suite containing embedded fixtures
*/
public static Test suite() {
Properties properties = new Properties();
// setting to 60, which is the default, for starters
properties.setProperty("derby.locks.waitTimeout", "60");
Test suite = TestConfiguration.defaultSuite(LockTableVtiTest.class);
suite = new DatabasePropertyTestSetup(suite, properties, true);
return new CleanDatabaseTestSetup(suite);
}
use of org.apache.derbyTesting.junit.CleanDatabaseTestSetup in project derby by apache.
the class StreamingColumnTest method baseSuite.
protected static Test baseSuite(String name) {
BaseTestSuite suite = new BaseTestSuite(name);
suite.addTestSuite(StreamingColumnTest.class);
Test test = new SupportFilesSetup(suite, new String[] { "functionTests/tests/store/short.data", "functionTests/tests/store/shortbanner", "functionTests/tests/store/derby.banner", "functionTests/tests/store/empty.data", "functionTests/tests/store/char32703trailingblanks.data", "functionTests/tests/store/char32703.data", "functionTests/tests/store/char32675trailingblanks.data", "functionTests/tests/store/char32675.data" });
return new CleanDatabaseTestSetup(DatabasePropertyTestSetup.setLockTimeouts(test, 2, 4)) {
/**
* Creates the tables used in the test cases.
*
* @exception SQLException
* if a database error occurs
*/
protected void decorateSQL(Statement stmt) throws SQLException {
// testStream1
stmt.execute("create table testLongVarChar1 (a int, b long varchar)");
// insert a null long varchar
stmt.execute("insert into testLongVarChar1 values(1, '')");
// insert a long varchar with a short text string
stmt.execute("insert into testLongVarChar1 values(2, " + "'test data: a string column inserted as an object')");
// todo use setProperty method
stmt.execute("call SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.storage.pageSize', '1024')");
stmt.execute("create table foo1 (a int not null, b long varchar, primary key (a))");
stmt.execute("call SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.storage.pageSize', NULL)");
// testStream2_1500
stmt.execute("create table foo2_1500 (a int not null, " + "b long varchar, primary key (a))");
// testStream2_5000
stmt.execute("create table foo2_5000 (a int not null, " + "b long varchar, primary key (a))");
// testStream2_10000
stmt.execute("create table foo2_10000 (a int not null, " + "b long varchar, primary key (a))");
// testStream3_0
stmt.execute("create table foo3_0 (a int not null " + "constraint pk3_0 primary key, b long varchar)");
// testStream3_1500
stmt.execute("create table foo3_1500 (a int not null " + "constraint pk3_1500 primary key, b long varchar)");
// testStream3_5000
stmt.execute("create table foo3_5000 (a int not null " + "constraint pk3_5000 primary key, b long varchar)");
// testStream3_10000
stmt.execute("create table foo3_10000 (a int not null " + "constraint pk3_10000 primary key, b long varchar)");
// testStream4
stmt.execute("create table testLongVarBinary4 (a int, b BLOB(1G))");
// testStream5_0
long length = 0;
String binaryType = length > 32700 ? "BLOB(1G)" : "long varchar for bit data";
stmt.execute("create table foo5_0 (a int not null " + "constraint pk5_0 primary key, b " + binaryType + " )");
// testStream5_1500
length = 1500;
binaryType = length > 32700 ? "BLOB(1G)" : "long varchar for bit data";
stmt.execute("create table foo5_1500 (a int not null " + "constraint pk5_1500 primary key, b " + binaryType + " )");
// testStream5_5000
length = 5000;
binaryType = length > 32700 ? "BLOB(1G)" : "long varchar for bit data";
stmt.executeUpdate("create table foo5_5000 (a int not null " + "constraint pk5_5000 primary key, b " + binaryType + " )");
// testStream5_100000
length = 100000;
binaryType = length > 32700 ? "BLOB(1G)" : "long varchar for bit data";
stmt.executeUpdate("create table foo5_100000 (a int not null " + "constraint pk5_100000 primary key, b " + binaryType + " )");
// testStream6
stmt.executeUpdate("create table foo_6 (a int not null constraint" + " pk6 primary key, b long varchar)");
// testStream7
stmt.executeUpdate("call SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.storage.pageSize', '1024')");
stmt.execute("create table testlvc7 (a int, b char(100), lvc long varchar, d char(100))");
stmt.executeUpdate("call SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.storage.pageSize', NULL)");
// testStream8_10_2500
stmt.execute("create table t8_10_2500(a int, b long varchar, c long varchar)");
// testStream8_2500_10
stmt.execute("create table t8_2500_10(a int, b long varchar, c long varchar)");
// testStream9_10_2500
stmt.execute("create table t9_10_2500(a int, b long varchar for bit data, " + "c long varchar for bit data)");
// testStream9_2500_10
stmt.execute("create table t9_2500_10(a int, b long varchar for bit data, " + "c long varchar for bit data)");
// testStream10
stmt.execute("call SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.storage.pageSize', '1024')");
stmt.execute("create table tab10 (a int, b int, c long varchar)");
stmt.execute("call SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.storage.pageSize', NULL)");
// create the indexes which shares columns
stmt.execute("call SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.storage.pageSize', '4096')");
stmt.execute("create index i_a on tab10 (a)");
stmt.execute("create index i_ab on tab10 (a, b)");
stmt.execute("call SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.storage.pageSize', NULL)");
// insert a null long varchar
stmt.execute("insert into tab10 values(1, 1, '')");
// insert a long varchar with a short text string
stmt.execute("insert into tab10 values(2, 2, 'test data: a string column inserted as an object')");
// testStream11
stmt.execute("create table testLongVarCharInvalidStreamLength11 " + "(a int, b long varchar, c long varchar for bit data)");
// testStream12
stmt.executeUpdate("call SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.storage.pageSize', '4096')");
stmt.execute("create table testVarChar12 (a int, b varchar(32672))");
// create a table with 4 varchars. This table will be used to
// try
// overflow through concatenation
stmt.execute("create table testConcatenation12 (a varchar(16350), b varchar(16350), c varchar(16336), d varchar(16336))");
stmt.executeUpdate("call SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.storage.pageSize', NULL)");
// testStream13
stmt.execute("create table testLongVarChars13 (a int, b long varchar)");
// testStream14
stmt.executeUpdate("call SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.storage.pageSize', '4096')");
stmt.execute("create table testClob14 (a int, b clob(32672))");
// create a table with 4 varchars. This table will be used to
// try
// overflow through concatenation
stmt.execute("create table testConcatenation14 (a clob(16350), b clob(16350), c clob(16336), d clob(16336))");
stmt.executeUpdate("call SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.storage.pageSize', NULL)");
// testDerby500
stmt.execute("CREATE TABLE test500 (" + "id INTEGER NOT NULL," + "mname VARCHAR( 254 ) NOT NULL," + "mvalue INT NOT NULL," + "bytedata BLOB NOT NULL," + "chardata CLOB NOT NULL," + "PRIMARY KEY ( id ))");
// testDerby500_verifyVarcharStreams
stmt.execute("CREATE TABLE test500_verify (" + "id INTEGER NOT NULL," + "mname VARCHAR( 254 ) NOT NULL," + "mvalue INT NOT NULL," + "vc varchar(32500)," + "lvc long varchar NOT NULL," + "PRIMARY KEY ( id ))");
}
};
}
use of org.apache.derbyTesting.junit.CleanDatabaseTestSetup in project derby by apache.
the class SpaceTableTest method suite.
/**
* Construct top level suite in this JUnit test
* The suite is wrapped in a DatabasePropertyTestSetup to set
* the lock wait timeout.
*
* @return A suite containing embedded fixtures
*/
public static Test suite() {
Test suite = TestConfiguration.embeddedSuite(SpaceTableTest.class);
return new CleanDatabaseTestSetup(suite) {
/**
* Creates the schemas and table used in the test cases.
*
* @throws SQLException
*/
protected void decorateSQL(Statement s) throws SQLException {
Connection conn = getConnection();
conn.setAutoCommit(false);
String createWaitForPostCommit = "CREATE PROCEDURE WAIT_FOR_POST_COMMIT() " + "DYNAMIC RESULT SETS 0 " + "LANGUAGE JAVA EXTERNAL NAME " + "'org.apache.derbyTesting.functionTests.util.T_Access." + "waitForPostCommitToFinish' " + "PARAMETER STYLE JAVA";
s.executeUpdate(createWaitForPostCommit);
conn.commit();
conn.setAutoCommit(true);
}
};
}
use of org.apache.derbyTesting.junit.CleanDatabaseTestSetup in project derby by apache.
the class Test_6661 method suite.
// /////////////////////////////////////////////////////////////////////////////////
//
// JUnit BEHAVIOR
//
// /////////////////////////////////////////////////////////////////////////////////
public static Test suite() {
BaseTestSuite baseTest = new BaseTestSuite(Test_6661.class, "Test_6661");
Test singleUseWrapper = TestConfiguration.singleUseDatabaseDecorator(baseTest);
Test cleanDatabaseWrapper = new CleanDatabaseTestSetup(singleUseWrapper);
Test supportFileWrapper = new SupportFilesSetup(cleanDatabaseWrapper);
Test noSecurityWrapper = SecurityManagerSetup.noSecurityManager(supportFileWrapper);
return noSecurityWrapper;
}
Aggregations