Search in sources :

Example 1 with SupportFilesSetup

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

the class cdsXid method suite.

public static Test suite() {
    if (JDBC.vmSupportsJSR169()) {
        // test uses unsupported classes like DriverManager, XADataSource,
        // ConnectionPoolDataSource, ConnectionEvenListenere, as well as
        // unsupported methods, like Connection.setTypeMap()...
        BaseTestSuite suite = new BaseTestSuite("J2EEDatasourceTest cannot run with JSR169");
        return suite;
    } else {
        BaseTestSuite suite = new BaseTestSuite("J2EEDataSourceTest suite");
        // Add tests that will run with both embedded
        suite.addTest(baseSuite(":embedded"));
        // and network server/client
        suite.addTest(TestConfiguration.clientServerDecorator(baseSuite(":client")));
        // Add the tests that only run with client
        suite.addTest(new SupportFilesSetup(TestConfiguration.clientServerDecorator(getClientSuite())));
        // Add the tests that only run with embedded
        suite.addTest(getEmbeddedSuite("embedded"));
        // Add the tests relying on getting timeouts.
        suite.addTest(getTimeoutSuite(":embedded"));
        suite.addTest(TestConfiguration.clientServerDecorator(getTimeoutSuite(":client")));
        // Note that not all fixtures need (all of) these.
        return new CleanDatabaseTestSetup(suite) {

            /**
             * Create and populate database objects
             *
             * @see org.apache.derbyTesting.junit.CleanDatabaseTestSetup#decorateSQL(java.sql.Statement)
             */
            protected void decorateSQL(Statement s) throws SQLException {
                TestRoutines.installRoutines(getConnection());
                s.executeUpdate("create table autocommitxastart(i int)");
                s.executeUpdate("insert into autocommitxastart values 1,2,3,4,5");
                s.executeUpdate("create schema SCHEMA_Patricio");
                s.executeUpdate("create table " + "SCHEMA_Patricio.Patricio (id VARCHAR(255), value INTEGER)");
                s.executeUpdate("create table intTable(i int)");
                s.executeUpdate("create table hold_30 " + "(id int not null primary key, b char(30))");
                s.executeUpdate("create procedure checkConn2(in dsname varchar(20)) " + "parameter style java language java modifies SQL DATA " + "external name " + "'org.apache.derbyTesting.functionTests.tests.jdbcapi.J2EEDataSourceTest." + getNestedMethodName() + "'");
                s.execute("create table derby3799 (dClob clob)");
                s.executeUpdate("insert into derby3799 values (" + "'myLittleTestClob')");
            }
        };
    }
}
Also used : 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)

Example 2 with SupportFilesSetup

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

the class DataSourceSerializationTest method suite.

/**
 * Returns an appropariate suite of tests to run.
 *
 * @return A test suite.
 */
public static Test suite() {
    BaseTestSuite suite = new BaseTestSuite("DataSourceSerializationTest");
    String filePrefix = "functionTests/testData/serializedDataSources/";
    // De-serialize embedded data sources only if we have the engine code.
    if (Derby.hasEmbedded()) {
        suite.addTest(new DataSourceSerializationTest("serTestEmbeddedDataSource"));
        suite.addTest(new DataSourceSerializationTest("serTestEmbeddedConnectionPoolDataSource"));
        suite.addTest(new DataSourceSerializationTest("serTestEmbeddedXADataSource"));
    }
    // De-serialize client data sources only if we have the client code.
    if (Derby.hasClient()) {
        suite.addTest(new DataSourceSerializationTest("serTestClientDataSource"));
        suite.addTest(new DataSourceSerializationTest("serTestClientConnectionPoolDataSource"));
        suite.addTest(new DataSourceSerializationTest("serTestClientXADataSource"));
    }
    return new SupportFilesSetup(suite, new String[] { // 10.0 resources
    filePrefix + "EmbeddedDataSource-10_0_2_1.ser", filePrefix + "EmbeddedConnectionPoolDataSource-10_0_2_1.ser", filePrefix + "EmbeddedXADataSource-10_0_2_1.ser", // 10.1 resources
    filePrefix + "EmbeddedDataSource-10_1_3_1.ser", filePrefix + "EmbeddedConnectionPoolDataSource-10_1_3_1.ser", filePrefix + "EmbeddedXADataSource-10_1_3_1.ser", filePrefix + "ClientDataSource-10_1_3_1.ser", filePrefix + "ClientConnectionPoolDataSource-10_1_3_1.ser", filePrefix + "ClientXADataSource-10_1_3_1.ser", // 10.2 resources
    filePrefix + "EmbeddedDataSource-10_2_2_0.ser", filePrefix + "EmbeddedConnectionPoolDataSource-10_2_2_0.ser", filePrefix + "EmbeddedXADataSource-10_2_2_0.ser", filePrefix + "ClientDataSource-10_2_2_0.ser", filePrefix + "ClientConnectionPoolDataSource-10_2_2_0.ser", filePrefix + "ClientXADataSource-10_2_2_0.ser", // 10.3 resources
    filePrefix + "EmbeddedDataSource-10_3_2_1.ser", filePrefix + "EmbeddedConnectionPoolDataSource-10_3_2_1.ser", filePrefix + "EmbeddedXADataSource-10_3_2_1.ser", filePrefix + "ClientDataSource-10_3_2_1.ser", filePrefix + "ClientConnectionPoolDataSource-10_3_2_1.ser", filePrefix + "ClientXADataSource-10_3_2_1.ser", // 10.10 resources
    filePrefix + "EmbeddedDataSource-10_10_1_0.ser", filePrefix + "EmbeddedDataSource40-10_10_1_0.ser", filePrefix + "EmbeddedConnectionPoolDataSource-10_10_1_0.ser", filePrefix + "EmbeddedConnectionPoolDataSource40-10_10_1_0.ser", filePrefix + "EmbeddedXADataSource-10_10_1_0.ser", filePrefix + "EmbeddedXADataSource40-10_10_1_0.ser", filePrefix + "ClientDataSource-10_10_1_0.ser", filePrefix + "ClientDataSource40-10_10_1_0.ser", filePrefix + "ClientConnectionPoolDataSource-10_10_1_0.ser", filePrefix + "ClientConnectionPoolDataSource40-10_10_1_0.ser", filePrefix + "ClientXADataSource-10_10_1_0.ser", filePrefix + "ClientXADataSource40-10_10_1_0.ser", filePrefix + "BasicEmbeddedDataSource40-10_10_1_0.ser", filePrefix + "BasicEmbeddedConnectionPoolDataSource40-10_10_1_0.ser", filePrefix + "BasicEmbeddedXADataSource40-10_10_1_0.ser", filePrefix + "BasicClientDataSource40-10_10_1_0.ser", filePrefix + "BasicClientConnectionPoolDataSource40-10_10_1_0.ser", filePrefix + "BasicClientXADataSource40-10_10_1_0.ser", // 10.11 resources
    filePrefix + "EmbeddedDataSource-10_11_1_0.ser", filePrefix + "EmbeddedDataSource40-10_11_1_0.ser", filePrefix + "EmbeddedConnectionPoolDataSource-10_11_1_0.ser", filePrefix + "EmbeddedConnectionPoolDataSource40-10_11_1_0.ser", filePrefix + "EmbeddedXADataSource-10_11_1_0.ser", filePrefix + "EmbeddedXADataSource40-10_11_1_0.ser", filePrefix + "ClientDataSource-10_11_1_0.ser", filePrefix + "ClientDataSource40-10_11_1_0.ser", filePrefix + "ClientConnectionPoolDataSource-10_11_1_0.ser", filePrefix + "ClientConnectionPoolDataSource40-10_11_1_0.ser", filePrefix + "ClientXADataSource-10_11_1_0.ser", filePrefix + "ClientXADataSource40-10_11_1_0.ser", filePrefix + "BasicEmbeddedDataSource40-10_11_1_0.ser", filePrefix + "BasicEmbeddedConnectionPoolDataSource40-10_11_1_0.ser", filePrefix + "BasicEmbeddedXADataSource40-10_11_1_0.ser", filePrefix + "BasicClientDataSource40-10_11_1_0.ser", filePrefix + "BasicClientConnectionPoolDataSource40-10_11_1_0.ser", filePrefix + "BasicClientXADataSource40-10_11_1_0.ser" });
}
Also used : BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) SupportFilesSetup(org.apache.derbyTesting.junit.SupportFilesSetup)

Example 3 with SupportFilesSetup

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

the class MergeStatementTest method standardDecoration.

/**
 * Decorate a test with standard decorators.
 */
private static Test standardDecoration(boolean withCollation) {
    Test cleanTest;
    if (withCollation) {
        cleanTest = Decorator.territoryCollatedDatabase(TestConfiguration.embeddedSuite(MergeStatementTest.Collated.class), "en");
    } else {
        cleanTest = new CleanDatabaseTestSetup(TestConfiguration.embeddedSuite(MergeStatementTest.class));
    }
    Test authenticatedTest = DatabasePropertyTestSetup.builtinAuthentication(cleanTest, LEGAL_USERS, "MergeStatementPermissions");
    Test authorizedTest = TestConfiguration.sqlAuthorizationDecorator(authenticatedTest);
    return new SupportFilesSetup(authorizedTest);
}
Also used : Test(junit.framework.Test) CleanDatabaseTestSetup(org.apache.derbyTesting.junit.CleanDatabaseTestSetup) SupportFilesSetup(org.apache.derbyTesting.junit.SupportFilesSetup)

Example 4 with SupportFilesSetup

use of org.apache.derbyTesting.junit.SupportFilesSetup 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 5 with SupportFilesSetup

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

the class LuceneJarLoadingTest method suite.

// /////////////////////////////////////////////////////////////////////////////////
// 
// JUnit BEHAVIOR
// 
// /////////////////////////////////////////////////////////////////////////////////
/**
 * Construct top level suite in this JUnit test
 */
public static Test suite() {
    BaseTestSuite suite = (BaseTestSuite) TestConfiguration.embeddedSuite(LuceneJarLoadingTest.class);
    Test secureTest = new SecurityManagerSetup(suite, POLICY_FILE);
    Test authenticatedTest = DatabasePropertyTestSetup.builtinAuthentication(secureTest, LEGAL_USERS, "LuceneJarLoadingPermissions");
    Test authorizedTest = TestConfiguration.sqlAuthorizationDecoratorSingleUse(authenticatedTest, DB_NAME, true);
    Test supportFilesTest = new SupportFilesSetup(authorizedTest, SUPPORT_FILES);
    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)

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