LUCENE-2642: merge LuceneTestCase and LuceneTestCaseJ4

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@996611 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2010-09-13 17:37:20 +00:00
parent 5192d949ad
commit feabadea20
192 changed files with 1021 additions and 1752 deletions

View File

@ -25,10 +25,6 @@ import org.apache.lucene.util.LuceneTestCase;
public abstract class DocumentTestCase extends LuceneTestCase
{
public DocumentTestCase(String name) {
super(name);
}
protected File getFile(String filename) throws IOException {
String fullname =
this.getClass().getResource(filename).getFile();

View File

@ -24,10 +24,6 @@ import org.apache.lucene.ant.HtmlDocument;
public class HtmlDocumentTest extends DocumentTestCase
{
public HtmlDocumentTest (String name) {
super(name);
}
HtmlDocument doc;
@Override

View File

@ -50,7 +50,7 @@ public class IndexTaskTest extends LuceneTestCase {
*@exception IOException Description of Exception
*/
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
// slightly hackish way to get the src/test dir
String docsDir = getDataFile("test.txt").getParent();
@ -87,7 +87,7 @@ public class IndexTaskTest extends LuceneTestCase {
* TODO: remove indexDir?
*/
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
searcher.close();
dir.close();
super.tearDown();

View File

@ -24,10 +24,6 @@ import org.apache.lucene.ant.TextDocument;
public class TextDocumentTest extends DocumentTestCase
{
public TextDocumentTest (String name) {
super(name);
}
TextDocument doc;
@Override

View File

@ -60,7 +60,7 @@ import org.apache.lucene.search.FieldCache;
public class TestPerfTasksLogic extends BenchmarkTestCase {
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
copyToWorkDir("reuters.first20.lines.txt");
}

View File

@ -37,10 +37,6 @@ public class TestPerfTasksParse extends LuceneTestCase {
INDENT + "print.props=false" + NEW_LINE
;
public TestPerfTasksParse(String name) {
super(name);
}
/** Test the repetiotion parsing for parallel tasks */
public void testParseParallelTaskSequenceRepetition() throws Exception {
String taskStr = "AddDoc";

View File

@ -17,14 +17,12 @@ package org.apache.lucene.benchmark.byTask.utils;
* limitations under the License.
*/
import static org.junit.Assert.*;
import java.util.Properties;
import org.apache.lucene.util.LuceneTestCaseJ4;
import org.apache.lucene.util.LuceneTestCase;
import org.junit.Test;
public class TestConfig extends LuceneTestCaseJ4 {
public class TestConfig extends LuceneTestCase {
@Test
public void testAbsolutePathNamesWindows() throws Exception {

View File

@ -46,7 +46,7 @@ import org.apache.lucene.store.FSDirectory;
public class TestQualityRun extends BenchmarkTestCase {
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
copyToWorkDir("reuters.578.lines.txt.bz2");
}

View File

@ -53,7 +53,7 @@ public class JEStoreTest extends LuceneTestCase {
protected Database index, blocks;
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
if (!dbHome.exists())
@ -100,7 +100,7 @@ public class JEStoreTest extends LuceneTestCase {
}
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
if (index != null)
index.close();

View File

@ -48,7 +48,7 @@ public class DbStoreTest extends LuceneTestCase {
protected Database index, blocks;
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
if (!dbHome.exists())
dbHome.mkdir();
@ -100,7 +100,7 @@ public class DbStoreTest extends LuceneTestCase {
}
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
if (index != null)
index.close();
if (blocks != null)

View File

@ -106,15 +106,6 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
"This text has a typo in referring to Keneddy",
"wordx wordy wordz wordx wordy wordx worda wordb wordy wordc", "y z x y z a b", "lets is a the lets is a the lets is a the lets" };
/**
* Constructor for HighlightExtractorTest.
*
* @param arg0
*/
public HighlighterTest(String arg0) {
super(arg0);
}
public void testQueryScorerHits() throws Exception {
Analyzer analyzer = new MockAnalyzer(MockTokenizer.SIMPLE, true);
QueryParser qp = new QueryParser(TEST_VERSION_CURRENT, FIELD_NAME, analyzer);
@ -1719,7 +1710,7 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
}
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
dir = newDirectory();
ramDir = newDirectory();
@ -1755,7 +1746,7 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
}
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
if (searcher != null) searcher.close();
reader.close();
dir.close();

View File

@ -85,7 +85,7 @@ public abstract class AbstractTestCase extends LuceneTestCase {
};
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
analyzerW = new MockAnalyzer(MockTokenizer.WHITESPACE, false);
analyzerB = new BigramAnalyzer();
@ -96,7 +96,7 @@ public abstract class AbstractTestCase extends LuceneTestCase {
}
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
if( reader != null ){
reader.close();
reader = null;

View File

@ -36,11 +36,6 @@ import org.apache.lucene.util.LuceneTestCase;
* Tests changing of field norms with a custom similarity and with fake norms.
*/
public class TestFieldNormModifier extends LuceneTestCase {
public TestFieldNormModifier(String name) {
super(name);
}
public static int NUM_DOCS = 5;
public Directory store;
@ -54,7 +49,7 @@ public class TestFieldNormModifier extends LuceneTestCase {
};
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
store = newDirectory();
IndexWriter writer = new IndexWriter(store, newIndexWriterConfig(
@ -76,7 +71,7 @@ public class TestFieldNormModifier extends LuceneTestCase {
}
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
store.close();
super.tearDown();
}

View File

@ -29,7 +29,7 @@ public class TestMultiPassIndexSplitter extends LuceneTestCase {
Directory dir;
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
dir = newDirectory();
IndexWriter w = new IndexWriter(dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()));
@ -50,7 +50,7 @@ public class TestMultiPassIndexSplitter extends LuceneTestCase {
}
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
input.close();
dir.close();
super.tearDown();

View File

@ -39,11 +39,6 @@ import org.apache.lucene.util.LuceneTestCase;
* Tests changing the norms after changing the simularity
*/
public class TestLengthNormModifier extends LuceneTestCase {
public TestLengthNormModifier(String name) {
super(name);
}
public static int NUM_DOCS = 5;
public Directory store;
@ -57,7 +52,7 @@ public class TestLengthNormModifier extends LuceneTestCase {
};
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
store = newDirectory();
IndexWriter writer = new IndexWriter(store, newIndexWriterConfig(
@ -82,7 +77,7 @@ public class TestLengthNormModifier extends LuceneTestCase {
}
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
store.close();
super.tearDown();
}

View File

@ -36,7 +36,7 @@ public class BooleanFilterTest extends LuceneTestCase {
private IndexReader reader;
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
directory = newDirectory();
RandomIndexWriter writer = new RandomIndexWriter(random, directory, new MockAnalyzer(MockTokenizer.WHITESPACE, false));
@ -53,7 +53,7 @@ public class BooleanFilterTest extends LuceneTestCase {
}
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
mainReader.close();
directory.close();
super.tearDown();

View File

@ -53,7 +53,7 @@ public class ChainedFilterTest extends LuceneTestCase {
private QueryWrapperFilter sueFilter;
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
directory = newDirectory();
RandomIndexWriter writer = new RandomIndexWriter(random, directory);

View File

@ -39,7 +39,7 @@ public class DuplicateFilterTest extends LuceneTestCase {
private IndexSearcher searcher;
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
directory = newDirectory();
RandomIndexWriter writer = new RandomIndexWriter(random, directory);
@ -65,7 +65,7 @@ public class DuplicateFilterTest extends LuceneTestCase {
}
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
reader.close();
searcher.close();
directory.close();

View File

@ -37,7 +37,7 @@ public class FuzzyLikeThisQueryTest extends LuceneTestCase {
private Analyzer analyzer=new MockAnalyzer();
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
directory = newDirectory();
RandomIndexWriter writer = new RandomIndexWriter(random, directory);
@ -55,7 +55,7 @@ public class FuzzyLikeThisQueryTest extends LuceneTestCase {
}
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
searcher.close();
reader.close();
directory.close();

View File

@ -38,7 +38,7 @@ public class TestRegexQuery extends LuceneTestCase {
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
directory = newDirectory();
RandomIndexWriter writer = new RandomIndexWriter(random, directory);
@ -51,7 +51,7 @@ public class TestRegexQuery extends LuceneTestCase {
}
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
searcher.close();
reader.close();
directory.close();

View File

@ -42,7 +42,7 @@ public class TestMoreLikeThis extends LuceneTestCase {
private IndexSearcher searcher;
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
directory = newDirectory();
RandomIndexWriter writer = new RandomIndexWriter(random, directory);
@ -57,7 +57,7 @@ public class TestMoreLikeThis extends LuceneTestCase {
}
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
reader.close();
searcher.close();
directory.close();

View File

@ -45,7 +45,7 @@ public class TestAnalyzingQueryParser extends LuceneTestCase {
private String[] fuzzyExpected;
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
wildcardInput = new String[] { "übersetzung über*ung",
"Mötley Cr\u00fce Mötl?* Crü?", "Renée Zellweger Ren?? Zellw?ger" };

View File

@ -109,7 +109,7 @@ public class TestComplexPhraseQuery extends LuceneTestCase {
}
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
rd = newDirectory();
IndexWriter w = new IndexWriter(rd, newIndexWriterConfig(TEST_VERSION_CURRENT, analyzer));
@ -126,7 +126,7 @@ public class TestComplexPhraseQuery extends LuceneTestCase {
}
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
searcher.close();
rd.close();
super.tearDown();

View File

@ -35,10 +35,6 @@ public class TestExtendableQueryParser extends TestQueryParser {
private static char[] DELIMITERS = new char[] {
Extensions.DEFAULT_EXTENSION_FIELD_DELIMITER, '-', '|' };
public TestExtendableQueryParser(String name) {
super(name);
}
@Override
public QueryParser getParser(Analyzer a) throws Exception {
return getParser(a, null);

View File

@ -27,7 +27,7 @@ public class TestExtensions extends LuceneTestCase {
private Extensions ext;
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
this.ext = new Extensions();
}

View File

@ -28,7 +28,6 @@ import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
import org.apache.lucene.document.DateTools;
import org.apache.lucene.index.Term;
import org.apache.lucene.queryParser.QueryParser;
import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.FuzzyQuery;
@ -41,26 +40,19 @@ import org.apache.lucene.search.TermRangeQuery;
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.search.WildcardQuery;
import org.apache.lucene.search.BooleanClause.Occur;
import org.apache.lucene.util.LocalizedTestCase;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.automaton.BasicAutomata;
import org.apache.lucene.util.automaton.CharacterRunAutomaton;
import org.junit.runner.RunWith;
import java.io.IOException;
import java.io.Reader;
import java.text.DateFormat;
import java.util.Arrays;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.HashSet;
public class TestPrecedenceQueryParser extends LocalizedTestCase {
public TestPrecedenceQueryParser(String name) {
super(name, new HashSet<String>(Arrays.asList(new String[]{
"testDateRange", "testNumber"
})));
}
@RunWith(LuceneTestCase.LocalizedTestCaseRunner.class)
public class TestPrecedenceQueryParser extends LuceneTestCase {
public static Analyzer qpAnalyzer = new QPTestAnalyzer();
public static final class QPTestFilter extends TokenFilter {
@ -129,7 +121,7 @@ public class TestPrecedenceQueryParser extends LocalizedTestCase {
private int originalMaxClauses;
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
originalMaxClauses = BooleanQuery.getMaxClauseCount();
}
@ -726,7 +718,7 @@ public class TestPrecedenceQueryParser extends LocalizedTestCase {
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
BooleanQuery.setMaxClauseCount(originalMaxClauses);
super.tearDown();
}

View File

@ -106,7 +106,7 @@ public class TestSpanQueryParser extends LuceneTestCase {
}
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
this.spanProcessorPipeline = new QueryNodeProcessorPipeline();

View File

@ -95,14 +95,6 @@ import org.apache.lucene.util.LuceneTestCase;
*/
public class TestSpanQueryParserSimpleSample extends LuceneTestCase {
public TestSpanQueryParserSimpleSample() {
// empty constructor
}
public TestSpanQueryParserSimpleSample(String testName) {
super(testName);
}
public void testBasicDemo() throws Exception {
SyntaxParser queryParser = new StandardSyntaxParser();

View File

@ -25,8 +25,6 @@ import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@ -74,10 +72,11 @@ import org.apache.lucene.search.TermRangeQuery;
import org.apache.lucene.search.WildcardQuery;
import org.apache.lucene.search.BooleanClause.Occur;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.LocalizedTestCase;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.automaton.BasicAutomata;
import org.apache.lucene.util.automaton.CharacterRunAutomaton;
import org.apache.lucene.util.automaton.RegExp;
import org.junit.runner.RunWith;
/**
* This test case is a copy of the core Lucene query parser test, it was adapted
@ -85,15 +84,8 @@ import org.apache.lucene.util.automaton.RegExp;
*
* Tests QueryParser.
*/
public class TestQPHelper extends LocalizedTestCase {
public TestQPHelper(String name) {
super(name, new HashSet<String>(Arrays.asList(new String[]{
"testLegacyDateRange", "testDateRange",
"testCJK", "testNumber", "testFarsiRangeCollating",
"testLocalDateFormat"
})));
}
@RunWith(LuceneTestCase.LocalizedTestCaseRunner.class)
public class TestQPHelper extends LuceneTestCase {
public static Analyzer qpAnalyzer = new QPTestAnalyzer();
@ -194,7 +186,7 @@ public class TestQPHelper extends LocalizedTestCase {
private int originalMaxClauses;
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
originalMaxClauses = BooleanQuery.getMaxClauseCount();
}
@ -1262,7 +1254,7 @@ public class TestQPHelper extends LocalizedTestCase {
}
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
BooleanQuery.setMaxClauseCount(originalMaxClauses);
super.tearDown();
}

View File

@ -68,10 +68,11 @@ import org.apache.lucene.search.TermQuery;
import org.apache.lucene.search.TermRangeQuery;
import org.apache.lucene.search.WildcardQuery;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.LocalizedTestCase;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.automaton.BasicAutomata;
import org.apache.lucene.util.automaton.CharacterRunAutomaton;
import org.apache.lucene.util.automaton.RegExp;
import org.junit.runner.RunWith;
/**
* This test case is a copy of the core Lucene query parser test, it was adapted
@ -82,15 +83,8 @@ import org.apache.lucene.util.automaton.RegExp;
* @deprecated this entire test case tests QueryParserWrapper which is
* deprecated. When QPW is gone, so will the test.
*/
public class TestQueryParserWrapper extends LocalizedTestCase {
public TestQueryParserWrapper(String name) {
super(name, new HashSet<String>(Arrays.asList(new String[]{
"testLegacyDateRange", "testDateRange",
"testCJK", "testNumber", "testFarsiRangeCollating",
"testLocalDateFormat"
})));
}
@RunWith(LuceneTestCase.LocalizedTestCaseRunner.class)
public class TestQueryParserWrapper extends LuceneTestCase {
public static Analyzer qpAnalyzer = new QPTestAnalyzer();
@ -209,7 +203,7 @@ public class TestQueryParserWrapper extends LocalizedTestCase {
private int originalMaxClauses;
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
originalMaxClauses = BooleanQuery.getMaxClauseCount();
}
@ -1213,7 +1207,7 @@ public class TestQueryParserWrapper extends LocalizedTestCase {
}
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
BooleanQuery.setMaxClauseCount(originalMaxClauses);
super.tearDown();
}

View File

@ -28,15 +28,14 @@ import org.apache.lucene.search.Query;
import org.apache.lucene.queryParser.surround.parser.QueryParser;
import junit.framework.TestCase;
import junit.framework.Assert;
import org.junit.Assert;
public class BooleanQueryTst {
String queryText;
final int[] expectedDocNrs;
SingleFieldTestDb dBase;
String fieldName;
TestCase testCase;
Assert testCase;
BasicQueryFactory qf;
boolean verbose = true;
@ -45,7 +44,7 @@ public class BooleanQueryTst {
int[] expectedDocNrs,
SingleFieldTestDb dBase,
String fieldName,
TestCase testCase,
Assert testCase,
BasicQueryFactory qf) {
this.queryText = queryText;
this.expectedDocNrs = expectedDocNrs;

View File

@ -28,7 +28,7 @@ import java.rmi.registry.LocateRegistry;
import java.rmi.server.RMIClientSocketFactory;
import java.rmi.server.RMIServerSocketFactory;
import org.apache.lucene.util.LuceneTestCaseJ4;
import org.apache.lucene.util.LuceneTestCase;
import org.junit.AfterClass;
/**
@ -38,7 +38,7 @@ import org.junit.AfterClass;
* to start the server.
* Call {@link #lookupRemote} to get a RemoteSearchable.
*/
public abstract class RemoteTestCaseJ4 extends LuceneTestCaseJ4 {
public abstract class RemoteTestCase extends LuceneTestCase {
private static int port;
public static void startServer(Searchable searchable) throws Exception {

View File

@ -34,7 +34,7 @@ import static org.junit.Assert.*;
/**
* Tests that the index is cached on the searcher side of things.
*/
public class TestRemoteCachingWrapperFilter extends RemoteTestCaseJ4 {
public class TestRemoteCachingWrapperFilter extends RemoteTestCase {
private static Directory indexStore;
private static Searchable local;

View File

@ -33,7 +33,7 @@ import java.util.Random;
import java.util.Set;
import java.util.HashSet;
public class TestRemoteSearchable extends RemoteTestCaseJ4 {
public class TestRemoteSearchable extends RemoteTestCase {
private static Directory indexStore;
private static Searchable local;

View File

@ -45,7 +45,7 @@ import org.junit.Test;
* methods and therefore unused members and methodes.
*/
public class TestRemoteSort extends RemoteTestCaseJ4 {
public class TestRemoteSort extends RemoteTestCase {
private static IndexSearcher full;
private static Directory indexStore;

View File

@ -67,7 +67,7 @@ public class TestCartesian extends LuceneTestCase {
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
directory = newDirectory();
@ -80,7 +80,7 @@ public class TestCartesian extends LuceneTestCase {
}
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
directory.close();
super.tearDown();
}

View File

@ -41,7 +41,7 @@ public class TestDistance extends LuceneTestCase {
private IndexWriter writer;
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
directory = newDirectory();
writer = new IndexWriter(directory, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()));
@ -50,7 +50,7 @@ public class TestDistance extends LuceneTestCase {
}
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
writer.close();
directory.close();
super.tearDown();

View File

@ -43,7 +43,7 @@ public class TestLuceneDictionary extends LuceneTestCase {
private Iterator<String> it;
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
store = newDirectory();
IndexWriter writer = new IndexWriter(store, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(MockTokenizer.WHITESPACE, false)));
@ -75,7 +75,7 @@ public class TestLuceneDictionary extends LuceneTestCase {
}
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
if (indexReader != null)
indexReader.close();
store.close();

View File

@ -48,7 +48,7 @@ public class TestSpellChecker extends LuceneTestCase {
private List<IndexSearcher> searchers;
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
//create a user index
@ -71,7 +71,7 @@ public class TestSpellChecker extends LuceneTestCase {
}
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
userindex.close();
if (!spellChecker.isClosed())
spellChecker.close();

View File

@ -31,7 +31,7 @@ public class TestBasicList extends LuceneTestCase {
private List<RestaurantInfo> list;
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
list = new ArrayList<RestaurantInfo>();
list.add(DataStore.canolis);

View File

@ -30,7 +30,7 @@ public class TestBasicTable extends LuceneTestCase {
private List<RestaurantInfo> list;
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
list = new ArrayList<RestaurantInfo>();
list.add(DataStore.canolis);

View File

@ -27,7 +27,7 @@ public class TestSearchingList extends LuceneTestCase {
private ListSearcher listSearcher;
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
baseListModel = new BaseListModel(DataStore.getRestaurants());
listSearcher = new ListSearcher(baseListModel);

View File

@ -25,7 +25,7 @@ public class TestSearchingTable extends LuceneTestCase {
private TableSearcher tableSearcher;
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
baseTableModel = new BaseTableModel(DataStore.getRestaurants());
tableSearcher = new TableSearcher(baseTableModel);

View File

@ -26,7 +26,7 @@ public class TestUpdatingList extends LuceneTestCase {
RestaurantInfo infoToAdd1, infoToAdd2;
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
baseListModel = new BaseListModel(DataStore.getRestaurants());
listSearcher = new ListSearcher(baseListModel);

View File

@ -26,7 +26,7 @@ public class TestUpdatingTable extends LuceneTestCase {
RestaurantInfo infoToAdd1, infoToAdd2;
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
baseTableModel = new BaseTableModel(DataStore.getRestaurants());
tableSearcher = new TableSearcher(baseTableModel);

View File

@ -38,7 +38,7 @@ public class TestWordnet extends LuceneTestCase {
new File(TEMP_DIR,"testLuceneWordnet").getAbsolutePath();
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
// create a temporary synonym index
File testFile = getDataFile("testSynonyms.txt");
@ -70,7 +70,7 @@ public class TestWordnet extends LuceneTestCase {
}
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
searcher.close();
rmDir(storePathName); // delete our temporary synonym index
super.tearDown();

View File

@ -50,7 +50,7 @@ public class TestParser extends LuceneTestCase {
* @see TestCase#setUp()
*/
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
//initialize the parser
@ -85,7 +85,7 @@ public class TestParser extends LuceneTestCase {
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
reader.close();
searcher.close();
dir.close();

View File

@ -136,7 +136,7 @@ public class TestQueryTemplateManager extends LuceneTestCase {
* @see TestCase#setUp()
*/
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
@ -158,7 +158,7 @@ public class TestQueryTemplateManager extends LuceneTestCase {
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
searcher.close();
dir.close();
super.tearDown();

View File

@ -29,15 +29,6 @@ import org.apache.lucene.util.LuceneTestCase;
* Base class for all Lucene unit tests that use TokenStreams.
*/
public abstract class BaseTokenStreamTestCase extends LuceneTestCase {
public BaseTokenStreamTestCase() {
super();
}
public BaseTokenStreamTestCase(String name) {
super(name);
}
// some helpers to test Analyzers and TokenStreams:
public static interface CheckClearAttributesAttribute extends Attribute {

View File

@ -27,10 +27,6 @@ import java.io.StringReader;
public class TestToken extends LuceneTestCase {
public TestToken(String name) {
super(name);
}
public void testCtor() throws Exception {
Token t = new Token();
char[] content = "hello".toCharArray();

View File

@ -26,10 +26,6 @@ import java.util.Random;
public class TestCharTermAttributeImpl extends LuceneTestCase {
public TestCharTermAttributeImpl(String name) {
super(name);
}
public void testResize() {
CharTermAttributeImpl t = new CharTermAttributeImpl();
char[] content = "hello".toCharArray();

View File

@ -24,10 +24,6 @@ import org.apache.lucene.util.AttributeSource.AttributeFactory;
@Deprecated
public class TestSimpleAttributeImpls extends LuceneTestCase {
public TestSimpleAttributeImpls(String name) {
super(name);
}
public void testFlagsAttribute() throws Exception {
FlagsAttributeImpl att = new FlagsAttributeImpl();

View File

@ -8,7 +8,8 @@ import java.util.GregorianCalendar;
import java.util.TimeZone;
import java.util.Locale;
import org.apache.lucene.util.LocalizedTestCase;
import org.apache.lucene.util.LuceneTestCase;
import org.junit.runner.RunWith;
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -26,8 +27,8 @@ import org.apache.lucene.util.LocalizedTestCase;
* See the License for the specific language governing permissions and
* limitations under the License.
*/
public class TestDateTools extends LocalizedTestCase {
@RunWith(LuceneTestCase.LocalizedTestCaseRunner.class)
public class TestDateTools extends LuceneTestCase {
public void testStringToDate() throws ParseException {

View File

@ -30,7 +30,7 @@ import org.apache.lucene.document.Field;
import org.apache.lucene.document.Fieldable;
import org.apache.lucene.search.Similarity;
import org.apache.lucene.store.Directory;
import static org.apache.lucene.util.LuceneTestCaseJ4.TEST_VERSION_CURRENT;
import static org.apache.lucene.util.LuceneTestCase.TEST_VERSION_CURRENT;
class DocHelper {
public static final String FIELD_1_TEXT = "field one text";

View File

@ -26,7 +26,7 @@ import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.index.codecs.CodecProvider;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.LuceneTestCaseJ4;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.Version;
import org.apache.lucene.util._TestUtil;
@ -63,17 +63,17 @@ public class RandomIndexWriter implements Closeable {
/** create a RandomIndexWriter with a random config: Uses TEST_VERSION_CURRENT and MockAnalyzer */
public RandomIndexWriter(Random r, Directory dir) throws IOException {
this(r, dir, LuceneTestCaseJ4.newIndexWriterConfig(r, LuceneTestCaseJ4.TEST_VERSION_CURRENT, new MockAnalyzer()));
this(r, dir, LuceneTestCase.newIndexWriterConfig(r, LuceneTestCase.TEST_VERSION_CURRENT, new MockAnalyzer()));
}
/** create a RandomIndexWriter with a random config: Uses TEST_VERSION_CURRENT */
public RandomIndexWriter(Random r, Directory dir, Analyzer a) throws IOException {
this(r, dir, LuceneTestCaseJ4.newIndexWriterConfig(r, LuceneTestCaseJ4.TEST_VERSION_CURRENT, a));
this(r, dir, LuceneTestCase.newIndexWriterConfig(r, LuceneTestCase.TEST_VERSION_CURRENT, a));
}
/** create a RandomIndexWriter with a random config */
public RandomIndexWriter(Random r, Directory dir, Version v, Analyzer a) throws IOException {
this(r, dir, LuceneTestCaseJ4.newIndexWriterConfig(r, v, a));
this(r, dir, LuceneTestCase.newIndexWriterConfig(r, v, a));
}
/** create a RandomIndexWriter with the provided config */
@ -81,7 +81,7 @@ public class RandomIndexWriter implements Closeable {
this.r = r;
w = new MockIndexWriter(r, dir, c);
flushAt = _TestUtil.nextInt(r, 10, 1000);
if (LuceneTestCaseJ4.VERBOSE) {
if (LuceneTestCase.VERBOSE) {
System.out.println("RIW config=" + w.getConfig());
System.out.println("codec default=" + CodecProvider.getDefaultCodec());
}
@ -90,7 +90,7 @@ public class RandomIndexWriter implements Closeable {
public void addDocument(Document doc) throws IOException {
w.addDocument(doc);
if (docCount++ == flushAt) {
if (LuceneTestCaseJ4.VERBOSE) {
if (LuceneTestCase.VERBOSE) {
System.out.println("RIW.addDocument: now doing a commit");
}
w.commit();
@ -127,12 +127,12 @@ public class RandomIndexWriter implements Closeable {
// IndexReader.open so terms are sorted in codepoint
// order during searching:
if (!w.codecs.getWriter(null).name.equals("PreFlex") && r.nextBoolean()) {
if (LuceneTestCaseJ4.VERBOSE) {
if (LuceneTestCase.VERBOSE) {
System.out.println("RIW.getReader: use NRT reader");
}
return w.getReader();
} else {
if (LuceneTestCaseJ4.VERBOSE) {
if (LuceneTestCase.VERBOSE) {
System.out.println("RIW.getReader: open new reader");
}
w.commit();

View File

@ -39,8 +39,9 @@ import org.apache.lucene.search.Query;
import org.apache.lucene.search.ScoreDoc;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.MultiCodecTestCase;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.Version;
import org.junit.runner.RunWith;
// TODO: test multiple codecs here?
@ -59,8 +60,8 @@ import org.apache.lucene.util.Version;
// goes to 1 before next one known to exist
// - skipTo(term)
// - skipTo(doc)
public class TestCodecs extends MultiCodecTestCase {
@RunWith(LuceneTestCase.MultiCodecTestCaseRunner.class)
public class TestCodecs extends LuceneTestCase {
private static String[] fieldNames = new String[] {"one", "two", "three", "four"};
private final static int NUM_TEST_ITER = 20 * RANDOM_MULTIPLIER;

View File

@ -55,7 +55,7 @@ public class TestCompoundFile extends LuceneTestCase
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
File file = new File(TEMP_DIR, "testIndex");
_TestUtil.rmDir(file);
@ -64,7 +64,7 @@ public class TestCompoundFile extends LuceneTestCase
}
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
dir.close();
_TestUtil.rmDir(new File(TEMP_DIR, "testIndex"));
super.tearDown();

View File

@ -35,13 +35,9 @@ public class TestDirectoryReader extends LuceneTestCase {
private Document doc2;
protected SegmentReader [] readers = new SegmentReader[2];
protected SegmentInfos sis;
public TestDirectoryReader(String s) {
super(s);
}
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
dir = newDirectory();
doc1 = new Document();
@ -55,7 +51,7 @@ public class TestDirectoryReader extends LuceneTestCase {
}
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
if (readers[0] != null) readers[0].close();
if (readers[1] != null) readers[1].close();
dir.close();

View File

@ -58,7 +58,7 @@ public class TestDoc extends LuceneTestCase {
* a few text files created in the current working directory.
*/
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
workDir = new File(TEMP_DIR,"TestDoc");
workDir.mkdirs();

View File

@ -42,19 +42,15 @@ import org.apache.lucene.util.BytesRef;
public class TestDocumentWriter extends LuceneTestCase {
private Directory dir;
public TestDocumentWriter(String s) {
super(s);
}
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
dir = newDirectory();
}
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
dir.close();
super.tearDown();
}

View File

@ -30,12 +30,8 @@ public class TestFieldInfos extends LuceneTestCase {
private Document testDoc = new Document();
public TestFieldInfos(String s) {
super(s);
}
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
DocHelper.setupDoc(testDoc);
}

View File

@ -48,12 +48,8 @@ public class TestFieldsReader extends LuceneTestCase {
private FieldInfos fieldInfos = null;
private final static String TEST_SEGMENT_NAME = "_0";
public TestFieldsReader(String s) {
super(s);
}
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
fieldInfos = new FieldInfos();
DocHelper.setupDoc(testDoc);
@ -68,7 +64,7 @@ public class TestFieldsReader extends LuceneTestCase {
}
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
dir.close();
super.tearDown();
}

View File

@ -24,10 +24,10 @@ import java.util.Collection;
import java.util.Map;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.LuceneTestCaseJ4;
import org.apache.lucene.util.LuceneTestCase;
import org.junit.Test;
public class TestIndexCommit extends LuceneTestCaseJ4 {
public class TestIndexCommit extends LuceneTestCase {
@Test
public void testEqualsHashCode() throws Exception {

View File

@ -30,9 +30,6 @@ import java.util.HashMap;
import java.util.Set;
import java.util.SortedSet;
import junit.framework.TestSuite;
import junit.textui.TestRunner;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
@ -61,18 +58,6 @@ import org.apache.lucene.util.Bits;
public class TestIndexReader extends LuceneTestCase
{
/** Main for running test case by itself. */
public static void main(String args[]) {
TestRunner.run (new TestSuite(TestIndexReader.class));
// TestRunner.run (new TestIndexReader("testBasicDelete"));
// TestRunner.run (new TestIndexReader("testDeleteReaderWriterConflict"));
// TestRunner.run (new TestIndexReader("testDeleteReaderReaderConflict"));
// TestRunner.run (new TestIndexReader("testFilesOpenClose"));
}
public TestIndexReader(String name) {
super(name);
}
public void testCommitUserData() throws Exception {
Directory d = newDirectory();

View File

@ -65,12 +65,8 @@ public class TestIndexReaderCloneNorms extends LuceneTestCase {
private float normDelta = (float) 0.001;
public TestIndexReaderCloneNorms(String s) {
super(s);
}
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
similarityOne = new SimilarityOne();
anlzr = new MockAnalyzer();

View File

@ -45,7 +45,7 @@ import org.apache.lucene.store.AlreadyClosedException;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.BitVector;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.LuceneTestCaseJ4;
import org.apache.lucene.util.LuceneTestCase;
public class TestIndexReaderReopen extends LuceneTestCase {
@ -947,7 +947,7 @@ public class TestIndexReaderReopen extends LuceneTestCase {
public static void createIndex(Random random, Directory dir, boolean multiSegment) throws IOException {
IndexWriter.unlock(dir);
IndexWriter w = new IndexWriter(dir, LuceneTestCaseJ4.newIndexWriterConfig(random,
IndexWriter w = new IndexWriter(dir, LuceneTestCase.newIndexWriterConfig(random,
TEST_VERSION_CURRENT, new MockAnalyzer())
.setMergePolicy(new LogDocMergePolicy()));
@ -1093,7 +1093,7 @@ public class TestIndexReaderReopen extends LuceneTestCase {
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
indexDir = new File(TEMP_DIR, "IndexReaderReopen");
}

View File

@ -79,10 +79,6 @@ import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.Bits;
public class TestIndexWriter extends LuceneTestCase {
public TestIndexWriter(String name) {
super(name);
}
public void testDocCount() throws IOException {
Directory dir = newDirectory();

View File

@ -34,10 +34,10 @@ import org.apache.lucene.index.codecs.CodecProvider;
import org.apache.lucene.search.DefaultSimilarity;
import org.apache.lucene.search.Similarity;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.LuceneTestCaseJ4;
import org.apache.lucene.util.LuceneTestCase;
import org.junit.Test;
public class TestIndexWriterConfig extends LuceneTestCaseJ4 {
public class TestIndexWriterConfig extends LuceneTestCase {
private static final class MySimilarity extends DefaultSimilarity {
// Does not implement anything - used only for type checking on IndexWriterConfig.

View File

@ -36,7 +36,7 @@ public class TestIndexWriterLockRelease extends LuceneTestCase {
private java.io.File __test_dir;
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
if (this.__test_dir == null) {
this.__test_dir = new File(TEMP_DIR, "testIndexWriter");
@ -53,7 +53,7 @@ public class TestIndexWriterLockRelease extends LuceneTestCase {
}
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
if (this.__test_dir != null) {
File[] files = this.__test_dir.listFiles();

View File

@ -38,7 +38,7 @@ import org.apache.lucene.store.MockDirectoryWrapper;
import org.apache.lucene.store.AlreadyClosedException;
import org.apache.lucene.store.RAMDirectory;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.LuceneTestCaseJ4;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util._TestUtil;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.ThreadInterruptedException;
@ -484,7 +484,7 @@ public class TestIndexWriterReader extends LuceneTestCase {
public static void createIndex(Random random, Directory dir1, String indexName,
boolean multiSegment) throws IOException {
IndexWriter w = new IndexWriter(dir1, LuceneTestCaseJ4.newIndexWriterConfig(random,
IndexWriter w = new IndexWriter(dir1, LuceneTestCase.newIndexWriterConfig(random,
TEST_VERSION_CURRENT, new MockAnalyzer())
.setMergePolicy(new LogDocMergePolicy()));
for (int i = 0; i < 100; i++) {

View File

@ -29,7 +29,7 @@ import org.junit.Test;
import java.io.IOException;
public class TestIsCurrent extends LuceneTestCaseJ4 {
public class TestIsCurrent extends LuceneTestCase {
private RandomIndexWriter writer;

View File

@ -20,9 +20,6 @@ package org.apache.lucene.index;
import java.io.IOException;
public class TestMultiReader extends TestDirectoryReader {
public TestMultiReader(String s) {
super(s);
}
@Override
protected IndexReader openReader() throws IOException {

View File

@ -31,10 +31,10 @@ import org.apache.lucene.document.Field;
import org.apache.lucene.document.Field.Index;
import org.apache.lucene.document.Field.Store;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.LuceneTestCaseJ4;
import org.apache.lucene.util.LuceneTestCase;
import org.junit.Test;
public class TestNoDeletionPolicy extends LuceneTestCaseJ4 {
public class TestNoDeletionPolicy extends LuceneTestCase {
@Test
public void testNoDeletionPolicy() throws Exception {

View File

@ -24,10 +24,10 @@ import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.Arrays;
import org.apache.lucene.util.LuceneTestCaseJ4;
import org.apache.lucene.util.LuceneTestCase;
import org.junit.Test;
public class TestNoMergePolicy extends LuceneTestCaseJ4 {
public class TestNoMergePolicy extends LuceneTestCase {
@Test
public void testNoMergePolicy() throws Exception {

View File

@ -24,10 +24,10 @@ import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.Arrays;
import org.apache.lucene.util.LuceneTestCaseJ4;
import org.apache.lucene.util.LuceneTestCase;
import org.junit.Test;
public class TestNoMergeScheduler extends LuceneTestCaseJ4 {
public class TestNoMergeScheduler extends LuceneTestCase {
@Test
public void testNoMergeScheduler() throws Exception {

View File

@ -56,12 +56,8 @@ public class TestNorms extends LuceneTestCase {
private float lastNorm = 0;
private float normDelta = (float) 0.001;
public TestNorms(String s) {
super(s);
}
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
similarityOne = new SimilarityOne();
anlzr = new MockAnalyzer();

View File

@ -42,14 +42,14 @@ public class TestParallelReader extends LuceneTestCase {
private Directory dir, dir1, dir2;
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
single = single(random);
parallel = parallel(random);
}
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
single.getIndexReader().close();
parallel.getIndexReader().close();
dir.close();

View File

@ -35,7 +35,7 @@ public class TestParallelTermEnum extends LuceneTestCase {
private Directory rd2;
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
Document doc;
rd1 = newDirectory();
@ -68,7 +68,7 @@ public class TestParallelTermEnum extends LuceneTestCase {
}
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
ir1.close();
ir2.close();
rd1.close();

View File

@ -38,10 +38,10 @@ import org.apache.lucene.index.PayloadProcessorProvider.PayloadProcessor;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.LuceneTestCaseJ4;
import org.apache.lucene.util.LuceneTestCase;
import org.junit.Test;
public class TestPayloadProcessorProvider extends LuceneTestCaseJ4 {
public class TestPayloadProcessorProvider extends LuceneTestCase {
private static final class PerDirPayloadProcessor extends PayloadProcessorProvider {

View File

@ -28,13 +28,8 @@ public class TestPositionBasedTermVectorMapper extends LuceneTestCase {
protected TermVectorOffsetInfo[][] offsets;
protected int numPositions;
public TestPositionBasedTermVectorMapper(String s) {
super(s);
}
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
tokens = new String[]{"here", "is", "some", "text", "to", "test", "extra"};
thePositions = new int[tokens.length][];

View File

@ -39,14 +39,9 @@ public class TestSegmentMerger extends LuceneTestCase {
private Directory merge2Dir;
private Document doc2 = new Document();
private SegmentReader reader2 = null;
public TestSegmentMerger(String s) {
super(s);
}
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
mergedDir = newDirectory();
merge1Dir = newDirectory();
@ -60,7 +55,7 @@ public class TestSegmentMerger extends LuceneTestCase {
}
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
reader1.close();
reader2.close();
mergedDir.close();

View File

@ -34,14 +34,10 @@ public class TestSegmentReader extends LuceneTestCase {
private Directory dir;
private Document testDoc = new Document();
private SegmentReader reader = null;
public TestSegmentReader(String s) {
super(s);
}
//TODO: Setup the reader w/ multiple documents
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
dir = newDirectory();
DocHelper.setupDoc(testDoc);
@ -50,7 +46,7 @@ public class TestSegmentReader extends LuceneTestCase {
}
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
reader.close();
dir.close();
super.tearDown();

View File

@ -31,12 +31,8 @@ public class TestSegmentTermDocs extends LuceneTestCase {
private Directory dir;
private SegmentInfo info;
public TestSegmentTermDocs(String s) {
super(s);
}
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
dir = newDirectory();
DocHelper.setupDoc(testDoc);
@ -44,7 +40,7 @@ public class TestSegmentTermDocs extends LuceneTestCase {
}
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
dir.close();
super.tearDown();
}

View File

@ -19,7 +19,7 @@ import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.KeepOnlyLastCommitDeletionPolicy;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.SnapshotDeletionPolicy;
import org.apache.lucene.util.LuceneTestCaseJ4;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.ThreadInterruptedException;
import org.apache.lucene.util._TestUtil;
import org.junit.Test;
@ -29,7 +29,7 @@ import org.junit.Test;
// http://lucenebook.com
//
public class TestSnapshotDeletionPolicy extends LuceneTestCaseJ4 {
public class TestSnapshotDeletionPolicy extends LuceneTestCase {
public static final String INDEX_PATH = "test.snapshots";
protected IndexWriterConfig getConfig(Random random, IndexDeletionPolicy dp) {

View File

@ -22,10 +22,12 @@ import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.*;
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
import org.apache.lucene.search.*;
import org.junit.runner.RunWith;
import java.io.File;
public class TestStressIndexing extends MultiCodecTestCase {
@RunWith(LuceneTestCase.MultiCodecTestCaseRunner.class)
public class TestStressIndexing extends LuceneTestCase {
private static abstract class TimedThread extends Thread {
volatile boolean failed;
int count;

View File

@ -35,8 +35,10 @@ import org.apache.lucene.document.Fieldable;
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.store.Directory;
import org.junit.runner.RunWith;
public class TestStressIndexing2 extends MultiCodecTestCase {
@RunWith(LuceneTestCase.MultiCodecTestCaseRunner.class)
public class TestStressIndexing2 extends LuceneTestCase {
static int maxFields=4;
static int bigFieldSize=10;
static boolean sameFieldOrder=false;
@ -236,7 +238,7 @@ public class TestStressIndexing2 extends MultiCodecTestCase {
public static void indexSerial(Random random, Map<String,Document> docs, Directory dir) throws IOException {
IndexWriter w = new IndexWriter(dir, LuceneTestCaseJ4.newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
IndexWriter w = new IndexWriter(dir, LuceneTestCase.newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));
// index all docs in a single thread
Iterator<Document> iter = docs.values().iterator();

View File

@ -48,10 +48,6 @@ public class TestTermVectorsReader extends LuceneTestCase {
private FieldInfos fieldInfos = new FieldInfos();
private static int TERM_FREQ = 3;
public TestTermVectorsReader(String s) {
super(s);
}
private class TestToken implements Comparable<TestToken> {
String text;
int pos;
@ -65,7 +61,7 @@ public class TestTermVectorsReader extends LuceneTestCase {
TestToken[] tokens = new TestToken[testTerms.length * TERM_FREQ];
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
/*
for (int i = 0; i < testFields.length; i++) {
@ -125,7 +121,7 @@ public class TestTermVectorsReader extends LuceneTestCase {
}
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
dir.close();
super.tearDown();
}

View File

@ -122,7 +122,7 @@ public class TestTransactionRollback extends LuceneTestCase {
*/
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
dir = newDirectory();
//Build index, of records 1 to 100, committing after each batch of 10
@ -144,7 +144,7 @@ public class TestTransactionRollback extends LuceneTestCase {
}
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
dir.close();
super.tearDown();
}

View File

@ -30,7 +30,7 @@ import java.io.IOException;
import static org.junit.Assert.*;
import org.junit.Test;
public class TestSurrogates extends LuceneTestCaseJ4 {
public class TestSurrogates extends LuceneTestCase {
private static String makeDifficultRandomUnicodeString(Random r) {
final int end = r.nextInt(20);

View File

@ -25,7 +25,7 @@ import org.apache.lucene.index.codecs.preflex.PreFlexCodec;
import org.apache.lucene.index.codecs.preflex.PreFlexFields;
import org.apache.lucene.index.codecs.FieldsConsumer;
import org.apache.lucene.index.codecs.FieldsProducer;
import org.apache.lucene.util.LuceneTestCaseJ4;
import org.apache.lucene.util.LuceneTestCase;
/** Codec, only for testing, that can write and read the
* pre-flex index format.
@ -63,7 +63,7 @@ public class PreFlexRWCodec extends PreFlexCodec {
//System.out.println(trace[i].getClassName());
if ("merge".equals(trace[i].getMethodName())) {
unicodeSortOrder = false;
if (LuceneTestCaseJ4.VERBOSE) {
if (LuceneTestCase.VERBOSE) {
System.out.println("NOTE: PreFlexRW codec: forcing legacy UTF16 term sort order");
}
break;

View File

@ -19,11 +19,13 @@ package org.apache.lucene.messages;
import java.util.Locale;
import org.apache.lucene.util.LocalizedTestCase;
import org.apache.lucene.util.LuceneTestCase;
import org.junit.runner.RunWith;
/**
*/
public class TestNLS extends LocalizedTestCase {
@RunWith(LuceneTestCase.LocalizedTestCaseRunner.class)
public class TestNLS extends LuceneTestCase {
public void testMessageLoading() {
Message invalidSyntax = new MessageImpl(
MessagesTestBundle.Q0001E_INVALID_SYNTAX, "XXX");

View File

@ -60,23 +60,17 @@ import org.apache.lucene.search.TermQuery;
import org.apache.lucene.search.WildcardQuery;
import org.apache.lucene.search.BooleanClause.Occur;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.LocalizedTestCase;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.automaton.BasicAutomata;
import org.apache.lucene.util.automaton.CharacterRunAutomaton;
import org.apache.lucene.util.automaton.RegExp;
import org.junit.runner.RunWith;
/**
* Tests QueryParser.
*/
public class TestQueryParser extends LocalizedTestCase {
public TestQueryParser(String name) {
super(name, new HashSet<String>(Arrays.asList(
"testLegacyDateRange", "testDateRange",
"testCJK", "testNumber", "testFarsiRangeCollating",
"testLocalDateFormat"
)));
}
@RunWith(LuceneTestCase.LocalizedTestCaseRunner.class)
public class TestQueryParser extends LuceneTestCase {
public static Analyzer qpAnalyzer = new QPTestAnalyzer();
@ -150,7 +144,7 @@ public class TestQueryParser extends LocalizedTestCase {
private int originalMaxClauses;
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
originalMaxClauses = BooleanQuery.getMaxClauseCount();
}
@ -1142,7 +1136,7 @@ public class TestQueryParser extends LocalizedTestCase {
}
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
BooleanQuery.setMaxClauseCount(originalMaxClauses);
super.tearDown();
}

View File

@ -20,7 +20,7 @@ package org.apache.lucene.search;
import java.io.IOException;
import java.util.Random;
import org.apache.lucene.util.LuceneTestCaseJ4;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util._TestUtil;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
@ -34,7 +34,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
public class BaseTestRangeFilter extends LuceneTestCaseJ4 {
public class BaseTestRangeFilter extends LuceneTestCase {
public static final boolean F = false;
public static final boolean T = true;

View File

@ -24,10 +24,10 @@ import java.io.IOException;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.search.Collector;
import org.apache.lucene.search.Scorer;
import org.apache.lucene.util.LuceneTestCaseJ4;
import org.apache.lucene.util.LuceneTestCase;
import org.junit.Test;
public class MultiCollectorTest extends LuceneTestCaseJ4 {
public class MultiCollectorTest extends LuceneTestCase {
private static class DummyCollector extends Collector {

View File

@ -18,7 +18,7 @@ import org.apache.lucene.store.Directory;
import org.apache.lucene.store.MockDirectoryWrapper;
import org.apache.lucene.store.RAMDirectory;
import static org.apache.lucene.util.LuceneTestCaseJ4.TEST_VERSION_CURRENT;
import static org.apache.lucene.util.LuceneTestCase.TEST_VERSION_CURRENT;
/**
* Copyright 2005 Apache Software Foundation

View File

@ -31,7 +31,7 @@ import org.apache.lucene.queryParser.QueryParser;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.MockDirectoryWrapper;
import org.apache.lucene.store.RAMDirectory;
import org.apache.lucene.util.LuceneTestCaseJ4;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util._TestUtil;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@ -42,7 +42,7 @@ import static org.junit.Assert.*;
/** Test BooleanQuery2 against BooleanQuery by overriding the standard query parser.
* This also tests the scoring order of BooleanQuery.
*/
public class TestBoolean2 extends LuceneTestCaseJ4 {
public class TestBoolean2 extends LuceneTestCase {
private static IndexSearcher searcher;
private static IndexSearcher bigSearcher;
private static IndexReader reader;

View File

@ -37,7 +37,7 @@ public class TestBooleanMinShouldMatch extends LuceneTestCase {
private IndexSearcher s;
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
String[] data = new String [] {
@ -71,7 +71,7 @@ public class TestBooleanMinShouldMatch extends LuceneTestCase {
}
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
s.close();
r.close();
index.close();

View File

@ -131,7 +131,7 @@ public class TestBooleanOr extends LuceneTestCase {
}
@Override
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
//
@ -164,7 +164,7 @@ public class TestBooleanOr extends LuceneTestCase {
}
@Override
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
searcher.close();
reader.close();
dir.close();

View File

@ -18,9 +18,6 @@ package org.apache.lucene.search;
*/
import org.apache.lucene.util.LuceneTestCase;
import junit.framework.Test;
import junit.framework.TestSuite;
import junit.textui.TestRunner;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.index.Term;
import org.apache.lucene.index.IndexReader;
@ -37,18 +34,6 @@ import org.apache.lucene.store.Directory;
public class TestBooleanPrefixQuery extends LuceneTestCase {
public static void main(String[] args) {
TestRunner.run(suite());
}
public static Test suite() {
return new TestSuite(TestBooleanPrefixQuery.class);
}
public TestBooleanPrefixQuery(String name) {
super(name);
}
private int getCount(IndexReader r, Query q) throws Exception {
if (q instanceof BooleanQuery) {
return ((BooleanQuery) q).getClauses().length;

View File

@ -31,11 +31,6 @@ import org.apache.lucene.util.LuceneTestCase;
public class TestBooleanScorer extends LuceneTestCase
{
public TestBooleanScorer(String name) {
super(name);
}
private static final String FIELD = "category";
public void testMethod() throws Exception {

Some files were not shown because too many files have changed in this diff Show More