Search in sources :

Example 51 with SupportFilesSetup

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

the class SimpleJsonTest method suite.

// /////////////////////////////////////////////////////////////////////////////////
// 
// JUnit MACHINERY
// 
// /////////////////////////////////////////////////////////////////////////////////
public static Test suite() {
    BaseTestSuite suite = new BaseTestSuite("SimpleJsonTest");
    suite.addTest(TestConfiguration.defaultSuite(SimpleJsonTest.class));
    return new SupportFilesSetup(suite, new String[] { "functionTests/tests/lang/thermostatReadings.dat", "functionTests/tests/lang/json.dat" });
}
Also used : BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) SupportFilesSetup(org.apache.derbyTesting.junit.SupportFilesSetup)

Example 52 with SupportFilesSetup

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

the class SSLTest method decorateTest.

// Test decoration
/**
 * <p>
 * Compose the required decorators to bring up the server in the correct
 * configuration.
 * </p>
 */
private static Test decorateTest(String testName) {
    SSLTest sslTest = new SSLTest(testName);
    String[] startupProperties = getStartupProperties();
    String[] startupArgs = new String[] {};
    NetworkServerTestSetup networkServerTestSetup = new NetworkServerTestSetup(sslTest, startupProperties, startupArgs, true);
    Test testSetup = SecurityManagerSetup.noSecurityManager(networkServerTestSetup);
    testSetup = new SupportFilesSetup(testSetup, null, new String[] { "functionTests/tests/derbynet/SSLTestServerKey.key" }, null, new String[] { "SSLTestServerKey.key" });
    Test test = TestConfiguration.defaultServerDecorator(testSetup);
    test = TestConfiguration.changeSSLDecorator(test, "basic");
    return test;
}
Also used : Test(junit.framework.Test) SupportFilesSetup(org.apache.derbyTesting.junit.SupportFilesSetup) NetworkServerTestSetup(org.apache.derbyTesting.junit.NetworkServerTestSetup)

Example 53 with SupportFilesSetup

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

the class SecureServerTest method decorateTest.

// /////////////////////////////////////////////////////////////////////////////////
// 
// TEST DECORATION
// 
// /////////////////////////////////////////////////////////////////////////////////
/**
 * <p>
 * Compose the required decorators to bring up the server in the correct
 * configuration.
 * </p>
 */
private static Test decorateTest(boolean unsecureSet, boolean authenticationRequired, String customDerbyProperties, String wildCardHost, Outcome outcome) {
    SecureServerTest secureServerTest = new SecureServerTest(unsecureSet, authenticationRequired, customDerbyProperties, wildCardHost, outcome);
    String[] startupProperties = getStartupProperties(authenticationRequired, customDerbyProperties);
    String[] startupArgs = getStartupArgs(unsecureSet, wildCardHost);
    NetworkServerTestSetup networkServerTestSetup = new NetworkServerTestSetup(secureServerTest, startupProperties, startupArgs, secureServerTest._outcome.serverShouldComeUp());
    secureServerTest.nsTestSetup = networkServerTestSetup;
    Test testSetup = SecurityManagerSetup.noSecurityManager(networkServerTestSetup);
    // if using the custom derby.properties, copy the custom properties to a visible place
    if (customDerbyProperties != null) {
        testSetup = new SupportFilesSetup(testSetup, null, new String[] { "functionTests/tests/derbynet/SecureServerTest.derby.properties" }, null, new String[] { "derby.properties" });
    }
    Test test = TestConfiguration.defaultServerDecorator(testSetup);
    // DERBY-2109: add support for user credentials
    test = TestConfiguration.changeUserDecorator(test, SST_USER_NAME, SST_PASSWORD);
    return test;
}
Also used : Test(junit.framework.Test) SupportFilesSetup(org.apache.derbyTesting.junit.SupportFilesSetup) NetworkServerTestSetup(org.apache.derbyTesting.junit.NetworkServerTestSetup)

Example 54 with SupportFilesSetup

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

the class Derby6587Test method baseSuite.

public static Test baseSuite(String name) {
    BaseTestSuite suite = new BaseTestSuite(Derby6587Test.class, name);
    Test test = new SupportFilesSetup(suite, new String[] { "functionTests/testData/Derby6587/Derby6587_TABLE1_T.csv", "functionTests/testData/Derby6587/Derby6587_TABLE2_T.csv" });
    return new CleanDatabaseTestSetup(test) {

        protected void decorateSQL(Statement stmt) throws SQLException {
            stmt.executeUpdate("CREATE TABLE TABLE1_T " + "(UUID char (16) for bit data NOT NULL," + "NR integer NOT NULL," + "TEXT varchar(200) NOT NULL," + "CONSTRAINT IDX_1 PRIMARY KEY (UUID, NR))");
            stmt.executeUpdate("CREATE TABLE TABLE2_T " + "(UUID char (16) for bit data NOT NULL," + "ID1 char(5) NOT NULL," + "ID2 integer NOT NULL," + "NR integer NOT NULL," + "CONSTRAINT IDX_2 PRIMARY KEY (ID1, UUID))");
            stmt.executeUpdate("ALTER TABLE TABLE2_T " + "ADD CONSTRAINT FK_1 FOREIGN KEY (UUID, NR) " + "REFERENCES TABLE1_T (UUID, NR) " + "ON DELETE NO ACTION ON UPDATE NO ACTION");
        }
    };
}
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 55 with SupportFilesSetup

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

the class Changes10_3 method suite.

/**
 * Return the suite of tests to test the changes made in 10.3.
 * @param phase an integer that indicates the current phase in
 *              the upgrade test.
 * @return the test suite created.
 */
public static Test suite(int phase) {
    BaseTestSuite suite = new BaseTestSuite("Upgrade changes for 10.3");
    suite.addTestSuite(Changes10_3.class);
    // only during the hard(full) upgrade phase.
    if (phase == PH_HARD_UPGRADE) {
        if (JDBC.vmSupportsJDBC3()) {
            // Tests for the Blob related locator StoredProcedures
            suite.addTestSuite(BlobStoredProcedureTest.class);
            // Tests for the Clob related locator StoredProcedures
            suite.addTestSuite(ClobStoredProcedureTest.class);
        }
    }
    return new SupportFilesSetup((Test) suite);
}
Also used : 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