Index: lucene/src/test/org/apache/lucene/queryParser/TestQueryParser.java =================================================================== --- lucene/src/test/org/apache/lucene/queryParser/TestQueryParser.java (revision 996432) +++ lucene/src/test/org/apache/lucene/queryParser/TestQueryParser.java (working copy) @@ -60,23 +60,17 @@ import org.apache.lucene.search.WildcardQuery; import org.apache.lucene.search.BooleanClause.Occur; import org.apache.lucene.store.Directory; -import org.apache.lucene.util.LocalizedTestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.util.automaton.BasicAutomata; import org.apache.lucene.util.automaton.CharacterRunAutomaton; import org.apache.lucene.util.automaton.RegExp; +import org.junit.runner.RunWith; /** * Tests QueryParser. */ -public class TestQueryParser extends LocalizedTestCase { - - public TestQueryParser(String name) { - super(name, new HashSet(Arrays.asList( - "testLegacyDateRange", "testDateRange", - "testCJK", "testNumber", "testFarsiRangeCollating", - "testLocalDateFormat" - ))); - } +@RunWith(LuceneTestCase.LocalizedTestCaseRunner.class) +public class TestQueryParser extends LuceneTestCase { public static Analyzer qpAnalyzer = new QPTestAnalyzer(); @@ -150,7 +144,7 @@ private int originalMaxClauses; @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); originalMaxClauses = BooleanQuery.getMaxClauseCount(); } @@ -1142,7 +1136,7 @@ } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { BooleanQuery.setMaxClauseCount(originalMaxClauses); super.tearDown(); } Index: lucene/src/test/org/apache/lucene/analysis/TestToken.java =================================================================== --- lucene/src/test/org/apache/lucene/analysis/TestToken.java (revision 996417) +++ lucene/src/test/org/apache/lucene/analysis/TestToken.java (working copy) @@ -27,10 +27,6 @@ public class TestToken extends LuceneTestCase { - public TestToken(String name) { - super(name); - } - public void testCtor() throws Exception { Token t = new Token(); char[] content = "hello".toCharArray(); Index: lucene/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java =================================================================== --- lucene/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java (revision 996417) +++ lucene/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java (working copy) @@ -29,15 +29,6 @@ * Base class for all Lucene unit tests that use TokenStreams. */ public abstract class BaseTokenStreamTestCase extends LuceneTestCase { - - public BaseTokenStreamTestCase() { - super(); - } - - public BaseTokenStreamTestCase(String name) { - super(name); - } - // some helpers to test Analyzers and TokenStreams: public static interface CheckClearAttributesAttribute extends Attribute { Index: lucene/src/test/org/apache/lucene/analysis/tokenattributes/TestSimpleAttributeImpls.java =================================================================== --- lucene/src/test/org/apache/lucene/analysis/tokenattributes/TestSimpleAttributeImpls.java (revision 996417) +++ lucene/src/test/org/apache/lucene/analysis/tokenattributes/TestSimpleAttributeImpls.java (working copy) @@ -24,10 +24,6 @@ @Deprecated public class TestSimpleAttributeImpls extends LuceneTestCase { - - public TestSimpleAttributeImpls(String name) { - super(name); - } public void testFlagsAttribute() throws Exception { FlagsAttributeImpl att = new FlagsAttributeImpl(); Index: lucene/src/test/org/apache/lucene/analysis/tokenattributes/TestCharTermAttributeImpl.java =================================================================== --- lucene/src/test/org/apache/lucene/analysis/tokenattributes/TestCharTermAttributeImpl.java (revision 996417) +++ lucene/src/test/org/apache/lucene/analysis/tokenattributes/TestCharTermAttributeImpl.java (working copy) @@ -26,10 +26,6 @@ public class TestCharTermAttributeImpl extends LuceneTestCase { - public TestCharTermAttributeImpl(String name) { - super(name); - } - public void testResize() { CharTermAttributeImpl t = new CharTermAttributeImpl(); char[] content = "hello".toCharArray(); Index: lucene/src/test/org/apache/lucene/search/TestNot.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestNot.java (revision 996417) +++ lucene/src/test/org/apache/lucene/search/TestNot.java (working copy) @@ -33,9 +33,6 @@ * @version $Revision$ */ public class TestNot extends LuceneTestCase { - public TestNot(String name) { - super(name); - } public void testNot() throws Exception { Directory store = newDirectory(); Index: lucene/src/test/org/apache/lucene/search/TestTimeLimitingCollector.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestTimeLimitingCollector.java (revision 996432) +++ lucene/src/test/org/apache/lucene/search/TestTimeLimitingCollector.java (working copy) @@ -55,15 +55,11 @@ private final String FIELD_NAME = "body"; private Query query; - public TestTimeLimitingCollector(String name) { - super(name); - } - /** * initializes searcher with a document set */ @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); final String docText[] = { "docThatNeverMatchesSoWeCanRequireLastDocCollectedToBeGreaterThanZero", @@ -99,7 +95,7 @@ } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { searcher.close(); reader.close(); directory.close(); Index: lucene/src/test/org/apache/lucene/search/TestPhraseQuery.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestPhraseQuery.java (revision 996432) +++ lucene/src/test/org/apache/lucene/search/TestPhraseQuery.java (working copy) @@ -91,7 +91,7 @@ } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { searcher.close(); reader.close(); directory.close(); Index: lucene/src/test/org/apache/lucene/search/TestTermRangeQuery.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestTermRangeQuery.java (revision 996432) +++ lucene/src/test/org/apache/lucene/search/TestTermRangeQuery.java (working copy) @@ -45,13 +45,13 @@ private Directory dir; @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); dir = newDirectory(); } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { dir.close(); super.tearDown(); } Index: lucene/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java (revision 996432) +++ lucene/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java (working copy) @@ -37,7 +37,7 @@ private IndexSearcher s; @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); String[] data = new String [] { @@ -71,7 +71,7 @@ } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { s.close(); r.close(); index.close(); Index: lucene/src/test/org/apache/lucene/search/TestBooleanOr.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestBooleanOr.java (revision 996432) +++ lucene/src/test/org/apache/lucene/search/TestBooleanOr.java (working copy) @@ -131,7 +131,7 @@ } @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); // @@ -164,7 +164,7 @@ } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { searcher.close(); reader.close(); dir.close(); Index: lucene/src/test/org/apache/lucene/search/TestDateSort.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestDateSort.java (revision 996433) +++ lucene/src/test/org/apache/lucene/search/TestDateSort.java (working copy) @@ -47,7 +47,7 @@ private IndexReader reader; @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); // Create an index writer. directory = newDirectory(); @@ -71,7 +71,7 @@ } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { reader.close(); directory.close(); super.tearDown(); Index: lucene/src/test/org/apache/lucene/search/TestSort.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestSort.java (revision 996433) +++ lucene/src/test/org/apache/lucene/search/TestSort.java (working copy) @@ -69,15 +69,6 @@ private Query queryG; private Sort sort; - public TestSort (String name) { - super (name); - } - - public static Test suite() { - return new TestSuite (TestSort.class); - } - - // document data: // the tracer field is used to determine which document was hit // the contents field is used to search and sort by relevance @@ -209,7 +200,7 @@ } @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); full = getFullIndex(); searchX = getXIndex(); @@ -226,7 +217,7 @@ private ArrayList dirs = new ArrayList(); @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { full.reader.close(); searchX.reader.close(); searchY.reader.close(); Index: lucene/src/test/org/apache/lucene/search/TestWildcardRandom.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestWildcardRandom.java (revision 996433) +++ lucene/src/test/org/apache/lucene/search/TestWildcardRandom.java (working copy) @@ -43,7 +43,7 @@ private Directory dir; @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); dir = newDirectory(); RandomIndexWriter writer = new RandomIndexWriter(random, dir, @@ -91,7 +91,7 @@ } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { searcher.close(); reader.close(); dir.close(); Index: lucene/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java =================================================================== --- lucene/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java (revision 996433) +++ lucene/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java (working copy) @@ -54,10 +54,6 @@ private byte[] payload2 = new byte[]{2}; private byte[] payload4 = new byte[]{4}; - public TestPayloadNearQuery(String s) { - super(s); - } - private class PayloadAnalyzer extends Analyzer { @Override public TokenStream tokenStream(String fieldName, Reader reader) { @@ -104,7 +100,7 @@ } @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); directory = newDirectory(); RandomIndexWriter writer = new RandomIndexWriter(random, directory, @@ -126,7 +122,7 @@ } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { searcher.close(); reader.close(); directory.close(); Index: lucene/src/test/org/apache/lucene/search/payloads/TestPayloadTermQuery.java =================================================================== --- lucene/src/test/org/apache/lucene/search/payloads/TestPayloadTermQuery.java (revision 996433) +++ lucene/src/test/org/apache/lucene/search/payloads/TestPayloadTermQuery.java (working copy) @@ -60,10 +60,6 @@ private byte[] payloadMultiField2 = new byte[]{4}; protected Directory directory; - public TestPayloadTermQuery(String s) { - super(s); - } - private class PayloadAnalyzer extends Analyzer { @@ -109,7 +105,7 @@ } @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); directory = newDirectory(); RandomIndexWriter writer = new RandomIndexWriter(random, directory, @@ -133,7 +129,7 @@ } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { searcher.close(); reader.close(); directory.close(); Index: lucene/src/test/org/apache/lucene/search/TestBooleanScorer.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestBooleanScorer.java (revision 996417) +++ lucene/src/test/org/apache/lucene/search/TestBooleanScorer.java (working copy) @@ -31,11 +31,6 @@ public class TestBooleanScorer extends LuceneTestCase { - - public TestBooleanScorer(String name) { - super(name); - } - private static final String FIELD = "category"; public void testMethod() throws Exception { Index: lucene/src/test/org/apache/lucene/search/spans/TestNearSpansOrdered.java =================================================================== --- lucene/src/test/org/apache/lucene/search/spans/TestNearSpansOrdered.java (revision 996433) +++ lucene/src/test/org/apache/lucene/search/spans/TestNearSpansOrdered.java (working copy) @@ -43,7 +43,7 @@ new QueryParser(TEST_VERSION_CURRENT, FIELD, new MockAnalyzer()); @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { searcher.close(); reader.close(); directory.close(); @@ -51,7 +51,7 @@ } @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); directory = newDirectory(); RandomIndexWriter writer= new RandomIndexWriter(random, directory); Index: lucene/src/test/org/apache/lucene/search/spans/TestSpans.java =================================================================== --- lucene/src/test/org/apache/lucene/search/spans/TestSpans.java (revision 996433) +++ lucene/src/test/org/apache/lucene/search/spans/TestSpans.java (working copy) @@ -47,7 +47,7 @@ public static final String field = "field"; @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); directory = newDirectory(); RandomIndexWriter writer= new RandomIndexWriter(random, directory); @@ -62,7 +62,7 @@ } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { searcher.close(); reader.close(); directory.close(); Index: lucene/src/test/org/apache/lucene/search/spans/TestFieldMaskingSpanQuery.java =================================================================== --- lucene/src/test/org/apache/lucene/search/spans/TestFieldMaskingSpanQuery.java (revision 996433) +++ lucene/src/test/org/apache/lucene/search/spans/TestFieldMaskingSpanQuery.java (working copy) @@ -52,7 +52,7 @@ protected IndexReader reader; @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); directory = newDirectory(); RandomIndexWriter writer= new RandomIndexWriter(random, directory); @@ -116,7 +116,7 @@ } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { searcher.close(); reader.close(); directory.close(); Index: lucene/src/test/org/apache/lucene/search/spans/TestSpansAdvanced.java =================================================================== --- lucene/src/test/org/apache/lucene/search/spans/TestSpansAdvanced.java (revision 996433) +++ lucene/src/test/org/apache/lucene/search/spans/TestSpansAdvanced.java (working copy) @@ -52,7 +52,7 @@ * Initializes the tests by adding 4 identical documents to the index. */ @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); // create test index mDirectory = newDirectory(); @@ -69,7 +69,7 @@ } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { searcher.close(); reader.close(); mDirectory.close(); Index: lucene/src/test/org/apache/lucene/search/spans/TestSpansAdvanced2.java =================================================================== --- lucene/src/test/org/apache/lucene/search/spans/TestSpansAdvanced2.java (revision 996433) +++ lucene/src/test/org/apache/lucene/search/spans/TestSpansAdvanced2.java (working copy) @@ -41,7 +41,7 @@ * Initializes the tests by adding documents to the index. */ @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); // create test index @@ -61,7 +61,7 @@ } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { searcher2.close(); reader2.close(); super.tearDown(); Index: lucene/src/test/org/apache/lucene/search/spans/TestPayloadSpans.java =================================================================== --- lucene/src/test/org/apache/lucene/search/spans/TestPayloadSpans.java (revision 996433) +++ lucene/src/test/org/apache/lucene/search/spans/TestPayloadSpans.java (working copy) @@ -55,13 +55,9 @@ protected IndexReader indexReader; private IndexReader closeIndexReader; private Directory directory; - - public TestPayloadSpans(String s) { - super(s); - } @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); PayloadHelper helper = new PayloadHelper(); searcher = helper.setUp(similarity, 1000); Index: lucene/src/test/org/apache/lucene/search/TestMultiSearcher.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestMultiSearcher.java (revision 996417) +++ lucene/src/test/org/apache/lucene/search/TestMultiSearcher.java (working copy) @@ -42,11 +42,6 @@ */ public class TestMultiSearcher extends LuceneTestCase { - - public TestMultiSearcher(String name) - { - super(name); - } /** * ReturnS a new instance of the concrete MultiSearcher class Index: lucene/src/test/org/apache/lucene/search/TestTermVectors.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestTermVectors.java (revision 996433) +++ lucene/src/test/org/apache/lucene/search/TestTermVectors.java (working copy) @@ -38,12 +38,8 @@ private IndexReader reader; private Directory directory; - public TestTermVectors(String s) { - super(s); - } - @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); directory = newDirectory(); RandomIndexWriter writer = new RandomIndexWriter(random, directory, new MockAnalyzer(MockTokenizer.SIMPLE, true)); @@ -79,7 +75,7 @@ } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { searcher.close(); reader.close(); directory.close(); Index: lucene/src/test/org/apache/lucene/search/TestQueryTermVector.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestQueryTermVector.java (revision 996417) +++ lucene/src/test/org/apache/lucene/search/TestQueryTermVector.java (working copy) @@ -23,11 +23,6 @@ public class TestQueryTermVector extends LuceneTestCase { - - public TestQueryTermVector(String s) { - super(s); - } - public void testConstructor() { BytesRef [] queryTerm = {new BytesRef("foo"), new BytesRef("bar"), new BytesRef("foo"), new BytesRef("again"), new BytesRef("foo"), new BytesRef("bar"), new BytesRef("go"), Index: lucene/src/test/org/apache/lucene/search/TestTopDocsCollector.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestTopDocsCollector.java (revision 996433) +++ lucene/src/test/org/apache/lucene/search/TestTopDocsCollector.java (working copy) @@ -102,7 +102,7 @@ } @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); // populate an index with 30 documents, this should be enough for the test. @@ -117,7 +117,7 @@ } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { reader.close(); dir.close(); dir = null; Index: lucene/src/test/org/apache/lucene/search/TestParallelMultiSearcher.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestParallelMultiSearcher.java (revision 996417) +++ lucene/src/test/org/apache/lucene/search/TestParallelMultiSearcher.java (working copy) @@ -24,10 +24,6 @@ */ public class TestParallelMultiSearcher extends TestMultiSearcher { - public TestParallelMultiSearcher(String name) { - super(name); - } - @Override protected MultiSearcher getMultiSearcherInstance(Searcher[] searchers) throws IOException { Index: lucene/src/test/org/apache/lucene/search/TestTermScorer.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestTermScorer.java (revision 996433) +++ lucene/src/test/org/apache/lucene/search/TestTermScorer.java (working copy) @@ -39,12 +39,8 @@ protected IndexSearcher indexSearcher; protected IndexReader indexReader; - public TestTermScorer(String s) { - super(s); - } - @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); directory = newDirectory(); @@ -62,7 +58,7 @@ } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { indexSearcher.close(); indexReader.close(); directory.close(); Index: lucene/src/test/org/apache/lucene/search/TestPhrasePrefixQuery.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestPhrasePrefixQuery.java (revision 996417) +++ lucene/src/test/org/apache/lucene/search/TestPhrasePrefixQuery.java (working copy) @@ -35,9 +35,6 @@ * This class tests PhrasePrefixQuery class. */ public class TestPhrasePrefixQuery extends LuceneTestCase { - public TestPhrasePrefixQuery(String name) { - super(name); - } /** * Index: lucene/src/test/org/apache/lucene/search/TestSetNorm.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestSetNorm.java (revision 996417) +++ lucene/src/test/org/apache/lucene/search/TestSetNorm.java (working copy) @@ -33,9 +33,6 @@ * @version $Revision$ */ public class TestSetNorm extends LuceneTestCase { - public TestSetNorm(String name) { - super(name); - } public void testSetNorm() throws Exception { Directory store = newDirectory(); Index: lucene/src/test/org/apache/lucene/search/TestExplanations.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestExplanations.java (revision 996433) +++ lucene/src/test/org/apache/lucene/search/TestExplanations.java (working copy) @@ -57,7 +57,7 @@ new QueryParser(TEST_VERSION_CURRENT, FIELD, new MockAnalyzer()); @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { searcher.close(); reader.close(); directory.close(); @@ -65,7 +65,7 @@ } @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); directory = newDirectory(); RandomIndexWriter writer= new RandomIndexWriter(random, directory); Index: lucene/src/test/org/apache/lucene/search/TestFieldCache.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestFieldCache.java (revision 996433) +++ lucene/src/test/org/apache/lucene/search/TestFieldCache.java (working copy) @@ -36,13 +36,9 @@ private static final int NUM_DOCS = 1000 * RANDOM_MULTIPLIER; private String[] unicodeStrings; private Directory directory; - - public TestFieldCache(String s) { - super(s); - } @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); directory = newDirectory(); RandomIndexWriter writer= new RandomIndexWriter(random, directory); @@ -86,7 +82,7 @@ } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { reader.close(); directory.close(); super.tearDown(); Index: lucene/src/test/org/apache/lucene/search/TestRegexpRandom2.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestRegexpRandom2.java (revision 996433) +++ lucene/src/test/org/apache/lucene/search/TestRegexpRandom2.java (working copy) @@ -51,7 +51,7 @@ private Directory dir; @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); dir = newDirectory(); RandomIndexWriter writer = new RandomIndexWriter(random, dir, @@ -85,7 +85,7 @@ } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { reader.close(); searcher.close(); dir.close(); Index: lucene/src/test/org/apache/lucene/search/TestMultiThreadTermVectors.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestMultiThreadTermVectors.java (revision 996433) +++ lucene/src/test/org/apache/lucene/search/TestMultiThreadTermVectors.java (working copy) @@ -34,12 +34,8 @@ public int numDocs = 100; public int numThreads = 3; - public TestMultiThreadTermVectors(String s) { - super(s); - } - @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); directory = newDirectory(); IndexWriter writer = new IndexWriter(directory, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer())); @@ -56,7 +52,7 @@ } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { directory.close(); super.tearDown(); } Index: lucene/src/test/org/apache/lucene/search/TestDateFilter.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestDateFilter.java (revision 996417) +++ lucene/src/test/org/apache/lucene/search/TestDateFilter.java (working copy) @@ -35,10 +35,7 @@ * @version $Revision$ */ public class TestDateFilter extends LuceneTestCase { - public TestDateFilter(String name) { - super(name); - } - + /** * */ Index: lucene/src/test/org/apache/lucene/search/TestFilteredSearch.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestFilteredSearch.java (revision 996417) +++ lucene/src/test/org/apache/lucene/search/TestFilteredSearch.java (working copy) @@ -38,10 +38,6 @@ */ public class TestFilteredSearch extends LuceneTestCase { - public TestFilteredSearch(String name) { - super(name); - } - private static final String FIELD = "category"; public void testFilteredSearch() throws CorruptIndexException, LockObtainFailedException, IOException { Index: lucene/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java (revision 996433) +++ lucene/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java (working copy) @@ -75,7 +75,7 @@ public IndexSearcher s; @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); index = newDirectory(); @@ -150,7 +150,7 @@ } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { s.close(); r.close(); index.close(); Index: lucene/src/test/org/apache/lucene/search/TestSimilarity.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestSimilarity.java (revision 996417) +++ lucene/src/test/org/apache/lucene/search/TestSimilarity.java (working copy) @@ -36,9 +36,6 @@ * @version $Revision$ */ public class TestSimilarity extends LuceneTestCase { - public TestSimilarity(String name) { - super(name); - } public static class SimpleSimilarity extends Similarity { @Override public float lengthNorm(String field, int numTerms) { return 1.0f; } Index: lucene/src/test/org/apache/lucene/search/TestRegexpRandom.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestRegexpRandom.java (revision 996433) +++ lucene/src/test/org/apache/lucene/search/TestRegexpRandom.java (working copy) @@ -43,7 +43,7 @@ private Directory dir; @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); dir = newDirectory(); RandomIndexWriter writer = new RandomIndexWriter(random, dir, @@ -90,7 +90,7 @@ } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { searcher.close(); reader.close(); dir.close(); Index: lucene/src/test/org/apache/lucene/search/TestTopScoreDocCollector.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestTopScoreDocCollector.java (revision 996417) +++ lucene/src/test/org/apache/lucene/search/TestTopScoreDocCollector.java (working copy) @@ -26,13 +26,6 @@ public class TestTopScoreDocCollector extends LuceneTestCase { - public TestTopScoreDocCollector() { - } - - public TestTopScoreDocCollector(String name) { - super(name); - } - public void testOutOfOrderCollection() throws Exception { Directory dir = newDirectory(); RandomIndexWriter writer = new RandomIndexWriter(random, dir); Index: lucene/src/test/org/apache/lucene/search/TestSpanQueryFilter.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestSpanQueryFilter.java (revision 996417) +++ lucene/src/test/org/apache/lucene/search/TestSpanQueryFilter.java (working copy) @@ -31,11 +31,6 @@ public class TestSpanQueryFilter extends LuceneTestCase { - - public TestSpanQueryFilter(String s) { - super(s); - } - public void testFilterWorks() throws Exception { Directory dir = newDirectory(); RandomIndexWriter writer = new RandomIndexWriter(random, dir); Index: lucene/src/test/org/apache/lucene/search/TestComplexExplanations.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestComplexExplanations.java (revision 996433) +++ lucene/src/test/org/apache/lucene/search/TestComplexExplanations.java (working copy) @@ -32,7 +32,7 @@ * nice with boosts of 0.0 */ @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); searcher.setSimilarity(createQnorm1Similarity()); } Index: lucene/src/test/org/apache/lucene/search/TestPrefixRandom.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestPrefixRandom.java (revision 996433) +++ lucene/src/test/org/apache/lucene/search/TestPrefixRandom.java (working copy) @@ -43,7 +43,7 @@ private Directory dir; @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); dir = newDirectory(); RandomIndexWriter writer = new RandomIndexWriter(random, dir, @@ -68,7 +68,7 @@ } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { reader.close(); searcher.close(); dir.close(); Index: lucene/src/test/org/apache/lucene/search/TestCustomSearcherSort.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestCustomSearcherSort.java (revision 996433) +++ lucene/src/test/org/apache/lucene/search/TestCustomSearcherSort.java (working copy) @@ -46,7 +46,7 @@ * Create index and query for test cases. */ @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); index = newDirectory(); RandomIndexWriter writer = new RandomIndexWriter(random, index); @@ -74,7 +74,7 @@ } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { reader.close(); index.close(); super.tearDown(); Index: lucene/src/test/org/apache/lucene/search/TestPrefixInBooleanQuery.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestPrefixInBooleanQuery.java (revision 996433) +++ lucene/src/test/org/apache/lucene/search/TestPrefixInBooleanQuery.java (working copy) @@ -43,7 +43,7 @@ private IndexSearcher searcher; @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); directory = newDirectory(); RandomIndexWriter writer = new RandomIndexWriter(random, directory); Index: lucene/src/test/org/apache/lucene/search/TestDocBoost.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestDocBoost.java (revision 996417) +++ lucene/src/test/org/apache/lucene/search/TestDocBoost.java (working copy) @@ -32,9 +32,6 @@ * @version $Revision$ */ public class TestDocBoost extends LuceneTestCase { - public TestDocBoost(String name) { - super(name); - } public void testDocBoost() throws Exception { Directory store = newDirectory(); Index: lucene/src/test/org/apache/lucene/search/TestMultiSearcherRanking.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestMultiSearcherRanking.java (revision 996433) +++ lucene/src/test/org/apache/lucene/search/TestMultiSearcherRanking.java (working copy) @@ -107,7 +107,7 @@ * initializes multiSearcher and singleSearcher with the same document set */ @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); // create MultiSearcher from two seperate searchers d1 = newDirectory(); @@ -136,7 +136,7 @@ Directory d1, d2, d; @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { multiSearcher.close(); singleSearcher.close(); d1.close(); Index: lucene/src/test/org/apache/lucene/search/TestMultiPhraseQuery.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestMultiPhraseQuery.java (revision 996417) +++ lucene/src/test/org/apache/lucene/search/TestMultiPhraseQuery.java (working copy) @@ -38,9 +38,6 @@ * */ public class TestMultiPhraseQuery extends LuceneTestCase { - public TestMultiPhraseQuery(String name) { - super(name); - } public void testPhrasePrefix() throws IOException { Directory indexStore = newDirectory(); Index: lucene/src/test/org/apache/lucene/search/TestBooleanPrefixQuery.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestBooleanPrefixQuery.java (revision 996417) +++ lucene/src/test/org/apache/lucene/search/TestBooleanPrefixQuery.java (working copy) @@ -18,9 +18,6 @@ */ import org.apache.lucene.util.LuceneTestCase; -import junit.framework.Test; -import junit.framework.TestSuite; -import junit.textui.TestRunner; import org.apache.lucene.index.RandomIndexWriter; import org.apache.lucene.index.Term; import org.apache.lucene.index.IndexReader; @@ -37,18 +34,6 @@ public class TestBooleanPrefixQuery extends LuceneTestCase { - public static void main(String[] args) { - TestRunner.run(suite()); - } - - public static Test suite() { - return new TestSuite(TestBooleanPrefixQuery.class); - } - - public TestBooleanPrefixQuery(String name) { - super(name); - } - private int getCount(IndexReader r, Query q) throws Exception { if (q instanceof BooleanQuery) { return ((BooleanQuery) q).getClauses().length; Index: lucene/src/test/org/apache/lucene/search/TestFilteredQuery.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestFilteredQuery.java (revision 996433) +++ lucene/src/test/org/apache/lucene/search/TestFilteredQuery.java (working copy) @@ -45,7 +45,7 @@ private Filter filter; @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); directory = newDirectory(); RandomIndexWriter writer = new RandomIndexWriter (random, directory); @@ -97,7 +97,7 @@ } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { searcher.close(); reader.close(); directory.close(); Index: lucene/src/test/org/apache/lucene/index/TestDoc.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestDoc.java (revision 996433) +++ lucene/src/test/org/apache/lucene/index/TestDoc.java (working copy) @@ -58,7 +58,7 @@ * a few text files created in the current working directory. */ @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); workDir = new File(TEMP_DIR,"TestDoc"); workDir.mkdirs(); Index: lucene/src/test/org/apache/lucene/index/TestParallelTermEnum.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestParallelTermEnum.java (revision 996433) +++ lucene/src/test/org/apache/lucene/index/TestParallelTermEnum.java (working copy) @@ -35,7 +35,7 @@ private Directory rd2; @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); Document doc; rd1 = newDirectory(); @@ -68,7 +68,7 @@ } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { ir1.close(); ir2.close(); rd1.close(); Index: lucene/src/test/org/apache/lucene/index/TestIndexReader.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestIndexReader.java (revision 996417) +++ lucene/src/test/org/apache/lucene/index/TestIndexReader.java (working copy) @@ -30,9 +30,6 @@ import java.util.Set; import java.util.SortedSet; -import junit.framework.TestSuite; -import junit.textui.TestRunner; - import org.apache.lucene.analysis.MockAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; @@ -61,19 +58,7 @@ public class TestIndexReader extends LuceneTestCase { - /** Main for running test case by itself. */ - public static void main(String args[]) { - TestRunner.run (new TestSuite(TestIndexReader.class)); -// TestRunner.run (new TestIndexReader("testBasicDelete")); -// TestRunner.run (new TestIndexReader("testDeleteReaderWriterConflict")); -// TestRunner.run (new TestIndexReader("testDeleteReaderReaderConflict")); -// TestRunner.run (new TestIndexReader("testFilesOpenClose")); - } - public TestIndexReader(String name) { - super(name); - } - public void testCommitUserData() throws Exception { Directory d = newDirectory(); Index: lucene/src/test/org/apache/lucene/index/TestStressIndexing2.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestStressIndexing2.java (revision 996417) +++ lucene/src/test/org/apache/lucene/index/TestStressIndexing2.java (working copy) @@ -35,8 +35,10 @@ import org.apache.lucene.index.IndexWriterConfig.OpenMode; import org.apache.lucene.search.TermQuery; import org.apache.lucene.store.Directory; +import org.junit.runner.RunWith; -public class TestStressIndexing2 extends MultiCodecTestCase { +@RunWith(LuceneTestCase.MultiCodecTestCaseRunner.class) +public class TestStressIndexing2 extends LuceneTestCase { static int maxFields=4; static int bigFieldSize=10; static boolean sameFieldOrder=false; Index: lucene/src/test/org/apache/lucene/index/TestTermVectorsReader.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestTermVectorsReader.java (revision 996433) +++ lucene/src/test/org/apache/lucene/index/TestTermVectorsReader.java (working copy) @@ -48,10 +48,6 @@ private FieldInfos fieldInfos = new FieldInfos(); private static int TERM_FREQ = 3; - public TestTermVectorsReader(String s) { - super(s); - } - private class TestToken implements Comparable { String text; int pos; @@ -65,7 +61,7 @@ TestToken[] tokens = new TestToken[testTerms.length * TERM_FREQ]; @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); /* for (int i = 0; i < testFields.length; i++) { @@ -125,7 +121,7 @@ } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { dir.close(); super.tearDown(); } Index: lucene/src/test/org/apache/lucene/index/TestSegmentTermDocs.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestSegmentTermDocs.java (revision 996433) +++ lucene/src/test/org/apache/lucene/index/TestSegmentTermDocs.java (working copy) @@ -31,12 +31,8 @@ private Directory dir; private SegmentInfo info; - public TestSegmentTermDocs(String s) { - super(s); - } - @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); dir = newDirectory(); DocHelper.setupDoc(testDoc); @@ -44,7 +40,7 @@ } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { dir.close(); super.tearDown(); } Index: lucene/src/test/org/apache/lucene/index/TestIndexWriter.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestIndexWriter.java (revision 996417) +++ lucene/src/test/org/apache/lucene/index/TestIndexWriter.java (working copy) @@ -79,10 +79,6 @@ import org.apache.lucene.util.Bits; public class TestIndexWriter extends LuceneTestCase { - - public TestIndexWriter(String name) { - super(name); - } public void testDocCount() throws IOException { Directory dir = newDirectory(); Index: lucene/src/test/org/apache/lucene/index/TestDocumentWriter.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestDocumentWriter.java (revision 996433) +++ lucene/src/test/org/apache/lucene/index/TestDocumentWriter.java (working copy) @@ -42,19 +42,15 @@ public class TestDocumentWriter extends LuceneTestCase { private Directory dir; - - public TestDocumentWriter(String s) { - super(s); - } @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); dir = newDirectory(); } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { dir.close(); super.tearDown(); } Index: lucene/src/test/org/apache/lucene/index/TestIndexWriterLockRelease.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestIndexWriterLockRelease.java (revision 996433) +++ lucene/src/test/org/apache/lucene/index/TestIndexWriterLockRelease.java (working copy) @@ -36,7 +36,7 @@ private java.io.File __test_dir; @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); if (this.__test_dir == null) { this.__test_dir = new File(TEMP_DIR, "testIndexWriter"); @@ -53,7 +53,7 @@ } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { if (this.__test_dir != null) { File[] files = this.__test_dir.listFiles(); Index: lucene/src/test/org/apache/lucene/index/TestIndexReaderCloneNorms.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestIndexReaderCloneNorms.java (revision 996433) +++ lucene/src/test/org/apache/lucene/index/TestIndexReaderCloneNorms.java (working copy) @@ -65,12 +65,8 @@ private float normDelta = (float) 0.001; - public TestIndexReaderCloneNorms(String s) { - super(s); - } - @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); similarityOne = new SimilarityOne(); anlzr = new MockAnalyzer(); Index: lucene/src/test/org/apache/lucene/index/TestCodecs.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestCodecs.java (revision 996417) +++ lucene/src/test/org/apache/lucene/index/TestCodecs.java (working copy) @@ -39,8 +39,9 @@ import org.apache.lucene.search.ScoreDoc; import org.apache.lucene.store.Directory; import org.apache.lucene.util.BytesRef; -import org.apache.lucene.util.MultiCodecTestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.util.Version; +import org.junit.runner.RunWith; // TODO: test multiple codecs here? @@ -59,8 +60,8 @@ // goes to 1 before next one known to exist // - skipTo(term) // - skipTo(doc) - -public class TestCodecs extends MultiCodecTestCase { +@RunWith(LuceneTestCase.MultiCodecTestCaseRunner.class) +public class TestCodecs extends LuceneTestCase { private static String[] fieldNames = new String[] {"one", "two", "three", "four"}; private final static int NUM_TEST_ITER = 20 * RANDOM_MULTIPLIER; Index: lucene/src/test/org/apache/lucene/index/TestMultiReader.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestMultiReader.java (revision 996417) +++ lucene/src/test/org/apache/lucene/index/TestMultiReader.java (working copy) @@ -20,9 +20,6 @@ import java.io.IOException; public class TestMultiReader extends TestDirectoryReader { - public TestMultiReader(String s) { - super(s); - } @Override protected IndexReader openReader() throws IOException { Index: lucene/src/test/org/apache/lucene/index/TestFieldInfos.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestFieldInfos.java (revision 996433) +++ lucene/src/test/org/apache/lucene/index/TestFieldInfos.java (working copy) @@ -30,12 +30,8 @@ private Document testDoc = new Document(); - public TestFieldInfos(String s) { - super(s); - } - @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); DocHelper.setupDoc(testDoc); } Index: lucene/src/test/org/apache/lucene/index/TestPositionBasedTermVectorMapper.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestPositionBasedTermVectorMapper.java (revision 996433) +++ lucene/src/test/org/apache/lucene/index/TestPositionBasedTermVectorMapper.java (working copy) @@ -28,13 +28,8 @@ protected TermVectorOffsetInfo[][] offsets; protected int numPositions; - - public TestPositionBasedTermVectorMapper(String s) { - super(s); - } - @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); tokens = new String[]{"here", "is", "some", "text", "to", "test", "extra"}; thePositions = new int[tokens.length][]; Index: lucene/src/test/org/apache/lucene/index/TestCompoundFile.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestCompoundFile.java (revision 996433) +++ lucene/src/test/org/apache/lucene/index/TestCompoundFile.java (working copy) @@ -55,7 +55,7 @@ @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); File file = new File(TEMP_DIR, "testIndex"); _TestUtil.rmDir(file); @@ -64,7 +64,7 @@ } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { dir.close(); _TestUtil.rmDir(new File(TEMP_DIR, "testIndex")); super.tearDown(); Index: lucene/src/test/org/apache/lucene/index/TestDirectoryReader.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestDirectoryReader.java (revision 996433) +++ lucene/src/test/org/apache/lucene/index/TestDirectoryReader.java (working copy) @@ -35,13 +35,9 @@ private Document doc2; protected SegmentReader [] readers = new SegmentReader[2]; protected SegmentInfos sis; - - public TestDirectoryReader(String s) { - super(s); - } @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); dir = newDirectory(); doc1 = new Document(); @@ -55,7 +51,7 @@ } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { if (readers[0] != null) readers[0].close(); if (readers[1] != null) readers[1].close(); dir.close(); Index: lucene/src/test/org/apache/lucene/index/TestFieldsReader.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestFieldsReader.java (revision 996433) +++ lucene/src/test/org/apache/lucene/index/TestFieldsReader.java (working copy) @@ -48,12 +48,8 @@ private FieldInfos fieldInfos = null; private final static String TEST_SEGMENT_NAME = "_0"; - public TestFieldsReader(String s) { - super(s); - } - @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); fieldInfos = new FieldInfos(); DocHelper.setupDoc(testDoc); @@ -68,7 +64,7 @@ } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { dir.close(); super.tearDown(); } Index: lucene/src/test/org/apache/lucene/index/TestTransactionRollback.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestTransactionRollback.java (revision 996433) +++ lucene/src/test/org/apache/lucene/index/TestTransactionRollback.java (working copy) @@ -122,7 +122,7 @@ */ @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); dir = newDirectory(); //Build index, of records 1 to 100, committing after each batch of 10 @@ -144,7 +144,7 @@ } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { dir.close(); super.tearDown(); } Index: lucene/src/test/org/apache/lucene/index/TestIndexReaderReopen.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestIndexReaderReopen.java (revision 996433) +++ lucene/src/test/org/apache/lucene/index/TestIndexReaderReopen.java (working copy) @@ -1093,7 +1093,7 @@ @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); indexDir = new File(TEMP_DIR, "IndexReaderReopen"); } Index: lucene/src/test/org/apache/lucene/index/TestSegmentMerger.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestSegmentMerger.java (revision 996433) +++ lucene/src/test/org/apache/lucene/index/TestSegmentMerger.java (working copy) @@ -39,14 +39,9 @@ private Directory merge2Dir; private Document doc2 = new Document(); private SegmentReader reader2 = null; - - public TestSegmentMerger(String s) { - super(s); - } - @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); mergedDir = newDirectory(); merge1Dir = newDirectory(); @@ -60,7 +55,7 @@ } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { reader1.close(); reader2.close(); mergedDir.close(); Index: lucene/src/test/org/apache/lucene/index/TestStressIndexing.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestStressIndexing.java (revision 996417) +++ lucene/src/test/org/apache/lucene/index/TestStressIndexing.java (working copy) @@ -22,10 +22,12 @@ import org.apache.lucene.document.*; import org.apache.lucene.index.IndexWriterConfig.OpenMode; import org.apache.lucene.search.*; +import org.junit.runner.RunWith; import java.io.File; -public class TestStressIndexing extends MultiCodecTestCase { +@RunWith(LuceneTestCase.MultiCodecTestCaseRunner.class) +public class TestStressIndexing extends LuceneTestCase { private static abstract class TimedThread extends Thread { volatile boolean failed; int count; Index: lucene/src/test/org/apache/lucene/index/TestParallelReader.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestParallelReader.java (revision 996433) +++ lucene/src/test/org/apache/lucene/index/TestParallelReader.java (working copy) @@ -42,14 +42,14 @@ private Directory dir, dir1, dir2; @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); single = single(random); parallel = parallel(random); } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { single.getIndexReader().close(); parallel.getIndexReader().close(); dir.close(); Index: lucene/src/test/org/apache/lucene/index/TestSegmentReader.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestSegmentReader.java (revision 996433) +++ lucene/src/test/org/apache/lucene/index/TestSegmentReader.java (working copy) @@ -34,14 +34,10 @@ private Directory dir; private Document testDoc = new Document(); private SegmentReader reader = null; - - public TestSegmentReader(String s) { - super(s); - } //TODO: Setup the reader w/ multiple documents @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); dir = newDirectory(); DocHelper.setupDoc(testDoc); @@ -50,7 +46,7 @@ } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { reader.close(); dir.close(); super.tearDown(); Index: lucene/src/test/org/apache/lucene/index/TestNorms.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestNorms.java (revision 996433) +++ lucene/src/test/org/apache/lucene/index/TestNorms.java (working copy) @@ -56,12 +56,8 @@ private float lastNorm = 0; private float normDelta = (float) 0.001; - public TestNorms(String s) { - super(s); - } - @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); similarityOne = new SimilarityOne(); anlzr = new MockAnalyzer(); Index: lucene/src/test/org/apache/lucene/messages/TestNLS.java =================================================================== --- lucene/src/test/org/apache/lucene/messages/TestNLS.java (revision 996417) +++ lucene/src/test/org/apache/lucene/messages/TestNLS.java (working copy) @@ -19,11 +19,13 @@ import java.util.Locale; -import org.apache.lucene.util.LocalizedTestCase; +import org.apache.lucene.util.LuceneTestCase; +import org.junit.runner.RunWith; /** */ -public class TestNLS extends LocalizedTestCase { +@RunWith(LuceneTestCase.LocalizedTestCaseRunner.class) +public class TestNLS extends LuceneTestCase { public void testMessageLoading() { Message invalidSyntax = new MessageImpl( MessagesTestBundle.Q0001E_INVALID_SYNTAX, "XXX"); Index: lucene/src/test/org/apache/lucene/store/TestRAMDirectory.java =================================================================== --- lucene/src/test/org/apache/lucene/store/TestRAMDirectory.java (revision 996433) +++ lucene/src/test/org/apache/lucene/store/TestRAMDirectory.java (working copy) @@ -47,7 +47,7 @@ // setup the index @Override - protected void setUp () throws Exception { + public void setUp() throws Exception { super.setUp(); indexDir = new File(TEMP_DIR, "RAMDirIndex"); @@ -152,7 +152,7 @@ } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { // cleanup if (indexDir != null && indexDir.exists()) { rmDir (indexDir); Index: lucene/src/test/org/apache/lucene/store/TestMultiMMap.java =================================================================== --- lucene/src/test/org/apache/lucene/store/TestMultiMMap.java (revision 996433) +++ lucene/src/test/org/apache/lucene/store/TestMultiMMap.java (working copy) @@ -38,7 +38,7 @@ File workDir; @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); workDir = new File(TEMP_DIR, "TestMultiMMap"); workDir.mkdirs(); Index: lucene/src/test/org/apache/lucene/store/TestWindowsMMap.java =================================================================== --- lucene/src/test/org/apache/lucene/store/TestWindowsMMap.java (revision 996433) +++ lucene/src/test/org/apache/lucene/store/TestWindowsMMap.java (working copy) @@ -34,7 +34,7 @@ private final static String alphabet = "abcdefghijklmnopqrstuvwzyz"; @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); } Index: lucene/src/test/org/apache/lucene/util/TestBitVector.java =================================================================== --- lucene/src/test/org/apache/lucene/util/TestBitVector.java (revision 996417) +++ lucene/src/test/org/apache/lucene/util/TestBitVector.java (working copy) @@ -28,9 +28,6 @@ */ public class TestBitVector extends LuceneTestCase { - public TestBitVector(String s) { - super(s); - } /** * Test the default constructor on BitVectors of various sizes. Index: lucene/src/test/org/apache/lucene/util/LocalizedTestCase.java =================================================================== --- lucene/src/test/org/apache/lucene/util/LocalizedTestCase.java (revision 996417) +++ lucene/src/test/org/apache/lucene/util/LocalizedTestCase.java (working copy) @@ -1,110 +0,0 @@ -package org.apache.lucene.util; - -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import java.util.Locale; -import java.util.Set; - -/** - * Base test class for Lucene test classes that test Locale-sensitive behavior. - *

- * This class will run tests under the default Locale, but then will also run - * tests under all available JVM locales. This is helpful to ensure tests will - * not fail under a different environment. - *

- */ -public abstract class LocalizedTestCase extends LuceneTestCase { - /** - * Before changing the default Locale, save the default Locale here so that it - * can be restored. - */ - private final Locale defaultLocale = Locale.getDefault(); - - /** - * The locale being used as the system default Locale - */ - private Locale locale; - - /** - * An optional limited set of testcases that will run under different Locales. - */ - private final Set testWithDifferentLocales; - - public LocalizedTestCase() { - super(); - testWithDifferentLocales = null; - } - - public LocalizedTestCase(String name) { - super(name); - testWithDifferentLocales = null; - } - - public LocalizedTestCase(Set testWithDifferentLocales) { - super(); - this.testWithDifferentLocales = testWithDifferentLocales; - } - - public LocalizedTestCase(String name, Set testWithDifferentLocales) { - super(name); - this.testWithDifferentLocales = testWithDifferentLocales; - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - Locale.setDefault(locale); - } - - @Override - protected void tearDown() throws Exception { - assertEquals("default locale unexpectedly changed:", locale, Locale - .getDefault()); - Locale.setDefault(defaultLocale); - super.tearDown(); - } - - @Override - public void runBare() throws Throwable { - // Do the test with the default Locale (default) - try { - locale = defaultLocale; - super.runBare(); - } catch (Throwable e) { - System.out.println("Test failure of '" + getName() - + "' occurred with the default Locale " + locale); - throw e; - } - - if (testWithDifferentLocales == null - || testWithDifferentLocales.contains(getName())) { - // Do the test again under different Locales - Locale systemLocales[] = Locale.getAvailableLocales(); - for (int i = 0; i < systemLocales.length; i++) { - try { - locale = systemLocales[i]; - super.runBare(); - } catch (Throwable e) { - System.out.println("Test failure of '" + getName() - + "' occurred under a different Locale " + locale); - throw e; - } - } - } - } -} Index: lucene/src/test/org/apache/lucene/util/LuceneTestCaseJ4.java =================================================================== --- lucene/src/test/org/apache/lucene/util/LuceneTestCaseJ4.java (revision 996433) +++ lucene/src/test/org/apache/lucene/util/LuceneTestCaseJ4.java (working copy) @@ -54,6 +54,8 @@ import org.junit.runner.RunWith; import org.junit.runner.manipulation.Filter; import org.junit.runner.manipulation.NoTestsRemainException; +import org.junit.runner.notification.Failure; +import org.junit.runner.notification.RunListener; import org.junit.runner.notification.RunNotifier; import org.junit.runners.BlockJUnit4ClassRunner; import org.junit.runners.model.FrameworkMethod; @@ -78,8 +80,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; +import junit.framework.TestCase; /** * Base class for all Lucene unit tests, Junit4 variant. @@ -117,7 +118,7 @@ // get from that override is provided by InterceptTestCaseEvents //@RunWith(RunBareWrapper.class) @RunWith(LuceneTestCaseJ4.LuceneTestCaseRunner.class) -public abstract class LuceneTestCaseJ4 { +public abstract class LuceneTestCaseJ4 extends TestCase { /** * true iff tests are run in verbose mode. Note: if it is false, tests are not @@ -337,6 +338,7 @@ // set current method name for logging LuceneTestCaseJ4.this.name = method.getName(); // check if the current test's class annotated all test* methods with @Test + /* final Class clazz = LuceneTestCaseJ4.this.getClass(); if (!checkedClasses.containsKey(clazz)) { checkedClasses.put(clazz, PLACEHOLDER); @@ -346,6 +348,7 @@ } } } + */ super.starting(method); } @@ -777,8 +780,23 @@ /** optionally filters the tests to be run by TEST_METHOD */ public static class LuceneTestCaseRunner extends BlockJUnit4ClassRunner { + private List testMethods; @Override + protected List computeTestMethods() { + if (testMethods != null) + return testMethods; + testMethods = getTestClass().getAnnotatedMethods(Test.class); + for (Method m : getTestClass().getJavaClass().getMethods()) + if (m.getName().startsWith("test") && + m.getAnnotation(Test.class) == null && + m.getParameterTypes().length == 0 && + m.getGenericReturnType() == Void.TYPE) + testMethods.add(new FrameworkMethod(m)); + return testMethods; + } + + @Override protected void runChild(FrameworkMethod arg0, RunNotifier arg1) { for (int i = 0; i < TEST_ITER; i++) super.runChild(arg0, arg1); @@ -804,4 +822,103 @@ } } } + + /** + * Test runner for Lucene test classes that test Locale-sensitive behavior. + *

+ * This class will run tests under the default Locale, but then will also run + * tests under all available JVM locales. This is helpful to ensure tests will + * not fail under a different environment. + *

+ */ + public static class LocalizedTestCaseRunner extends LuceneTestCaseRunner { + /** + * Before changing the default Locale, save the default Locale here so + * that it can be restored. + */ + private final Locale defaultLocale = Locale.getDefault(); + + /** + * The locale being used as the system default Locale + */ + private Locale locale; + + private final RunListener listener = new RunListener() { + @Override + public void testFailure(Failure failure) throws Exception { + super.testFailure(failure); + String methodName = failure.getDescription().getMethodName(); + if (locale.equals(defaultLocale)) + System.out.println("Test failure of '" + methodName + + "' occurred with the default Locale " + locale); + else + System.out.println("Test failure of '" + methodName + + "' occurred under a different Locale " + locale); + } + }; + + public LocalizedTestCaseRunner(Class clazz) throws InitializationError { + super(clazz); + } + + @Override + protected void runChild(FrameworkMethod arg0, RunNotifier arg1) { + arg1.addListener(listener); + locale = defaultLocale; + super.runChild(arg0, arg1); + + for (Locale other : Locale.getAvailableLocales()) { + locale = other; + Locale.setDefault(locale); + super.runChild(arg0, arg1); + } + + Locale.setDefault(defaultLocale); + } + } + + /** + * Test runner for Lucene test classes that run across all core codecs. + */ + public static class MultiCodecTestCaseRunner extends LuceneTestCaseRunner { + /** + * Before changing the default Codec, save the default Codec here so + * that it can be restored. + */ + private final String defaultCodec = CodecProvider.getDefaultCodec(); + + /** + * The Codec being used as the system default + */ + private String codec; + + private final RunListener listener = new RunListener() { + @Override + public void testFailure(Failure failure) throws Exception { + super.testFailure(failure); + String methodName = failure.getDescription().getMethodName(); + System.out.println("Test failure of '" + methodName + + "' occurred with codec " + codec); + } + }; + + public MultiCodecTestCaseRunner(Class clazz) throws InitializationError { + super(clazz); + } + + @Override + protected void runChild(FrameworkMethod arg0, RunNotifier arg1) { + arg1.addListener(listener); + + for (String other : CodecProvider.CORE_CODECS) { + if (other.equals("PreFlex")) continue; // nocommit: impersonation problem! + codec = other; + CodecProvider.setDefaultCodec(codec); + super.runChild(arg0, arg1); + } + + CodecProvider.setDefaultCodec(defaultCodec); + } + + } } Index: lucene/src/test/org/apache/lucene/util/LuceneTestCase.java =================================================================== --- lucene/src/test/org/apache/lucene/util/LuceneTestCase.java (revision 996433) +++ lucene/src/test/org/apache/lucene/util/LuceneTestCase.java (working copy) @@ -17,38 +17,6 @@ * limitations under the License. */ -import java.io.File; -import java.io.PrintStream; -import java.io.IOException; -import java.util.Arrays; -import java.util.IdentityHashMap; -import java.util.Iterator; -import java.util.Locale; -import java.util.Map; -import java.util.Random; -import java.util.ArrayList; -import java.util.List; -import java.util.Collections; -import java.util.TimeZone; - -import junit.framework.TestCase; -import junit.framework.TestResult; - -import org.apache.lucene.analysis.Analyzer; -import org.apache.lucene.document.Field; -import org.apache.lucene.document.Field.Index; -import org.apache.lucene.document.Field.Store; -import org.apache.lucene.document.Field.TermVector; -import org.apache.lucene.index.ConcurrentMergeScheduler; -import org.apache.lucene.index.IndexWriterConfig; -import org.apache.lucene.index.codecs.Codec; -import org.apache.lucene.search.BooleanQuery; -import org.apache.lucene.search.FieldCache; -import org.apache.lucene.search.FieldCache.CacheEntry; -import org.apache.lucene.store.Directory; -import org.apache.lucene.store.MockDirectoryWrapper; -import org.apache.lucene.util.FieldCacheSanityChecker.Insanity; - /** * Base class for all Lucene unit tests. *

@@ -68,339 +36,5 @@ * @see #assertSaneFieldCaches * */ -public abstract class LuceneTestCase extends TestCase { - - /** - * true iff tests are run in verbose mode. Note: if it is false, tests are not - * expected to print any messages. - */ - public static final boolean VERBOSE = LuceneTestCaseJ4.VERBOSE; - - /** Use this constant when creating Analyzers and any other version-dependent stuff. */ - public static final Version TEST_VERSION_CURRENT = LuceneTestCaseJ4.TEST_VERSION_CURRENT; - - /** Create indexes in this directory, optimally use a subdir, named after the test */ - public static final File TEMP_DIR = LuceneTestCaseJ4.TEMP_DIR; - - /** Gets the codec to run tests with. */ - public static final String TEST_CODEC = LuceneTestCaseJ4.TEST_CODEC; - /** Gets the locale to run tests with */ - static final String TEST_LOCALE = LuceneTestCaseJ4.TEST_LOCALE; - /** Gets the timezone to run tests with */ - static final String TEST_TIMEZONE = LuceneTestCaseJ4.TEST_TIMEZONE; - /** Gets the directory to run tests with */ - static final String TEST_DIRECTORY = LuceneTestCaseJ4.TEST_DIRECTORY; - /** Get the random seed for tests */ - static final String TEST_SEED = LuceneTestCaseJ4.TEST_SEED; - - /** - * A random multiplier which you should use when writing random tests: - * multiply it by the number of iterations - */ - public static final int RANDOM_MULTIPLIER = LuceneTestCaseJ4.RANDOM_MULTIPLIER; - - private int savedBoolMaxClauseCount; - - private volatile Thread.UncaughtExceptionHandler savedUncaughtExceptionHandler = null; - - private Codec codec; - - private Locale locale; - private Locale savedLocale; - private TimeZone timeZone; - private TimeZone savedTimeZone; - - private Map stores; - - /** Used to track if setUp and tearDown are called correctly from subclasses */ - private boolean setup; - - private static class UncaughtExceptionEntry { - public final Thread thread; - public final Throwable exception; - - public UncaughtExceptionEntry(Thread thread, Throwable exception) { - this.thread = thread; - this.exception = exception; - } - } - private List uncaughtExceptions = Collections.synchronizedList(new ArrayList()); - - public LuceneTestCase() { - super(); - } - - public LuceneTestCase(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - assertFalse("ensure your tearDown() calls super.tearDown()!!!", setup); - seed = Long.valueOf(TEST_SEED.equals("random") ? seedRnd.nextLong() : Long.parseLong(TEST_SEED)); - random = new Random(seed); - setup = true; - stores = new IdentityHashMap(); - savedUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler(); - Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { - public void uncaughtException(Thread t, Throwable e) { - uncaughtExceptions.add(new UncaughtExceptionEntry(t, e)); - if (savedUncaughtExceptionHandler != null) - savedUncaughtExceptionHandler.uncaughtException(t, e); - } - }); - - ConcurrentMergeScheduler.setTestMode(); - savedBoolMaxClauseCount = BooleanQuery.getMaxClauseCount(); - codec = LuceneTestCaseJ4.installTestCodecs(); - savedLocale = Locale.getDefault(); - locale = TEST_LOCALE.equals("random") - ? LuceneTestCaseJ4.randomLocale(seedRnd) - : LuceneTestCaseJ4.localeForName(TEST_LOCALE); - Locale.setDefault(locale); - savedTimeZone = TimeZone.getDefault(); - timeZone = TEST_TIMEZONE.equals("random") - ? LuceneTestCaseJ4.randomTimeZone(seedRnd) - : TimeZone.getTimeZone(TEST_TIMEZONE); - TimeZone.setDefault(timeZone); - } - - /** - * Forcible purges all cache entries from the FieldCache. - *

- * This method will be called by tearDown to clean up FieldCache.DEFAULT. - * If a (poorly written) test has some expectation that the FieldCache - * will persist across test methods (ie: a static IndexReader) this - * method can be overridden to do nothing. - *

- * @see FieldCache#purgeAllCaches() - */ - protected void purgeFieldCache(final FieldCache fc) { - fc.purgeAllCaches(); - } - - protected String getTestLabel() { - return getClass().getName() + "." + getName(); - } - - @Override - protected void tearDown() throws Exception { - assertTrue("ensure your setUp() calls super.setUp()!!!", setup); - setup = false; - BooleanQuery.setMaxClauseCount(savedBoolMaxClauseCount); - LuceneTestCaseJ4.removeTestCodecs(codec); - Locale.setDefault(savedLocale); - TimeZone.setDefault(savedTimeZone); - System.clearProperty("solr.solr.home"); - System.clearProperty("solr.data.dir"); - try { - Thread.setDefaultUncaughtExceptionHandler(savedUncaughtExceptionHandler); - if (!uncaughtExceptions.isEmpty()) { - System.err.println("The following exceptions were thrown by threads:"); - for (UncaughtExceptionEntry entry : uncaughtExceptions) { - System.err.println("*** Thread: " + entry.thread.getName() + " ***"); - entry.exception.printStackTrace(System.err); - } - fail("Some threads threw uncaught exceptions!"); - } - - // this isn't as useful as calling directly from the scope where the - // index readers are used, because they could be gc'ed just before - // tearDown is called. - // But it's better then nothing. - assertSaneFieldCaches(getTestLabel()); - - if (ConcurrentMergeScheduler.anyUnhandledExceptions()) { - // Clear the failure so that we don't just keep - // failing subsequent test cases - ConcurrentMergeScheduler.clearUnhandledExceptions(); - fail("ConcurrentMergeScheduler hit unhandled exceptions"); - } - } finally { - purgeFieldCache(FieldCache.DEFAULT); - } - - // now look for unclosed resources - for (MockDirectoryWrapper d : stores.keySet()) { - if (d.isOpen()) { - StackTraceElement elements[] = stores.get(d); - StackTraceElement element = (elements.length > 1) ? elements[1] : null; - fail("directory of testcase " + getName() + " was not closed, opened from: " + element); - } - } - stores = null; - super.tearDown(); - } - - /** - * Asserts that FieldCacheSanityChecker does not detect any - * problems with FieldCache.DEFAULT. - *

- * If any problems are found, they are logged to System.err - * (allong with the msg) when the Assertion is thrown. - *

- *

- * This method is called by tearDown after every test method, - * however IndexReaders scoped inside test methods may be garbage - * collected prior to this method being called, causing errors to - * be overlooked. Tests are encouraged to keep their IndexReaders - * scoped at the class level, or to explicitly call this method - * directly in the same scope as the IndexReader. - *

- * @see FieldCacheSanityChecker - */ - protected void assertSaneFieldCaches(final String msg) { - final CacheEntry[] entries = FieldCache.DEFAULT.getCacheEntries(); - Insanity[] insanity = null; - try { - try { - insanity = FieldCacheSanityChecker.checkSanity(entries); - } catch (RuntimeException e) { - dumpArray(msg+ ": FieldCache", entries, System.err); - throw e; - } - - assertEquals(msg + ": Insane FieldCache usage(s) found", - 0, insanity.length); - insanity = null; - } finally { - - // report this in the event of any exception/failure - // if no failure, then insanity will be null anyway - if (null != insanity) { - dumpArray(msg + ": Insane FieldCache usage(s)", insanity, System.err); - } - - } - } - - /** - * Convinience method for logging an iterator. - * @param label String logged before/after the items in the iterator - * @param iter Each next() is toString()ed and logged on it's own line. If iter is null this is logged differnetly then an empty iterator. - * @param stream Stream to log messages to. - */ - public static void dumpIterator(String label, Iterator iter, - PrintStream stream) { - stream.println("*** BEGIN "+label+" ***"); - if (null == iter) { - stream.println(" ... NULL ..."); - } else { - while (iter.hasNext()) { - stream.println(iter.next().toString()); - } - } - stream.println("*** END "+label+" ***"); - } - - /** - * Convinience method for logging an array. Wraps the array in an iterator and delegates - * @see #dumpIterator(String,Iterator,PrintStream) - */ - public static void dumpArray(String label, Object[] objs, - PrintStream stream) { - Iterator iter = (null == objs) ? null : Arrays.asList(objs).iterator(); - dumpIterator(label, iter, stream); - } - - /** create a new index writer config with random defaults */ - public IndexWriterConfig newIndexWriterConfig(Version v, Analyzer a) { - return LuceneTestCaseJ4.newIndexWriterConfig(random, v, a); - } - - /** - * Returns a new Dictionary instance. Use this when the test does not - * care about the specific Directory implementation (most tests). - *

- * The Directory is wrapped with {@link MockDirectoryWrapper}. - * By default this means it will be picky, such as ensuring that you - * properly close it and all open files in your test. It will emulate - * some features of Windows, such as not allowing open files to be - * overwritten. - */ - public MockDirectoryWrapper newDirectory() throws IOException { - StackTraceElement[] stack = new Exception().getStackTrace(); - Directory impl = LuceneTestCaseJ4.newDirectoryImpl(random, TEST_DIRECTORY); - MockDirectoryWrapper dir = new MockDirectoryWrapper(impl); - stores.put(dir, stack); - return dir; - } - - /** - * Returns a new Dictionary instance, with contents copied from the - * provided directory. See {@link #newDirectory()} for more - * information. - */ - public MockDirectoryWrapper newDirectory(Directory d) throws IOException { - StackTraceElement[] stack = new Exception().getStackTrace(); - Directory impl = LuceneTestCaseJ4.newDirectoryImpl(random, TEST_DIRECTORY); - for (String file : d.listAll()) { - d.copy(impl, file, file); - } - MockDirectoryWrapper dir = new MockDirectoryWrapper(impl); - stores.put(dir, stack); - return dir; - } - - public Field newField(String name, String value, Index index) { - return LuceneTestCaseJ4.newField(random, name, value, index); - } - - public Field newField(String name, String value, Store store, Index index) { - return LuceneTestCaseJ4.newField(random, name, value, store, index); - } - - public Field newField(String name, String value, Store store, Index index, TermVector tv) { - return LuceneTestCaseJ4.newField(random, name, value, store, index, tv); - } - - /** Gets a resource from the classpath as {@link File}. This method should only be used, - * if a real file is needed. To get a stream, code should prefer - * {@link Class#getResourceAsStream} using {@code this.getClass()}. - */ - protected File getDataFile(String name) throws IOException { - try { - return new File(this.getClass().getResource(name).toURI()); - } catch (Exception e) { - throw new IOException("Cannot find resource: " + name); - } - } - - - @Override - public void run(TestResult result) { - for (int i = 0; i < LuceneTestCaseJ4.TEST_ITER; i++) - if (LuceneTestCaseJ4.TEST_METHOD == null || - getName().equals(LuceneTestCaseJ4.TEST_METHOD)) - super.run(result); - } - - @Override - public void runBare() throws Throwable { - //long t0 = System.currentTimeMillis(); - try { - seed = null; - super.runBare(); - } catch (Throwable e) { - System.out.println("NOTE: random codec of testcase '" + getName() + "' was: " + codec); - if (TEST_LOCALE.equals("random")) - System.out.println("NOTE: random locale of testcase '" + getName() + "' was: " + locale); - if (TEST_TIMEZONE.equals("random")) // careful to not deliver NPE here in case they forgot super.setUp - System.out.println("NOTE: random timezone of testcase '" + getName() + "' was: " + (timeZone == null ? "(null)" : timeZone.getID())); - if (seed != null) { - System.out.println("NOTE: random seed of testcase '" + getName() + "' was: " + seed); - } - throw e; - } - //long t = System.currentTimeMillis() - t0; - //System.out.println(t + " msec for " + getName()); - } - - // recorded seed - protected Long seed = null; - protected Random random = null; - - // static members - private static final Random seedRnd = new Random(); +public abstract class LuceneTestCase extends LuceneTestCaseJ4 { } Index: lucene/src/test/org/apache/lucene/util/TestFieldCacheSanityChecker.java =================================================================== --- lucene/src/test/org/apache/lucene/util/TestFieldCacheSanityChecker.java (revision 996433) +++ lucene/src/test/org/apache/lucene/util/TestFieldCacheSanityChecker.java (working copy) @@ -38,7 +38,7 @@ private static final int NUM_DOCS = 1000; @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); dirA = newDirectory(); dirB = newDirectory(); @@ -74,7 +74,7 @@ } @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { readerA.close(); readerB.close(); readerX.close(); Index: lucene/src/test/org/apache/lucene/util/MultiCodecTestCase.java =================================================================== --- lucene/src/test/org/apache/lucene/util/MultiCodecTestCase.java (revision 996417) +++ lucene/src/test/org/apache/lucene/util/MultiCodecTestCase.java (working copy) @@ -1,46 +0,0 @@ -package org.apache.lucene.util; - -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import org.apache.lucene.index.codecs.CodecProvider; - -/** - * Base test class for Lucene test classes that to test across - * all core codecs. - */ -public abstract class MultiCodecTestCase extends LuceneTestCase { - - @Override - public void runBare() throws Throwable { - final String savedDefaultCodec = CodecProvider.getDefaultCodec(); - try { - for(String codec : CodecProvider.CORE_CODECS) { - CodecProvider.setDefaultCodec(codec); - try { - super.runBare(); - } catch (Throwable e) { - System.out.println("Test failure of '" + getName() - + "' occurred with \"" + codec + "\" codec"); - throw e; - } - } - } finally { - CodecProvider.setDefaultCodec(savedDefaultCodec); - } - } -} Index: lucene/src/test/org/apache/lucene/util/TestPriorityQueue.java =================================================================== --- lucene/src/test/org/apache/lucene/util/TestPriorityQueue.java (revision 996417) +++ lucene/src/test/org/apache/lucene/util/TestPriorityQueue.java (working copy) @@ -20,9 +20,6 @@ import java.util.Random; public class TestPriorityQueue extends LuceneTestCase { - public TestPriorityQueue(String name) { - super(name); - } private static class IntegerQueue extends PriorityQueue { public IntegerQueue(int count) { Index: lucene/src/test/org/apache/lucene/util/automaton/TestDeterminism.java =================================================================== --- lucene/src/test/org/apache/lucene/util/automaton/TestDeterminism.java (revision 996433) +++ lucene/src/test/org/apache/lucene/util/automaton/TestDeterminism.java (working copy) @@ -26,7 +26,7 @@ public class TestDeterminism extends LuceneTestCase { @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); } Index: lucene/src/test/org/apache/lucene/util/automaton/TestUTF32ToUTF8.java =================================================================== --- lucene/src/test/org/apache/lucene/util/automaton/TestUTF32ToUTF8.java (revision 996433) +++ lucene/src/test/org/apache/lucene/util/automaton/TestUTF32ToUTF8.java (working copy) @@ -27,7 +27,7 @@ public class TestUTF32ToUTF8 extends LuceneTestCase { @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); } Index: lucene/src/test/org/apache/lucene/document/TestDateTools.java =================================================================== --- lucene/src/test/org/apache/lucene/document/TestDateTools.java (revision 996417) +++ lucene/src/test/org/apache/lucene/document/TestDateTools.java (working copy) @@ -8,7 +8,8 @@ import java.util.TimeZone; import java.util.Locale; -import org.apache.lucene.util.LocalizedTestCase; +import org.apache.lucene.util.LuceneTestCase; +import org.junit.runner.RunWith; /** * Licensed to the Apache Software Foundation (ASF) under one or more @@ -26,9 +27,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@RunWith(LuceneTestCase.LocalizedTestCaseRunner.class) +public class TestDateTools extends LuceneTestCase { -public class TestDateTools extends LocalizedTestCase { - public void testStringToDate() throws ParseException { Date d = null;