Search in sources :

Example 36 with SystemPropertyTestSetup

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

the class UpdateLocksTest method suite.

public static Test suite() {
    Test suite = TestConfiguration.defaultSuite(UpdateLocksTest.class);
    Properties p = new Properties();
    p.put("derby.storage.pageSize", "4096");
    return new CleanDatabaseTestSetup(new SystemPropertyTestSetup(suite, p, false));
}
Also used : Test(junit.framework.Test) CleanDatabaseTestSetup(org.apache.derbyTesting.junit.CleanDatabaseTestSetup) SystemPropertyTestSetup(org.apache.derbyTesting.junit.SystemPropertyTestSetup) Properties(java.util.Properties)

Example 37 with SystemPropertyTestSetup

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

the class ConnectWrongSubprotocolTest method suite.

public static Test suite() {
    // Test does not run on J2ME
    if (JDBC.vmSupportsJSR169()) {
        return new BaseTestSuite("empty: no support for Driver.sql.Manager with jsr 169");
    }
    if (!Derby.hasTools())
        return new BaseTestSuite("empty: no tools support");
    Properties props = new Properties();
    props.setProperty("ij.connection.wrongSubprotocol", "jdbc:noone:fruitfly;create=true");
    Test test = TestConfiguration.embeddedSuite(ConnectWrongSubprotocolTest.class);
    return new SystemPropertyTestSetup(test, props);
}
Also used : Test(junit.framework.Test) SystemPropertyTestSetup(org.apache.derbyTesting.junit.SystemPropertyTestSetup) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) Properties(java.util.Properties)

Example 38 with SystemPropertyTestSetup

use of org.apache.derbyTesting.junit.SystemPropertyTestSetup 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);
}
Also used : Test(junit.framework.Test) CleanDatabaseTestSetup(org.apache.derbyTesting.junit.CleanDatabaseTestSetup) SystemPropertyTestSetup(org.apache.derbyTesting.junit.SystemPropertyTestSetup) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) Properties(java.util.Properties)

Example 39 with SystemPropertyTestSetup

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

the class UpdateCursorTest method suite.

/**
 * Returns the implemented tests.
 *
 * @return An instance of <code>Test</code> with the implemented tests to
 *         run.
 */
public static Test suite() {
    Properties props = new Properties();
    props.setProperty("derby.language.maxMemoryPerTable", "1");
    return new DatabasePropertyTestSetup(new SystemPropertyTestSetup(new CleanDatabaseTestSetup(new BaseTestSuite(UpdateCursorTest.class, "UpdateCursorTest")) {

        /**
         * @see org.apache.derbyTesting.junit.CleanDatabaseTestSetup#decorateSQL(java.sql.Statement)
         */
        protected void decorateSQL(Statement s) throws SQLException {
            StringBuffer sb = new StringBuffer(1000);
            String largeString;
            PreparedStatement pstmt;
            assertUpdateCount(s, 0, "create table T1 (" + "  c1	int," + "  c2	char(50)," + "  c3	int," + "  c4   char(50)," + "  c5   int," + "  c6   varchar(1000))");
            assertUpdateCount(s, 0, "create index I11 on T1(c3, c1, c5)");
            assertUpdateCount(s, 0, "create table T2(" + "  c1 	int)");
            assertUpdateCount(s, 0, "create table T3(" + "  c1	char(20) not null primary key)");
            assertUpdateCount(s, 0, "create table T4(" + "  c1 	char(20) references T3(c1) on delete cascade)");
            /* fill the newly created tables */
            for (int i = 0; i < 1000; i++) {
                sb.append('a');
            }
            pstmt = s.getConnection().prepareStatement("insert into T1 values (?, ?, ?, ?, ?, ?), " + "(?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?), " + "(?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?)");
            largeString = new String(sb);
            for (int i = 246; i > 0; i = i - 5) {
                int k = 0;
                for (int j = 0; j < 5; j++) {
                    pstmt.setInt(1 + k, i + (4 - j));
                    pstmt.setString(2 + k, Integer.toString(i));
                    pstmt.setInt(3 + k, i + j);
                    pstmt.setString(4 + k, Integer.toString(i));
                    pstmt.setInt(5 + k, i);
                    pstmt.setString(6 + k, largeString);
                    k += 6;
                }
                assertUpdateCount(pstmt, 5);
            }
            s.executeUpdate("insert into t2 values (1)");
            pstmt.close();
        }
    }, props), props, true);
}
Also used : DatabasePropertyTestSetup(org.apache.derbyTesting.junit.DatabasePropertyTestSetup) CleanDatabaseTestSetup(org.apache.derbyTesting.junit.CleanDatabaseTestSetup) PreparedStatement(java.sql.PreparedStatement) Statement(java.sql.Statement) SystemPropertyTestSetup(org.apache.derbyTesting.junit.SystemPropertyTestSetup) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) PreparedStatement(java.sql.PreparedStatement) Properties(java.util.Properties)

Example 40 with SystemPropertyTestSetup

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

the class BlobImplT method baseSuite.

/**
 * Create an instance of the {@code LobLimitsTest} suite.
 *
 * @param biggestSize the size of the biggest LOB to test
 * @param bigSize the size of a typical big LOB to test
 * @return a test suite
 */
static Test baseSuite(final int biggestSize, final int bigSize) {
    // Run the suite with following properties in case we run into lock
    // time out issues. It will help debug the problem if timeouts occur.
    Properties sysprops = new Properties();
    sysprops.setProperty("derby.locks.deadlockTrace", "true");
    sysprops.setProperty("derby.locks.monitor", "true");
    // Some of the test cases depend on certain other test cases to run
    // first, so force the test cases to run in lexicographical order.
    Test suite = new CleanDatabaseTestSetup(new BaseTestSuite(LobLimitsTest.class)) {

        @Override
        protected void decorateSQL(Statement s) throws SQLException {
            setupTables(s, biggestSize, bigSize);
        }
    };
    suite = new SystemPropertyTestSetup(suite, sysprops);
    return new SupportFilesSetup(suite);
}
Also used : Test(junit.framework.Test) CleanDatabaseTestSetup(org.apache.derbyTesting.junit.CleanDatabaseTestSetup) PreparedStatement(java.sql.PreparedStatement) Statement(java.sql.Statement) SystemPropertyTestSetup(org.apache.derbyTesting.junit.SystemPropertyTestSetup) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) Properties(java.util.Properties) SupportFilesSetup(org.apache.derbyTesting.junit.SupportFilesSetup)

Aggregations

SystemPropertyTestSetup (org.apache.derbyTesting.junit.SystemPropertyTestSetup)55 Properties (java.util.Properties)54 BaseTestSuite (org.apache.derbyTesting.junit.BaseTestSuite)34 Test (junit.framework.Test)33 CleanDatabaseTestSetup (org.apache.derbyTesting.junit.CleanDatabaseTestSetup)20 PreparedStatement (java.sql.PreparedStatement)8 Statement (java.sql.Statement)8 SupportFilesSetup (org.apache.derbyTesting.junit.SupportFilesSetup)8 DatabasePropertyTestSetup (org.apache.derbyTesting.junit.DatabasePropertyTestSetup)6 Connection (java.sql.Connection)3 TestSetup (junit.extensions.TestSetup)3 JDBCClientSetup (org.apache.derbyTesting.junit.JDBCClientSetup)2 NetworkServerTestSetup (org.apache.derbyTesting.junit.NetworkServerTestSetup)2 SecurityManagerSetup (org.apache.derbyTesting.junit.SecurityManagerSetup)2 File (java.io.File)1 URL (java.net.URL)1 CallableStatement (java.sql.CallableStatement)1 SQLException (java.sql.SQLException)1 Locale (java.util.Locale)1 Random (java.util.Random)1