Search in sources :

Example 36 with SupportFilesSetup

use of org.apache.derbyTesting.junit.SupportFilesSetup in project derby by apache.

the class ImportExportTest method baseSuite.

public static Test baseSuite(String name) {
    BaseTestSuite suite = new BaseTestSuite(ImportExportTest.class, name);
    Test test = new SupportFilesSetup(suite, new String[] { "functionTests/testData/ImportExport/TwoLineBadEOF.dat" });
    return new CleanDatabaseTestSetup(test) {

        protected void decorateSQL(Statement s) throws SQLException {
            s.execute("create type Price external name 'org.apache.derbyTesting.functionTests.tests.lang.Price' language java");
            s.execute("create type hashmap external name 'java.util.HashMap' language java");
            s.execute("create function makePrice( ) returns price " + "language java parameter style java no sql " + "external name 'org.apache.derbyTesting.functionTests.tests.lang.Price.makePrice'");
            s.execute("create function makeHashMap( ) returns hashmap " + "language java parameter style java no sql " + "external name 'org.apache.derbyTesting.functionTests.tests.lang.UDTTest.makeHashMap'");
            s.execute("CREATE TABLE T1 (COLUMN1 VARCHAR(5) , COLUMN2 VARCHAR(8) , " + "COLUMN3 SMALLINT , COLUMN4 CHAR(11) , COLUMN5 DATE , COLUMN6 DECIMAL(5,1) , " + "COLUMN7 DOUBLE PRECISION , COLUMN8 INT , COLUMN9 BIGINT , COLUMN10 NUMERIC , " + "COLUMN11 REAL , COLUMN12 SMALLINT , COLUMN13 TIME , COLUMN14 TIMESTAMP , " + "COLUMN15 SMALLINT , COLUMN16 VARCHAR(1), COLUMN17 PRICE)");
            s.execute("CREATE TABLE T2 (COLUMN1 VARCHAR(5) , COLUMN2 VARCHAR(8) , " + "COLUMN3 SMALLINT, COLUMN4 CHAR(11) , COLUMN5 DATE , COLUMN6 DECIMAL(5,1) , " + "COLUMN7 DOUBLE PRECISION , COLUMN8 INT , COLUMN9 BIGINT , COLUMN10 NUMERIC , " + "COLUMN11 REAL , COLUMN12 SMALLINT , COLUMN13 TIME , COLUMN14 TIMESTAMP , " + "COLUMN15 SMALLINT , COLUMN16 VARCHAR(1), COLUMN17 PRICE)");
            s.execute("create table T4 (   Account int,    Name   char(30), Jobdesc char(40), " + "Company varchar(35), Address1 varchar(40), Address2 varchar(40), " + "City    varchar(20), State   char(5), Zip char(10), Country char(10), " + "Phone1  char(20), Phone2  char(20), email   char(30), web     char(30), " + "Fname   char(30), Lname   char(30), Comment char(30), AccDate char(30), " + "Payment decimal(8,2), Balance decimal(8,2))");
            s.execute("create table t5( a int, b price )");
            s.execute("create table t6( a int, b hashmap )");
        }
    };
}
Also used : Test(junit.framework.Test) CleanDatabaseTestSetup(org.apache.derbyTesting.junit.CleanDatabaseTestSetup) Statement(java.sql.Statement) PreparedStatement(java.sql.PreparedStatement) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) SupportFilesSetup(org.apache.derbyTesting.junit.SupportFilesSetup)

Example 37 with SupportFilesSetup

use of org.apache.derbyTesting.junit.SupportFilesSetup in project derby by apache.

the class EncryptionAESTest method suite.

/**
 * Clean up the connection maintained by this test.
 */
/*    protected void tearDown()
    throws java.lang.Exception {
        if (con != null && !con.isClosed()) {
            con.rollback();
            con.close();
            con = null;
        }
        super.tearDown();
    }
*/
public static Test suite() {
    BaseTestSuite suite = new BaseTestSuite("Encryption AES suite");
    // we're using SupportFilesSetup so the created databases will get
    // removed. Databases get created in subdirectory EXTINOUT.
    // However, this only happens after the test is finished, so we
    // can't run both embedded and networkserver for the database
    // wouldn't get created with networkserver.
    suite.addTest(TestConfiguration.embeddedSuite(EncryptionAESTest.class));
    return new SupportFilesSetup(suite);
}
Also used : BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) SupportFilesSetup(org.apache.derbyTesting.junit.SupportFilesSetup)

Example 38 with SupportFilesSetup

use of org.apache.derbyTesting.junit.SupportFilesSetup 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" });
}
Also used : Test(junit.framework.Test) CleanDatabaseTestSetup(org.apache.derbyTesting.junit.CleanDatabaseTestSetup) LocaleTestSetup(org.apache.derbyTesting.junit.LocaleTestSetup) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) SupportFilesSetup(org.apache.derbyTesting.junit.SupportFilesSetup)

Example 39 with SupportFilesSetup

use of org.apache.derbyTesting.junit.SupportFilesSetup 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)");
        }
    };
}
Also used : Test(junit.framework.Test) CleanDatabaseTestSetup(org.apache.derbyTesting.junit.CleanDatabaseTestSetup) PreparedStatement(java.sql.PreparedStatement) Statement(java.sql.Statement) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) SupportFilesSetup(org.apache.derbyTesting.junit.SupportFilesSetup)

Example 40 with SupportFilesSetup

use of org.apache.derbyTesting.junit.SupportFilesSetup in project derby by apache.

the class ResultSetStreamTest method basesuite.

public static Test basesuite(String name) {
    BaseTestSuite suite = new BaseTestSuite(ResultSetStreamTest.class, name);
    Test test = new SupportFilesSetup(suite, new String[] { "functionTests/testData/ResultSetStream/littleclob.utf", "functionTests/testData/ResultSetStream/short.utf", "functionTests/testData/ResultSetStream/resultsetStream.gif" });
    return new CleanDatabaseTestSetup(test) {

        protected void decorateSQL(Statement s) throws SQLException {
            s.execute("create table t2 (len int, data LONG VARCHAR FOR BIT DATA)");
            s.execute("create table t3(text_data clob)");
            s.execute("create table setMaxFieldSize(id int unique, " + "dVarchar VARCHAR(32672), dClob clob)");
        }
    };
}
Also used : Test(junit.framework.Test) CleanDatabaseTestSetup(org.apache.derbyTesting.junit.CleanDatabaseTestSetup) PreparedStatement(java.sql.PreparedStatement) Statement(java.sql.Statement) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) SupportFilesSetup(org.apache.derbyTesting.junit.SupportFilesSetup)

Aggregations

SupportFilesSetup (org.apache.derbyTesting.junit.SupportFilesSetup)58 BaseTestSuite (org.apache.derbyTesting.junit.BaseTestSuite)49 Test (junit.framework.Test)34 CleanDatabaseTestSetup (org.apache.derbyTesting.junit.CleanDatabaseTestSetup)19 Statement (java.sql.Statement)13 PreparedStatement (java.sql.PreparedStatement)11 Properties (java.util.Properties)9 SystemPropertyTestSetup (org.apache.derbyTesting.junit.SystemPropertyTestSetup)8 SecurityManagerSetup (org.apache.derbyTesting.junit.SecurityManagerSetup)4 CallableStatement (java.sql.CallableStatement)3 LocaleTestSetup (org.apache.derbyTesting.junit.LocaleTestSetup)3 NetworkServerTestSetup (org.apache.derbyTesting.junit.NetworkServerTestSetup)3 URL (java.net.URL)2 Locale (java.util.Locale)2 ClasspathSetup (org.apache.derbyTesting.junit.ClasspathSetup)2 BufferedReader (java.io.BufferedReader)1 File (java.io.File)1 InputStreamReader (java.io.InputStreamReader)1 Connection (java.sql.Connection)1 SQLException (java.sql.SQLException)1