mirror of https://github.com/apache/lucene.git
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:
parent
5192d949ad
commit
feabadea20
|
@ -25,10 +25,6 @@ import org.apache.lucene.util.LuceneTestCase;
|
||||||
|
|
||||||
public abstract class DocumentTestCase extends LuceneTestCase
|
public abstract class DocumentTestCase extends LuceneTestCase
|
||||||
{
|
{
|
||||||
public DocumentTestCase(String name) {
|
|
||||||
super(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected File getFile(String filename) throws IOException {
|
protected File getFile(String filename) throws IOException {
|
||||||
String fullname =
|
String fullname =
|
||||||
this.getClass().getResource(filename).getFile();
|
this.getClass().getResource(filename).getFile();
|
||||||
|
|
|
@ -24,10 +24,6 @@ import org.apache.lucene.ant.HtmlDocument;
|
||||||
|
|
||||||
public class HtmlDocumentTest extends DocumentTestCase
|
public class HtmlDocumentTest extends DocumentTestCase
|
||||||
{
|
{
|
||||||
public HtmlDocumentTest (String name) {
|
|
||||||
super(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
HtmlDocument doc;
|
HtmlDocument doc;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class IndexTaskTest extends LuceneTestCase {
|
||||||
*@exception IOException Description of Exception
|
*@exception IOException Description of Exception
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
// slightly hackish way to get the src/test dir
|
// slightly hackish way to get the src/test dir
|
||||||
String docsDir = getDataFile("test.txt").getParent();
|
String docsDir = getDataFile("test.txt").getParent();
|
||||||
|
@ -87,7 +87,7 @@ public class IndexTaskTest extends LuceneTestCase {
|
||||||
* TODO: remove indexDir?
|
* TODO: remove indexDir?
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
searcher.close();
|
searcher.close();
|
||||||
dir.close();
|
dir.close();
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
|
|
|
@ -24,10 +24,6 @@ import org.apache.lucene.ant.TextDocument;
|
||||||
|
|
||||||
public class TextDocumentTest extends DocumentTestCase
|
public class TextDocumentTest extends DocumentTestCase
|
||||||
{
|
{
|
||||||
public TextDocumentTest (String name) {
|
|
||||||
super(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
TextDocument doc;
|
TextDocument doc;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -60,7 +60,7 @@ import org.apache.lucene.search.FieldCache;
|
||||||
public class TestPerfTasksLogic extends BenchmarkTestCase {
|
public class TestPerfTasksLogic extends BenchmarkTestCase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
copyToWorkDir("reuters.first20.lines.txt");
|
copyToWorkDir("reuters.first20.lines.txt");
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,10 +37,6 @@ public class TestPerfTasksParse extends LuceneTestCase {
|
||||||
INDENT + "print.props=false" + NEW_LINE
|
INDENT + "print.props=false" + NEW_LINE
|
||||||
;
|
;
|
||||||
|
|
||||||
public TestPerfTasksParse(String name) {
|
|
||||||
super(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Test the repetiotion parsing for parallel tasks */
|
/** Test the repetiotion parsing for parallel tasks */
|
||||||
public void testParseParallelTaskSequenceRepetition() throws Exception {
|
public void testParseParallelTaskSequenceRepetition() throws Exception {
|
||||||
String taskStr = "AddDoc";
|
String taskStr = "AddDoc";
|
||||||
|
|
|
@ -17,14 +17,12 @@ package org.apache.lucene.benchmark.byTask.utils;
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.apache.lucene.util.LuceneTestCaseJ4;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class TestConfig extends LuceneTestCaseJ4 {
|
public class TestConfig extends LuceneTestCase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAbsolutePathNamesWindows() throws Exception {
|
public void testAbsolutePathNamesWindows() throws Exception {
|
||||||
|
|
|
@ -46,7 +46,7 @@ import org.apache.lucene.store.FSDirectory;
|
||||||
public class TestQualityRun extends BenchmarkTestCase {
|
public class TestQualityRun extends BenchmarkTestCase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
copyToWorkDir("reuters.578.lines.txt.bz2");
|
copyToWorkDir("reuters.578.lines.txt.bz2");
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class JEStoreTest extends LuceneTestCase {
|
||||||
protected Database index, blocks;
|
protected Database index, blocks;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
|
||||||
if (!dbHome.exists())
|
if (!dbHome.exists())
|
||||||
|
@ -100,7 +100,7 @@ public class JEStoreTest extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
|
|
||||||
if (index != null)
|
if (index != null)
|
||||||
index.close();
|
index.close();
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class DbStoreTest extends LuceneTestCase {
|
||||||
protected Database index, blocks;
|
protected Database index, blocks;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
if (!dbHome.exists())
|
if (!dbHome.exists())
|
||||||
dbHome.mkdir();
|
dbHome.mkdir();
|
||||||
|
@ -100,7 +100,7 @@ public class DbStoreTest extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
if (index != null)
|
if (index != null)
|
||||||
index.close();
|
index.close();
|
||||||
if (blocks != null)
|
if (blocks != null)
|
||||||
|
|
|
@ -106,15 +106,6 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
|
||||||
"This text has a typo in referring to Keneddy",
|
"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" };
|
"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 {
|
public void testQueryScorerHits() throws Exception {
|
||||||
Analyzer analyzer = new MockAnalyzer(MockTokenizer.SIMPLE, true);
|
Analyzer analyzer = new MockAnalyzer(MockTokenizer.SIMPLE, true);
|
||||||
QueryParser qp = new QueryParser(TEST_VERSION_CURRENT, FIELD_NAME, analyzer);
|
QueryParser qp = new QueryParser(TEST_VERSION_CURRENT, FIELD_NAME, analyzer);
|
||||||
|
@ -1719,7 +1710,7 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
dir = newDirectory();
|
dir = newDirectory();
|
||||||
ramDir = newDirectory();
|
ramDir = newDirectory();
|
||||||
|
@ -1755,7 +1746,7 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
if (searcher != null) searcher.close();
|
if (searcher != null) searcher.close();
|
||||||
reader.close();
|
reader.close();
|
||||||
dir.close();
|
dir.close();
|
||||||
|
|
|
@ -85,7 +85,7 @@ public abstract class AbstractTestCase extends LuceneTestCase {
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
analyzerW = new MockAnalyzer(MockTokenizer.WHITESPACE, false);
|
analyzerW = new MockAnalyzer(MockTokenizer.WHITESPACE, false);
|
||||||
analyzerB = new BigramAnalyzer();
|
analyzerB = new BigramAnalyzer();
|
||||||
|
@ -96,7 +96,7 @@ public abstract class AbstractTestCase extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
if( reader != null ){
|
if( reader != null ){
|
||||||
reader.close();
|
reader.close();
|
||||||
reader = null;
|
reader = null;
|
||||||
|
|
|
@ -36,11 +36,6 @@ import org.apache.lucene.util.LuceneTestCase;
|
||||||
* Tests changing of field norms with a custom similarity and with fake norms.
|
* Tests changing of field norms with a custom similarity and with fake norms.
|
||||||
*/
|
*/
|
||||||
public class TestFieldNormModifier extends LuceneTestCase {
|
public class TestFieldNormModifier extends LuceneTestCase {
|
||||||
|
|
||||||
public TestFieldNormModifier(String name) {
|
|
||||||
super(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int NUM_DOCS = 5;
|
public static int NUM_DOCS = 5;
|
||||||
|
|
||||||
public Directory store;
|
public Directory store;
|
||||||
|
@ -54,7 +49,7 @@ public class TestFieldNormModifier extends LuceneTestCase {
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
store = newDirectory();
|
store = newDirectory();
|
||||||
IndexWriter writer = new IndexWriter(store, newIndexWriterConfig(
|
IndexWriter writer = new IndexWriter(store, newIndexWriterConfig(
|
||||||
|
@ -76,7 +71,7 @@ public class TestFieldNormModifier extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
store.close();
|
store.close();
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class TestMultiPassIndexSplitter extends LuceneTestCase {
|
||||||
Directory dir;
|
Directory dir;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
dir = newDirectory();
|
dir = newDirectory();
|
||||||
IndexWriter w = new IndexWriter(dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()));
|
IndexWriter w = new IndexWriter(dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
|
@ -50,7 +50,7 @@ public class TestMultiPassIndexSplitter extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
input.close();
|
input.close();
|
||||||
dir.close();
|
dir.close();
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
|
|
|
@ -39,11 +39,6 @@ import org.apache.lucene.util.LuceneTestCase;
|
||||||
* Tests changing the norms after changing the simularity
|
* Tests changing the norms after changing the simularity
|
||||||
*/
|
*/
|
||||||
public class TestLengthNormModifier extends LuceneTestCase {
|
public class TestLengthNormModifier extends LuceneTestCase {
|
||||||
|
|
||||||
public TestLengthNormModifier(String name) {
|
|
||||||
super(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int NUM_DOCS = 5;
|
public static int NUM_DOCS = 5;
|
||||||
|
|
||||||
public Directory store;
|
public Directory store;
|
||||||
|
@ -57,7 +52,7 @@ public class TestLengthNormModifier extends LuceneTestCase {
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
store = newDirectory();
|
store = newDirectory();
|
||||||
IndexWriter writer = new IndexWriter(store, newIndexWriterConfig(
|
IndexWriter writer = new IndexWriter(store, newIndexWriterConfig(
|
||||||
|
@ -82,7 +77,7 @@ public class TestLengthNormModifier extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
store.close();
|
store.close();
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class BooleanFilterTest extends LuceneTestCase {
|
||||||
private IndexReader reader;
|
private IndexReader reader;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
directory = newDirectory();
|
directory = newDirectory();
|
||||||
RandomIndexWriter writer = new RandomIndexWriter(random, directory, new MockAnalyzer(MockTokenizer.WHITESPACE, false));
|
RandomIndexWriter writer = new RandomIndexWriter(random, directory, new MockAnalyzer(MockTokenizer.WHITESPACE, false));
|
||||||
|
@ -53,7 +53,7 @@ public class BooleanFilterTest extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
mainReader.close();
|
mainReader.close();
|
||||||
directory.close();
|
directory.close();
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class ChainedFilterTest extends LuceneTestCase {
|
||||||
private QueryWrapperFilter sueFilter;
|
private QueryWrapperFilter sueFilter;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
directory = newDirectory();
|
directory = newDirectory();
|
||||||
RandomIndexWriter writer = new RandomIndexWriter(random, directory);
|
RandomIndexWriter writer = new RandomIndexWriter(random, directory);
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class DuplicateFilterTest extends LuceneTestCase {
|
||||||
private IndexSearcher searcher;
|
private IndexSearcher searcher;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
directory = newDirectory();
|
directory = newDirectory();
|
||||||
RandomIndexWriter writer = new RandomIndexWriter(random, directory);
|
RandomIndexWriter writer = new RandomIndexWriter(random, directory);
|
||||||
|
@ -65,7 +65,7 @@ public class DuplicateFilterTest extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
reader.close();
|
reader.close();
|
||||||
searcher.close();
|
searcher.close();
|
||||||
directory.close();
|
directory.close();
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class FuzzyLikeThisQueryTest extends LuceneTestCase {
|
||||||
private Analyzer analyzer=new MockAnalyzer();
|
private Analyzer analyzer=new MockAnalyzer();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
directory = newDirectory();
|
directory = newDirectory();
|
||||||
RandomIndexWriter writer = new RandomIndexWriter(random, directory);
|
RandomIndexWriter writer = new RandomIndexWriter(random, directory);
|
||||||
|
@ -55,7 +55,7 @@ public class FuzzyLikeThisQueryTest extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
searcher.close();
|
searcher.close();
|
||||||
reader.close();
|
reader.close();
|
||||||
directory.close();
|
directory.close();
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class TestRegexQuery extends LuceneTestCase {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
directory = newDirectory();
|
directory = newDirectory();
|
||||||
RandomIndexWriter writer = new RandomIndexWriter(random, directory);
|
RandomIndexWriter writer = new RandomIndexWriter(random, directory);
|
||||||
|
@ -51,7 +51,7 @@ public class TestRegexQuery extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
searcher.close();
|
searcher.close();
|
||||||
reader.close();
|
reader.close();
|
||||||
directory.close();
|
directory.close();
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class TestMoreLikeThis extends LuceneTestCase {
|
||||||
private IndexSearcher searcher;
|
private IndexSearcher searcher;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
directory = newDirectory();
|
directory = newDirectory();
|
||||||
RandomIndexWriter writer = new RandomIndexWriter(random, directory);
|
RandomIndexWriter writer = new RandomIndexWriter(random, directory);
|
||||||
|
@ -57,7 +57,7 @@ public class TestMoreLikeThis extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
reader.close();
|
reader.close();
|
||||||
searcher.close();
|
searcher.close();
|
||||||
directory.close();
|
directory.close();
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class TestAnalyzingQueryParser extends LuceneTestCase {
|
||||||
private String[] fuzzyExpected;
|
private String[] fuzzyExpected;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
wildcardInput = new String[] { "übersetzung über*ung",
|
wildcardInput = new String[] { "übersetzung über*ung",
|
||||||
"Mötley Cr\u00fce Mötl?* Crü?", "Renée Zellweger Ren?? Zellw?ger" };
|
"Mötley Cr\u00fce Mötl?* Crü?", "Renée Zellweger Ren?? Zellw?ger" };
|
||||||
|
|
|
@ -109,7 +109,7 @@ public class TestComplexPhraseQuery extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
rd = newDirectory();
|
rd = newDirectory();
|
||||||
IndexWriter w = new IndexWriter(rd, newIndexWriterConfig(TEST_VERSION_CURRENT, analyzer));
|
IndexWriter w = new IndexWriter(rd, newIndexWriterConfig(TEST_VERSION_CURRENT, analyzer));
|
||||||
|
@ -126,7 +126,7 @@ public class TestComplexPhraseQuery extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
searcher.close();
|
searcher.close();
|
||||||
rd.close();
|
rd.close();
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
|
|
|
@ -35,10 +35,6 @@ public class TestExtendableQueryParser extends TestQueryParser {
|
||||||
private static char[] DELIMITERS = new char[] {
|
private static char[] DELIMITERS = new char[] {
|
||||||
Extensions.DEFAULT_EXTENSION_FIELD_DELIMITER, '-', '|' };
|
Extensions.DEFAULT_EXTENSION_FIELD_DELIMITER, '-', '|' };
|
||||||
|
|
||||||
public TestExtendableQueryParser(String name) {
|
|
||||||
super(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public QueryParser getParser(Analyzer a) throws Exception {
|
public QueryParser getParser(Analyzer a) throws Exception {
|
||||||
return getParser(a, null);
|
return getParser(a, null);
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class TestExtensions extends LuceneTestCase {
|
||||||
private Extensions ext;
|
private Extensions ext;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
this.ext = new Extensions();
|
this.ext = new Extensions();
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,6 @@ import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
|
||||||
import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
|
import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
|
||||||
import org.apache.lucene.document.DateTools;
|
import org.apache.lucene.document.DateTools;
|
||||||
import org.apache.lucene.index.Term;
|
import org.apache.lucene.index.Term;
|
||||||
import org.apache.lucene.queryParser.QueryParser;
|
|
||||||
import org.apache.lucene.search.BooleanClause;
|
import org.apache.lucene.search.BooleanClause;
|
||||||
import org.apache.lucene.search.BooleanQuery;
|
import org.apache.lucene.search.BooleanQuery;
|
||||||
import org.apache.lucene.search.FuzzyQuery;
|
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.TermQuery;
|
||||||
import org.apache.lucene.search.WildcardQuery;
|
import org.apache.lucene.search.WildcardQuery;
|
||||||
import org.apache.lucene.search.BooleanClause.Occur;
|
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.BasicAutomata;
|
||||||
import org.apache.lucene.util.automaton.CharacterRunAutomaton;
|
import org.apache.lucene.util.automaton.CharacterRunAutomaton;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.GregorianCalendar;
|
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 Analyzer qpAnalyzer = new QPTestAnalyzer();
|
||||||
|
|
||||||
public static final class QPTestFilter extends TokenFilter {
|
public static final class QPTestFilter extends TokenFilter {
|
||||||
|
@ -129,7 +121,7 @@ public class TestPrecedenceQueryParser extends LocalizedTestCase {
|
||||||
private int originalMaxClauses;
|
private int originalMaxClauses;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
originalMaxClauses = BooleanQuery.getMaxClauseCount();
|
originalMaxClauses = BooleanQuery.getMaxClauseCount();
|
||||||
}
|
}
|
||||||
|
@ -726,7 +718,7 @@ public class TestPrecedenceQueryParser extends LocalizedTestCase {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
BooleanQuery.setMaxClauseCount(originalMaxClauses);
|
BooleanQuery.setMaxClauseCount(originalMaxClauses);
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,7 @@ public class TestSpanQueryParser extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
|
||||||
this.spanProcessorPipeline = new QueryNodeProcessorPipeline();
|
this.spanProcessorPipeline = new QueryNodeProcessorPipeline();
|
||||||
|
|
|
@ -95,14 +95,6 @@ import org.apache.lucene.util.LuceneTestCase;
|
||||||
*/
|
*/
|
||||||
public class TestSpanQueryParserSimpleSample extends LuceneTestCase {
|
public class TestSpanQueryParserSimpleSample extends LuceneTestCase {
|
||||||
|
|
||||||
public TestSpanQueryParserSimpleSample() {
|
|
||||||
// empty constructor
|
|
||||||
}
|
|
||||||
|
|
||||||
public TestSpanQueryParserSimpleSample(String testName) {
|
|
||||||
super(testName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testBasicDemo() throws Exception {
|
public void testBasicDemo() throws Exception {
|
||||||
SyntaxParser queryParser = new StandardSyntaxParser();
|
SyntaxParser queryParser = new StandardSyntaxParser();
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,6 @@ import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
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.WildcardQuery;
|
||||||
import org.apache.lucene.search.BooleanClause.Occur;
|
import org.apache.lucene.search.BooleanClause.Occur;
|
||||||
import org.apache.lucene.store.Directory;
|
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.BasicAutomata;
|
||||||
import org.apache.lucene.util.automaton.CharacterRunAutomaton;
|
import org.apache.lucene.util.automaton.CharacterRunAutomaton;
|
||||||
import org.apache.lucene.util.automaton.RegExp;
|
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
|
* 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.
|
* Tests QueryParser.
|
||||||
*/
|
*/
|
||||||
public class TestQPHelper extends LocalizedTestCase {
|
@RunWith(LuceneTestCase.LocalizedTestCaseRunner.class)
|
||||||
|
public class TestQPHelper extends LuceneTestCase {
|
||||||
public TestQPHelper(String name) {
|
|
||||||
super(name, new HashSet<String>(Arrays.asList(new String[]{
|
|
||||||
"testLegacyDateRange", "testDateRange",
|
|
||||||
"testCJK", "testNumber", "testFarsiRangeCollating",
|
|
||||||
"testLocalDateFormat"
|
|
||||||
})));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Analyzer qpAnalyzer = new QPTestAnalyzer();
|
public static Analyzer qpAnalyzer = new QPTestAnalyzer();
|
||||||
|
|
||||||
|
@ -194,7 +186,7 @@ public class TestQPHelper extends LocalizedTestCase {
|
||||||
private int originalMaxClauses;
|
private int originalMaxClauses;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
originalMaxClauses = BooleanQuery.getMaxClauseCount();
|
originalMaxClauses = BooleanQuery.getMaxClauseCount();
|
||||||
}
|
}
|
||||||
|
@ -1262,7 +1254,7 @@ public class TestQPHelper extends LocalizedTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
BooleanQuery.setMaxClauseCount(originalMaxClauses);
|
BooleanQuery.setMaxClauseCount(originalMaxClauses);
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,10 +68,11 @@ import org.apache.lucene.search.TermQuery;
|
||||||
import org.apache.lucene.search.TermRangeQuery;
|
import org.apache.lucene.search.TermRangeQuery;
|
||||||
import org.apache.lucene.search.WildcardQuery;
|
import org.apache.lucene.search.WildcardQuery;
|
||||||
import org.apache.lucene.store.Directory;
|
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.BasicAutomata;
|
||||||
import org.apache.lucene.util.automaton.CharacterRunAutomaton;
|
import org.apache.lucene.util.automaton.CharacterRunAutomaton;
|
||||||
import org.apache.lucene.util.automaton.RegExp;
|
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
|
* 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 this entire test case tests QueryParserWrapper which is
|
||||||
* deprecated. When QPW is gone, so will the test.
|
* deprecated. When QPW is gone, so will the test.
|
||||||
*/
|
*/
|
||||||
public class TestQueryParserWrapper extends LocalizedTestCase {
|
@RunWith(LuceneTestCase.LocalizedTestCaseRunner.class)
|
||||||
|
public class TestQueryParserWrapper extends LuceneTestCase {
|
||||||
public TestQueryParserWrapper(String name) {
|
|
||||||
super(name, new HashSet<String>(Arrays.asList(new String[]{
|
|
||||||
"testLegacyDateRange", "testDateRange",
|
|
||||||
"testCJK", "testNumber", "testFarsiRangeCollating",
|
|
||||||
"testLocalDateFormat"
|
|
||||||
})));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Analyzer qpAnalyzer = new QPTestAnalyzer();
|
public static Analyzer qpAnalyzer = new QPTestAnalyzer();
|
||||||
|
|
||||||
|
@ -209,7 +203,7 @@ public class TestQueryParserWrapper extends LocalizedTestCase {
|
||||||
private int originalMaxClauses;
|
private int originalMaxClauses;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
originalMaxClauses = BooleanQuery.getMaxClauseCount();
|
originalMaxClauses = BooleanQuery.getMaxClauseCount();
|
||||||
}
|
}
|
||||||
|
@ -1213,7 +1207,7 @@ public class TestQueryParserWrapper extends LocalizedTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
BooleanQuery.setMaxClauseCount(originalMaxClauses);
|
BooleanQuery.setMaxClauseCount(originalMaxClauses);
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,15 +28,14 @@ import org.apache.lucene.search.Query;
|
||||||
|
|
||||||
import org.apache.lucene.queryParser.surround.parser.QueryParser;
|
import org.apache.lucene.queryParser.surround.parser.QueryParser;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import org.junit.Assert;
|
||||||
import junit.framework.Assert;
|
|
||||||
|
|
||||||
public class BooleanQueryTst {
|
public class BooleanQueryTst {
|
||||||
String queryText;
|
String queryText;
|
||||||
final int[] expectedDocNrs;
|
final int[] expectedDocNrs;
|
||||||
SingleFieldTestDb dBase;
|
SingleFieldTestDb dBase;
|
||||||
String fieldName;
|
String fieldName;
|
||||||
TestCase testCase;
|
Assert testCase;
|
||||||
BasicQueryFactory qf;
|
BasicQueryFactory qf;
|
||||||
boolean verbose = true;
|
boolean verbose = true;
|
||||||
|
|
||||||
|
@ -45,7 +44,7 @@ public class BooleanQueryTst {
|
||||||
int[] expectedDocNrs,
|
int[] expectedDocNrs,
|
||||||
SingleFieldTestDb dBase,
|
SingleFieldTestDb dBase,
|
||||||
String fieldName,
|
String fieldName,
|
||||||
TestCase testCase,
|
Assert testCase,
|
||||||
BasicQueryFactory qf) {
|
BasicQueryFactory qf) {
|
||||||
this.queryText = queryText;
|
this.queryText = queryText;
|
||||||
this.expectedDocNrs = expectedDocNrs;
|
this.expectedDocNrs = expectedDocNrs;
|
||||||
|
|
|
@ -28,7 +28,7 @@ import java.rmi.registry.LocateRegistry;
|
||||||
import java.rmi.server.RMIClientSocketFactory;
|
import java.rmi.server.RMIClientSocketFactory;
|
||||||
import java.rmi.server.RMIServerSocketFactory;
|
import java.rmi.server.RMIServerSocketFactory;
|
||||||
|
|
||||||
import org.apache.lucene.util.LuceneTestCaseJ4;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -38,7 +38,7 @@ import org.junit.AfterClass;
|
||||||
* to start the server.
|
* to start the server.
|
||||||
* Call {@link #lookupRemote} to get a RemoteSearchable.
|
* Call {@link #lookupRemote} to get a RemoteSearchable.
|
||||||
*/
|
*/
|
||||||
public abstract class RemoteTestCaseJ4 extends LuceneTestCaseJ4 {
|
public abstract class RemoteTestCase extends LuceneTestCase {
|
||||||
private static int port;
|
private static int port;
|
||||||
|
|
||||||
public static void startServer(Searchable searchable) throws Exception {
|
public static void startServer(Searchable searchable) throws Exception {
|
|
@ -34,7 +34,7 @@ import static org.junit.Assert.*;
|
||||||
/**
|
/**
|
||||||
* Tests that the index is cached on the searcher side of things.
|
* 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 Directory indexStore;
|
||||||
private static Searchable local;
|
private static Searchable local;
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import java.util.Random;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
public class TestRemoteSearchable extends RemoteTestCaseJ4 {
|
public class TestRemoteSearchable extends RemoteTestCase {
|
||||||
private static Directory indexStore;
|
private static Directory indexStore;
|
||||||
private static Searchable local;
|
private static Searchable local;
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ import org.junit.Test;
|
||||||
* methods and therefore unused members and methodes.
|
* methods and therefore unused members and methodes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class TestRemoteSort extends RemoteTestCaseJ4 {
|
public class TestRemoteSort extends RemoteTestCase {
|
||||||
|
|
||||||
private static IndexSearcher full;
|
private static IndexSearcher full;
|
||||||
private static Directory indexStore;
|
private static Directory indexStore;
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class TestCartesian extends LuceneTestCase {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
directory = newDirectory();
|
directory = newDirectory();
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ public class TestCartesian extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
directory.close();
|
directory.close();
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class TestDistance extends LuceneTestCase {
|
||||||
private IndexWriter writer;
|
private IndexWriter writer;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
directory = newDirectory();
|
directory = newDirectory();
|
||||||
writer = new IndexWriter(directory, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()));
|
writer = new IndexWriter(directory, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||||
|
@ -50,7 +50,7 @@ public class TestDistance extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
writer.close();
|
writer.close();
|
||||||
directory.close();
|
directory.close();
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class TestLuceneDictionary extends LuceneTestCase {
|
||||||
private Iterator<String> it;
|
private Iterator<String> it;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
store = newDirectory();
|
store = newDirectory();
|
||||||
IndexWriter writer = new IndexWriter(store, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(MockTokenizer.WHITESPACE, false)));
|
IndexWriter writer = new IndexWriter(store, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(MockTokenizer.WHITESPACE, false)));
|
||||||
|
@ -75,7 +75,7 @@ public class TestLuceneDictionary extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
if (indexReader != null)
|
if (indexReader != null)
|
||||||
indexReader.close();
|
indexReader.close();
|
||||||
store.close();
|
store.close();
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class TestSpellChecker extends LuceneTestCase {
|
||||||
private List<IndexSearcher> searchers;
|
private List<IndexSearcher> searchers;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
|
||||||
//create a user index
|
//create a user index
|
||||||
|
@ -71,7 +71,7 @@ public class TestSpellChecker extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
userindex.close();
|
userindex.close();
|
||||||
if (!spellChecker.isClosed())
|
if (!spellChecker.isClosed())
|
||||||
spellChecker.close();
|
spellChecker.close();
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class TestBasicList extends LuceneTestCase {
|
||||||
private List<RestaurantInfo> list;
|
private List<RestaurantInfo> list;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
list = new ArrayList<RestaurantInfo>();
|
list = new ArrayList<RestaurantInfo>();
|
||||||
list.add(DataStore.canolis);
|
list.add(DataStore.canolis);
|
||||||
|
|
|
@ -30,7 +30,7 @@ public class TestBasicTable extends LuceneTestCase {
|
||||||
private List<RestaurantInfo> list;
|
private List<RestaurantInfo> list;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
list = new ArrayList<RestaurantInfo>();
|
list = new ArrayList<RestaurantInfo>();
|
||||||
list.add(DataStore.canolis);
|
list.add(DataStore.canolis);
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class TestSearchingList extends LuceneTestCase {
|
||||||
private ListSearcher listSearcher;
|
private ListSearcher listSearcher;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
baseListModel = new BaseListModel(DataStore.getRestaurants());
|
baseListModel = new BaseListModel(DataStore.getRestaurants());
|
||||||
listSearcher = new ListSearcher(baseListModel);
|
listSearcher = new ListSearcher(baseListModel);
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class TestSearchingTable extends LuceneTestCase {
|
||||||
private TableSearcher tableSearcher;
|
private TableSearcher tableSearcher;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
baseTableModel = new BaseTableModel(DataStore.getRestaurants());
|
baseTableModel = new BaseTableModel(DataStore.getRestaurants());
|
||||||
tableSearcher = new TableSearcher(baseTableModel);
|
tableSearcher = new TableSearcher(baseTableModel);
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class TestUpdatingList extends LuceneTestCase {
|
||||||
RestaurantInfo infoToAdd1, infoToAdd2;
|
RestaurantInfo infoToAdd1, infoToAdd2;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
baseListModel = new BaseListModel(DataStore.getRestaurants());
|
baseListModel = new BaseListModel(DataStore.getRestaurants());
|
||||||
listSearcher = new ListSearcher(baseListModel);
|
listSearcher = new ListSearcher(baseListModel);
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class TestUpdatingTable extends LuceneTestCase {
|
||||||
RestaurantInfo infoToAdd1, infoToAdd2;
|
RestaurantInfo infoToAdd1, infoToAdd2;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
baseTableModel = new BaseTableModel(DataStore.getRestaurants());
|
baseTableModel = new BaseTableModel(DataStore.getRestaurants());
|
||||||
tableSearcher = new TableSearcher(baseTableModel);
|
tableSearcher = new TableSearcher(baseTableModel);
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class TestWordnet extends LuceneTestCase {
|
||||||
new File(TEMP_DIR,"testLuceneWordnet").getAbsolutePath();
|
new File(TEMP_DIR,"testLuceneWordnet").getAbsolutePath();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
// create a temporary synonym index
|
// create a temporary synonym index
|
||||||
File testFile = getDataFile("testSynonyms.txt");
|
File testFile = getDataFile("testSynonyms.txt");
|
||||||
|
@ -70,7 +70,7 @@ public class TestWordnet extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
searcher.close();
|
searcher.close();
|
||||||
rmDir(storePathName); // delete our temporary synonym index
|
rmDir(storePathName); // delete our temporary synonym index
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class TestParser extends LuceneTestCase {
|
||||||
* @see TestCase#setUp()
|
* @see TestCase#setUp()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
|
||||||
//initialize the parser
|
//initialize the parser
|
||||||
|
@ -85,7 +85,7 @@ public class TestParser extends LuceneTestCase {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
reader.close();
|
reader.close();
|
||||||
searcher.close();
|
searcher.close();
|
||||||
dir.close();
|
dir.close();
|
||||||
|
|
|
@ -136,7 +136,7 @@ public class TestQueryTemplateManager extends LuceneTestCase {
|
||||||
* @see TestCase#setUp()
|
* @see TestCase#setUp()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ public class TestQueryTemplateManager extends LuceneTestCase {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
searcher.close();
|
searcher.close();
|
||||||
dir.close();
|
dir.close();
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
|
|
|
@ -29,15 +29,6 @@ import org.apache.lucene.util.LuceneTestCase;
|
||||||
* Base class for all Lucene unit tests that use TokenStreams.
|
* Base class for all Lucene unit tests that use TokenStreams.
|
||||||
*/
|
*/
|
||||||
public abstract class BaseTokenStreamTestCase extends LuceneTestCase {
|
public abstract class BaseTokenStreamTestCase extends LuceneTestCase {
|
||||||
|
|
||||||
public BaseTokenStreamTestCase() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public BaseTokenStreamTestCase(String name) {
|
|
||||||
super(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
// some helpers to test Analyzers and TokenStreams:
|
// some helpers to test Analyzers and TokenStreams:
|
||||||
|
|
||||||
public static interface CheckClearAttributesAttribute extends Attribute {
|
public static interface CheckClearAttributesAttribute extends Attribute {
|
||||||
|
|
|
@ -27,10 +27,6 @@ import java.io.StringReader;
|
||||||
|
|
||||||
public class TestToken extends LuceneTestCase {
|
public class TestToken extends LuceneTestCase {
|
||||||
|
|
||||||
public TestToken(String name) {
|
|
||||||
super(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testCtor() throws Exception {
|
public void testCtor() throws Exception {
|
||||||
Token t = new Token();
|
Token t = new Token();
|
||||||
char[] content = "hello".toCharArray();
|
char[] content = "hello".toCharArray();
|
||||||
|
|
|
@ -26,10 +26,6 @@ import java.util.Random;
|
||||||
|
|
||||||
public class TestCharTermAttributeImpl extends LuceneTestCase {
|
public class TestCharTermAttributeImpl extends LuceneTestCase {
|
||||||
|
|
||||||
public TestCharTermAttributeImpl(String name) {
|
|
||||||
super(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testResize() {
|
public void testResize() {
|
||||||
CharTermAttributeImpl t = new CharTermAttributeImpl();
|
CharTermAttributeImpl t = new CharTermAttributeImpl();
|
||||||
char[] content = "hello".toCharArray();
|
char[] content = "hello".toCharArray();
|
||||||
|
|
|
@ -25,10 +25,6 @@ import org.apache.lucene.util.AttributeSource.AttributeFactory;
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public class TestSimpleAttributeImpls extends LuceneTestCase {
|
public class TestSimpleAttributeImpls extends LuceneTestCase {
|
||||||
|
|
||||||
public TestSimpleAttributeImpls(String name) {
|
|
||||||
super(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testFlagsAttribute() throws Exception {
|
public void testFlagsAttribute() throws Exception {
|
||||||
FlagsAttributeImpl att = new FlagsAttributeImpl();
|
FlagsAttributeImpl att = new FlagsAttributeImpl();
|
||||||
assertEquals(0, att.getFlags());
|
assertEquals(0, att.getFlags());
|
||||||
|
|
|
@ -8,7 +8,8 @@ import java.util.GregorianCalendar;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
import java.util.Locale;
|
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
|
* 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
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
@RunWith(LuceneTestCase.LocalizedTestCaseRunner.class)
|
||||||
public class TestDateTools extends LocalizedTestCase {
|
public class TestDateTools extends LuceneTestCase {
|
||||||
|
|
||||||
public void testStringToDate() throws ParseException {
|
public void testStringToDate() throws ParseException {
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ import org.apache.lucene.document.Field;
|
||||||
import org.apache.lucene.document.Fieldable;
|
import org.apache.lucene.document.Fieldable;
|
||||||
import org.apache.lucene.search.Similarity;
|
import org.apache.lucene.search.Similarity;
|
||||||
import org.apache.lucene.store.Directory;
|
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 {
|
class DocHelper {
|
||||||
public static final String FIELD_1_TEXT = "field one text";
|
public static final String FIELD_1_TEXT = "field one text";
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.apache.lucene.analysis.MockAnalyzer;
|
||||||
import org.apache.lucene.document.Document;
|
import org.apache.lucene.document.Document;
|
||||||
import org.apache.lucene.index.codecs.CodecProvider;
|
import org.apache.lucene.index.codecs.CodecProvider;
|
||||||
import org.apache.lucene.store.Directory;
|
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.Version;
|
||||||
import org.apache.lucene.util._TestUtil;
|
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 */
|
/** create a RandomIndexWriter with a random config: Uses TEST_VERSION_CURRENT and MockAnalyzer */
|
||||||
public RandomIndexWriter(Random r, Directory dir) throws IOException {
|
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 */
|
/** create a RandomIndexWriter with a random config: Uses TEST_VERSION_CURRENT */
|
||||||
public RandomIndexWriter(Random r, Directory dir, Analyzer a) throws IOException {
|
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 */
|
/** create a RandomIndexWriter with a random config */
|
||||||
public RandomIndexWriter(Random r, Directory dir, Version v, Analyzer a) throws IOException {
|
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 */
|
/** create a RandomIndexWriter with the provided config */
|
||||||
|
@ -81,7 +81,7 @@ public class RandomIndexWriter implements Closeable {
|
||||||
this.r = r;
|
this.r = r;
|
||||||
w = new MockIndexWriter(r, dir, c);
|
w = new MockIndexWriter(r, dir, c);
|
||||||
flushAt = _TestUtil.nextInt(r, 10, 1000);
|
flushAt = _TestUtil.nextInt(r, 10, 1000);
|
||||||
if (LuceneTestCaseJ4.VERBOSE) {
|
if (LuceneTestCase.VERBOSE) {
|
||||||
System.out.println("RIW config=" + w.getConfig());
|
System.out.println("RIW config=" + w.getConfig());
|
||||||
System.out.println("codec default=" + CodecProvider.getDefaultCodec());
|
System.out.println("codec default=" + CodecProvider.getDefaultCodec());
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ public class RandomIndexWriter implements Closeable {
|
||||||
public void addDocument(Document doc) throws IOException {
|
public void addDocument(Document doc) throws IOException {
|
||||||
w.addDocument(doc);
|
w.addDocument(doc);
|
||||||
if (docCount++ == flushAt) {
|
if (docCount++ == flushAt) {
|
||||||
if (LuceneTestCaseJ4.VERBOSE) {
|
if (LuceneTestCase.VERBOSE) {
|
||||||
System.out.println("RIW.addDocument: now doing a commit");
|
System.out.println("RIW.addDocument: now doing a commit");
|
||||||
}
|
}
|
||||||
w.commit();
|
w.commit();
|
||||||
|
@ -127,12 +127,12 @@ public class RandomIndexWriter implements Closeable {
|
||||||
// IndexReader.open so terms are sorted in codepoint
|
// IndexReader.open so terms are sorted in codepoint
|
||||||
// order during searching:
|
// order during searching:
|
||||||
if (!w.codecs.getWriter(null).name.equals("PreFlex") && r.nextBoolean()) {
|
if (!w.codecs.getWriter(null).name.equals("PreFlex") && r.nextBoolean()) {
|
||||||
if (LuceneTestCaseJ4.VERBOSE) {
|
if (LuceneTestCase.VERBOSE) {
|
||||||
System.out.println("RIW.getReader: use NRT reader");
|
System.out.println("RIW.getReader: use NRT reader");
|
||||||
}
|
}
|
||||||
return w.getReader();
|
return w.getReader();
|
||||||
} else {
|
} else {
|
||||||
if (LuceneTestCaseJ4.VERBOSE) {
|
if (LuceneTestCase.VERBOSE) {
|
||||||
System.out.println("RIW.getReader: open new reader");
|
System.out.println("RIW.getReader: open new reader");
|
||||||
}
|
}
|
||||||
w.commit();
|
w.commit();
|
||||||
|
|
|
@ -39,8 +39,9 @@ import org.apache.lucene.search.Query;
|
||||||
import org.apache.lucene.search.ScoreDoc;
|
import org.apache.lucene.search.ScoreDoc;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.util.BytesRef;
|
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.apache.lucene.util.Version;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
// TODO: test multiple codecs here?
|
// TODO: test multiple codecs here?
|
||||||
|
|
||||||
|
@ -59,8 +60,8 @@ import org.apache.lucene.util.Version;
|
||||||
// goes to 1 before next one known to exist
|
// goes to 1 before next one known to exist
|
||||||
// - skipTo(term)
|
// - skipTo(term)
|
||||||
// - skipTo(doc)
|
// - skipTo(doc)
|
||||||
|
@RunWith(LuceneTestCase.MultiCodecTestCaseRunner.class)
|
||||||
public class TestCodecs extends MultiCodecTestCase {
|
public class TestCodecs extends LuceneTestCase {
|
||||||
private static String[] fieldNames = new String[] {"one", "two", "three", "four"};
|
private static String[] fieldNames = new String[] {"one", "two", "three", "four"};
|
||||||
|
|
||||||
private final static int NUM_TEST_ITER = 20 * RANDOM_MULTIPLIER;
|
private final static int NUM_TEST_ITER = 20 * RANDOM_MULTIPLIER;
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class TestCompoundFile extends LuceneTestCase
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
File file = new File(TEMP_DIR, "testIndex");
|
File file = new File(TEMP_DIR, "testIndex");
|
||||||
_TestUtil.rmDir(file);
|
_TestUtil.rmDir(file);
|
||||||
|
@ -64,7 +64,7 @@ public class TestCompoundFile extends LuceneTestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
dir.close();
|
dir.close();
|
||||||
_TestUtil.rmDir(new File(TEMP_DIR, "testIndex"));
|
_TestUtil.rmDir(new File(TEMP_DIR, "testIndex"));
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
|
|
|
@ -36,12 +36,8 @@ public class TestDirectoryReader extends LuceneTestCase {
|
||||||
protected SegmentReader [] readers = new SegmentReader[2];
|
protected SegmentReader [] readers = new SegmentReader[2];
|
||||||
protected SegmentInfos sis;
|
protected SegmentInfos sis;
|
||||||
|
|
||||||
public TestDirectoryReader(String s) {
|
|
||||||
super(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
dir = newDirectory();
|
dir = newDirectory();
|
||||||
doc1 = new Document();
|
doc1 = new Document();
|
||||||
|
@ -55,7 +51,7 @@ public class TestDirectoryReader extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
if (readers[0] != null) readers[0].close();
|
if (readers[0] != null) readers[0].close();
|
||||||
if (readers[1] != null) readers[1].close();
|
if (readers[1] != null) readers[1].close();
|
||||||
dir.close();
|
dir.close();
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class TestDoc extends LuceneTestCase {
|
||||||
* a few text files created in the current working directory.
|
* a few text files created in the current working directory.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
workDir = new File(TEMP_DIR,"TestDoc");
|
workDir = new File(TEMP_DIR,"TestDoc");
|
||||||
workDir.mkdirs();
|
workDir.mkdirs();
|
||||||
|
|
|
@ -43,18 +43,14 @@ import org.apache.lucene.util.BytesRef;
|
||||||
public class TestDocumentWriter extends LuceneTestCase {
|
public class TestDocumentWriter extends LuceneTestCase {
|
||||||
private Directory dir;
|
private Directory dir;
|
||||||
|
|
||||||
public TestDocumentWriter(String s) {
|
|
||||||
super(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
dir = newDirectory();
|
dir = newDirectory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
dir.close();
|
dir.close();
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,12 +30,8 @@ public class TestFieldInfos extends LuceneTestCase {
|
||||||
|
|
||||||
private Document testDoc = new Document();
|
private Document testDoc = new Document();
|
||||||
|
|
||||||
public TestFieldInfos(String s) {
|
|
||||||
super(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
DocHelper.setupDoc(testDoc);
|
DocHelper.setupDoc(testDoc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,12 +48,8 @@ public class TestFieldsReader extends LuceneTestCase {
|
||||||
private FieldInfos fieldInfos = null;
|
private FieldInfos fieldInfos = null;
|
||||||
private final static String TEST_SEGMENT_NAME = "_0";
|
private final static String TEST_SEGMENT_NAME = "_0";
|
||||||
|
|
||||||
public TestFieldsReader(String s) {
|
|
||||||
super(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
fieldInfos = new FieldInfos();
|
fieldInfos = new FieldInfos();
|
||||||
DocHelper.setupDoc(testDoc);
|
DocHelper.setupDoc(testDoc);
|
||||||
|
@ -68,7 +64,7 @@ public class TestFieldsReader extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
dir.close();
|
dir.close();
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,10 +24,10 @@ import java.util.Collection;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.util.LuceneTestCaseJ4;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class TestIndexCommit extends LuceneTestCaseJ4 {
|
public class TestIndexCommit extends LuceneTestCase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEqualsHashCode() throws Exception {
|
public void testEqualsHashCode() throws Exception {
|
||||||
|
|
|
@ -30,9 +30,6 @@ import java.util.HashMap;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
|
|
||||||
import junit.framework.TestSuite;
|
|
||||||
import junit.textui.TestRunner;
|
|
||||||
|
|
||||||
import org.apache.lucene.analysis.MockAnalyzer;
|
import org.apache.lucene.analysis.MockAnalyzer;
|
||||||
import org.apache.lucene.document.Document;
|
import org.apache.lucene.document.Document;
|
||||||
import org.apache.lucene.document.Field;
|
import org.apache.lucene.document.Field;
|
||||||
|
@ -61,18 +58,6 @@ import org.apache.lucene.util.Bits;
|
||||||
|
|
||||||
public class TestIndexReader extends LuceneTestCase
|
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 {
|
public void testCommitUserData() throws Exception {
|
||||||
Directory d = newDirectory();
|
Directory d = newDirectory();
|
||||||
|
|
|
@ -65,12 +65,8 @@ public class TestIndexReaderCloneNorms extends LuceneTestCase {
|
||||||
|
|
||||||
private float normDelta = (float) 0.001;
|
private float normDelta = (float) 0.001;
|
||||||
|
|
||||||
public TestIndexReaderCloneNorms(String s) {
|
|
||||||
super(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
similarityOne = new SimilarityOne();
|
similarityOne = new SimilarityOne();
|
||||||
anlzr = new MockAnalyzer();
|
anlzr = new MockAnalyzer();
|
||||||
|
|
|
@ -45,7 +45,7 @@ import org.apache.lucene.store.AlreadyClosedException;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.apache.lucene.util.BitVector;
|
import org.apache.lucene.util.BitVector;
|
||||||
import org.apache.lucene.util.Bits;
|
import org.apache.lucene.util.Bits;
|
||||||
import org.apache.lucene.util.LuceneTestCaseJ4;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
|
|
||||||
public class TestIndexReaderReopen extends 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 {
|
public static void createIndex(Random random, Directory dir, boolean multiSegment) throws IOException {
|
||||||
IndexWriter.unlock(dir);
|
IndexWriter.unlock(dir);
|
||||||
IndexWriter w = new IndexWriter(dir, LuceneTestCaseJ4.newIndexWriterConfig(random,
|
IndexWriter w = new IndexWriter(dir, LuceneTestCase.newIndexWriterConfig(random,
|
||||||
TEST_VERSION_CURRENT, new MockAnalyzer())
|
TEST_VERSION_CURRENT, new MockAnalyzer())
|
||||||
.setMergePolicy(new LogDocMergePolicy()));
|
.setMergePolicy(new LogDocMergePolicy()));
|
||||||
|
|
||||||
|
@ -1093,7 +1093,7 @@ public class TestIndexReaderReopen extends LuceneTestCase {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
indexDir = new File(TEMP_DIR, "IndexReaderReopen");
|
indexDir = new File(TEMP_DIR, "IndexReaderReopen");
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,10 +80,6 @@ import org.apache.lucene.util.Bits;
|
||||||
|
|
||||||
public class TestIndexWriter extends LuceneTestCase {
|
public class TestIndexWriter extends LuceneTestCase {
|
||||||
|
|
||||||
public TestIndexWriter(String name) {
|
|
||||||
super(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testDocCount() throws IOException {
|
public void testDocCount() throws IOException {
|
||||||
Directory dir = newDirectory();
|
Directory dir = newDirectory();
|
||||||
|
|
||||||
|
|
|
@ -34,10 +34,10 @@ import org.apache.lucene.index.codecs.CodecProvider;
|
||||||
import org.apache.lucene.search.DefaultSimilarity;
|
import org.apache.lucene.search.DefaultSimilarity;
|
||||||
import org.apache.lucene.search.Similarity;
|
import org.apache.lucene.search.Similarity;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.util.LuceneTestCaseJ4;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class TestIndexWriterConfig extends LuceneTestCaseJ4 {
|
public class TestIndexWriterConfig extends LuceneTestCase {
|
||||||
|
|
||||||
private static final class MySimilarity extends DefaultSimilarity {
|
private static final class MySimilarity extends DefaultSimilarity {
|
||||||
// Does not implement anything - used only for type checking on IndexWriterConfig.
|
// Does not implement anything - used only for type checking on IndexWriterConfig.
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class TestIndexWriterLockRelease extends LuceneTestCase {
|
||||||
private java.io.File __test_dir;
|
private java.io.File __test_dir;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
if (this.__test_dir == null) {
|
if (this.__test_dir == null) {
|
||||||
this.__test_dir = new File(TEMP_DIR, "testIndexWriter");
|
this.__test_dir = new File(TEMP_DIR, "testIndexWriter");
|
||||||
|
@ -53,7 +53,7 @@ public class TestIndexWriterLockRelease extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
if (this.__test_dir != null) {
|
if (this.__test_dir != null) {
|
||||||
File[] files = this.__test_dir.listFiles();
|
File[] files = this.__test_dir.listFiles();
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ import org.apache.lucene.store.MockDirectoryWrapper;
|
||||||
import org.apache.lucene.store.AlreadyClosedException;
|
import org.apache.lucene.store.AlreadyClosedException;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.RAMDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
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._TestUtil;
|
||||||
import org.apache.lucene.util.BytesRef;
|
import org.apache.lucene.util.BytesRef;
|
||||||
import org.apache.lucene.util.ThreadInterruptedException;
|
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,
|
public static void createIndex(Random random, Directory dir1, String indexName,
|
||||||
boolean multiSegment) throws IOException {
|
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())
|
TEST_VERSION_CURRENT, new MockAnalyzer())
|
||||||
.setMergePolicy(new LogDocMergePolicy()));
|
.setMergePolicy(new LogDocMergePolicy()));
|
||||||
for (int i = 0; i < 100; i++) {
|
for (int i = 0; i < 100; i++) {
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.junit.Test;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class TestIsCurrent extends LuceneTestCaseJ4 {
|
public class TestIsCurrent extends LuceneTestCase {
|
||||||
|
|
||||||
private RandomIndexWriter writer;
|
private RandomIndexWriter writer;
|
||||||
|
|
||||||
|
|
|
@ -20,9 +20,6 @@ package org.apache.lucene.index;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class TestMultiReader extends TestDirectoryReader {
|
public class TestMultiReader extends TestDirectoryReader {
|
||||||
public TestMultiReader(String s) {
|
|
||||||
super(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected IndexReader openReader() throws IOException {
|
protected IndexReader openReader() throws IOException {
|
||||||
|
|
|
@ -31,10 +31,10 @@ import org.apache.lucene.document.Field;
|
||||||
import org.apache.lucene.document.Field.Index;
|
import org.apache.lucene.document.Field.Index;
|
||||||
import org.apache.lucene.document.Field.Store;
|
import org.apache.lucene.document.Field.Store;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.util.LuceneTestCaseJ4;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class TestNoDeletionPolicy extends LuceneTestCaseJ4 {
|
public class TestNoDeletionPolicy extends LuceneTestCase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNoDeletionPolicy() throws Exception {
|
public void testNoDeletionPolicy() throws Exception {
|
||||||
|
|
|
@ -24,10 +24,10 @@ import java.lang.reflect.Method;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import org.apache.lucene.util.LuceneTestCaseJ4;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class TestNoMergePolicy extends LuceneTestCaseJ4 {
|
public class TestNoMergePolicy extends LuceneTestCase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNoMergePolicy() throws Exception {
|
public void testNoMergePolicy() throws Exception {
|
||||||
|
|
|
@ -24,10 +24,10 @@ import java.lang.reflect.Method;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import org.apache.lucene.util.LuceneTestCaseJ4;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class TestNoMergeScheduler extends LuceneTestCaseJ4 {
|
public class TestNoMergeScheduler extends LuceneTestCase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNoMergeScheduler() throws Exception {
|
public void testNoMergeScheduler() throws Exception {
|
||||||
|
|
|
@ -56,12 +56,8 @@ public class TestNorms extends LuceneTestCase {
|
||||||
private float lastNorm = 0;
|
private float lastNorm = 0;
|
||||||
private float normDelta = (float) 0.001;
|
private float normDelta = (float) 0.001;
|
||||||
|
|
||||||
public TestNorms(String s) {
|
|
||||||
super(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
similarityOne = new SimilarityOne();
|
similarityOne = new SimilarityOne();
|
||||||
anlzr = new MockAnalyzer();
|
anlzr = new MockAnalyzer();
|
||||||
|
|
|
@ -42,14 +42,14 @@ public class TestParallelReader extends LuceneTestCase {
|
||||||
private Directory dir, dir1, dir2;
|
private Directory dir, dir1, dir2;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
single = single(random);
|
single = single(random);
|
||||||
parallel = parallel(random);
|
parallel = parallel(random);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
single.getIndexReader().close();
|
single.getIndexReader().close();
|
||||||
parallel.getIndexReader().close();
|
parallel.getIndexReader().close();
|
||||||
dir.close();
|
dir.close();
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class TestParallelTermEnum extends LuceneTestCase {
|
||||||
private Directory rd2;
|
private Directory rd2;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
Document doc;
|
Document doc;
|
||||||
rd1 = newDirectory();
|
rd1 = newDirectory();
|
||||||
|
@ -68,7 +68,7 @@ public class TestParallelTermEnum extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
ir1.close();
|
ir1.close();
|
||||||
ir2.close();
|
ir2.close();
|
||||||
rd1.close();
|
rd1.close();
|
||||||
|
|
|
@ -38,10 +38,10 @@ import org.apache.lucene.index.PayloadProcessorProvider.PayloadProcessor;
|
||||||
import org.apache.lucene.search.DocIdSetIterator;
|
import org.apache.lucene.search.DocIdSetIterator;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.util.BytesRef;
|
import org.apache.lucene.util.BytesRef;
|
||||||
import org.apache.lucene.util.LuceneTestCaseJ4;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class TestPayloadProcessorProvider extends LuceneTestCaseJ4 {
|
public class TestPayloadProcessorProvider extends LuceneTestCase {
|
||||||
|
|
||||||
private static final class PerDirPayloadProcessor extends PayloadProcessorProvider {
|
private static final class PerDirPayloadProcessor extends PayloadProcessorProvider {
|
||||||
|
|
||||||
|
|
|
@ -28,13 +28,8 @@ public class TestPositionBasedTermVectorMapper extends LuceneTestCase {
|
||||||
protected TermVectorOffsetInfo[][] offsets;
|
protected TermVectorOffsetInfo[][] offsets;
|
||||||
protected int numPositions;
|
protected int numPositions;
|
||||||
|
|
||||||
|
|
||||||
public TestPositionBasedTermVectorMapper(String s) {
|
|
||||||
super(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
tokens = new String[]{"here", "is", "some", "text", "to", "test", "extra"};
|
tokens = new String[]{"here", "is", "some", "text", "to", "test", "extra"};
|
||||||
thePositions = new int[tokens.length][];
|
thePositions = new int[tokens.length][];
|
||||||
|
|
|
@ -40,13 +40,8 @@ public class TestSegmentMerger extends LuceneTestCase {
|
||||||
private Document doc2 = new Document();
|
private Document doc2 = new Document();
|
||||||
private SegmentReader reader2 = null;
|
private SegmentReader reader2 = null;
|
||||||
|
|
||||||
|
|
||||||
public TestSegmentMerger(String s) {
|
|
||||||
super(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
mergedDir = newDirectory();
|
mergedDir = newDirectory();
|
||||||
merge1Dir = newDirectory();
|
merge1Dir = newDirectory();
|
||||||
|
@ -60,7 +55,7 @@ public class TestSegmentMerger extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
reader1.close();
|
reader1.close();
|
||||||
reader2.close();
|
reader2.close();
|
||||||
mergedDir.close();
|
mergedDir.close();
|
||||||
|
|
|
@ -35,13 +35,9 @@ public class TestSegmentReader extends LuceneTestCase {
|
||||||
private Document testDoc = new Document();
|
private Document testDoc = new Document();
|
||||||
private SegmentReader reader = null;
|
private SegmentReader reader = null;
|
||||||
|
|
||||||
public TestSegmentReader(String s) {
|
|
||||||
super(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO: Setup the reader w/ multiple documents
|
//TODO: Setup the reader w/ multiple documents
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
dir = newDirectory();
|
dir = newDirectory();
|
||||||
DocHelper.setupDoc(testDoc);
|
DocHelper.setupDoc(testDoc);
|
||||||
|
@ -50,7 +46,7 @@ public class TestSegmentReader extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
reader.close();
|
reader.close();
|
||||||
dir.close();
|
dir.close();
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
|
|
|
@ -31,12 +31,8 @@ public class TestSegmentTermDocs extends LuceneTestCase {
|
||||||
private Directory dir;
|
private Directory dir;
|
||||||
private SegmentInfo info;
|
private SegmentInfo info;
|
||||||
|
|
||||||
public TestSegmentTermDocs(String s) {
|
|
||||||
super(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
dir = newDirectory();
|
dir = newDirectory();
|
||||||
DocHelper.setupDoc(testDoc);
|
DocHelper.setupDoc(testDoc);
|
||||||
|
@ -44,7 +40,7 @@ public class TestSegmentTermDocs extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
dir.close();
|
dir.close();
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ import org.apache.lucene.index.IndexWriterConfig;
|
||||||
import org.apache.lucene.index.KeepOnlyLastCommitDeletionPolicy;
|
import org.apache.lucene.index.KeepOnlyLastCommitDeletionPolicy;
|
||||||
import org.apache.lucene.index.IndexWriter;
|
import org.apache.lucene.index.IndexWriter;
|
||||||
import org.apache.lucene.index.SnapshotDeletionPolicy;
|
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.ThreadInterruptedException;
|
||||||
import org.apache.lucene.util._TestUtil;
|
import org.apache.lucene.util._TestUtil;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -29,7 +29,7 @@ import org.junit.Test;
|
||||||
// http://lucenebook.com
|
// http://lucenebook.com
|
||||||
//
|
//
|
||||||
|
|
||||||
public class TestSnapshotDeletionPolicy extends LuceneTestCaseJ4 {
|
public class TestSnapshotDeletionPolicy extends LuceneTestCase {
|
||||||
public static final String INDEX_PATH = "test.snapshots";
|
public static final String INDEX_PATH = "test.snapshots";
|
||||||
|
|
||||||
protected IndexWriterConfig getConfig(Random random, IndexDeletionPolicy dp) {
|
protected IndexWriterConfig getConfig(Random random, IndexDeletionPolicy dp) {
|
||||||
|
|
|
@ -22,10 +22,12 @@ import org.apache.lucene.analysis.MockAnalyzer;
|
||||||
import org.apache.lucene.document.*;
|
import org.apache.lucene.document.*;
|
||||||
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
|
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
|
||||||
import org.apache.lucene.search.*;
|
import org.apache.lucene.search.*;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
import java.io.File;
|
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 {
|
private static abstract class TimedThread extends Thread {
|
||||||
volatile boolean failed;
|
volatile boolean failed;
|
||||||
int count;
|
int count;
|
||||||
|
|
|
@ -35,8 +35,10 @@ import org.apache.lucene.document.Fieldable;
|
||||||
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
|
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
|
||||||
import org.apache.lucene.search.TermQuery;
|
import org.apache.lucene.search.TermQuery;
|
||||||
import org.apache.lucene.store.Directory;
|
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 maxFields=4;
|
||||||
static int bigFieldSize=10;
|
static int bigFieldSize=10;
|
||||||
static boolean sameFieldOrder=false;
|
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 {
|
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
|
// index all docs in a single thread
|
||||||
Iterator<Document> iter = docs.values().iterator();
|
Iterator<Document> iter = docs.values().iterator();
|
||||||
|
|
|
@ -48,10 +48,6 @@ public class TestTermVectorsReader extends LuceneTestCase {
|
||||||
private FieldInfos fieldInfos = new FieldInfos();
|
private FieldInfos fieldInfos = new FieldInfos();
|
||||||
private static int TERM_FREQ = 3;
|
private static int TERM_FREQ = 3;
|
||||||
|
|
||||||
public TestTermVectorsReader(String s) {
|
|
||||||
super(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
private class TestToken implements Comparable<TestToken> {
|
private class TestToken implements Comparable<TestToken> {
|
||||||
String text;
|
String text;
|
||||||
int pos;
|
int pos;
|
||||||
|
@ -65,7 +61,7 @@ public class TestTermVectorsReader extends LuceneTestCase {
|
||||||
TestToken[] tokens = new TestToken[testTerms.length * TERM_FREQ];
|
TestToken[] tokens = new TestToken[testTerms.length * TERM_FREQ];
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
/*
|
/*
|
||||||
for (int i = 0; i < testFields.length; i++) {
|
for (int i = 0; i < testFields.length; i++) {
|
||||||
|
@ -125,7 +121,7 @@ public class TestTermVectorsReader extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
dir.close();
|
dir.close();
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ public class TestTransactionRollback extends LuceneTestCase {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
dir = newDirectory();
|
dir = newDirectory();
|
||||||
//Build index, of records 1 to 100, committing after each batch of 10
|
//Build index, of records 1 to 100, committing after each batch of 10
|
||||||
|
@ -144,7 +144,7 @@ public class TestTransactionRollback extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
dir.close();
|
dir.close();
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ import java.io.IOException;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class TestSurrogates extends LuceneTestCaseJ4 {
|
public class TestSurrogates extends LuceneTestCase {
|
||||||
|
|
||||||
private static String makeDifficultRandomUnicodeString(Random r) {
|
private static String makeDifficultRandomUnicodeString(Random r) {
|
||||||
final int end = r.nextInt(20);
|
final int end = r.nextInt(20);
|
||||||
|
|
|
@ -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.preflex.PreFlexFields;
|
||||||
import org.apache.lucene.index.codecs.FieldsConsumer;
|
import org.apache.lucene.index.codecs.FieldsConsumer;
|
||||||
import org.apache.lucene.index.codecs.FieldsProducer;
|
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
|
/** Codec, only for testing, that can write and read the
|
||||||
* pre-flex index format.
|
* pre-flex index format.
|
||||||
|
@ -63,7 +63,7 @@ public class PreFlexRWCodec extends PreFlexCodec {
|
||||||
//System.out.println(trace[i].getClassName());
|
//System.out.println(trace[i].getClassName());
|
||||||
if ("merge".equals(trace[i].getMethodName())) {
|
if ("merge".equals(trace[i].getMethodName())) {
|
||||||
unicodeSortOrder = false;
|
unicodeSortOrder = false;
|
||||||
if (LuceneTestCaseJ4.VERBOSE) {
|
if (LuceneTestCase.VERBOSE) {
|
||||||
System.out.println("NOTE: PreFlexRW codec: forcing legacy UTF16 term sort order");
|
System.out.println("NOTE: PreFlexRW codec: forcing legacy UTF16 term sort order");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -19,11 +19,13 @@ package org.apache.lucene.messages;
|
||||||
|
|
||||||
import java.util.Locale;
|
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() {
|
public void testMessageLoading() {
|
||||||
Message invalidSyntax = new MessageImpl(
|
Message invalidSyntax = new MessageImpl(
|
||||||
MessagesTestBundle.Q0001E_INVALID_SYNTAX, "XXX");
|
MessagesTestBundle.Q0001E_INVALID_SYNTAX, "XXX");
|
||||||
|
|
|
@ -60,23 +60,17 @@ import org.apache.lucene.search.TermQuery;
|
||||||
import org.apache.lucene.search.WildcardQuery;
|
import org.apache.lucene.search.WildcardQuery;
|
||||||
import org.apache.lucene.search.BooleanClause.Occur;
|
import org.apache.lucene.search.BooleanClause.Occur;
|
||||||
import org.apache.lucene.store.Directory;
|
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.BasicAutomata;
|
||||||
import org.apache.lucene.util.automaton.CharacterRunAutomaton;
|
import org.apache.lucene.util.automaton.CharacterRunAutomaton;
|
||||||
import org.apache.lucene.util.automaton.RegExp;
|
import org.apache.lucene.util.automaton.RegExp;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests QueryParser.
|
* Tests QueryParser.
|
||||||
*/
|
*/
|
||||||
public class TestQueryParser extends LocalizedTestCase {
|
@RunWith(LuceneTestCase.LocalizedTestCaseRunner.class)
|
||||||
|
public class TestQueryParser extends LuceneTestCase {
|
||||||
public TestQueryParser(String name) {
|
|
||||||
super(name, new HashSet<String>(Arrays.asList(
|
|
||||||
"testLegacyDateRange", "testDateRange",
|
|
||||||
"testCJK", "testNumber", "testFarsiRangeCollating",
|
|
||||||
"testLocalDateFormat"
|
|
||||||
)));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Analyzer qpAnalyzer = new QPTestAnalyzer();
|
public static Analyzer qpAnalyzer = new QPTestAnalyzer();
|
||||||
|
|
||||||
|
@ -150,7 +144,7 @@ public class TestQueryParser extends LocalizedTestCase {
|
||||||
private int originalMaxClauses;
|
private int originalMaxClauses;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
originalMaxClauses = BooleanQuery.getMaxClauseCount();
|
originalMaxClauses = BooleanQuery.getMaxClauseCount();
|
||||||
}
|
}
|
||||||
|
@ -1142,7 +1136,7 @@ public class TestQueryParser extends LocalizedTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
BooleanQuery.setMaxClauseCount(originalMaxClauses);
|
BooleanQuery.setMaxClauseCount(originalMaxClauses);
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ package org.apache.lucene.search;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Random;
|
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.util._TestUtil;
|
||||||
import org.apache.lucene.analysis.MockAnalyzer;
|
import org.apache.lucene.analysis.MockAnalyzer;
|
||||||
import org.apache.lucene.document.Document;
|
import org.apache.lucene.document.Document;
|
||||||
|
@ -34,7 +34,7 @@ import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import static org.junit.Assert.*;
|
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 F = false;
|
||||||
public static final boolean T = true;
|
public static final boolean T = true;
|
||||||
|
|
|
@ -24,10 +24,10 @@ import java.io.IOException;
|
||||||
import org.apache.lucene.index.IndexReader;
|
import org.apache.lucene.index.IndexReader;
|
||||||
import org.apache.lucene.search.Collector;
|
import org.apache.lucene.search.Collector;
|
||||||
import org.apache.lucene.search.Scorer;
|
import org.apache.lucene.search.Scorer;
|
||||||
import org.apache.lucene.util.LuceneTestCaseJ4;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class MultiCollectorTest extends LuceneTestCaseJ4 {
|
public class MultiCollectorTest extends LuceneTestCase {
|
||||||
|
|
||||||
private static class DummyCollector extends Collector {
|
private static class DummyCollector extends Collector {
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.MockDirectoryWrapper;
|
import org.apache.lucene.store.MockDirectoryWrapper;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
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
|
* Copyright 2005 Apache Software Foundation
|
||||||
|
|
|
@ -31,7 +31,7 @@ import org.apache.lucene.queryParser.QueryParser;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.MockDirectoryWrapper;
|
import org.apache.lucene.store.MockDirectoryWrapper;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
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.apache.lucene.util._TestUtil;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
|
@ -42,7 +42,7 @@ import static org.junit.Assert.*;
|
||||||
/** Test BooleanQuery2 against BooleanQuery by overriding the standard query parser.
|
/** Test BooleanQuery2 against BooleanQuery by overriding the standard query parser.
|
||||||
* This also tests the scoring order of BooleanQuery.
|
* 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 searcher;
|
||||||
private static IndexSearcher bigSearcher;
|
private static IndexSearcher bigSearcher;
|
||||||
private static IndexReader reader;
|
private static IndexReader reader;
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class TestBooleanMinShouldMatch extends LuceneTestCase {
|
||||||
private IndexSearcher s;
|
private IndexSearcher s;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
|
||||||
String[] data = new String [] {
|
String[] data = new String [] {
|
||||||
|
@ -71,7 +71,7 @@ public class TestBooleanMinShouldMatch extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
s.close();
|
s.close();
|
||||||
r.close();
|
r.close();
|
||||||
index.close();
|
index.close();
|
||||||
|
|
|
@ -131,7 +131,7 @@ public class TestBooleanOr extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -164,7 +164,7 @@ public class TestBooleanOr extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
searcher.close();
|
searcher.close();
|
||||||
reader.close();
|
reader.close();
|
||||||
dir.close();
|
dir.close();
|
||||||
|
|
|
@ -18,9 +18,6 @@ package org.apache.lucene.search;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
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.RandomIndexWriter;
|
||||||
import org.apache.lucene.index.Term;
|
import org.apache.lucene.index.Term;
|
||||||
import org.apache.lucene.index.IndexReader;
|
import org.apache.lucene.index.IndexReader;
|
||||||
|
@ -37,18 +34,6 @@ import org.apache.lucene.store.Directory;
|
||||||
|
|
||||||
public class TestBooleanPrefixQuery extends LuceneTestCase {
|
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 {
|
private int getCount(IndexReader r, Query q) throws Exception {
|
||||||
if (q instanceof BooleanQuery) {
|
if (q instanceof BooleanQuery) {
|
||||||
return ((BooleanQuery) q).getClauses().length;
|
return ((BooleanQuery) q).getClauses().length;
|
||||||
|
|
|
@ -31,11 +31,6 @@ import org.apache.lucene.util.LuceneTestCase;
|
||||||
|
|
||||||
public class TestBooleanScorer extends LuceneTestCase
|
public class TestBooleanScorer extends LuceneTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
public TestBooleanScorer(String name) {
|
|
||||||
super(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final String FIELD = "category";
|
private static final String FIELD = "category";
|
||||||
|
|
||||||
public void testMethod() throws Exception {
|
public void testMethod() throws Exception {
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue