use of org.apache.derbyTesting.junit.SupportFilesSetup in project derby by apache.
the class ForeignKeysDeferrableTest method suite.
public static Test suite() {
BaseTestSuite suite = new BaseTestSuite();
suite.addTest(new SupportFilesSetup(embeddedSuite(ForeignKeysDeferrableTest.class)));
suite.addTest(new SupportFilesSetup(clientServerSuite(ForeignKeysDeferrableTest.class)));
return suite;
}
use of org.apache.derbyTesting.junit.SupportFilesSetup in project derby by apache.
the class DBOAccessTest method suite.
// /////////////////////////////////////////////////////////////////////////////////
//
// JUnit BEHAVIOR
//
// /////////////////////////////////////////////////////////////////////////////////
/**
* Construct top level suite in this JUnit test
*/
public static Test suite() {
String[] testFiles = new String[] { "functionTests/tests/lang/" + TEST_LOG_FILE };
Test authorizedRun = TestConfiguration.embeddedSuite(DBOAccessTest.class);
authorizedRun = DatabasePropertyTestSetup.builtinAuthentication(authorizedRun, LEGAL_USERS, "authorizationOnDBOAccessTest");
authorizedRun = new SupportFilesSetup(authorizedRun, testFiles);
authorizedRun = TestConfiguration.sqlAuthorizationDecorator(authorizedRun);
Test unauthorizedRun = TestConfiguration.embeddedSuite(NoAuthorization.class);
unauthorizedRun = new SupportFilesSetup(unauthorizedRun, testFiles);
BaseTestSuite suite = new BaseTestSuite();
suite.addTest(authorizedRun);
suite.addTest(unauthorizedRun);
return suite;
}
use of org.apache.derbyTesting.junit.SupportFilesSetup in project derby by apache.
the class DatabaseClassLoadingTest method suite.
/**
* Run the tests only in embedded since this is testing
* server side behaviour. Due to DERBY-537 and DERBY-2040
* most of the tests are run without a security manager.
* Ordering is important here so the fixtures are added
* explicitly.
*/
public static Test suite() throws Exception {
final BaseTestSuite suite = new BaseTestSuite("DatabaseClassLoadingTest");
// Need DriverManager to execute the add contact procedure
// as it uses server side jdbc.
Test test = suite;
if (JDBC.vmSupportsJDBC3()) {
String[] orderedTests = { "testJarHandling", "testWithNoInstalledJars", "testWithNoClasspath", "testSetClasspath", "testAddContact", "testGetResource", "testAlterTable", "testClassPathRollback", "testReplaceJar", "testReplacedClass", "testSecondJar", "testSignedJar", "testCreateDatabaseJar", "testHackedJarReplacedClass", "testInvalidJar", "testRemoveJar", "testLoadJavaClassIndirectly", "testLoadJavaClassDirectly", "testLoadJavaClassDirectly2", "testLoadJavaClassDirectly3", "testLoadDerbyClassIndirectly", "testIndirectLoading", "testTableFunctionInJar", "testUDAInJar", "test_5352" };
for (int i = 0; i < orderedTests.length; i++) {
suite.addTest(new DatabaseClassLoadingTest(orderedTests[i]));
}
suite.addTest(new DatabaseClassLoadingTest("testDatabaseInJar"));
// to delete the jar file afterwards.
if (ClasspathSetup.supportsClose()) {
suite.addTest(new ClasspathSetup(new DatabaseClassLoadingTest("testDatabaseInClasspath"), SupportFilesSetup.getReadOnlyURL("dclt.jar")));
}
// No security manager because the test uses getClass().getClassLoader()
// in an installed jar to ensure that the class loader for
// specific classes is correct. This operation is not allowed in general.
suite.addTest(SecurityManagerSetup.noSecurityManager(new DatabaseClassLoadingTest("testClassLoadOrdering")));
// Add test cases accessing a classpath database when a login
// timeout has been specified.
suite.addTest(loginTimeoutSuite());
test = new SupportFilesSetup(suite, new String[] { "functionTests/tests/lang/dcl_emc1.jar", "functionTests/tests/lang/dcl_emcaddon.jar", "functionTests/tests/lang/dcl_emc2.jar", "functionTests/tests/lang/dcl_emc2s.jar", "functionTests/tests/lang/dcl_emc2sm.jar", "functionTests/tests/lang/dcl_emc2l.jar", "functionTests/tests/lang/dcl_java.jar", "functionTests/tests/lang/dcl_ot1.jar", "functionTests/tests/lang/dcl_ot2.jar", "functionTests/tests/lang/dcl_ot3.jar", "functionTests/tests/lang/dcl_id.jar", "functionTests/tests/lang/dummy_vti.jar", "functionTests/tests/lang/median_uda.jar" });
}
return new CleanDatabaseTestSetup(test) {
protected void decorateSQL(Statement s) throws SQLException {
s.executeUpdate("create schema emc");
s.executeUpdate("create schema \"emcAddOn\"");
s.executeUpdate("create table emc.contacts " + "(id int primary key, e_mail varchar(30))");
s.executeUpdate("create procedure EMC.ADDCONTACT(id INT, e_mail VARCHAR(30)) " + "MODIFIES SQL DATA " + "external name 'org.apache.derbyTesting.databaseclassloader.emc.addContact' " + "language java parameter style java");
s.executeUpdate("create function EMC.GETARTICLE(path VARCHAR(60)) " + "RETURNS VARCHAR(256) " + "NO SQL " + "external name 'org.apache.derbyTesting.databaseclassloader.emc.getArticle' " + "language java parameter style java");
// function that gets the signers of the class (loaded from the jar)
s.executeUpdate("CREATE FUNCTION EMC.GETSIGNERS(" + "CLASS_NAME VARCHAR(256)) RETURNS VARCHAR(60) " + "NO SQL LANGUAGE JAVA PARAMETER STYLE JAVA " + "EXTERNAL NAME 'org.apache.derbyTesting.databaseclassloader.emc.getSigners'");
s.executeUpdate("CREATE FUNCTION \"emcAddOn\".VALIDCONTACT(E_MAIL VARCHAR(30)) " + "RETURNS SMALLINT " + "READS SQL DATA LANGUAGE JAVA PARAMETER STYLE JAVA " + "EXTERNAL NAME 'org.apache.derbyTesting.databaseclassloader.addon.vendor.util.valid'");
}
};
}
use of org.apache.derbyTesting.junit.SupportFilesSetup in project derby by apache.
the class GeneratedColumnsTest method suite.
// /////////////////////////////////////////////////////////////////////////////////
//
// JUnit BEHAVIOR
//
// /////////////////////////////////////////////////////////////////////////////////
/**
* Construct top level suite in this JUnit test
*/
public static Test suite() {
BaseTestSuite suite = (BaseTestSuite) TestConfiguration.embeddedSuite(GeneratedColumnsTest.class);
Test cleanDatabaseSuite = new CleanDatabaseTestSetup(suite);
//
// Copies the data file to a location which can be read.
//
Test result = new SupportFilesSetup(cleanDatabaseSuite, new String[] { "functionTests/tests/lang/" + IMPORT_FILE_NAME });
return result;
}
use of org.apache.derbyTesting.junit.SupportFilesSetup in project derby by apache.
the class XMLXXETest method suite.
/**
* Only return a suite IF the testing classpath has the
* required XML classes. Otherwise just return an empty suite.
*/
public static Test suite() {
BaseTestSuite suite = new BaseTestSuite("XML XXE Vulnerability tests\n");
if (!XML.classpathMeetsXMLReqs())
return suite;
String[] testFiles = new String[] { "functionTests/tests/lang/xmlOptimizerXXE1Payload.trace", "functionTests/tests/lang/xmlOptimizerXXE1.trace", "functionTests/tests/lang/xmlOptimizerXXE2.trace" };
suite.addTest(new SupportFilesSetup(TestConfiguration.defaultSuite(XMLXXETest.class), testFiles));
// which may be different in different locales (DERBY-6869).
return new LocaleTestSetup(SecurityManagerSetup.noSecurityManager(suite), Locale.US);
}
Aggregations