Search in sources :

Example 1 with DatabaseMetaDataTest

use of org.apache.derbyTesting.functionTests.tests.jdbcapi.DatabaseMetaDataTest in project derby by apache.

the class AdditionalDb method runDataBaseMetaDataTest.

/**
 * Adds a subset of the tests from DatabaseMetaDataTest to the test suite.
 * <p>
 * We want to run DatabaseMetaDataTest, but it includes some
 * features not supported in older versions, so we cannot just
 * add the DatabaseMetaDataTest.class as is.
 * Note also, that this does not execute fixture initialCompilationTest.
 */
private static void runDataBaseMetaDataTest(BaseTestSuite suite, int oldMinor) {
    BaseTestSuite dmdSuite = new BaseTestSuite("DatabaseMetaData subsuite");
    Method[] methods = DatabaseMetaDataTest.class.getMethods();
    for (int i = 0; i < methods.length; i++) {
        Method m = methods[i];
        if (m.getParameterTypes().length > 0 || !m.getReturnType().equals(Void.TYPE)) {
            continue;
        }
        String name = m.getName();
        if (name.startsWith("test")) {
            if ((!(name.equals("testGetTablesModify") && oldMinor < 1)) && // because of missing support for grant/revoke/privileges
            (!(name.equals("testGetTablePrivileges") && oldMinor < 2)) && (!(name.equals("testGetColumnPrivileges") && oldMinor < 2)))
                dmdSuite.addTest(new DatabaseMetaDataTest(name));
        }
    }
    // Run the test in its own schema to avoid interference from other
    // tests. A typical example is additional matching rows when querying
    // system tables like SYS.SYSFOREIGNKEYS.
    suite.addTest(TestConfiguration.changeUserDecorator(dmdSuite, "DMDT", "DMDT"));
}
Also used : DatabaseMetaDataTest(org.apache.derbyTesting.functionTests.tests.jdbcapi.DatabaseMetaDataTest) BaseTestSuite(org.apache.derbyTesting.junit.BaseTestSuite) Method(java.lang.reflect.Method)

Aggregations

Method (java.lang.reflect.Method)1 DatabaseMetaDataTest (org.apache.derbyTesting.functionTests.tests.jdbcapi.DatabaseMetaDataTest)1 BaseTestSuite (org.apache.derbyTesting.junit.BaseTestSuite)1