Search in sources :

Example 46 with BaseTestSuite

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

the class OLAPTest method makeSuite.

public static Test makeSuite() {
    Test clean = new CleanDatabaseTestSetup(new BaseTestSuite(OLAPTest.class)) {

        protected void decorateSQL(Statement s) throws SQLException {
            getConnection().setAutoCommit(false);
            s.executeUpdate("create table t1 (a int, b int)");
            s.executeUpdate("create table t2 (x int)");
            s.executeUpdate("create table t3 (y int)");
            s.executeUpdate("create table t4 (a int, b int)");
            s.executeUpdate("create table t5 (a int, b int)");
            s.executeUpdate("insert into t1 values (10,100),(20,200)," + "                      (30,300),(40,400)," + "                      (50,500)");
            s.executeUpdate("insert into t2 values (1),(2),(3),(4),(5)");
            s.executeUpdate("insert into t3 values (4),(5),(6),(7),(8)");
            s.executeUpdate("insert into t4 values (10,100),(20,200)");
            s.executeUpdate("insert into t5 values (1,1),(2,4),(3,4),(4,4),(5,9)");
            getConnection().commit();
        }
    };
    return clean;
}
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)

Example 47 with BaseTestSuite

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

the class OffsetFetchNextTest method suite.

public static Test suite() {
    BaseTestSuite suite = new BaseTestSuite("OffsetFetchNextTest");
    suite.addTest(baseSuite("OffsetFetchNextTest:embedded"));
    suite.addTest(TestConfiguration.clientServerDecorator(baseSuite("OffsetFetchNextTest:client")));
    return suite;
}
Also used : BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite)

Example 48 with BaseTestSuite

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

the class OrderByAndOffsetFetchInSubqueries method makeSuite.

/**
 * Construct suite of tests
 *
 * @return A suite containing the test cases.
 */
private static Test makeSuite() {
    return new CleanDatabaseTestSetup(new BaseTestSuite(OrderByAndOffsetFetchInSubqueries.class)) {

        @Override
        protected void decorateSQL(Statement s) throws SQLException {
            getConnection().setAutoCommit(false);
            s.execute("create table temp1(s varchar(10))");
            // GENERATED ALWAYS AS IDENTITY
            s.execute("create table temp2(" + "i integer not null " + "    generated always as identity," + "s varchar(10))");
            s.execute("create table temp2b(" + "i integer not null " + "    generated always as identity," + "s varchar(10))");
            // DEFAULT value
            s.execute("create table temp3(" + "i integer not null " + "    generated always as identity," + "s varchar(10)," + "j integer not null " + "    default 66," + "t varchar(10))");
            // GENERATED ALWAYS AS (expression)
            s.execute("create table temp4(" + "i integer not null " + "    generated always as identity," + "s varchar(10)," + "j integer not null " + "    generated always as (2*i)," + "t varchar(10))");
            s.execute("create table t01(c1 int)");
            s.execute("create table t02(c2 int)");
            s.execute("create table t_source(c1 int, c2 varchar(10))");
            s.execute("create table t(i int not null, " + "               constraint c unique (i), " + "               j int, k int)");
            getConnection().commit();
        }
    };
}
Also used : CleanDatabaseTestSetup(org.apache.derbyTesting.junit.CleanDatabaseTestSetup) Statement(java.sql.Statement) PreparedStatement(java.sql.PreparedStatement) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite)

Example 49 with BaseTestSuite

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

the class LuceneBackupTest method suite.

// /////////////////////////////////////////////////////////////////////////////////
// 
// JUnit BEHAVIOR
// 
// /////////////////////////////////////////////////////////////////////////////////
/**
 * Construct top level suite in this JUnit test
 */
public static Test suite() {
    BaseTestSuite suite = (BaseTestSuite) TestConfiguration.embeddedSuite(LuceneBackupTest.class);
    Test secureTest = new SecurityManagerSetup(suite, POLICY_FILE);
    Test authenticatedTest = DatabasePropertyTestSetup.builtinAuthentication(secureTest, LEGAL_USERS, "LuceneBackupPermissions");
    Test authorizedTest = TestConfiguration.sqlAuthorizationDecoratorSingleUse(authenticatedTest, DB_NAME, true);
    Test supportFilesTest = new SupportFilesSetup(authorizedTest);
    return supportFilesTest;
}
Also used : Test(junit.framework.Test) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) SecurityManagerSetup(org.apache.derbyTesting.junit.SecurityManagerSetup) SupportFilesSetup(org.apache.derbyTesting.junit.SupportFilesSetup)

Example 50 with BaseTestSuite

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

the class LuceneCoarseAuthorizationTest method suite.

// /////////////////////////////////////////////////////////////////////////////////
// 
// JUnit BEHAVIOR
// 
// /////////////////////////////////////////////////////////////////////////////////
/**
 * Construct top level suite in this JUnit test
 */
public static Test suite() {
    BaseTestSuite suite = (BaseTestSuite) TestConfiguration.embeddedSuite(LuceneCoarseAuthorizationTest.class);
    Test unsecureTest = SecurityManagerSetup.noSecurityManager(suite);
    Test authenticatedTest = DatabasePropertyTestSetup.builtinAuthentication(unsecureTest, LEGAL_USERS, "LuceneCoarsePermissions");
    Test coarseTest = new DatabasePropertyTestSetup(authenticatedTest, makeProperties());
    Test singleUseTest = TestConfiguration.singleUseDatabaseDecorator(coarseTest);
    return singleUseTest;
}
Also used : Test(junit.framework.Test) DatabasePropertyTestSetup(org.apache.derbyTesting.junit.DatabasePropertyTestSetup) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite)

Aggregations

BaseTestSuite (org.apache.derbyTesting.junit.BaseTestSuite)476 Test (junit.framework.Test)136 CleanDatabaseTestSetup (org.apache.derbyTesting.junit.CleanDatabaseTestSetup)118 Statement (java.sql.Statement)81 PreparedStatement (java.sql.PreparedStatement)68 SupportFilesSetup (org.apache.derbyTesting.junit.SupportFilesSetup)49 Properties (java.util.Properties)43 SystemPropertyTestSetup (org.apache.derbyTesting.junit.SystemPropertyTestSetup)34 CallableStatement (java.sql.CallableStatement)19 Connection (java.sql.Connection)14 SecurityManagerSetup (org.apache.derbyTesting.junit.SecurityManagerSetup)13 DatabasePropertyTestSetup (org.apache.derbyTesting.junit.DatabasePropertyTestSetup)11 TestSetup (junit.extensions.TestSetup)10 SQLException (java.sql.SQLException)7 LocaleTestSetup (org.apache.derbyTesting.junit.LocaleTestSetup)7 Method (java.lang.reflect.Method)5 Locale (java.util.Locale)5 BaseJDBCTestSetup (org.apache.derbyTesting.junit.BaseJDBCTestSetup)4 NetworkServerTestSetup (org.apache.derbyTesting.junit.NetworkServerTestSetup)4 ResultSet (java.sql.ResultSet)3