Index: src/test/org/apache/lucene/queryParser/TestMultiAnalyzer.java =================================================================== --- src/test/org/apache/lucene/queryParser/TestMultiAnalyzer.java (revision 582218) +++ src/test/org/apache/lucene/queryParser/TestMultiAnalyzer.java (working copy) @@ -19,7 +19,7 @@ import java.io.Reader; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.search.Query; import org.apache.lucene.analysis.Analyzer; @@ -36,7 +36,7 @@ * * @author Daniel Naber */ -public class TestMultiAnalyzer extends TestCase { +public class TestMultiAnalyzer extends LuceneTestCase { private static int multiToken = 0; Index: src/test/org/apache/lucene/queryParser/TestMultiFieldQueryParser.java =================================================================== --- src/test/org/apache/lucene/queryParser/TestMultiFieldQueryParser.java (revision 582218) +++ src/test/org/apache/lucene/queryParser/TestMultiFieldQueryParser.java (working copy) @@ -17,7 +17,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.Token; import org.apache.lucene.analysis.TokenStream; @@ -42,7 +42,7 @@ * Tests QueryParser. * @author Daniel Naber */ -public class TestMultiFieldQueryParser extends TestCase { +public class TestMultiFieldQueryParser extends LuceneTestCase { /** test stop words arsing for both the non static form, and for the * corresponding static form (qtxt, fields[]). */ Index: src/test/org/apache/lucene/queryParser/TestQueryParser.java =================================================================== --- src/test/org/apache/lucene/queryParser/TestQueryParser.java (revision 582218) +++ src/test/org/apache/lucene/queryParser/TestQueryParser.java (working copy) @@ -17,7 +17,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.*; import org.apache.lucene.analysis.Token; import org.apache.lucene.analysis.standard.StandardAnalyzer; @@ -40,7 +40,7 @@ /** * Tests QueryParser. */ -public class TestQueryParser extends TestCase { +public class TestQueryParser extends LuceneTestCase { public static Analyzer qpAnalyzer = new QPTestAnalyzer(); @@ -98,7 +98,8 @@ private int originalMaxClauses; - public void setUp() { + public void setUp() throws Exception { + super.setUp(); originalMaxClauses = BooleanQuery.getMaxClauseCount(); } @@ -861,7 +862,8 @@ iw.addDocument(d); } - public void tearDown() { + public void tearDown() throws Exception { + super.tearDown(); BooleanQuery.setMaxClauseCount(originalMaxClauses); } Index: src/test/org/apache/lucene/analysis/TestToken.java =================================================================== --- src/test/org/apache/lucene/analysis/TestToken.java (revision 582218) +++ src/test/org/apache/lucene/analysis/TestToken.java (working copy) @@ -18,9 +18,9 @@ */ import java.io.*; -import junit.framework.*; +import org.apache.lucene.util.LuceneTestCase; -public class TestToken extends TestCase { +public class TestToken extends LuceneTestCase { public TestToken(String name) { super(name); Index: src/test/org/apache/lucene/analysis/TestPerFieldAnalzyerWrapper.java =================================================================== --- src/test/org/apache/lucene/analysis/TestPerFieldAnalzyerWrapper.java (revision 582218) +++ src/test/org/apache/lucene/analysis/TestPerFieldAnalzyerWrapper.java (working copy) @@ -1,6 +1,6 @@ package org.apache.lucene.analysis; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import java.io.StringReader; /** @@ -20,7 +20,7 @@ * limitations under the License. */ -public class TestPerFieldAnalzyerWrapper extends TestCase { +public class TestPerFieldAnalzyerWrapper extends LuceneTestCase { public void testPerField() throws Exception { String text = "Qwerty"; PerFieldAnalyzerWrapper analyzer = Index: src/test/org/apache/lucene/analysis/TestCachingTokenFilter.java =================================================================== --- src/test/org/apache/lucene/analysis/TestCachingTokenFilter.java (revision 582218) +++ src/test/org/apache/lucene/analysis/TestCachingTokenFilter.java (working copy) @@ -20,7 +20,7 @@ import java.io.IOException; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; @@ -32,7 +32,7 @@ import org.apache.lucene.store.Directory; import org.apache.lucene.store.RAMDirectory; -public class TestCachingTokenFilter extends TestCase { +public class TestCachingTokenFilter extends LuceneTestCase { private String[] tokens = new String[] {"term1", "term2", "term3", "term2"}; public void testCaching() throws IOException { Index: src/test/org/apache/lucene/analysis/TestStandardAnalyzer.java =================================================================== --- src/test/org/apache/lucene/analysis/TestStandardAnalyzer.java (revision 582218) +++ src/test/org/apache/lucene/analysis/TestStandardAnalyzer.java (working copy) @@ -1,6 +1,6 @@ package org.apache.lucene.analysis; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.standard.StandardAnalyzer; import java.io.StringReader; @@ -21,7 +21,7 @@ * limitations under the License. */ -public class TestStandardAnalyzer extends TestCase { +public class TestStandardAnalyzer extends LuceneTestCase { private Analyzer a = new StandardAnalyzer(); Index: src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java =================================================================== --- src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java (revision 582218) +++ src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java (working copy) @@ -17,11 +17,11 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import java.io.StringReader; -public class TestISOLatin1AccentFilter extends TestCase { +public class TestISOLatin1AccentFilter extends LuceneTestCase { public void testU() throws Exception { TokenStream stream = new WhitespaceTokenizer(new StringReader("Des mot clés À LA CHAÎNE À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö Ø Œ Þ Ù Ú Û Ü Ý Ÿ à á â ã ä å æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ø œ ß þ ù ú û ü ý ÿ")); ISOLatin1AccentFilter filter = new ISOLatin1AccentFilter(stream); Index: src/test/org/apache/lucene/analysis/TestLengthFilter.java =================================================================== --- src/test/org/apache/lucene/analysis/TestLengthFilter.java (revision 582218) +++ src/test/org/apache/lucene/analysis/TestLengthFilter.java (working copy) @@ -17,11 +17,11 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import java.io.StringReader; -public class TestLengthFilter extends TestCase { +public class TestLengthFilter extends LuceneTestCase { public void testFilter() throws Exception { TokenStream stream = new WhitespaceTokenizer( Index: src/test/org/apache/lucene/analysis/TestAnalyzers.java =================================================================== --- src/test/org/apache/lucene/analysis/TestAnalyzers.java (revision 582218) +++ src/test/org/apache/lucene/analysis/TestAnalyzers.java (working copy) @@ -18,9 +18,9 @@ */ import java.io.*; -import junit.framework.*; +import org.apache.lucene.util.LuceneTestCase; -public class TestAnalyzers extends TestCase { +public class TestAnalyzers extends LuceneTestCase { public TestAnalyzers(String name) { super(name); Index: src/test/org/apache/lucene/analysis/TestKeywordAnalyzer.java =================================================================== --- src/test/org/apache/lucene/analysis/TestKeywordAnalyzer.java (revision 582218) +++ src/test/org/apache/lucene/analysis/TestKeywordAnalyzer.java (working copy) @@ -17,7 +17,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.store.RAMDirectory; import org.apache.lucene.document.Document; @@ -27,12 +27,13 @@ import org.apache.lucene.search.Hits; import org.apache.lucene.queryParser.QueryParser; -public class TestKeywordAnalyzer extends TestCase { +public class TestKeywordAnalyzer extends LuceneTestCase { private RAMDirectory directory; private IndexSearcher searcher; public void setUp() throws Exception { + super.setUp(); directory = new RAMDirectory(); IndexWriter writer = new IndexWriter(directory, new SimpleAnalyzer(), Index: src/test/org/apache/lucene/analysis/TestStopAnalyzer.java =================================================================== --- src/test/org/apache/lucene/analysis/TestStopAnalyzer.java (revision 582218) +++ src/test/org/apache/lucene/analysis/TestStopAnalyzer.java (working copy) @@ -17,14 +17,14 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import java.io.StringReader; import java.io.IOException; import java.util.Set; import java.util.HashSet; -public class TestStopAnalyzer extends TestCase { +public class TestStopAnalyzer extends LuceneTestCase { private StopAnalyzer stop = new StopAnalyzer(); private Set inValidTokens = new HashSet(); @@ -33,7 +33,8 @@ super(s); } - protected void setUp() { + protected void setUp() throws Exception { + super.setUp(); for (int i = 0; i < StopAnalyzer.ENGLISH_STOP_WORDS.length; i++) { inValidTokens.add(StopAnalyzer.ENGLISH_STOP_WORDS[i]); } Index: src/test/org/apache/lucene/analysis/TestStopFilter.java =================================================================== --- src/test/org/apache/lucene/analysis/TestStopFilter.java (revision 582218) +++ src/test/org/apache/lucene/analysis/TestStopFilter.java (working copy) @@ -19,12 +19,12 @@ import java.io.IOException; import java.io.StringReader; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; /** * @author yonik */ -public class TestStopFilter extends TestCase { +public class TestStopFilter extends LuceneTestCase { // other StopFilter functionality is already tested by TestStopAnalyzer Index: src/test/org/apache/lucene/TestSearch.java =================================================================== --- src/test/org/apache/lucene/TestSearch.java (revision 582218) +++ src/test/org/apache/lucene/TestSearch.java (working copy) @@ -21,7 +21,7 @@ import java.io.PrintWriter; import java.io.StringWriter; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import junit.framework.TestSuite; import junit.textui.TestRunner; @@ -36,7 +36,7 @@ * * @version $Id$ */ -public class TestSearch extends TestCase { +public class TestSearch extends LuceneTestCase { /** Main for running test case by itself. */ public static void main(String args[]) { Index: src/test/org/apache/lucene/store/TestMMapDirectory.java =================================================================== --- src/test/org/apache/lucene/store/TestMMapDirectory.java (revision 582218) +++ src/test/org/apache/lucene/store/TestMMapDirectory.java (working copy) @@ -17,10 +17,10 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import java.lang.reflect.Method; -public class TestMMapDirectory extends TestCase { +public class TestMMapDirectory extends LuceneTestCase { // Simply verify that if there is a method in FSDirectory // that returns IndexInput or a subclass, that Index: src/test/org/apache/lucene/store/TestLockFactory.java =================================================================== --- src/test/org/apache/lucene/store/TestLockFactory.java (revision 582218) +++ src/test/org/apache/lucene/store/TestLockFactory.java (working copy) @@ -17,7 +17,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import java.util.Hashtable; import java.util.Enumeration; @@ -36,7 +36,7 @@ import org.apache.lucene.search.Hits; import org.apache.lucene.analysis.WhitespaceAnalyzer; -public class TestLockFactory extends TestCase { +public class TestLockFactory extends LuceneTestCase { // Verify: we can provide our own LockFactory implementation, the right // methods are called at the right time, locks are created, etc. Index: src/test/org/apache/lucene/store/TestWindowsMMap.java =================================================================== --- src/test/org/apache/lucene/store/TestWindowsMMap.java (revision 582218) +++ src/test/org/apache/lucene/store/TestWindowsMMap.java (working copy) @@ -1,96 +1,97 @@ -package org.apache.lucene.store; - -/** - * 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.HashSet; -import java.util.Random; -import java.io.File; - -import junit.framework.TestCase; - -import org.apache.lucene.analysis.standard.StandardAnalyzer; -import org.apache.lucene.document.Document; -import org.apache.lucene.document.Field; -import org.apache.lucene.index.IndexWriter; -import org.apache.lucene.search.IndexSearcher; -import org.apache.lucene.store.FSDirectory; - -public class TestWindowsMMap extends TestCase { - - private final static String alphabet = "abcdefghijklmnopqrstuvwzyz"; - private Random random; - - public void setUp() { - random = new Random(); - System.setProperty("org.apache.lucene.FSDirectory.class", "org.apache.lucene.store.MMapDirectory"); - } - - private String randomToken() { - int tl = 1 + random.nextInt(7); - StringBuffer sb = new StringBuffer(); - for(int cx = 0; cx < tl; cx ++) { - int c = random.nextInt(25); - sb.append(alphabet.substring(c, c+1)); - } - return sb.toString(); - } - - private String randomField() { - int fl = 1 + random.nextInt(3); - StringBuffer fb = new StringBuffer(); - for(int fx = 0; fx < fl; fx ++) { - fb.append(randomToken()); - fb.append(" "); - } - return fb.toString(); - } - - private final static String storePathname = - new File(System.getProperty("tempDir"),"testLuceneMmap").getAbsolutePath(); - - public void testMmapIndex() throws Exception { - FSDirectory storeDirectory; - storeDirectory = FSDirectory.getDirectory(storePathname); - - // plan to add a set of useful stopwords, consider changing some of the - // interior filters. - StandardAnalyzer analyzer = new StandardAnalyzer(new HashSet()); - // TODO: something about lock timeouts and leftover locks. - IndexWriter writer = new IndexWriter(storeDirectory, analyzer, true); - IndexSearcher searcher = new IndexSearcher(storePathname); - - for(int dx = 0; dx < 1000; dx ++) { - String f = randomField(); - Document doc = new Document(); - doc.add(new Field("data", f, Field.Store.YES, Field.Index.TOKENIZED)); - writer.addDocument(doc); - } - - searcher.close(); - writer.close(); - rmDir(new File(storePathname)); - } - - private void rmDir(File dir) { - File[] files = dir.listFiles(); - for (int i = 0; i < files.length; i++) { - files[i].delete(); - } - dir.delete(); - } -} +package org.apache.lucene.store; + +/** + * 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.HashSet; +import java.util.Random; +import java.io.File; + +import org.apache.lucene.util.LuceneTestCase; + +import org.apache.lucene.analysis.standard.StandardAnalyzer; +import org.apache.lucene.document.Document; +import org.apache.lucene.document.Field; +import org.apache.lucene.index.IndexWriter; +import org.apache.lucene.search.IndexSearcher; +import org.apache.lucene.store.FSDirectory; + +public class TestWindowsMMap extends LuceneTestCase { + + private final static String alphabet = "abcdefghijklmnopqrstuvwzyz"; + private Random random; + + public void setUp() throws Exception { + super.setUp(); + random = new Random(); + System.setProperty("org.apache.lucene.FSDirectory.class", "org.apache.lucene.store.MMapDirectory"); + } + + private String randomToken() { + int tl = 1 + random.nextInt(7); + StringBuffer sb = new StringBuffer(); + for(int cx = 0; cx < tl; cx ++) { + int c = random.nextInt(25); + sb.append(alphabet.substring(c, c+1)); + } + return sb.toString(); + } + + private String randomField() { + int fl = 1 + random.nextInt(3); + StringBuffer fb = new StringBuffer(); + for(int fx = 0; fx < fl; fx ++) { + fb.append(randomToken()); + fb.append(" "); + } + return fb.toString(); + } + + private final static String storePathname = + new File(System.getProperty("tempDir"),"testLuceneMmap").getAbsolutePath(); + + public void testMmapIndex() throws Exception { + FSDirectory storeDirectory; + storeDirectory = FSDirectory.getDirectory(storePathname); + + // plan to add a set of useful stopwords, consider changing some of the + // interior filters. + StandardAnalyzer analyzer = new StandardAnalyzer(new HashSet()); + // TODO: something about lock timeouts and leftover locks. + IndexWriter writer = new IndexWriter(storeDirectory, analyzer, true); + IndexSearcher searcher = new IndexSearcher(storePathname); + + for(int dx = 0; dx < 1000; dx ++) { + String f = randomField(); + Document doc = new Document(); + doc.add(new Field("data", f, Field.Store.YES, Field.Index.TOKENIZED)); + writer.addDocument(doc); + } + + searcher.close(); + writer.close(); + rmDir(new File(storePathname)); + } + + private void rmDir(File dir) { + File[] files = dir.listFiles(); + for (int i = 0; i < files.length; i++) { + files[i].delete(); + } + dir.delete(); + } +} Index: src/test/org/apache/lucene/store/TestHugeRamFile.java =================================================================== --- src/test/org/apache/lucene/store/TestHugeRamFile.java (revision 582218) +++ src/test/org/apache/lucene/store/TestHugeRamFile.java (working copy) @@ -20,10 +20,10 @@ import java.io.IOException; import java.util.HashMap; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; /** Test huge RAMFile with more than Integer.MAX_VALUE bytes. */ -public class TestHugeRamFile extends TestCase { +public class TestHugeRamFile extends LuceneTestCase { private static final long MAX_VALUE = (long) 2 * (long) Integer.MAX_VALUE; Index: src/test/org/apache/lucene/store/TestLock.java =================================================================== --- src/test/org/apache/lucene/store/TestLock.java (revision 582218) +++ src/test/org/apache/lucene/store/TestLock.java (working copy) @@ -56,9 +56,9 @@ import java.io.IOException; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; -public class TestLock extends TestCase { +public class TestLock extends LuceneTestCase { public void testObtain() { LockMock lock = new LockMock(); Index: src/test/org/apache/lucene/store/TestBufferedIndexInput.java =================================================================== --- src/test/org/apache/lucene/store/TestBufferedIndexInput.java (revision 582218) +++ src/test/org/apache/lucene/store/TestBufferedIndexInput.java (working copy) @@ -34,9 +34,9 @@ import org.apache.lucene.search.TermQuery; import org.apache.lucene.util._TestUtil; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; -public class TestBufferedIndexInput extends TestCase { +public class TestBufferedIndexInput extends LuceneTestCase { // Call readByte() repeatedly, past the buffer boundary, and see that it // is working as expected. // Our input comes from a dynamically generated/ "file" - see Index: src/test/org/apache/lucene/TestDemo.java =================================================================== --- src/test/org/apache/lucene/TestDemo.java (revision 582218) +++ src/test/org/apache/lucene/TestDemo.java (working copy) @@ -17,7 +17,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.document.Document; @@ -38,7 +38,7 @@ * * @author Daniel Naber */ -public class TestDemo extends TestCase { +public class TestDemo extends LuceneTestCase { public void testDemo() throws IOException, ParseException { Index: src/test/org/apache/lucene/search/TestNot.java =================================================================== --- src/test/org/apache/lucene/search/TestNot.java (revision 582218) +++ src/test/org/apache/lucene/search/TestNot.java (working copy) @@ -17,7 +17,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.queryParser.QueryParser; @@ -31,7 +31,7 @@ * * @version $Revision$ */ -public class TestNot extends TestCase { +public class TestNot extends LuceneTestCase { public TestNot(String name) { super(name); } Index: src/test/org/apache/lucene/search/TestBoolean2.java =================================================================== --- src/test/org/apache/lucene/search/TestBoolean2.java (revision 582218) +++ src/test/org/apache/lucene/search/TestBoolean2.java (working copy) @@ -31,19 +31,20 @@ import org.apache.lucene.queryParser.QueryParser; import org.apache.lucene.queryParser.ParseException; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import java.util.Random; /** Test BooleanQuery2 against BooleanQuery by overriding the standard query parser. * This also tests the scoring order of BooleanQuery. */ -public class TestBoolean2 extends TestCase { +public class TestBoolean2 extends LuceneTestCase { private IndexSearcher searcher; public static final String field = "field"; public void setUp() throws Exception { + super.setUp(); RAMDirectory directory = new RAMDirectory(); IndexWriter writer= new IndexWriter(directory, new WhitespaceAnalyzer(), true); for (int i = 0; i < docFields.length; i++) { Index: src/test/org/apache/lucene/search/TestCachingWrapperFilter.java =================================================================== --- src/test/org/apache/lucene/search/TestCachingWrapperFilter.java (revision 582218) +++ src/test/org/apache/lucene/search/TestCachingWrapperFilter.java (working copy) @@ -17,14 +17,14 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.store.Directory; import org.apache.lucene.store.RAMDirectory; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.analysis.standard.StandardAnalyzer; -public class TestCachingWrapperFilter extends TestCase { +public class TestCachingWrapperFilter extends LuceneTestCase { public void testCachingWorks() throws Exception { Directory dir = new RAMDirectory(); IndexWriter writer = new IndexWriter(dir, new StandardAnalyzer(), true); Index: src/test/org/apache/lucene/search/TestPrefixFilter.java =================================================================== --- src/test/org/apache/lucene/search/TestPrefixFilter.java (revision 582218) +++ src/test/org/apache/lucene/search/TestPrefixFilter.java (working copy) @@ -17,7 +17,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.store.RAMDirectory; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.Term; @@ -31,7 +31,7 @@ * @author Yura Smolsky * @author yonik */ -public class TestPrefixFilter extends TestCase { +public class TestPrefixFilter extends LuceneTestCase { public void testPrefixFilter() throws Exception { RAMDirectory directory = new RAMDirectory(); Index: src/test/org/apache/lucene/search/function/FunctionTestSetup.java =================================================================== --- src/test/org/apache/lucene/search/function/FunctionTestSetup.java (revision 582218) +++ src/test/org/apache/lucene/search/function/FunctionTestSetup.java (working copy) @@ -26,12 +26,12 @@ import org.apache.lucene.store.Directory; import org.apache.lucene.store.RAMDirectory; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; /** * Setup for function tests */ -public abstract class FunctionTestSetup extends TestCase { +public abstract class FunctionTestSetup extends LuceneTestCase { /** * Actual score computation order is slightly different than assumptios @@ -76,12 +76,14 @@ /* @override */ protected void tearDown() throws Exception { super.tearDown(); + super.tearDown(); dir = null; anlzr = null; } /* @override */ protected void setUp() throws Exception { + super.setUp(); // prepare a small index with just a few documents. super.setUp(); dir = new RAMDirectory(); Index: src/test/org/apache/lucene/search/TestExplanations.java =================================================================== --- src/test/org/apache/lucene/search/TestExplanations.java (revision 582218) +++ src/test/org/apache/lucene/search/TestExplanations.java (working copy) @@ -32,7 +32,7 @@ import org.apache.lucene.queryParser.QueryParser; import org.apache.lucene.queryParser.ParseException; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import java.util.Random; import java.util.BitSet; @@ -49,7 +49,7 @@ * * @see "Subclasses for actual tests" */ -public class TestExplanations extends TestCase { +public class TestExplanations extends LuceneTestCase { protected IndexSearcher searcher; public static final String FIELD = "field"; @@ -57,10 +57,12 @@ new QueryParser(FIELD, new WhitespaceAnalyzer()); public void tearDown() throws Exception { + super.tearDown(); searcher.close(); } public void setUp() throws Exception { + super.setUp(); RAMDirectory directory = new RAMDirectory(); IndexWriter writer= new IndexWriter(directory, new WhitespaceAnalyzer(), true); for (int i = 0; i < docFields.length; i++) { Index: src/test/org/apache/lucene/search/TestBooleanQuery.java =================================================================== --- src/test/org/apache/lucene/search/TestBooleanQuery.java (revision 582218) +++ src/test/org/apache/lucene/search/TestBooleanQuery.java (working copy) @@ -17,10 +17,10 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.index.Term; -public class TestBooleanQuery extends TestCase { +public class TestBooleanQuery extends LuceneTestCase { public void testEquality() throws Exception { BooleanQuery bq1 = new BooleanQuery(); Index: src/test/org/apache/lucene/search/TestRemoteSearchable.java =================================================================== --- src/test/org/apache/lucene/search/TestRemoteSearchable.java (revision 582218) +++ src/test/org/apache/lucene/search/TestRemoteSearchable.java (working copy) @@ -17,7 +17,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.SimpleAnalyzer; import org.apache.lucene.document.*; import org.apache.lucene.index.IndexWriter; @@ -33,7 +33,7 @@ /** * @version $Id$ */ -public class TestRemoteSearchable extends TestCase { +public class TestRemoteSearchable extends LuceneTestCase { public TestRemoteSearchable(String name) { super(name); } Index: src/test/org/apache/lucene/search/TestThreadSafe.java =================================================================== --- src/test/org/apache/lucene/search/TestThreadSafe.java (revision 582218) +++ src/test/org/apache/lucene/search/TestThreadSafe.java (working copy) @@ -17,6 +17,7 @@ */ import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.store.Directory; import org.apache.lucene.store.RAMDirectory; import org.apache.lucene.index.IndexReader; @@ -32,7 +33,7 @@ * * @version $Id$ */ -public class TestThreadSafe extends TestCase { +public class TestThreadSafe extends LuceneTestCase { Random r = new Random(); Directory dir1; Directory dir2; Index: src/test/org/apache/lucene/search/TestPhraseQuery.java =================================================================== --- src/test/org/apache/lucene/search/TestPhraseQuery.java (revision 582218) +++ src/test/org/apache/lucene/search/TestPhraseQuery.java (working copy) @@ -17,7 +17,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.*; import org.apache.lucene.document.*; import org.apache.lucene.index.IndexWriter; @@ -34,7 +34,7 @@ * @see TestPositionIncrement * @author Erik Hatcher */ -public class TestPhraseQuery extends TestCase { +public class TestPhraseQuery extends LuceneTestCase { /** threshold for comparing floats */ public static final float SCORE_COMP_THRESH = 1e-6f; @@ -44,6 +44,7 @@ private RAMDirectory directory; public void setUp() throws Exception { + super.setUp(); directory = new RAMDirectory(); Analyzer analyzer = new Analyzer() { public TokenStream tokenStream(String fieldName, Reader reader) { @@ -80,6 +81,7 @@ } public void tearDown() throws Exception { + super.tearDown(); searcher.close(); directory.close(); } Index: src/test/org/apache/lucene/search/TestPositionIncrement.java =================================================================== --- src/test/org/apache/lucene/search/TestPositionIncrement.java (revision 582218) +++ src/test/org/apache/lucene/search/TestPositionIncrement.java (working copy) @@ -33,7 +33,7 @@ import java.io.Reader; import java.io.StringReader; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; /** * Term position unit test. @@ -41,7 +41,7 @@ * * @version $Revision$ */ -public class TestPositionIncrement extends TestCase { +public class TestPositionIncrement extends LuceneTestCase { public void testSetPosition() throws Exception { Analyzer analyzer = new Analyzer() { Index: src/test/org/apache/lucene/search/TestScorerPerf.java =================================================================== --- src/test/org/apache/lucene/search/TestScorerPerf.java (revision 582218) +++ src/test/org/apache/lucene/search/TestScorerPerf.java (working copy) @@ -1,6 +1,6 @@ package org.apache.lucene.search; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import java.util.Random; import java.util.BitSet; @@ -37,7 +37,7 @@ * * @version $Id$ */ -public class TestScorerPerf extends TestCase { +public class TestScorerPerf extends LuceneTestCase { Random r = new Random(0); boolean validate = true; // set to false when doing performance testing Index: src/test/org/apache/lucene/search/TestFuzzyQuery.java =================================================================== --- src/test/org/apache/lucene/search/TestFuzzyQuery.java (revision 582218) +++ src/test/org/apache/lucene/search/TestFuzzyQuery.java (working copy) @@ -19,7 +19,7 @@ import java.io.IOException; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.WhitespaceAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; @@ -32,7 +32,7 @@ * * @author Daniel Naber */ -public class TestFuzzyQuery extends TestCase { +public class TestFuzzyQuery extends LuceneTestCase { public void testFuzziness() throws Exception { RAMDirectory directory = new RAMDirectory(); Index: src/test/org/apache/lucene/search/TestRemoteCachingWrapperFilter.java =================================================================== --- src/test/org/apache/lucene/search/TestRemoteCachingWrapperFilter.java (revision 582218) +++ src/test/org/apache/lucene/search/TestRemoteCachingWrapperFilter.java (working copy) @@ -20,7 +20,7 @@ import java.rmi.Naming; import java.rmi.registry.LocateRegistry; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.SimpleAnalyzer; import org.apache.lucene.document.Document; @@ -34,7 +34,7 @@ * NOTE: This is copied from TestRemoteSearchable since it already had a remote index set up. * @author Matt Ericson */ -public class TestRemoteCachingWrapperFilter extends TestCase { +public class TestRemoteCachingWrapperFilter extends LuceneTestCase { public TestRemoteCachingWrapperFilter(String name) { super(name); } Index: src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java =================================================================== --- src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java (revision 582218) +++ src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java (working copy) @@ -19,6 +19,7 @@ import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.WhitespaceAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; @@ -33,7 +34,7 @@ /** Test that BooleanQuery.setMinimumNumberShouldMatch works. */ -public class TestBooleanMinShouldMatch extends TestCase { +public class TestBooleanMinShouldMatch extends LuceneTestCase { public Directory index; @@ -43,6 +44,9 @@ public void setUp() throws Exception { + super.setUp(); + + String[] data = new String [] { "A 1 2 3 4 5 6", "Z 4 5 6", @@ -325,9 +329,9 @@ // should be a superset to the unconstrained query. if (top2.totalHits > top1.totalHits) { TestCase.fail("Constrained results not a subset:\n" - + CheckHits.topdocsString(top1,0,0) - + CheckHits.topdocsString(top2,0,0) - + "for query:" + q2.toString()); + + CheckHits.topdocsString(top1,0,0) + + CheckHits.topdocsString(top2,0,0) + + "for query:" + q2.toString()); } for (int hit=0; hitAdapted to Lucene testcase by Paul Elschot. * @author appler@gmail.com */ -public class TestBooleanOr extends TestCase { +public class TestBooleanOr extends LuceneTestCase { private static String FIELD_T = "T"; private static String FIELD_C = "C"; @@ -134,6 +134,7 @@ protected void setUp() throws Exception { super.setUp(); + super.setUp(); // RAMDirectory rd = new RAMDirectory(); Index: src/test/org/apache/lucene/search/TestMultiThreadTermVectors.java =================================================================== --- src/test/org/apache/lucene/search/TestMultiThreadTermVectors.java (revision 582218) +++ src/test/org/apache/lucene/search/TestMultiThreadTermVectors.java (working copy) @@ -17,7 +17,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.SimpleAnalyzer; import org.apache.lucene.document.*; import org.apache.lucene.index.IndexReader; @@ -32,7 +32,7 @@ * * @version $rcs = ' $Id$ ' ; */ -public class TestMultiThreadTermVectors extends TestCase { +public class TestMultiThreadTermVectors extends LuceneTestCase { private RAMDirectory directory = new RAMDirectory(); public int numDocs = 100; public int numThreads = 3; @@ -42,6 +42,7 @@ } public void setUp() throws Exception { + super.setUp(); IndexWriter writer = new IndexWriter(directory, new SimpleAnalyzer(), true); //writer.setUseCompoundFile(false); Index: src/test/org/apache/lucene/search/TestDateFilter.java =================================================================== --- src/test/org/apache/lucene/search/TestDateFilter.java (revision 582218) +++ src/test/org/apache/lucene/search/TestDateFilter.java (working copy) @@ -17,7 +17,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.SimpleAnalyzer; import org.apache.lucene.document.DateTools; import org.apache.lucene.document.Document; @@ -35,7 +35,7 @@ * @version $Revision$ */ public class TestDateFilter - extends TestCase + extends LuceneTestCase { public TestDateFilter(String name) { Index: src/test/org/apache/lucene/search/TestMatchAllDocsQuery.java =================================================================== --- src/test/org/apache/lucene/search/TestMatchAllDocsQuery.java (revision 582218) +++ src/test/org/apache/lucene/search/TestMatchAllDocsQuery.java (working copy) @@ -25,14 +25,14 @@ import org.apache.lucene.index.Term; import org.apache.lucene.store.RAMDirectory; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; /** * Tests MatchAllDocsQuery. * * @author Daniel Naber */ -public class TestMatchAllDocsQuery extends TestCase { +public class TestMatchAllDocsQuery extends LuceneTestCase { public void testQuery() throws IOException { RAMDirectory dir = new RAMDirectory(); Index: src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java =================================================================== --- src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java (revision 582218) +++ src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java (working copy) @@ -18,7 +18,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.WhitespaceAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; @@ -35,7 +35,7 @@ * Test of the DisjunctionMaxQuery. * */ -public class TestDisjunctionMaxQuery extends TestCase{ +public class TestDisjunctionMaxQuery extends LuceneTestCase{ /** threshold for comparing floats */ public static final float SCORE_COMP_THRESH = 0.0000f; @@ -73,6 +73,8 @@ public void setUp() throws Exception { + super.setUp(); + index = new RAMDirectory(); IndexWriter writer = new IndexWriter(index, new WhitespaceAnalyzer(), Index: src/test/org/apache/lucene/search/TestSimilarity.java =================================================================== --- src/test/org/apache/lucene/search/TestSimilarity.java (revision 582218) +++ src/test/org/apache/lucene/search/TestSimilarity.java (working copy) @@ -17,7 +17,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import java.util.Collection; @@ -34,7 +34,7 @@ * * @version $Revision$ */ -public class TestSimilarity extends TestCase { +public class TestSimilarity extends LuceneTestCase { public TestSimilarity(String name) { super(name); } Index: src/test/org/apache/lucene/search/payloads/TestBoostingTermQuery.java =================================================================== --- src/test/org/apache/lucene/search/payloads/TestBoostingTermQuery.java (revision 582218) +++ src/test/org/apache/lucene/search/payloads/TestBoostingTermQuery.java (working copy) @@ -16,7 +16,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.*; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; @@ -32,7 +32,7 @@ import java.io.IOException; import java.io.Reader; -public class TestBoostingTermQuery extends TestCase { +public class TestBoostingTermQuery extends LuceneTestCase { private IndexSearcher searcher; private BoostingSimilarity similarity = new BoostingSimilarity(); private byte[] payloadField = new byte[]{1}; @@ -81,7 +81,8 @@ } } - protected void setUp() throws IOException { + protected void setUp() throws Exception { + super.setUp(); RAMDirectory directory = new RAMDirectory(); PayloadAnalyzer analyzer = new PayloadAnalyzer(); IndexWriter writer @@ -104,11 +105,6 @@ searcher.setSimilarity(similarity); } - - protected void tearDown() { - - } - public void test() throws IOException { BoostingTermQuery query = new BoostingTermQuery(new Term("field", "seventy")); TopDocs hits = searcher.search(query, null, 100); @@ -231,4 +227,4 @@ return freq == 0 ? 0 : 1; } } -} \ No newline at end of file +} Index: src/test/org/apache/lucene/search/TestSpanQueryFilter.java =================================================================== --- src/test/org/apache/lucene/search/TestSpanQueryFilter.java (revision 582218) +++ src/test/org/apache/lucene/search/TestSpanQueryFilter.java (working copy) @@ -16,7 +16,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.SimpleAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; @@ -32,20 +32,13 @@ import java.util.Iterator; import java.util.List; -public class TestSpanQueryFilter extends TestCase { +public class TestSpanQueryFilter extends LuceneTestCase { public TestSpanQueryFilter(String s) { super(s); } - protected void setUp() { - } - - protected void tearDown() { - - } - public void testFilterWorks() throws Exception { Directory dir = new RAMDirectory(); IndexWriter writer = new IndexWriter(dir, new SimpleAnalyzer(), true); @@ -78,4 +71,4 @@ } reader.close(); } -} \ No newline at end of file +} Index: src/test/org/apache/lucene/search/TestBooleanScorer.java =================================================================== --- src/test/org/apache/lucene/search/TestBooleanScorer.java (revision 582218) +++ src/test/org/apache/lucene/search/TestBooleanScorer.java (working copy) @@ -26,13 +26,13 @@ import org.apache.lucene.index.Term; import org.apache.lucene.store.RAMDirectory; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; /** * * @version $rcs = ' $Id$ ' ; */ -public class TestBooleanScorer extends TestCase +public class TestBooleanScorer extends LuceneTestCase { public TestBooleanScorer(String name) { Index: src/test/org/apache/lucene/search/spans/TestNearSpansOrdered.java =================================================================== --- src/test/org/apache/lucene/search/spans/TestNearSpansOrdered.java (revision 582218) +++ src/test/org/apache/lucene/search/spans/TestNearSpansOrdered.java (working copy) @@ -34,9 +34,9 @@ import org.apache.lucene.queryParser.QueryParser; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; -public class TestNearSpansOrdered extends TestCase { +public class TestNearSpansOrdered extends LuceneTestCase { protected IndexSearcher searcher; public static final String FIELD = "field"; @@ -44,10 +44,12 @@ new QueryParser(FIELD, new WhitespaceAnalyzer()); public void tearDown() throws Exception { + super.tearDown(); searcher.close(); } public void setUp() throws Exception { + super.setUp(); RAMDirectory directory = new RAMDirectory(); IndexWriter writer= new IndexWriter(directory, new WhitespaceAnalyzer(), true); for (int i = 0; i < docFields.length; i++) { Index: src/test/org/apache/lucene/search/spans/TestBasics.java =================================================================== --- src/test/org/apache/lucene/search/spans/TestBasics.java (revision 582218) +++ src/test/org/apache/lucene/search/spans/TestBasics.java (working copy) @@ -17,7 +17,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import java.io.IOException; @@ -44,10 +44,11 @@ * * @author Doug Cutting */ -public class TestBasics extends TestCase { +public class TestBasics extends LuceneTestCase { private IndexSearcher searcher; public void setUp() throws Exception { + super.setUp(); RAMDirectory directory = new RAMDirectory(); IndexWriter writer = new IndexWriter(directory, new SimpleAnalyzer(), true); Index: src/test/org/apache/lucene/search/spans/TestSpans.java =================================================================== --- src/test/org/apache/lucene/search/spans/TestSpans.java (revision 582218) +++ src/test/org/apache/lucene/search/spans/TestSpans.java (working copy) @@ -26,16 +26,17 @@ import org.apache.lucene.analysis.WhitespaceAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import java.io.IOException; -public class TestSpans extends TestCase { +public class TestSpans extends LuceneTestCase { private IndexSearcher searcher; public static final String field = "field"; public void setUp() throws Exception { + super.setUp(); RAMDirectory directory = new RAMDirectory(); IndexWriter writer= new IndexWriter(directory, new WhitespaceAnalyzer(), true); for (int i = 0; i < docFields.length; i++) { Index: src/test/org/apache/lucene/search/spans/TestSpansAdvanced.java =================================================================== --- src/test/org/apache/lucene/search/spans/TestSpansAdvanced.java (revision 582218) +++ src/test/org/apache/lucene/search/spans/TestSpansAdvanced.java (working copy) @@ -19,7 +19,7 @@ import java.io.IOException; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.document.Document; @@ -36,7 +36,7 @@ * * @author Reece Wilton */ -public class TestSpansAdvanced extends TestCase { +public class TestSpansAdvanced extends LuceneTestCase { // location to the index protected Directory mDirectory;; @@ -52,6 +52,7 @@ */ protected void setUp() throws Exception { super.setUp(); + super.setUp(); // create test index mDirectory = new RAMDirectory(); @@ -65,6 +66,7 @@ } protected void tearDown() throws Exception { + super.tearDown(); searcher.close(); mDirectory.close(); mDirectory = null; Index: src/test/org/apache/lucene/search/TestMultiSearcher.java =================================================================== --- src/test/org/apache/lucene/search/TestMultiSearcher.java (revision 582218) +++ src/test/org/apache/lucene/search/TestMultiSearcher.java (working copy) @@ -17,7 +17,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.KeywordAnalyzer; import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.document.Document; @@ -41,7 +41,7 @@ * * @version $Id$ */ -public class TestMultiSearcher extends TestCase +public class TestMultiSearcher extends LuceneTestCase { public TestMultiSearcher(String name) { Index: src/test/org/apache/lucene/search/TestDocBoost.java =================================================================== --- src/test/org/apache/lucene/search/TestDocBoost.java (revision 582218) +++ src/test/org/apache/lucene/search/TestDocBoost.java (working copy) @@ -17,7 +17,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.SimpleAnalyzer; import org.apache.lucene.document.*; import org.apache.lucene.index.IndexWriter; @@ -29,7 +29,7 @@ * * @version $Revision$ */ -public class TestDocBoost extends TestCase { +public class TestDocBoost extends LuceneTestCase { public TestDocBoost(String name) { super(name); } Index: src/test/org/apache/lucene/search/TestTermVectors.java =================================================================== --- src/test/org/apache/lucene/search/TestTermVectors.java (revision 582218) +++ src/test/org/apache/lucene/search/TestTermVectors.java (working copy) @@ -17,7 +17,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.SimpleAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; @@ -32,7 +32,7 @@ import java.util.Map; import java.util.SortedSet; -public class TestTermVectors extends TestCase { +public class TestTermVectors extends LuceneTestCase { private IndexSearcher searcher; private RAMDirectory directory = new RAMDirectory(); public TestTermVectors(String s) { @@ -40,6 +40,7 @@ } public void setUp() throws Exception { + super.setUp(); IndexWriter writer = new IndexWriter(directory, new SimpleAnalyzer(), true); //writer.setUseCompoundFile(true); @@ -69,10 +70,6 @@ searcher = new IndexSearcher(directory); } - protected void tearDown() { - - } - public void test() { assertTrue(searcher != null); } Index: src/test/org/apache/lucene/search/TestQueryTermVector.java =================================================================== --- src/test/org/apache/lucene/search/TestQueryTermVector.java (revision 582218) +++ src/test/org/apache/lucene/search/TestQueryTermVector.java (working copy) @@ -17,23 +17,16 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.WhitespaceAnalyzer; -public class TestQueryTermVector extends TestCase { +public class TestQueryTermVector extends LuceneTestCase { public TestQueryTermVector(String s) { super(s); } - protected void setUp() { - } - - protected void tearDown() { - - } - public void testConstructor() { String [] queryTerm = {"foo", "bar", "foo", "again", "foo", "bar", "go", "go", "go"}; //Items are sorted lexicographically Index: src/test/org/apache/lucene/search/TestMultiSearcherRanking.java =================================================================== --- src/test/org/apache/lucene/search/TestMultiSearcherRanking.java (revision 582218) +++ src/test/org/apache/lucene/search/TestMultiSearcherRanking.java (working copy) @@ -17,7 +17,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; @@ -35,7 +35,7 @@ * * @version $Id: TestMultiSearcher.java 150492 2004-09-06 22:01:49Z dnaber $ */ -public class TestMultiSearcherRanking extends TestCase { +public class TestMultiSearcherRanking extends LuceneTestCase { private final boolean verbose = false; // set to true to output hits private final String FIELD_NAME = "body"; @@ -111,6 +111,7 @@ * initializes multiSearcher and singleSearcher with the same document set */ protected void setUp() throws Exception { + super.setUp(); // create MultiSearcher from two seperate searchers Directory d1 = new RAMDirectory(); IndexWriter iw1 = new IndexWriter(d1, new StandardAnalyzer(), true); Index: src/test/org/apache/lucene/search/TestRangeQuery.java =================================================================== --- src/test/org/apache/lucene/search/TestRangeQuery.java (revision 582218) +++ src/test/org/apache/lucene/search/TestRangeQuery.java (working copy) @@ -24,18 +24,19 @@ import org.apache.lucene.index.Term; import org.apache.lucene.store.RAMDirectory; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import java.io.IOException; /** * @author goller */ -public class TestRangeQuery extends TestCase { +public class TestRangeQuery extends LuceneTestCase { private int docCount = 0; private RAMDirectory dir; - public void setUp() { + public void setUp() throws Exception { + super.setUp(); dir = new RAMDirectory(); } Index: src/test/org/apache/lucene/search/TestMultiPhraseQuery.java =================================================================== --- src/test/org/apache/lucene/search/TestMultiPhraseQuery.java (revision 582218) +++ src/test/org/apache/lucene/search/TestMultiPhraseQuery.java (working copy) @@ -28,7 +28,7 @@ import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import java.io.IOException; import java.util.LinkedList; @@ -39,7 +39,7 @@ * * @version $Id$ */ -public class TestMultiPhraseQuery extends TestCase +public class TestMultiPhraseQuery extends LuceneTestCase { public TestMultiPhraseQuery(String name) { super(name); Index: src/test/org/apache/lucene/search/TestBooleanPrefixQuery.java =================================================================== --- src/test/org/apache/lucene/search/TestBooleanPrefixQuery.java (revision 582218) +++ src/test/org/apache/lucene/search/TestBooleanPrefixQuery.java (working copy) @@ -17,7 +17,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; @@ -39,7 +39,7 @@ * @version $Id$ **/ -public class TestBooleanPrefixQuery extends TestCase { +public class TestBooleanPrefixQuery extends LuceneTestCase { public static void main(String[] args) { TestRunner.run(suite()); Index: src/test/org/apache/lucene/search/TestPrefixQuery.java =================================================================== --- src/test/org/apache/lucene/search/TestPrefixQuery.java (revision 582218) +++ src/test/org/apache/lucene/search/TestPrefixQuery.java (working copy) @@ -17,7 +17,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.store.RAMDirectory; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.Term; @@ -30,7 +30,7 @@ * * @author Erik Hatcher */ -public class TestPrefixQuery extends TestCase { +public class TestPrefixQuery extends LuceneTestCase { public void testPrefixQuery() throws Exception { RAMDirectory directory = new RAMDirectory(); Index: src/test/org/apache/lucene/search/TestTermScorer.java =================================================================== --- src/test/org/apache/lucene/search/TestTermScorer.java (revision 582218) +++ src/test/org/apache/lucene/search/TestTermScorer.java (working copy) @@ -21,7 +21,7 @@ import java.util.ArrayList; import java.util.List; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.WhitespaceAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; @@ -30,7 +30,7 @@ import org.apache.lucene.index.Term; import org.apache.lucene.store.RAMDirectory; -public class TestTermScorer extends TestCase +public class TestTermScorer extends LuceneTestCase { protected RAMDirectory directory; private static final String FIELD = "field"; @@ -45,8 +45,9 @@ super(s); } - protected void setUp() throws IOException + protected void setUp() throws Exception { + super.setUp(); directory = new RAMDirectory(); @@ -64,11 +65,6 @@ } - protected void tearDown() - { - - } - public void test() throws IOException { Index: src/test/org/apache/lucene/search/TestPhrasePrefixQuery.java =================================================================== --- src/test/org/apache/lucene/search/TestPhrasePrefixQuery.java (revision 582218) +++ src/test/org/apache/lucene/search/TestPhrasePrefixQuery.java (working copy) @@ -17,7 +17,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.SimpleAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; @@ -37,7 +37,7 @@ * @version $Id$ */ public class TestPhrasePrefixQuery - extends TestCase + extends LuceneTestCase { public TestPhrasePrefixQuery(String name) { Index: src/test/org/apache/lucene/search/TestSetNorm.java =================================================================== --- src/test/org/apache/lucene/search/TestSetNorm.java (revision 582218) +++ src/test/org/apache/lucene/search/TestSetNorm.java (working copy) @@ -17,7 +17,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.SimpleAnalyzer; import org.apache.lucene.document.*; import org.apache.lucene.index.IndexReader; @@ -30,7 +30,7 @@ * * @version $Revision$ */ -public class TestSetNorm extends TestCase { +public class TestSetNorm extends LuceneTestCase { public TestSetNorm(String name) { super(name); } Index: src/test/org/apache/lucene/search/TestWildcard.java =================================================================== --- src/test/org/apache/lucene/search/TestWildcard.java (revision 582218) +++ src/test/org/apache/lucene/search/TestWildcard.java (working copy) @@ -17,7 +17,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.SimpleAnalyzer; import org.apache.lucene.analysis.WhitespaceAnalyzer; import org.apache.lucene.document.Document; @@ -38,7 +38,7 @@ * */ public class TestWildcard - extends TestCase { + extends LuceneTestCase { public void testEquals() { WildcardQuery wq1 = new WildcardQuery(new Term("field", "b*a")); WildcardQuery wq2 = new WildcardQuery(new Term("field", "b*a")); Index: src/test/org/apache/lucene/search/BaseTestRangeFilter.java =================================================================== --- src/test/org/apache/lucene/search/BaseTestRangeFilter.java (revision 582218) +++ src/test/org/apache/lucene/search/BaseTestRangeFilter.java (working copy) @@ -19,7 +19,7 @@ import java.util.Random; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.SimpleAnalyzer; import org.apache.lucene.document.Document; @@ -27,7 +27,7 @@ import org.apache.lucene.index.IndexWriter; import org.apache.lucene.store.RAMDirectory; -public class BaseTestRangeFilter extends TestCase { +public class BaseTestRangeFilter extends LuceneTestCase { public static final boolean F = false; public static final boolean T = true; Index: src/test/org/apache/lucene/index/TestConcurrentMergeScheduler.java =================================================================== --- src/test/org/apache/lucene/index/TestConcurrentMergeScheduler.java (revision 582218) +++ src/test/org/apache/lucene/index/TestConcurrentMergeScheduler.java (working copy) @@ -28,12 +28,12 @@ import org.apache.lucene.util._TestUtil; import org.apache.lucene.util.English; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import java.io.IOException; import java.io.File; -public class TestConcurrentMergeScheduler extends TestCase { +public class TestConcurrentMergeScheduler extends LuceneTestCase { private static final Analyzer ANALYZER = new SimpleAnalyzer(); @@ -94,8 +94,6 @@ } } - assertEquals(0, cms.getExceptions().size()); - writer.close(); IndexReader reader = IndexReader.open(directory); assertEquals(200, reader.numDocs()); @@ -139,8 +137,6 @@ writer.flush(); } - assertEquals(0, cms.getExceptions().size()); - writer.close(); IndexReader reader = IndexReader.open(directory); // Verify that we did not lose any deletes... @@ -171,7 +167,6 @@ writer.close(); TestIndexWriter.assertNoUnreferencedFiles(directory, "testNoExtraFiles autoCommit=" + autoCommit); - assertEquals(0, cms.getExceptions().size()); // Reopen writer = new IndexWriter(directory, autoCommit, ANALYZER, false); @@ -211,7 +206,6 @@ } writer.close(false); - assertEquals(0, cms.getExceptions().size()); IndexReader reader = IndexReader.open(directory); assertEquals((1+iter)*181, reader.numDocs()); Index: src/test/org/apache/lucene/index/TestThreadedOptimize.java =================================================================== --- src/test/org/apache/lucene/index/TestThreadedOptimize.java (revision 582218) +++ src/test/org/apache/lucene/index/TestThreadedOptimize.java (working copy) @@ -27,12 +27,12 @@ import org.apache.lucene.util._TestUtil; import org.apache.lucene.util.English; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import java.io.IOException; import java.io.File; -public class TestThreadedOptimize extends TestCase { +public class TestThreadedOptimize extends LuceneTestCase { private static final Analyzer ANALYZER = new SimpleAnalyzer(); Index: src/test/org/apache/lucene/index/TestIndexWriterMergePolicy.java =================================================================== --- src/test/org/apache/lucene/index/TestIndexWriterMergePolicy.java (revision 582218) +++ src/test/org/apache/lucene/index/TestIndexWriterMergePolicy.java (working copy) @@ -26,9 +26,9 @@ import org.apache.lucene.store.RAMDirectory; import org.apache.lucene.util._TestUtil; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; -public class TestIndexWriterMergePolicy extends TestCase { +public class TestIndexWriterMergePolicy extends LuceneTestCase { // Test the normal case public void testNormalCase() throws IOException { Index: src/test/org/apache/lucene/index/TestDoc.java =================================================================== --- src/test/org/apache/lucene/index/TestDoc.java (revision 582218) +++ src/test/org/apache/lucene/index/TestDoc.java (working copy) @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import junit.framework.TestSuite; import junit.textui.TestRunner; @@ -37,7 +37,7 @@ * * @version $Id$ */ -public class TestDoc extends TestCase { +public class TestDoc extends LuceneTestCase { /** Main for running test case by itself. */ public static void main(String args[]) { @@ -53,7 +53,8 @@ /** Set the test case. This test case needs * a few text files created in the current working directory. */ - public void setUp() throws IOException { + public void setUp() throws Exception { + super.setUp(); workDir = new File(System.getProperty("tempDir"),"TestDoc"); workDir.mkdirs(); Index: src/test/org/apache/lucene/index/TestParallelTermEnum.java =================================================================== --- src/test/org/apache/lucene/index/TestParallelTermEnum.java (revision 582218) +++ src/test/org/apache/lucene/index/TestParallelTermEnum.java (working copy) @@ -19,7 +19,7 @@ import java.io.IOException; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.SimpleAnalyzer; import org.apache.lucene.document.Document; @@ -28,12 +28,13 @@ import org.apache.lucene.document.Field.Store; import org.apache.lucene.store.RAMDirectory; -public class TestParallelTermEnum extends TestCase { +public class TestParallelTermEnum extends LuceneTestCase { private IndexReader ir1; private IndexReader ir2; protected void setUp() throws Exception { super.setUp(); + super.setUp(); Document doc; RAMDirectory rd1 = new RAMDirectory(); @@ -67,6 +68,7 @@ protected void tearDown() throws Exception { super.tearDown(); + super.tearDown(); ir1.close(); ir2.close(); Index: src/test/org/apache/lucene/index/TestAtomicUpdate.java =================================================================== --- src/test/org/apache/lucene/index/TestAtomicUpdate.java (revision 582218) +++ src/test/org/apache/lucene/index/TestAtomicUpdate.java (working copy) @@ -25,12 +25,12 @@ import org.apache.lucene.queryParser.*; import org.apache.lucene.util._TestUtil; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import java.util.Random; import java.io.File; -public class TestAtomicUpdate extends TestCase { +public class TestAtomicUpdate extends LuceneTestCase { private static final Analyzer ANALYZER = new SimpleAnalyzer(); private static final Random RANDOM = new Random(); Index: src/test/org/apache/lucene/index/TestSegmentTermEnum.java =================================================================== --- src/test/org/apache/lucene/index/TestSegmentTermEnum.java (revision 582218) +++ src/test/org/apache/lucene/index/TestSegmentTermEnum.java (working copy) @@ -19,7 +19,7 @@ import java.io.IOException; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.WhitespaceAnalyzer; import org.apache.lucene.document.Document; @@ -34,7 +34,7 @@ /** * @author goller */ -public class TestSegmentTermEnum extends TestCase +public class TestSegmentTermEnum extends LuceneTestCase { Directory dir = new RAMDirectory(); Index: src/test/org/apache/lucene/index/TestFieldInfos.java =================================================================== --- src/test/org/apache/lucene/index/TestFieldInfos.java (revision 582218) +++ src/test/org/apache/lucene/index/TestFieldInfos.java (working copy) @@ -17,7 +17,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.document.Document; import org.apache.lucene.store.RAMDirectory; import org.apache.lucene.store.IndexOutput; @@ -26,7 +26,7 @@ //import org.cnlp.utils.properties.ResourceBundleHelper; -public class TestFieldInfos extends TestCase { +public class TestFieldInfos extends LuceneTestCase { private Document testDoc = new Document(); @@ -34,13 +34,11 @@ super(s); } - protected void setUp() { + protected void setUp() throws Exception { + super.setUp(); DocHelper.setupDoc(testDoc); } - protected void tearDown() { - } - public void test() throws IOException { //Positive test of FieldInfos assertTrue(testDoc != null); Index: src/test/org/apache/lucene/index/TestPositionBasedTermVectorMapper.java =================================================================== --- src/test/org/apache/lucene/index/TestPositionBasedTermVectorMapper.java (revision 582218) +++ src/test/org/apache/lucene/index/TestPositionBasedTermVectorMapper.java (working copy) @@ -15,14 +15,14 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import java.io.IOException; import java.util.BitSet; import java.util.Iterator; import java.util.Map; -public class TestPositionBasedTermVectorMapper extends TestCase { +public class TestPositionBasedTermVectorMapper extends LuceneTestCase { protected String[] tokens; protected int[][] thePositions; protected TermVectorOffsetInfo[][] offsets; @@ -33,7 +33,8 @@ super(s); } - protected void setUp() { + protected void setUp() throws Exception { + super.setUp(); tokens = new String[]{"here", "is", "some", "text", "to", "test", "extra"}; thePositions = new int[tokens.length][]; offsets = new TermVectorOffsetInfo[tokens.length][]; @@ -57,10 +58,6 @@ offsets[tokens.length - 1][0] = new TermVectorOffsetInfo(0, 1); } - protected void tearDown() { - - } - public void test() throws IOException { PositionBasedTermVectorMapper mapper = new PositionBasedTermVectorMapper(); @@ -104,4 +101,4 @@ -} \ No newline at end of file +} Index: src/test/org/apache/lucene/index/TestCompoundFile.java =================================================================== --- src/test/org/apache/lucene/index/TestCompoundFile.java (revision 582218) +++ src/test/org/apache/lucene/index/TestCompoundFile.java (working copy) @@ -20,7 +20,7 @@ import java.io.IOException; import java.io.File; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import junit.framework.TestSuite; import junit.textui.TestRunner; import org.apache.lucene.store.IndexOutput; @@ -35,7 +35,7 @@ * * @version $Id$ */ -public class TestCompoundFile extends TestCase +public class TestCompoundFile extends LuceneTestCase { /** Main for running test case by itself. */ public static void main(String args[]) { @@ -58,7 +58,8 @@ private Directory dir; - public void setUp() throws IOException { + public void setUp() throws Exception { + super.setUp(); File file = new File(System.getProperty("tempDir"), "testIndex"); _TestUtil.rmDir(file); dir = FSDirectory.getDirectory(file); Index: src/test/org/apache/lucene/index/TestIndexInput.java =================================================================== --- src/test/org/apache/lucene/index/TestIndexInput.java (revision 582218) +++ src/test/org/apache/lucene/index/TestIndexInput.java (working copy) @@ -17,12 +17,12 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.store.IndexInput; import java.io.IOException; -public class TestIndexInput extends TestCase { +public class TestIndexInput extends LuceneTestCase { public void testRead() throws IOException { IndexInput is = new MockIndexInput(new byte[]{(byte) 0x80, 0x01, (byte) 0xFF, 0x7F, Index: src/test/org/apache/lucene/index/TestIndexWriterDelete.java =================================================================== --- src/test/org/apache/lucene/index/TestIndexWriterDelete.java (revision 582218) +++ src/test/org/apache/lucene/index/TestIndexWriterDelete.java (working copy) @@ -21,7 +21,7 @@ import java.util.Arrays; import java.lang.StackTraceElement; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.WhitespaceAnalyzer; import org.apache.lucene.document.Document; @@ -33,7 +33,7 @@ import org.apache.lucene.store.MockRAMDirectory; import org.apache.lucene.store.RAMDirectory; -public class TestIndexWriterDelete extends TestCase { +public class TestIndexWriterDelete extends LuceneTestCase { // test the simple case public void testSimpleCase() throws IOException { Index: src/test/org/apache/lucene/index/TestFieldsReader.java =================================================================== --- src/test/org/apache/lucene/index/TestFieldsReader.java (revision 582218) +++ src/test/org/apache/lucene/index/TestFieldsReader.java (working copy) @@ -17,7 +17,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.WhitespaceAnalyzer; import org.apache.lucene.document.*; import org.apache.lucene.search.Similarity; @@ -30,7 +30,7 @@ import java.io.IOException; import java.util.*; -public class TestFieldsReader extends TestCase { +public class TestFieldsReader extends LuceneTestCase { private RAMDirectory dir = new RAMDirectory(); private Document testDoc = new Document(); private FieldInfos fieldInfos = null; @@ -41,7 +41,8 @@ super(s); } - protected void setUp() throws IOException { + protected void setUp() throws Exception { + super.setUp(); fieldInfos = new FieldInfos(); DocHelper.setupDoc(testDoc); fieldInfos.add(testDoc); Index: src/test/org/apache/lucene/index/TestIndexReader.java =================================================================== --- src/test/org/apache/lucene/index/TestIndexReader.java (revision 582218) +++ src/test/org/apache/lucene/index/TestIndexReader.java (working copy) @@ -18,7 +18,7 @@ */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import junit.framework.TestSuite; import junit.textui.TestRunner; import org.apache.lucene.analysis.WhitespaceAnalyzer; @@ -36,7 +36,7 @@ import java.io.IOException; import java.util.*; -public class TestIndexReader extends TestCase +public class TestIndexReader extends LuceneTestCase { /** Main for running test case by itself. */ public static void main(String args[]) { Index: src/test/org/apache/lucene/index/TestWordlistLoader.java =================================================================== --- src/test/org/apache/lucene/index/TestWordlistLoader.java (revision 582218) +++ src/test/org/apache/lucene/index/TestWordlistLoader.java (working copy) @@ -22,11 +22,11 @@ import java.io.StringReader; import java.util.HashSet; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.WordlistLoader; -public class TestWordlistLoader extends TestCase { +public class TestWordlistLoader extends LuceneTestCase { public void testWordlistLoading() throws IOException { String s = "ONE\n two \nthree"; Index: src/test/org/apache/lucene/index/TestTermVectorsReader.java =================================================================== --- src/test/org/apache/lucene/index/TestTermVectorsReader.java (revision 582218) +++ src/test/org/apache/lucene/index/TestTermVectorsReader.java (working copy) @@ -17,7 +17,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.store.MockRAMDirectory; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.TokenStream; @@ -32,7 +32,7 @@ import java.util.Map; import java.util.SortedSet; -public class TestTermVectorsReader extends TestCase { +public class TestTermVectorsReader extends LuceneTestCase { //Must be lexicographically sorted, will do in setup, versus trying to maintain here private String[] testFields = {"f1", "f2", "f3", "f4"}; private boolean[] testFieldsStorePos = {true, false, true, false}; @@ -61,7 +61,8 @@ TestToken[] tokens = new TestToken[testTerms.length * TERM_FREQ]; - protected void setUp() throws IOException { + protected void setUp() throws Exception { + super.setUp(); /* for (int i = 0; i < testFields.length; i++) { fieldInfos.add(testFields[i], true, true, testFieldsStorePos[i], testFieldsStoreOff[i]); @@ -141,10 +142,6 @@ } } - protected void tearDown() { - - } - public void test() { //Check to see the files were created properly in setup assertTrue(dir.fileExists(seg + "." + IndexFileNames.VECTORS_DOCUMENTS_EXTENSION)); Index: src/test/org/apache/lucene/index/TestFilterIndexReader.java =================================================================== --- src/test/org/apache/lucene/index/TestFilterIndexReader.java (revision 582218) +++ src/test/org/apache/lucene/index/TestFilterIndexReader.java (working copy) @@ -18,7 +18,7 @@ */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import junit.framework.TestSuite; import junit.textui.TestRunner; @@ -30,7 +30,7 @@ import java.io.IOException; -public class TestFilterIndexReader extends TestCase { +public class TestFilterIndexReader extends LuceneTestCase { private static class TestReader extends FilterIndexReader { Index: src/test/org/apache/lucene/index/TestMultiSegmentReader.java =================================================================== --- src/test/org/apache/lucene/index/TestMultiSegmentReader.java (revision 582218) +++ src/test/org/apache/lucene/index/TestMultiSegmentReader.java (working copy) @@ -17,7 +17,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.document.Document; @@ -27,7 +27,7 @@ import java.io.IOException; -public class TestMultiSegmentReader extends TestCase { +public class TestMultiSegmentReader extends LuceneTestCase { protected Directory dir; private Document doc1; private Document doc2; @@ -39,7 +39,8 @@ super(s); } - protected void setUp() throws IOException { + protected void setUp() throws Exception { + super.setUp(); dir = new RAMDirectory(); doc1 = new Document(); doc2 = new Document(); @@ -63,7 +64,7 @@ return reader; } - public void test() throws IOException { + public void test() throws Exception { setUp(); doTestDocument(); doTestUndeleteAll(); Index: src/test/org/apache/lucene/index/TestSegmentTermDocs.java =================================================================== --- src/test/org/apache/lucene/index/TestSegmentTermDocs.java (revision 582218) +++ src/test/org/apache/lucene/index/TestSegmentTermDocs.java (working copy) @@ -17,7 +17,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.store.RAMDirectory; import org.apache.lucene.store.Directory; import org.apache.lucene.analysis.WhitespaceAnalyzer; @@ -26,7 +26,7 @@ import java.io.IOException; -public class TestSegmentTermDocs extends TestCase { +public class TestSegmentTermDocs extends LuceneTestCase { private Document testDoc = new Document(); private Directory dir = new RAMDirectory(); private SegmentInfo info; @@ -35,16 +35,12 @@ super(s); } - protected void setUp() throws IOException { + protected void setUp() throws Exception { + super.setUp(); DocHelper.setupDoc(testDoc); info = DocHelper.writeDoc(dir, testDoc); } - - protected void tearDown() { - - } - public void test() { assertTrue(dir != null); } Index: src/test/org/apache/lucene/index/TestSegmentMerger.java =================================================================== --- src/test/org/apache/lucene/index/TestSegmentMerger.java (revision 582218) +++ src/test/org/apache/lucene/index/TestSegmentMerger.java (working copy) @@ -17,7 +17,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.store.Directory; import org.apache.lucene.store.RAMDirectory; import org.apache.lucene.document.Document; @@ -25,7 +25,7 @@ import java.io.IOException; import java.util.Collection; -public class TestSegmentMerger extends TestCase { +public class TestSegmentMerger extends LuceneTestCase { //The variables for the new merged segment private Directory mergedDir = new RAMDirectory(); private String mergedSegment = "test"; @@ -43,7 +43,8 @@ super(s); } - protected void setUp() throws IOException { + protected void setUp() throws Exception { + super.setUp(); DocHelper.setupDoc(doc1); SegmentInfo info1 = DocHelper.writeDoc(merge1Dir, doc1); DocHelper.setupDoc(doc2); Index: src/test/org/apache/lucene/index/TestIndexWriter.java =================================================================== --- src/test/org/apache/lucene/index/TestIndexWriter.java (revision 582218) +++ src/test/org/apache/lucene/index/TestIndexWriter.java (working copy) @@ -22,7 +22,7 @@ import java.util.Arrays; import java.util.Random; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.WhitespaceAnalyzer; import org.apache.lucene.analysis.standard.StandardAnalyzer; @@ -50,7 +50,7 @@ * * @version $Id$ */ -public class TestIndexWriter extends TestCase +public class TestIndexWriter extends LuceneTestCase { public void testDocCount() throws IOException { Index: src/test/org/apache/lucene/index/TestMultiLevelSkipList.java =================================================================== --- src/test/org/apache/lucene/index/TestMultiLevelSkipList.java (revision 582218) +++ src/test/org/apache/lucene/index/TestMultiLevelSkipList.java (working copy) @@ -20,7 +20,7 @@ import java.io.IOException; import java.io.Reader; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.LowerCaseTokenizer; @@ -42,7 +42,7 @@ * testcases. * */ -public class TestMultiLevelSkipList extends TestCase { +public class TestMultiLevelSkipList extends LuceneTestCase { public void testSimpleSkip() throws IOException { RAMDirectory dir = new RAMDirectory(); IndexWriter writer = new IndexWriter(dir, new PayloadAnalyzer(), true); Index: src/test/org/apache/lucene/index/TestTerm.java =================================================================== --- src/test/org/apache/lucene/index/TestTerm.java (revision 582218) +++ src/test/org/apache/lucene/index/TestTerm.java (working copy) @@ -17,9 +17,9 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; -public class TestTerm extends TestCase { +public class TestTerm extends LuceneTestCase { public void testEquals() { final Term base = new Term("same", "same"); Index: src/test/org/apache/lucene/index/TestStressIndexing.java =================================================================== --- src/test/org/apache/lucene/index/TestStressIndexing.java (revision 582218) +++ src/test/org/apache/lucene/index/TestStressIndexing.java (working copy) @@ -24,12 +24,12 @@ import org.apache.lucene.search.*; import org.apache.lucene.queryParser.*; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import java.util.Random; import java.io.File; -public class TestStressIndexing extends TestCase { +public class TestStressIndexing extends LuceneTestCase { private static final Analyzer ANALYZER = new SimpleAnalyzer(); private static final Random RANDOM = new Random(); Index: src/test/org/apache/lucene/index/TestTermdocPerf.java =================================================================== --- src/test/org/apache/lucene/index/TestTermdocPerf.java (revision 582218) +++ src/test/org/apache/lucene/index/TestTermdocPerf.java (working copy) @@ -17,7 +17,7 @@ */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.store.Directory; import org.apache.lucene.store.RAMDirectory; import org.apache.lucene.analysis.Analyzer; @@ -49,7 +49,7 @@ } -public class TestTermdocPerf extends TestCase { +public class TestTermdocPerf extends LuceneTestCase { void addDocs(Directory dir, final int ndocs, String field, final String val, final int maxTF, final float percentDocs) throws IOException { final Random random = new Random(0); Index: src/test/org/apache/lucene/index/TestDocumentWriter.java =================================================================== --- src/test/org/apache/lucene/index/TestDocumentWriter.java (revision 582218) +++ src/test/org/apache/lucene/index/TestDocumentWriter.java (working copy) @@ -17,7 +17,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.SimpleAnalyzer; import org.apache.lucene.analysis.Token; @@ -34,24 +34,20 @@ import java.util.Arrays; -public class TestDocumentWriter extends TestCase { +public class TestDocumentWriter extends LuceneTestCase { private RAMDirectory dir; public TestDocumentWriter(String s) { super(s); } - protected void setUp() { + protected void setUp() throws Exception { + super.setUp(); dir = new RAMDirectory(); } - protected void tearDown() { - - } - public void test() { assertTrue(dir != null); - } public void testAddDocument() throws Exception { Index: src/test/org/apache/lucene/index/store/TestRAMDirectory.java =================================================================== --- src/test/org/apache/lucene/index/store/TestRAMDirectory.java (revision 582218) +++ src/test/org/apache/lucene/index/store/TestRAMDirectory.java (working copy) @@ -24,7 +24,7 @@ import java.io.ByteArrayOutputStream; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.WhitespaceAnalyzer; import org.apache.lucene.document.Document; @@ -47,7 +47,7 @@ * * @version $Id: RAMDirectory.java 150537 2004-09-28 22:45:26 +0200 (Di, 28 Sep 2004) cutting $ */ -public class TestRAMDirectory extends TestCase { +public class TestRAMDirectory extends LuceneTestCase { private File indexDir = null; @@ -55,7 +55,8 @@ private final int docsToAdd = 500; // setup the index - public void setUp () throws IOException { + public void setUp () throws Exception { + super.setUp(); String tempDir = System.getProperty("java.io.tmpdir"); if (tempDir == null) throw new IOException("java.io.tmpdir undefined, cannot run test"); @@ -206,7 +207,8 @@ assertTrue("contains more then just header", headerSize < bos.size()); } - public void tearDown() { + public void tearDown() throws Exception { + super.tearDown(); // cleanup if (indexDir != null && indexDir.exists()) { rmDir (indexDir); Index: src/test/org/apache/lucene/index/TestPayloads.java =================================================================== --- src/test/org/apache/lucene/index/TestPayloads.java (revision 582218) +++ src/test/org/apache/lucene/index/TestPayloads.java (working copy) @@ -26,7 +26,7 @@ import java.util.Map; import java.util.Random; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.Token; @@ -41,7 +41,7 @@ import org.apache.lucene.store.RAMDirectory; -public class TestPayloads extends TestCase { +public class TestPayloads extends LuceneTestCase { // Simple tests to test the Payload class public void testPayload() throws Exception { Index: src/test/org/apache/lucene/index/TestIndexFileDeleter.java =================================================================== --- src/test/org/apache/lucene/index/TestIndexFileDeleter.java (revision 582218) +++ src/test/org/apache/lucene/index/TestIndexFileDeleter.java (working copy) @@ -17,7 +17,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import java.util.Vector; import java.util.Arrays; import java.io.ByteArrayOutputStream; @@ -44,7 +44,7 @@ against it, and add documents to it. */ -public class TestIndexFileDeleter extends TestCase +public class TestIndexFileDeleter extends LuceneTestCase { public void testDeleteLeftoverFiles() throws IOException { Index: src/test/org/apache/lucene/index/TestLazyBug.java =================================================================== --- src/test/org/apache/lucene/index/TestLazyBug.java (revision 582218) +++ src/test/org/apache/lucene/index/TestLazyBug.java (working copy) @@ -17,7 +17,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.SimpleAnalyzer; import org.apache.lucene.document.*; @@ -32,7 +32,7 @@ * Test demonstrating EOF bug on the last field of the last doc * if other docs have allready been accessed. */ -public class TestLazyBug extends TestCase { +public class TestLazyBug extends LuceneTestCase { public static int BASE_SEED = 13; Index: src/test/org/apache/lucene/index/TestIndexWriterMerging.java =================================================================== --- src/test/org/apache/lucene/index/TestIndexWriterMerging.java (revision 582218) +++ src/test/org/apache/lucene/index/TestIndexWriterMerging.java (working copy) @@ -20,12 +20,12 @@ import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import java.io.IOException; -public class TestIndexWriterMerging extends TestCase +public class TestIndexWriterMerging extends LuceneTestCase { /** Index: src/test/org/apache/lucene/index/TestIndexWriterLockRelease.java =================================================================== --- src/test/org/apache/lucene/index/TestIndexWriterLockRelease.java (revision 582218) +++ src/test/org/apache/lucene/index/TestIndexWriterLockRelease.java (working copy) @@ -20,7 +20,7 @@ import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.index.IndexWriter; /** @@ -32,10 +32,11 @@ * @version $Id$ */ -public class TestIndexWriterLockRelease extends TestCase { +public class TestIndexWriterLockRelease extends LuceneTestCase { private java.io.File __test_dir; - public void setUp() throws IOException { + public void setUp() throws Exception { + super.setUp(); if (this.__test_dir == null) { String tmp_dir = System.getProperty("java.io.tmpdir", "tmp"); this.__test_dir = new File(tmp_dir, "testIndexWriter"); @@ -51,7 +52,8 @@ } } - public void tearDown() throws IOException { + public void tearDown() throws Exception { + super.tearDown(); if (this.__test_dir != null) { File[] files = this.__test_dir.listFiles(); Index: src/test/org/apache/lucene/index/TestParallelReader.java =================================================================== --- src/test/org/apache/lucene/index/TestParallelReader.java (revision 582218) +++ src/test/org/apache/lucene/index/TestParallelReader.java (working copy) @@ -21,7 +21,7 @@ import java.util.Arrays; import java.util.Collection; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.document.Document; @@ -38,12 +38,13 @@ import org.apache.lucene.store.RAMDirectory; import org.apache.lucene.store.MockRAMDirectory; -public class TestParallelReader extends TestCase { +public class TestParallelReader extends LuceneTestCase { private Searcher parallel; private Searcher single; protected void setUp() throws Exception { + super.setUp(); single = single(); parallel = parallel(); } Index: src/test/org/apache/lucene/index/TestDeletionPolicy.java =================================================================== --- src/test/org/apache/lucene/index/TestDeletionPolicy.java (revision 582218) +++ src/test/org/apache/lucene/index/TestDeletionPolicy.java (working copy) @@ -17,7 +17,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import java.io.IOException; @@ -40,7 +40,7 @@ against it, and add documents to it. */ -public class TestDeletionPolicy extends TestCase +public class TestDeletionPolicy extends LuceneTestCase { private void verifyCommitOrder(List commits) { long last = SegmentInfos.generationFromSegmentsFileName(((IndexCommitPoint) commits.get(0)).getSegmentsFileName()); Index: src/test/org/apache/lucene/index/TestSegmentReader.java =================================================================== --- src/test/org/apache/lucene/index/TestSegmentReader.java (revision 582218) +++ src/test/org/apache/lucene/index/TestSegmentReader.java (working copy) @@ -22,14 +22,14 @@ import java.util.Iterator; import java.util.List; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.document.Document; import org.apache.lucene.document.Fieldable; import org.apache.lucene.search.DefaultSimilarity; import org.apache.lucene.store.RAMDirectory; -public class TestSegmentReader extends TestCase { +public class TestSegmentReader extends LuceneTestCase { private RAMDirectory dir = new RAMDirectory(); private Document testDoc = new Document(); private SegmentReader reader = null; @@ -39,16 +39,13 @@ } //TODO: Setup the reader w/ multiple documents - protected void setUp() throws IOException { + protected void setUp() throws Exception { + super.setUp(); DocHelper.setupDoc(testDoc); SegmentInfo info = DocHelper.writeDoc(dir, testDoc); reader = SegmentReader.get(info); } - protected void tearDown() { - - } - public void test() { assertTrue(dir != null); assertTrue(reader != null); Index: src/test/org/apache/lucene/index/TestAddIndexesNoOptimize.java =================================================================== --- src/test/org/apache/lucene/index/TestAddIndexesNoOptimize.java (revision 582218) +++ src/test/org/apache/lucene/index/TestAddIndexesNoOptimize.java (working copy) @@ -19,7 +19,7 @@ import java.io.IOException; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.WhitespaceAnalyzer; import org.apache.lucene.document.Document; @@ -29,7 +29,7 @@ import org.apache.lucene.store.Directory; import org.apache.lucene.store.RAMDirectory; -public class TestAddIndexesNoOptimize extends TestCase { +public class TestAddIndexesNoOptimize extends LuceneTestCase { public void testSimpleCase() throws IOException { // main directory Directory dir = new RAMDirectory(); Index: src/test/org/apache/lucene/index/TestIndexModifier.java =================================================================== --- src/test/org/apache/lucene/index/TestIndexModifier.java (revision 582218) +++ src/test/org/apache/lucene/index/TestIndexModifier.java (working copy) @@ -17,7 +17,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.SimpleAnalyzer; import org.apache.lucene.analysis.standard.StandardAnalyzer; @@ -42,7 +42,7 @@ * @author Daniel Naber * @deprecated */ -public class TestIndexModifier extends TestCase { +public class TestIndexModifier extends LuceneTestCase { private int docCount = 0; Index: src/test/org/apache/lucene/index/TestBackwardsCompatibility.java =================================================================== --- src/test/org/apache/lucene/index/TestBackwardsCompatibility.java (revision 582218) +++ src/test/org/apache/lucene/index/TestBackwardsCompatibility.java (working copy) @@ -17,7 +17,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import java.util.Vector; import java.util.Arrays; import java.io.ByteArrayOutputStream; @@ -42,7 +42,7 @@ against it, and add documents to it. */ -public class TestBackwardsCompatibility extends TestCase +public class TestBackwardsCompatibility extends LuceneTestCase { // Uncomment these cases & run in a pre-lockless checkout Index: src/test/org/apache/lucene/index/TestLazyProxSkipping.java =================================================================== --- src/test/org/apache/lucene/index/TestLazyProxSkipping.java (revision 582218) +++ src/test/org/apache/lucene/index/TestLazyProxSkipping.java (working copy) @@ -30,13 +30,13 @@ import org.apache.lucene.store.IndexInput; import org.apache.lucene.store.RAMDirectory; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; /** * Tests lazy skipping on the proximity file. * */ -public class TestLazyProxSkipping extends TestCase { +public class TestLazyProxSkipping extends LuceneTestCase { private Searcher searcher; private int seeksCounter = 0; Index: src/test/org/apache/lucene/index/TestNorms.java =================================================================== --- src/test/org/apache/lucene/index/TestNorms.java (revision 582218) +++ src/test/org/apache/lucene/index/TestNorms.java (working copy) @@ -17,7 +17,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.standard.StandardAnalyzer; @@ -38,7 +38,7 @@ * Test that norms info is preserved during index life - including * separate norms, addDocument, addIndexes, optimize. */ -public class TestNorms extends TestCase { +public class TestNorms extends LuceneTestCase { private class SimilarityOne extends DefaultSimilarity { public float lengthNorm(String fieldName, int numTerms) { @@ -60,14 +60,12 @@ super(s); } - protected void setUp() throws IOException { + protected void setUp() throws Exception { + super.setUp(); similarityOne = new SimilarityOne(); anlzr = new StandardAnalyzer(); } - protected void tearDown() throws IOException { - } - /** * Test that norms values are preserved as the index is maintained. * Including separate norms. Index: src/test/org/apache/lucene/TestSearchForDuplicates.java =================================================================== --- src/test/org/apache/lucene/TestSearchForDuplicates.java (revision 582218) +++ src/test/org/apache/lucene/TestSearchForDuplicates.java (working copy) @@ -28,7 +28,7 @@ import org.apache.lucene.search.*; import org.apache.lucene.queryParser.*; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import junit.framework.TestSuite; import junit.textui.TestRunner; @@ -37,7 +37,7 @@ * * @version $Id$ */ -public class TestSearchForDuplicates extends TestCase { +public class TestSearchForDuplicates extends LuceneTestCase { /** Main for running test case by itself. */ public static void main(String args[]) { Index: src/test/org/apache/lucene/util/TestBitVector.java =================================================================== --- src/test/org/apache/lucene/util/TestBitVector.java (revision 582218) +++ src/test/org/apache/lucene/util/TestBitVector.java (working copy) @@ -19,7 +19,7 @@ import java.io.IOException; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.store.Directory; import org.apache.lucene.store.RAMDirectory; @@ -29,7 +29,7 @@ * * @version $Id$ */ -public class TestBitVector extends TestCase +public class TestBitVector extends LuceneTestCase { public TestBitVector(String s) { super(s); Index: src/test/org/apache/lucene/util/TestPriorityQueue.java =================================================================== --- src/test/org/apache/lucene/util/TestPriorityQueue.java (revision 582218) +++ src/test/org/apache/lucene/util/TestPriorityQueue.java (working copy) @@ -18,10 +18,10 @@ */ import java.util.Random; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; public class TestPriorityQueue - extends TestCase + extends LuceneTestCase { public TestPriorityQueue(String name) { Index: src/test/org/apache/lucene/util/TestStringHelper.java =================================================================== --- src/test/org/apache/lucene/util/TestStringHelper.java (revision 582218) +++ src/test/org/apache/lucene/util/TestStringHelper.java (working copy) @@ -17,9 +17,9 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; -public class TestStringHelper extends TestCase { +public class TestStringHelper extends LuceneTestCase { public void testStringDifference() { Index: src/test/org/apache/lucene/util/LuceneTestCase.java =================================================================== --- src/test/org/apache/lucene/util/LuceneTestCase.java (revision 0) +++ src/test/org/apache/lucene/util/LuceneTestCase.java (revision 0) @@ -0,0 +1,52 @@ +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.ConcurrentMergeScheduler; +import junit.framework.TestCase; + +/** Base class for all Lucene unit tests. Currently the + * only added functionality over JUnit's TestCase is + * asserting that no unhandled exceptions occurred in + * threads launched by ConcurrentMergeScheduler. If you + * override either setUp() or + * tearDown() in your unit test, make sure you + * call super.setUp() and + * super.tearDown(). + */ + +public class LuceneTestCase extends TestCase { + + public LuceneTestCase() { + super(); + } + + public LuceneTestCase(String name) { + super(name); + } + + protected void setUp() throws Exception { + ConcurrentMergeScheduler.setTestMode(); + } + + protected void tearDown() throws Exception { + if (ConcurrentMergeScheduler.anyUnhandledExceptions()) { + fail("ConcurrentMergeScheduler hit unhandled exceptions"); + } + } +} Property changes on: src/test/org/apache/lucene/util/LuceneTestCase.java ___________________________________________________________________ Name: svn:eol-style + native Index: src/test/org/apache/lucene/util/TestSmallFloat.java =================================================================== --- src/test/org/apache/lucene/util/TestSmallFloat.java (revision 582218) +++ src/test/org/apache/lucene/util/TestSmallFloat.java (working copy) @@ -16,14 +16,14 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import java.util.Random; /** * @author yonik * @version $Id$ */ -public class TestSmallFloat extends TestCase { +public class TestSmallFloat extends LuceneTestCase { // original lucene byteToFloat static float orig_byteToFloat(byte b) { Index: src/test/org/apache/lucene/document/TestBinaryDocument.java =================================================================== --- src/test/org/apache/lucene/document/TestBinaryDocument.java (revision 582218) +++ src/test/org/apache/lucene/document/TestBinaryDocument.java (working copy) @@ -1,6 +1,6 @@ package org.apache.lucene.document; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.index.IndexReader; @@ -30,7 +30,7 @@ * * @version $Id$ */ -public class TestBinaryDocument extends TestCase +public class TestBinaryDocument extends LuceneTestCase { String binaryValStored = "this text will be stored as a byte array in the index"; Index: src/test/org/apache/lucene/document/TestNumberTools.java =================================================================== --- src/test/org/apache/lucene/document/TestNumberTools.java (revision 582218) +++ src/test/org/apache/lucene/document/TestNumberTools.java (working copy) @@ -17,9 +17,9 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; -public class TestNumberTools extends TestCase { +public class TestNumberTools extends LuceneTestCase { public void testNearZero() { for (int i = -100; i <= 100; i++) { for (int j = -100; j <= 100; j++) { Index: src/test/org/apache/lucene/document/TestDateTools.java =================================================================== --- src/test/org/apache/lucene/document/TestDateTools.java (revision 582218) +++ src/test/org/apache/lucene/document/TestDateTools.java (working copy) @@ -6,7 +6,7 @@ import java.util.Date; import java.util.TimeZone; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; /** * Licensed to the Apache Software Foundation (ASF) under one or more @@ -25,7 +25,7 @@ * limitations under the License. */ -public class TestDateTools extends TestCase { +public class TestDateTools extends LuceneTestCase { public void testStringToDate() throws ParseException { Index: src/test/org/apache/lucene/document/TestDocument.java =================================================================== --- src/test/org/apache/lucene/document/TestDocument.java (revision 582218) +++ src/test/org/apache/lucene/document/TestDocument.java (working copy) @@ -1,6 +1,6 @@ package org.apache.lucene.document; -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.store.RAMDirectory; import org.apache.lucene.document.Document; @@ -37,7 +37,7 @@ * * @version $Id$ */ -public class TestDocument extends TestCase +public class TestDocument extends LuceneTestCase { String binaryVal = "this text will be stored as a byte array in the index"; Index: src/test/org/apache/lucene/TestHitIterator.java =================================================================== --- src/test/org/apache/lucene/TestHitIterator.java (revision 582218) +++ src/test/org/apache/lucene/TestHitIterator.java (working copy) @@ -17,7 +17,7 @@ * limitations under the License. */ -import junit.framework.TestCase; +import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.store.RAMDirectory; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.Term; @@ -36,7 +36,7 @@ * This test intentionally not put in the search package in order * to test HitIterator and Hit package protection. */ -public class TestHitIterator extends TestCase { +public class TestHitIterator extends LuceneTestCase { public void testIterator() throws Exception { RAMDirectory directory = new RAMDirectory(); Index: src/java/org/apache/lucene/index/ConcurrentMergeScheduler.java =================================================================== --- src/java/org/apache/lucene/index/ConcurrentMergeScheduler.java (revision 582218) +++ src/java/org/apache/lucene/index/ConcurrentMergeScheduler.java (working copy) @@ -43,6 +43,15 @@ private List exceptions = new ArrayList(); private Directory dir; + private boolean closed; + + public ConcurrentMergeScheduler() { + if (allInstances != null) { + // Only for testing + addMyself(); + } + } + /** Sets the max # simultaneous threads that may be * running. If a merge is necessary yet we already have * this many threads running, the merge is returned back @@ -72,7 +81,7 @@ public synchronized void setMergeThreadPriority(int pri) { mergeThreadPriority = pri; - final int numThreads = mergeThreads.size(); + final int numThreads = mergeThreadCount(); for(int i=0;i 0) { + public synchronized void sync() { + while(mergeThreadCount() > 0) { if (VERBOSE) { message("now wait for threads; currently " + mergeThreads.size() + " still running"); for(int i=0;i