use of org.apache.derbyTesting.junit.SupportFilesSetup in project derby by apache.
the class NetHarnessJavaTest method suite.
public static Test suite() {
BaseTestSuite suite = new BaseTestSuite("derbynet: old harness java tests");
if (!Derby.hasServer())
return suite;
suite.addTest(TestConfiguration.clientServerDecorator(decorate(new NetHarnessJavaTest("executeUpdate"))));
// which is tested in ProtocolTest.
return new SupportFilesSetup(suite, new String[] { "functionTests/tests/derbynet/excsat_accsecrd1.inc", "functionTests/tests/derbynet/excsat_accsecrd2.inc", "functionTests/tests/derbynet/excsat_secchk.inc", "functionTests/tests/derbynet/connect.inc", "functionTests/tests/derbynet/values1.inc", "functionTests/tests/derbynet/values64kblksz.inc" });
}
use of org.apache.derbyTesting.junit.SupportFilesSetup in project derby by apache.
the class ProtocolTest method suite.
/**
* Creates a suite of tests dynamically from a file describing protocol
* tests.
*
* @return A suite of tests.
* @throws Exception if creating the suite fails for some reason
*/
public static Test suite() throws Exception {
BaseTestSuite suite = new BaseTestSuite("Derby DRDA protocol tests");
// Process the list of files and create test cases for the sub-tests.
// NOTE: We cannot assume anything about the order in which the tests
// are executed.
final String testFile = PREFIX + "protocol.tests";
final URL testFileURL = BaseTestCase.getTestResource(testFile);
BufferedReader bIn = new BufferedReader(new InputStreamReader(openTestResource(testFileURL), Charset.forName("UTF-8")));
// Split the tests into individual tests.
final String END_TEST = ProtocolTestGrammar.END_TEST.toCmdString();
int currentLine = 1;
// First line is line number one.
int startLine = 1;
ArrayList<String> cmdLines = new ArrayList<String>();
StringBuilder str = new StringBuilder();
String line;
// Iterate until the end of test token is reached.
while ((line = bIn.readLine()) != null) {
cmdLines.add(line);
str.append(line).append(NL);
if (line.toLowerCase(Locale.ENGLISH).startsWith(END_TEST)) {
// Create a new test case.
suite.addTest(new ProtocolTest("protocol.tests", str.toString(), startLine, currentLine - startLine));
cmdLines.clear();
str.setLength(0);
startLine = currentLine + 1;
}
currentLine++;
}
bIn.close();
// Install a security policy and copy the required include files.
final String resourcePath = "functionTests/tests/derbynet";
return new SecurityManagerSetup(TestConfiguration.clientServerDecorator(new SupportFilesSetup(suite, new String[] { resourcePath + "/connect.inc", resourcePath + "/excsat_accsecrd1.inc", resourcePath + "/excsat_accsecrd2.inc", resourcePath + "/excsat_accsecrd_nordb.inc", resourcePath + "/excsat_secchk_nordbonaccsec.inc", resourcePath + "/excsat_secchk.inc", resourcePath + "/values1.inc", resourcePath + "/values64kblksz.inc" })), PREFIX + "ProtocolTest.policy", true);
}
use of org.apache.derbyTesting.junit.SupportFilesSetup in project derby by apache.
the class CheckToursDBTest method basesuite.
public static Test basesuite(String name) {
BaseTestSuite suite = new BaseTestSuite(CheckToursDBTest.class, name);
Test test = new SupportFilesSetup(suite, new String[] { "functionTests/tests/demo/cupisle.gif", "functionTests/tests/demo/smallisle.gif", "functionTests/tests/demo/witchisle.gif" });
return test;
}
use of org.apache.derbyTesting.junit.SupportFilesSetup in project derby by apache.
the class RestrictiveFilePermissionsTest method suite.
public static Test suite() throws Exception {
File f = new File("system/testPermissions");
assertTrue(f.mkdirs());
supportsLaxTesting = checkAccessToOwner(f, false, UNKNOWN);
if (!supportsLaxTesting) {
println("warning: testing of lax file permissions in" + "RestrictiveFilePermissionsTest can not take place, " + "use a more liberal runtime default (umask) for the tests");
}
assertDirectoryDeleted(f);
// First collect the tests that check that, if we actually do restrict
// permissions, the files created by Derby actually *are*
// restricted. We test that with an embedded Derby with explicit
// setting of the property derby.storage.useDefaultFilePermissions.
// The extra setup file is for testJarFiles.
BaseTestSuite totalSuite = new BaseTestSuite("RestrictiveFilePermissionsTest");
Properties p = new Properties();
p.put("derby.storage.useDefaultFilePermissions", "false");
p.put("derby.stream.error.file", derbyDotLog);
totalSuite.addTest(new SystemPropertyTestSetup(TestConfiguration.singleUseDatabaseDecorator(new SupportFilesSetup(new BaseTestSuite(RestrictiveFilePermissionsTest.class, "haveWeGotAllCreatedFilesSuite"), new String[] { "functionTests/tests/lang/dcl_id.jar" }), dbName), p, true));
// permissions.
if (Derby.hasServer()) {
totalSuite.addTest(new NetworkServerTestSetup(new RestrictiveFilePermissionsTest("doTestCliServerIsRestrictive"), // system properties
new String[] {}, // non-default start up arguments
new String[] {}, true));
}
//
if (supportsLaxTesting) {
totalSuite.addTest(TestConfiguration.clientServerDecorator(new RestrictiveFilePermissionsTest("doTestNonCliServerIsLax")));
// For embedded, we should see lax permissions also.
//
p = new Properties();
p.put("derby.stream.error.file", derbyDotLog + ".lax");
totalSuite.addTest(new SystemPropertyTestSetup(new RestrictiveFilePermissionsTest("dotestEmbeddedIsLax"), p, true));
}
return totalSuite;
}
use of org.apache.derbyTesting.junit.SupportFilesSetup in project derby by apache.
the class I18NImportExport method suite.
public static Test suite() {
BaseTestSuite suite = new BaseTestSuite("I18NImportExport");
suite.addTest(new CleanDatabaseTestSetup(new I18NImportExport("I18NImportExport")));
return getIJConfig(new SupportFilesSetup(suite, new String[] { "functionTests/tests/i18n/data/Tab1_fr.ctrl", "functionTests/tests/i18n/data/Tab1_il.ctrl", "functionTests/tests/i18n/data/Tab1_jp.ctrl" }));
}
Aggregations