Hi,
Currently the Jackrabbit core tests are only run with the default
configuration (with the default persistence manager, without data
store). The tests should be run with different configurations as well
(for example with the BundleFsPersistenceManager, with data store). To
do that, we need to do two things: the test repository.xml must be
'dynamic', that is, generated / modified / replaced while the tests
run. Second, the tests must be invoked multiple times. It would be bad
to loop in each test case (run the first test with all persistence
managers, then the second, and so on), because it would be very slow.
Better is to run all tests with the default configuration, and then a
second time with different settings, and so on. To do that, we could
use a 'super test suite' (uber test suite). I found a way to do that.
If somebody has a better idea please help (I'm not a JUnit
specialist)!
// new "super test suite"
package unit;
import junit.framework.*;
public class TestEverything extends TestCase {
public static int config = 0;
public static Test suite() {
TestSuite suite = new TestSuite("All tests with all configs");
suite.addTest(unit.sub.TestAll.suite());
suite.addTestSuite(TestEverything.class);
suite.addTest(unit.sub.TestAll.suite());
suite.addTestSuite(TestEverything.class);
suite.addTest(unit.sub.TestAll.suite());
return suite;
}
public void testNext() {
config++;
}
}
// current test suite
package unit.sub;
import junit.framework.*;
public class TestAll extends TestCase {
public static Test suite() {
TestSuite suite = new TestSuite("Subproject Tests");
suite.addTestSuite(TestOne.class);
return suite;
}
}
// single test
package unit.sub;
import junit.framework.TestCase;
public class TestOne extends TestCase {
public void testIt() {
System.out.println("config: " + unit.TestEverything.config);
}
}
Regards,
Thomas