Search in sources :

Example 11 with SupportFilesSetup

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

the class ImportExportProcedureESTest method suite.

/**
 * Run tests from iepnegative.sql with es_MX locale.
 * These  have already been converted in tools/ImportExportProcedureTest
 * So we will just run that whole test in es_MX
 */
public static Test suite() {
    Test test = TestConfiguration.embeddedSuite(ImportExportProcedureTest.class);
    Properties attributes = new Properties();
    attributes.put("territory", "es_MX");
    test = Decorator.attributesDatabase(attributes, test);
    return new SupportFilesSetup(test, new String[] { "functionTests/testData/ImportExport/db2ttypes.del", "functionTests/testData/ImportExport/mixednl.del", "functionTests/testData/ImportExport/position_info.del" });
}
Also used : Test(junit.framework.Test) ImportExportProcedureTest(org.apache.derbyTesting.functionTests.tests.tools.ImportExportProcedureTest) Properties(java.util.Properties) SupportFilesSetup(org.apache.derbyTesting.junit.SupportFilesSetup)

Example 12 with SupportFilesSetup

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

the class CollationTest2 method suite.

public static Test suite() {
    // only test in embedded mode, all tests are server side actions.
    BaseTestSuite suite = new BaseTestSuite("CollationTest2");
    suite.addTest(new CollationTest2("testDefaultCollation"));
    suite.addTest(collatedTest("en", "testEnglishCollation"));
    suite.addTest(caseInsensitiveCollationSuite());
    // Only add tests for other locales if they are in fact supported
    // by the jvm.
    Locale[] availableLocales = Collator.getAvailableLocales();
    boolean norwegian = false;
    boolean polish = false;
    for (int i = 0; i < availableLocales.length; i++) {
        if ("no".equals(availableLocales[i].getLanguage())) {
            norwegian = true;
        }
        if ("pl".equals(availableLocales[i].getLanguage())) {
            polish = true;
        }
    }
    if (norwegian) {
        suite.addTest(collatedTest("no_NO", "testNorwayCollation"));
    }
    if (polish) {
        suite.addTest(collatedTest("pl", "testPolishCollation"));
    }
    suite.addTest(collatedTest(null, "testDefaultJVMTerritoryCollation"));
    // add support to use external files for import/export calls.
    Test test = new SupportFilesSetup(suite);
    // turn on log statement text for sequence of statements in derby.log.
    if (verbose_debug) {
        Properties props = new Properties();
        props.setProperty("derby.language.logStatementText", "true");
        test = new SystemPropertyTestSetup(test, props);
    }
    return test;
}
Also used : Locale(java.util.Locale) Test(junit.framework.Test) SystemPropertyTestSetup(org.apache.derbyTesting.junit.SystemPropertyTestSetup) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) SupportFilesSetup(org.apache.derbyTesting.junit.SupportFilesSetup) Properties(java.util.Properties)

Example 13 with SupportFilesSetup

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

the class SysDiagVTIMappingTest method suite.

public static Test suite() {
    BaseTestSuite suite = new BaseTestSuite("Diagnostic VTI Table Mappings");
    Test defaultSetup = TestConfiguration.defaultSuite(SysDiagVTIMappingTest.class);
    // turn on statement logging so there will be something in the error log
    // to run these vtis against
    Properties sysprops = new Properties();
    sysprops.put("derby.language.logStatementText", "true");
    Test verboseTest = new SystemPropertyTestSetup(defaultSetup, sysprops);
    suite.addTest(verboseTest);
    /* Some of the VTIs that are tested in this class require a derby.log
         * file.  We have a test log file stored in the tests/lang directory,
         * and since the VTIs are going to try to read it, the test log file
         * must be in a directory for which Derby has read access.  By
         * using a SupportFilesSetup wrapper, we copy the test log file to
         * the "extin" directory, which has the required permissions.
         */
    return SecurityManagerSetup.noSecurityManager(new SupportFilesSetup(suite, new String[] { "functionTests/tests/lang/" + testLogFile }));
}
Also used : Test(junit.framework.Test) SystemPropertyTestSetup(org.apache.derbyTesting.junit.SystemPropertyTestSetup) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) Properties(java.util.Properties) SupportFilesSetup(org.apache.derbyTesting.junit.SupportFilesSetup)

Example 14 with SupportFilesSetup

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

the class RawDBReaderTest method suite.

// /////////////////////////////////////////////////////////////////////////////////
// 
// JUnit BEHAVIOR
// 
// /////////////////////////////////////////////////////////////////////////////////
/**
 * Construct top level suite in this JUnit test
 */
public static Test suite() {
    Test baseTest = TestConfiguration.embeddedSuite(RawDBReaderTest.class);
    // We don't expect that users of this tool will run with a security
    // manager. The tool is run standalone behind a firewall.
    Test wideOpenTest = SecurityManagerSetup.noSecurityManager(baseTest);
    // don't teardown the corrupt database. instead, just delete it in our
    // own tearDown() method. this is to prevent the corrupt database from
    // interfering with later tests which want to use a database with sql
    // authorization turned on.
    Test authenticatedTest = DatabasePropertyTestSetup.builtinAuthenticationNoTeardown(wideOpenTest, LEGAL_USERS, "RRT");
    Test authorizedTest = TestConfiguration.sqlAuthorizationDecorator(authenticatedTest);
    Test encryptedTest = Decorator.encryptedDatabaseBpw(authorizedTest, "DES/CBC/NoPadding", BOOT_PASSWORD);
    Test supportFilesTest = new SupportFilesSetup(encryptedTest);
    return supportFilesTest;
}
Also used : Test(junit.framework.Test) SupportFilesSetup(org.apache.derbyTesting.junit.SupportFilesSetup)

Example 15 with SupportFilesSetup

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