mirror of https://github.com/apache/lucene.git
LUCENE-1021: make all unit tests subclass from a new LuceneTestCase, so that we can assert no unhandled exceptions occurred in ConcurrentMergeScheduler's threads
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@583534 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5f4975211a
commit
3b6b765939
|
@ -43,6 +43,15 @@ public class ConcurrentMergeScheduler implements MergeScheduler {
|
|||
private List exceptions = new ArrayList();
|
||||
private Directory dir;
|
||||
|
||||
private boolean closed;
|
||||
|
||||
public ConcurrentMergeScheduler() {
|
||||
if (allInstances != null) {
|
||||
// Only for testing
|
||||
addMyself();
|
||||
}
|
||||
}
|
||||
|
||||
/** Sets the max # simultaneous threads that may be
|
||||
* running. If a merge is necessary yet we already have
|
||||
* this many threads running, the merge is returned back
|
||||
|
@ -72,7 +81,7 @@ public class ConcurrentMergeScheduler implements MergeScheduler {
|
|||
public synchronized void setMergeThreadPriority(int pri) {
|
||||
mergeThreadPriority = pri;
|
||||
|
||||
final int numThreads = mergeThreads.size();
|
||||
final int numThreads = mergeThreadCount();
|
||||
for(int i=0;i<numThreads;i++) {
|
||||
MergeThread merge = (MergeThread) mergeThreads.get(i);
|
||||
try {
|
||||
|
@ -84,12 +93,6 @@ public class ConcurrentMergeScheduler implements MergeScheduler {
|
|||
}
|
||||
}
|
||||
|
||||
/** Returns any exceptions that were caught in the merge
|
||||
* threads. */
|
||||
public List getExceptions() {
|
||||
return exceptions;
|
||||
}
|
||||
|
||||
private void message(String message) {
|
||||
System.out.println("CMS [" + Thread.currentThread().getName() + "]: " + message);
|
||||
}
|
||||
|
@ -101,10 +104,12 @@ public class ConcurrentMergeScheduler implements MergeScheduler {
|
|||
mergeThreadPriority = 1+Thread.currentThread().getPriority();
|
||||
}
|
||||
|
||||
public void close() {}
|
||||
public void close() {
|
||||
closed = true;
|
||||
}
|
||||
|
||||
private synchronized void finishThreads() {
|
||||
while(mergeThreads.size() > 0) {
|
||||
public synchronized void sync() {
|
||||
while(mergeThreadCount() > 0) {
|
||||
if (VERBOSE) {
|
||||
message("now wait for threads; currently " + mergeThreads.size() + " still running");
|
||||
for(int i=0;i<mergeThreads.size();i++)
|
||||
|
@ -117,20 +122,8 @@ public class ConcurrentMergeScheduler implements MergeScheduler {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void sync() {
|
||||
finishThreads();
|
||||
}
|
||||
|
||||
// Used for testing
|
||||
private boolean suppressExceptions;
|
||||
|
||||
/** Used for testing */
|
||||
void setSuppressExceptions() {
|
||||
suppressExceptions = true;
|
||||
}
|
||||
void clearSuppressExceptions() {
|
||||
suppressExceptions = false;
|
||||
private synchronized int mergeThreadCount() {
|
||||
return mergeThreads.size();
|
||||
}
|
||||
|
||||
public void merge(IndexWriter writer)
|
||||
|
@ -179,7 +172,7 @@ public class ConcurrentMergeScheduler implements MergeScheduler {
|
|||
message(" merge involves segments from an external directory; now run in foreground");
|
||||
} else {
|
||||
synchronized(this) {
|
||||
if (mergeThreads.size() < maxThreadCount) {
|
||||
if (mergeThreadCount() < maxThreadCount) {
|
||||
// OK to spawn a new merge thread to handle this
|
||||
// merge:
|
||||
MergeThread merger = new MergeThread(writer, merge);
|
||||
|
@ -269,10 +262,12 @@ public class ConcurrentMergeScheduler implements MergeScheduler {
|
|||
exceptions.add(exc);
|
||||
}
|
||||
|
||||
if (!suppressExceptions)
|
||||
if (!suppressExceptions) {
|
||||
// suppressExceptions is normally only set during
|
||||
// testing.
|
||||
anyExceptions = true;
|
||||
throw new MergePolicy.MergeException(exc);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
synchronized(ConcurrentMergeScheduler.this) {
|
||||
|
@ -289,4 +284,53 @@ public class ConcurrentMergeScheduler implements MergeScheduler {
|
|||
return "merge thread: " + merge.segString(dir);
|
||||
}
|
||||
}
|
||||
|
||||
static boolean anyExceptions = false;
|
||||
|
||||
/** Used for testing */
|
||||
public static boolean anyUnhandledExceptions() {
|
||||
synchronized(allInstances) {
|
||||
final int count = allInstances.size();
|
||||
// Make sure all outstanding threads are done so we see
|
||||
// any exceptions they may produce:
|
||||
for(int i=0;i<count;i++)
|
||||
((ConcurrentMergeScheduler) allInstances.get(i)).sync();
|
||||
return anyExceptions;
|
||||
}
|
||||
}
|
||||
|
||||
/** Used for testing */
|
||||
private void addMyself() {
|
||||
synchronized(allInstances) {
|
||||
final int size=0;
|
||||
int upto = 0;
|
||||
for(int i=0;i<size;i++) {
|
||||
final ConcurrentMergeScheduler other = (ConcurrentMergeScheduler) allInstances.get(i);
|
||||
if (!(other.closed && 0 == other.mergeThreadCount()))
|
||||
// Keep this one for now: it still has threads or
|
||||
// may spawn new threads
|
||||
allInstances.set(upto++, other);
|
||||
}
|
||||
allInstances.subList(upto, allInstances.size()).clear();
|
||||
allInstances.add(this);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean suppressExceptions;
|
||||
|
||||
/** Used for testing */
|
||||
void setSuppressExceptions() {
|
||||
suppressExceptions = true;
|
||||
}
|
||||
|
||||
/** Used for testing */
|
||||
void clearSuppressExceptions() {
|
||||
suppressExceptions = false;
|
||||
}
|
||||
|
||||
/** Used for testing */
|
||||
private static List allInstances;
|
||||
public static void setTestMode() {
|
||||
allInstances = new ArrayList();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.analysis.Analyzer;
|
||||
import org.apache.lucene.analysis.standard.StandardAnalyzer;
|
||||
import org.apache.lucene.document.Document;
|
||||
|
@ -38,7 +38,7 @@ import java.io.IOException;
|
|||
*
|
||||
* @author Daniel Naber
|
||||
*/
|
||||
public class TestDemo extends TestCase {
|
||||
public class TestDemo extends LuceneTestCase {
|
||||
|
||||
public void testDemo() throws IOException, ParseException {
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.store.RAMDirectory;
|
||||
import org.apache.lucene.index.IndexWriter;
|
||||
import org.apache.lucene.index.Term;
|
||||
|
@ -36,7 +36,7 @@ import java.util.NoSuchElementException;
|
|||
* This test intentionally not put in the search package in order
|
||||
* to test HitIterator and Hit package protection.
|
||||
*/
|
||||
public class TestHitIterator extends TestCase {
|
||||
public class TestHitIterator extends LuceneTestCase {
|
||||
public void testIterator() throws Exception {
|
||||
RAMDirectory directory = new RAMDirectory();
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import java.util.GregorianCalendar;
|
|||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import junit.framework.TestSuite;
|
||||
import junit.textui.TestRunner;
|
||||
|
||||
|
@ -36,7 +36,7 @@ import org.apache.lucene.queryParser.*;
|
|||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
public class TestSearch extends TestCase {
|
||||
public class TestSearch extends LuceneTestCase {
|
||||
|
||||
/** Main for running test case by itself. */
|
||||
public static void main(String args[]) {
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.apache.lucene.index.*;
|
|||
import org.apache.lucene.search.*;
|
||||
import org.apache.lucene.queryParser.*;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import junit.framework.TestSuite;
|
||||
import junit.textui.TestRunner;
|
||||
|
||||
|
@ -37,7 +37,7 @@ import junit.textui.TestRunner;
|
|||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
public class TestSearchForDuplicates extends TestCase {
|
||||
public class TestSearchForDuplicates extends LuceneTestCase {
|
||||
|
||||
/** Main for running test case by itself. */
|
||||
public static void main(String args[]) {
|
||||
|
|
|
@ -18,9 +18,9 @@ package org.apache.lucene.analysis;
|
|||
*/
|
||||
|
||||
import java.io.*;
|
||||
import junit.framework.*;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
public class TestAnalyzers extends TestCase {
|
||||
public class TestAnalyzers extends LuceneTestCase {
|
||||
|
||||
public TestAnalyzers(String name) {
|
||||
super(name);
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.apache.lucene.analysis;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
import org.apache.lucene.document.Document;
|
||||
import org.apache.lucene.document.Field;
|
||||
|
@ -32,7 +32,7 @@ import org.apache.lucene.index.TermPositions;
|
|||
import org.apache.lucene.store.Directory;
|
||||
import org.apache.lucene.store.RAMDirectory;
|
||||
|
||||
public class TestCachingTokenFilter extends TestCase {
|
||||
public class TestCachingTokenFilter extends LuceneTestCase {
|
||||
private String[] tokens = new String[] {"term1", "term2", "term3", "term2"};
|
||||
|
||||
public void testCaching() throws IOException {
|
||||
|
|
|
@ -17,11 +17,11 @@ package org.apache.lucene.analysis;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
import java.io.StringReader;
|
||||
|
||||
public class TestISOLatin1AccentFilter extends TestCase {
|
||||
public class TestISOLatin1AccentFilter extends LuceneTestCase {
|
||||
public void testU() throws Exception {
|
||||
TokenStream stream = new WhitespaceTokenizer(new StringReader("Des mot clés À LA CHAÎNE À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö Ø Œ Þ Ù Ú Û Ü Ý Ÿ à á â ã ä å æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ø œ ß þ ù ú û ü ý ÿ"));
|
||||
ISOLatin1AccentFilter filter = new ISOLatin1AccentFilter(stream);
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.analysis;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.index.IndexWriter;
|
||||
import org.apache.lucene.store.RAMDirectory;
|
||||
import org.apache.lucene.document.Document;
|
||||
|
@ -27,12 +27,13 @@ import org.apache.lucene.search.Query;
|
|||
import org.apache.lucene.search.Hits;
|
||||
import org.apache.lucene.queryParser.QueryParser;
|
||||
|
||||
public class TestKeywordAnalyzer extends TestCase {
|
||||
public class TestKeywordAnalyzer extends LuceneTestCase {
|
||||
|
||||
private RAMDirectory directory;
|
||||
private IndexSearcher searcher;
|
||||
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
directory = new RAMDirectory();
|
||||
IndexWriter writer = new IndexWriter(directory,
|
||||
new SimpleAnalyzer(),
|
||||
|
|
|
@ -17,11 +17,11 @@ package org.apache.lucene.analysis;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
import java.io.StringReader;
|
||||
|
||||
public class TestLengthFilter extends TestCase {
|
||||
public class TestLengthFilter extends LuceneTestCase {
|
||||
|
||||
public void testFilter() throws Exception {
|
||||
TokenStream stream = new WhitespaceTokenizer(
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.apache.lucene.analysis;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import java.io.StringReader;
|
||||
|
||||
/**
|
||||
|
@ -20,7 +20,7 @@ import java.io.StringReader;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
public class TestPerFieldAnalzyerWrapper extends TestCase {
|
||||
public class TestPerFieldAnalzyerWrapper extends LuceneTestCase {
|
||||
public void testPerField() throws Exception {
|
||||
String text = "Qwerty";
|
||||
PerFieldAnalyzerWrapper analyzer =
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.apache.lucene.analysis;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.analysis.standard.StandardAnalyzer;
|
||||
|
||||
import java.io.StringReader;
|
||||
|
@ -21,7 +21,7 @@ import java.io.StringReader;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
public class TestStandardAnalyzer extends TestCase {
|
||||
public class TestStandardAnalyzer extends LuceneTestCase {
|
||||
|
||||
private Analyzer a = new StandardAnalyzer();
|
||||
|
||||
|
|
|
@ -17,14 +17,14 @@ package org.apache.lucene.analysis;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
import java.io.StringReader;
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class TestStopAnalyzer extends TestCase {
|
||||
public class TestStopAnalyzer extends LuceneTestCase {
|
||||
|
||||
private StopAnalyzer stop = new StopAnalyzer();
|
||||
private Set inValidTokens = new HashSet();
|
||||
|
@ -33,7 +33,8 @@ public class TestStopAnalyzer extends TestCase {
|
|||
super(s);
|
||||
}
|
||||
|
||||
protected void setUp() {
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
for (int i = 0; i < StopAnalyzer.ENGLISH_STOP_WORDS.length; i++) {
|
||||
inValidTokens.add(StopAnalyzer.ENGLISH_STOP_WORDS[i]);
|
||||
}
|
||||
|
|
|
@ -19,12 +19,12 @@ package org.apache.lucene.analysis;
|
|||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
/**
|
||||
* @author yonik
|
||||
*/
|
||||
public class TestStopFilter extends TestCase {
|
||||
public class TestStopFilter extends LuceneTestCase {
|
||||
|
||||
// other StopFilter functionality is already tested by TestStopAnalyzer
|
||||
|
||||
|
|
|
@ -18,9 +18,9 @@ package org.apache.lucene.analysis;
|
|||
*/
|
||||
|
||||
import java.io.*;
|
||||
import junit.framework.*;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
public class TestToken extends TestCase {
|
||||
public class TestToken extends LuceneTestCase {
|
||||
|
||||
public TestToken(String name) {
|
||||
super(name);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.apache.lucene.document;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
import org.apache.lucene.analysis.standard.StandardAnalyzer;
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
|
@ -30,7 +30,7 @@ import org.apache.lucene.store.RAMDirectory;
|
|||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
public class TestBinaryDocument extends TestCase
|
||||
public class TestBinaryDocument extends LuceneTestCase
|
||||
{
|
||||
|
||||
String binaryValStored = "this text will be stored as a byte array in the index";
|
||||
|
|
|
@ -6,7 +6,7 @@ import java.util.Calendar;
|
|||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
|
@ -25,7 +25,7 @@ import junit.framework.TestCase;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
public class TestDateTools extends TestCase {
|
||||
public class TestDateTools extends LuceneTestCase {
|
||||
|
||||
public void testStringToDate() throws ParseException {
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.apache.lucene.document;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
import org.apache.lucene.store.RAMDirectory;
|
||||
import org.apache.lucene.document.Document;
|
||||
|
@ -37,7 +37,7 @@ import org.apache.lucene.search.Hits;
|
|||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
public class TestDocument extends TestCase
|
||||
public class TestDocument extends LuceneTestCase
|
||||
{
|
||||
|
||||
String binaryVal = "this text will be stored as a byte array in the index";
|
||||
|
|
|
@ -17,9 +17,9 @@ package org.apache.lucene.document;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
public class TestNumberTools extends TestCase {
|
||||
public class TestNumberTools extends LuceneTestCase {
|
||||
public void testNearZero() {
|
||||
for (int i = -100; i <= 100; i++) {
|
||||
for (int j = -100; j <= 100; j++) {
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.apache.lucene.index;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
import org.apache.lucene.analysis.WhitespaceAnalyzer;
|
||||
import org.apache.lucene.document.Document;
|
||||
|
@ -29,7 +29,7 @@ import org.apache.lucene.index.IndexWriter;
|
|||
import org.apache.lucene.store.Directory;
|
||||
import org.apache.lucene.store.RAMDirectory;
|
||||
|
||||
public class TestAddIndexesNoOptimize extends TestCase {
|
||||
public class TestAddIndexesNoOptimize extends LuceneTestCase {
|
||||
public void testSimpleCase() throws IOException {
|
||||
// main directory
|
||||
Directory dir = new RAMDirectory();
|
||||
|
|
|
@ -25,12 +25,12 @@ import org.apache.lucene.search.*;
|
|||
import org.apache.lucene.queryParser.*;
|
||||
import org.apache.lucene.util._TestUtil;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
import java.util.Random;
|
||||
import java.io.File;
|
||||
|
||||
public class TestAtomicUpdate extends TestCase {
|
||||
public class TestAtomicUpdate extends LuceneTestCase {
|
||||
private static final Analyzer ANALYZER = new SimpleAnalyzer();
|
||||
private static final Random RANDOM = new Random();
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.index;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import java.util.Vector;
|
||||
import java.util.Arrays;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
@ -42,7 +42,7 @@ import java.util.zip.*;
|
|||
against it, and add documents to it.
|
||||
*/
|
||||
|
||||
public class TestBackwardsCompatibility extends TestCase
|
||||
public class TestBackwardsCompatibility extends LuceneTestCase
|
||||
{
|
||||
|
||||
// Uncomment these cases & run in a pre-lockless checkout
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.apache.lucene.index;
|
|||
import java.io.IOException;
|
||||
import java.io.File;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import junit.framework.TestSuite;
|
||||
import junit.textui.TestRunner;
|
||||
import org.apache.lucene.store.IndexOutput;
|
||||
|
@ -35,7 +35,7 @@ import org.apache.lucene.util._TestUtil;
|
|||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
public class TestCompoundFile extends TestCase
|
||||
public class TestCompoundFile extends LuceneTestCase
|
||||
{
|
||||
/** Main for running test case by itself. */
|
||||
public static void main(String args[]) {
|
||||
|
@ -58,7 +58,8 @@ public class TestCompoundFile extends TestCase
|
|||
private Directory dir;
|
||||
|
||||
|
||||
public void setUp() throws IOException {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
File file = new File(System.getProperty("tempDir"), "testIndex");
|
||||
_TestUtil.rmDir(file);
|
||||
dir = FSDirectory.getDirectory(file);
|
||||
|
|
|
@ -28,12 +28,12 @@ import org.apache.lucene.document.Field;
|
|||
import org.apache.lucene.util._TestUtil;
|
||||
import org.apache.lucene.util.English;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.File;
|
||||
|
||||
public class TestConcurrentMergeScheduler extends TestCase {
|
||||
public class TestConcurrentMergeScheduler extends LuceneTestCase {
|
||||
|
||||
private static final Analyzer ANALYZER = new SimpleAnalyzer();
|
||||
|
||||
|
@ -94,8 +94,6 @@ public class TestConcurrentMergeScheduler extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
assertEquals(0, cms.getExceptions().size());
|
||||
|
||||
writer.close();
|
||||
IndexReader reader = IndexReader.open(directory);
|
||||
assertEquals(200, reader.numDocs());
|
||||
|
@ -139,8 +137,6 @@ public class TestConcurrentMergeScheduler extends TestCase {
|
|||
writer.flush();
|
||||
}
|
||||
|
||||
assertEquals(0, cms.getExceptions().size());
|
||||
|
||||
writer.close();
|
||||
IndexReader reader = IndexReader.open(directory);
|
||||
// Verify that we did not lose any deletes...
|
||||
|
@ -171,7 +167,6 @@ public class TestConcurrentMergeScheduler extends TestCase {
|
|||
|
||||
writer.close();
|
||||
TestIndexWriter.assertNoUnreferencedFiles(directory, "testNoExtraFiles autoCommit=" + autoCommit);
|
||||
assertEquals(0, cms.getExceptions().size());
|
||||
|
||||
// Reopen
|
||||
writer = new IndexWriter(directory, autoCommit, ANALYZER, false);
|
||||
|
@ -211,7 +206,6 @@ public class TestConcurrentMergeScheduler extends TestCase {
|
|||
}
|
||||
|
||||
writer.close(false);
|
||||
assertEquals(0, cms.getExceptions().size());
|
||||
|
||||
IndexReader reader = IndexReader.open(directory);
|
||||
assertEquals((1+iter)*181, reader.numDocs());
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.index;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -40,7 +40,7 @@ import java.util.HashSet;
|
|||
against it, and add documents to it.
|
||||
*/
|
||||
|
||||
public class TestDeletionPolicy extends TestCase
|
||||
public class TestDeletionPolicy extends LuceneTestCase
|
||||
{
|
||||
private void verifyCommitOrder(List commits) {
|
||||
long last = SegmentInfos.generationFromSegmentsFileName(((IndexCommitPoint) commits.get(0)).getSegmentsFileName());
|
||||
|
|
|
@ -16,7 +16,7 @@ package org.apache.lucene.index;
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import junit.framework.TestSuite;
|
||||
import junit.textui.TestRunner;
|
||||
|
||||
|
@ -37,7 +37,7 @@ import java.util.*;
|
|||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
public class TestDoc extends TestCase {
|
||||
public class TestDoc extends LuceneTestCase {
|
||||
|
||||
/** Main for running test case by itself. */
|
||||
public static void main(String args[]) {
|
||||
|
@ -53,7 +53,8 @@ public class TestDoc extends TestCase {
|
|||
/** Set the test case. This test case needs
|
||||
* a few text files created in the current working directory.
|
||||
*/
|
||||
public void setUp() throws IOException {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
workDir = new File(System.getProperty("tempDir"),"TestDoc");
|
||||
workDir.mkdirs();
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.index;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.analysis.Analyzer;
|
||||
import org.apache.lucene.analysis.SimpleAnalyzer;
|
||||
import org.apache.lucene.analysis.Token;
|
||||
|
@ -34,24 +34,20 @@ import java.io.IOException;
|
|||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class TestDocumentWriter extends TestCase {
|
||||
public class TestDocumentWriter extends LuceneTestCase {
|
||||
private RAMDirectory dir;
|
||||
|
||||
public TestDocumentWriter(String s) {
|
||||
super(s);
|
||||
}
|
||||
|
||||
protected void setUp() {
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
dir = new RAMDirectory();
|
||||
}
|
||||
|
||||
protected void tearDown() {
|
||||
|
||||
}
|
||||
|
||||
public void test() {
|
||||
assertTrue(dir != null);
|
||||
|
||||
}
|
||||
|
||||
public void testAddDocument() throws Exception {
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.index;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.document.Document;
|
||||
import org.apache.lucene.store.RAMDirectory;
|
||||
import org.apache.lucene.store.IndexOutput;
|
||||
|
@ -26,7 +26,7 @@ import java.io.IOException;
|
|||
|
||||
//import org.cnlp.utils.properties.ResourceBundleHelper;
|
||||
|
||||
public class TestFieldInfos extends TestCase {
|
||||
public class TestFieldInfos extends LuceneTestCase {
|
||||
|
||||
private Document testDoc = new Document();
|
||||
|
||||
|
@ -34,13 +34,11 @@ public class TestFieldInfos extends TestCase {
|
|||
super(s);
|
||||
}
|
||||
|
||||
protected void setUp() {
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
DocHelper.setupDoc(testDoc);
|
||||
}
|
||||
|
||||
protected void tearDown() {
|
||||
}
|
||||
|
||||
public void test() throws IOException {
|
||||
//Positive test of FieldInfos
|
||||
assertTrue(testDoc != null);
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.index;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.analysis.WhitespaceAnalyzer;
|
||||
import org.apache.lucene.document.*;
|
||||
import org.apache.lucene.search.Similarity;
|
||||
|
@ -30,7 +30,7 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
public class TestFieldsReader extends TestCase {
|
||||
public class TestFieldsReader extends LuceneTestCase {
|
||||
private RAMDirectory dir = new RAMDirectory();
|
||||
private Document testDoc = new Document();
|
||||
private FieldInfos fieldInfos = null;
|
||||
|
@ -41,7 +41,8 @@ public class TestFieldsReader extends TestCase {
|
|||
super(s);
|
||||
}
|
||||
|
||||
protected void setUp() throws IOException {
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
fieldInfos = new FieldInfos();
|
||||
DocHelper.setupDoc(testDoc);
|
||||
fieldInfos.add(testDoc);
|
||||
|
|
|
@ -18,7 +18,7 @@ package org.apache.lucene.index;
|
|||
*/
|
||||
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import junit.framework.TestSuite;
|
||||
import junit.textui.TestRunner;
|
||||
|
||||
|
@ -30,7 +30,7 @@ import org.apache.lucene.document.Field;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
public class TestFilterIndexReader extends TestCase {
|
||||
public class TestFilterIndexReader extends LuceneTestCase {
|
||||
|
||||
private static class TestReader extends FilterIndexReader {
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.index;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import java.util.Vector;
|
||||
import java.util.Arrays;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
@ -44,7 +44,7 @@ import java.util.zip.*;
|
|||
against it, and add documents to it.
|
||||
*/
|
||||
|
||||
public class TestIndexFileDeleter extends TestCase
|
||||
public class TestIndexFileDeleter extends LuceneTestCase
|
||||
{
|
||||
public void testDeleteLeftoverFiles() throws IOException {
|
||||
|
||||
|
|
|
@ -17,12 +17,12 @@ package org.apache.lucene.index;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.store.IndexInput;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class TestIndexInput extends TestCase {
|
||||
public class TestIndexInput extends LuceneTestCase {
|
||||
public void testRead() throws IOException {
|
||||
IndexInput is = new MockIndexInput(new byte[]{(byte) 0x80, 0x01,
|
||||
(byte) 0xFF, 0x7F,
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.index;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.analysis.Analyzer;
|
||||
import org.apache.lucene.analysis.SimpleAnalyzer;
|
||||
import org.apache.lucene.analysis.standard.StandardAnalyzer;
|
||||
|
@ -42,7 +42,7 @@ import java.util.Stack;
|
|||
* @author Daniel Naber
|
||||
* @deprecated
|
||||
*/
|
||||
public class TestIndexModifier extends TestCase {
|
||||
public class TestIndexModifier extends LuceneTestCase {
|
||||
|
||||
private int docCount = 0;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ package org.apache.lucene.index;
|
|||
*/
|
||||
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import junit.framework.TestSuite;
|
||||
import junit.textui.TestRunner;
|
||||
import org.apache.lucene.analysis.WhitespaceAnalyzer;
|
||||
|
@ -36,7 +36,7 @@ import java.io.FileNotFoundException;
|
|||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
public class TestIndexReader extends TestCase
|
||||
public class TestIndexReader extends LuceneTestCase
|
||||
{
|
||||
/** Main for running test case by itself. */
|
||||
public static void main(String args[]) {
|
||||
|
|
|
@ -22,7 +22,7 @@ import java.io.File;
|
|||
import java.util.Arrays;
|
||||
import java.util.Random;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
import org.apache.lucene.analysis.WhitespaceAnalyzer;
|
||||
import org.apache.lucene.analysis.standard.StandardAnalyzer;
|
||||
|
@ -50,7 +50,7 @@ import org.apache.lucene.store.SingleInstanceLockFactory;
|
|||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
public class TestIndexWriter extends TestCase
|
||||
public class TestIndexWriter extends LuceneTestCase
|
||||
{
|
||||
public void testDocCount() throws IOException
|
||||
{
|
||||
|
|
|
@ -21,7 +21,7 @@ import java.io.IOException;
|
|||
import java.util.Arrays;
|
||||
import java.lang.StackTraceElement;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
import org.apache.lucene.analysis.WhitespaceAnalyzer;
|
||||
import org.apache.lucene.document.Document;
|
||||
|
@ -33,7 +33,7 @@ import org.apache.lucene.store.Directory;
|
|||
import org.apache.lucene.store.MockRAMDirectory;
|
||||
import org.apache.lucene.store.RAMDirectory;
|
||||
|
||||
public class TestIndexWriterDelete extends TestCase {
|
||||
public class TestIndexWriterDelete extends LuceneTestCase {
|
||||
|
||||
// test the simple case
|
||||
public void testSimpleCase() throws IOException {
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.apache.lucene.index;
|
|||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.index.IndexWriter;
|
||||
|
||||
/**
|
||||
|
@ -32,10 +32,11 @@ import org.apache.lucene.index.IndexWriter;
|
|||
* @version $Id$
|
||||
*/
|
||||
|
||||
public class TestIndexWriterLockRelease extends TestCase {
|
||||
public class TestIndexWriterLockRelease extends LuceneTestCase {
|
||||
private java.io.File __test_dir;
|
||||
|
||||
public void setUp() throws IOException {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
if (this.__test_dir == null) {
|
||||
String tmp_dir = System.getProperty("java.io.tmpdir", "tmp");
|
||||
this.__test_dir = new File(tmp_dir, "testIndexWriter");
|
||||
|
@ -51,7 +52,8 @@ public class TestIndexWriterLockRelease extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
public void tearDown() throws IOException {
|
||||
public void tearDown() throws Exception {
|
||||
super.tearDown();
|
||||
if (this.__test_dir != null) {
|
||||
File[] files = this.__test_dir.listFiles();
|
||||
|
||||
|
|
|
@ -26,9 +26,9 @@ import org.apache.lucene.store.Directory;
|
|||
import org.apache.lucene.store.RAMDirectory;
|
||||
import org.apache.lucene.util._TestUtil;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
public class TestIndexWriterMergePolicy extends TestCase {
|
||||
public class TestIndexWriterMergePolicy extends LuceneTestCase {
|
||||
|
||||
// Test the normal case
|
||||
public void testNormalCase() throws IOException {
|
||||
|
|
|
@ -20,12 +20,12 @@ import org.apache.lucene.store.MockRAMDirectory;
|
|||
import org.apache.lucene.analysis.standard.StandardAnalyzer;
|
||||
import org.apache.lucene.document.Document;
|
||||
import org.apache.lucene.document.Field;
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
public class TestIndexWriterMerging extends TestCase
|
||||
public class TestIndexWriterMerging extends LuceneTestCase
|
||||
{
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.index;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.analysis.Analyzer;
|
||||
import org.apache.lucene.analysis.SimpleAnalyzer;
|
||||
import org.apache.lucene.document.*;
|
||||
|
@ -32,7 +32,7 @@ import java.lang.reflect.Array;
|
|||
* Test demonstrating EOF bug on the last field of the last doc
|
||||
* if other docs have allready been accessed.
|
||||
*/
|
||||
public class TestLazyBug extends TestCase {
|
||||
public class TestLazyBug extends LuceneTestCase {
|
||||
|
||||
public static int BASE_SEED = 13;
|
||||
|
||||
|
|
|
@ -30,13 +30,13 @@ import org.apache.lucene.store.Directory;
|
|||
import org.apache.lucene.store.IndexInput;
|
||||
import org.apache.lucene.store.RAMDirectory;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
/**
|
||||
* Tests lazy skipping on the proximity file.
|
||||
*
|
||||
*/
|
||||
public class TestLazyProxSkipping extends TestCase {
|
||||
public class TestLazyProxSkipping extends LuceneTestCase {
|
||||
private Searcher searcher;
|
||||
private int seeksCounter = 0;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.apache.lucene.index;
|
|||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
import org.apache.lucene.analysis.Analyzer;
|
||||
import org.apache.lucene.analysis.LowerCaseTokenizer;
|
||||
|
@ -42,7 +42,7 @@ import org.apache.lucene.store.RAMDirectory;
|
|||
* testcases.
|
||||
*
|
||||
*/
|
||||
public class TestMultiLevelSkipList extends TestCase {
|
||||
public class TestMultiLevelSkipList extends LuceneTestCase {
|
||||
public void testSimpleSkip() throws IOException {
|
||||
RAMDirectory dir = new RAMDirectory();
|
||||
IndexWriter writer = new IndexWriter(dir, new PayloadAnalyzer(), true);
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.index;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
import org.apache.lucene.analysis.standard.StandardAnalyzer;
|
||||
import org.apache.lucene.document.Document;
|
||||
|
@ -27,7 +27,7 @@ import org.apache.lucene.store.RAMDirectory;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
public class TestMultiSegmentReader extends TestCase {
|
||||
public class TestMultiSegmentReader extends LuceneTestCase {
|
||||
protected Directory dir;
|
||||
private Document doc1;
|
||||
private Document doc2;
|
||||
|
@ -39,7 +39,8 @@ public class TestMultiSegmentReader extends TestCase {
|
|||
super(s);
|
||||
}
|
||||
|
||||
protected void setUp() throws IOException {
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
dir = new RAMDirectory();
|
||||
doc1 = new Document();
|
||||
doc2 = new Document();
|
||||
|
@ -63,7 +64,7 @@ public class TestMultiSegmentReader extends TestCase {
|
|||
return reader;
|
||||
}
|
||||
|
||||
public void test() throws IOException {
|
||||
public void test() throws Exception {
|
||||
setUp();
|
||||
doTestDocument();
|
||||
doTestUndeleteAll();
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.index;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
import org.apache.lucene.analysis.Analyzer;
|
||||
import org.apache.lucene.analysis.standard.StandardAnalyzer;
|
||||
|
@ -38,7 +38,7 @@ import java.util.ArrayList;
|
|||
* Test that norms info is preserved during index life - including
|
||||
* separate norms, addDocument, addIndexes, optimize.
|
||||
*/
|
||||
public class TestNorms extends TestCase {
|
||||
public class TestNorms extends LuceneTestCase {
|
||||
|
||||
private class SimilarityOne extends DefaultSimilarity {
|
||||
public float lengthNorm(String fieldName, int numTerms) {
|
||||
|
@ -60,14 +60,12 @@ public class TestNorms extends TestCase {
|
|||
super(s);
|
||||
}
|
||||
|
||||
protected void setUp() throws IOException {
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
similarityOne = new SimilarityOne();
|
||||
anlzr = new StandardAnalyzer();
|
||||
}
|
||||
|
||||
protected void tearDown() throws IOException {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that norms values are preserved as the index is maintained.
|
||||
* Including separate norms.
|
||||
|
|
|
@ -21,7 +21,7 @@ import java.io.IOException;
|
|||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
import org.apache.lucene.analysis.standard.StandardAnalyzer;
|
||||
import org.apache.lucene.document.Document;
|
||||
|
@ -38,12 +38,13 @@ import org.apache.lucene.store.Directory;
|
|||
import org.apache.lucene.store.RAMDirectory;
|
||||
import org.apache.lucene.store.MockRAMDirectory;
|
||||
|
||||
public class TestParallelReader extends TestCase {
|
||||
public class TestParallelReader extends LuceneTestCase {
|
||||
|
||||
private Searcher parallel;
|
||||
private Searcher single;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
single = single();
|
||||
parallel = parallel();
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.apache.lucene.index;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
import org.apache.lucene.analysis.SimpleAnalyzer;
|
||||
import org.apache.lucene.document.Document;
|
||||
|
@ -28,11 +28,12 @@ import org.apache.lucene.document.Field.Index;
|
|||
import org.apache.lucene.document.Field.Store;
|
||||
import org.apache.lucene.store.RAMDirectory;
|
||||
|
||||
public class TestParallelTermEnum extends TestCase {
|
||||
public class TestParallelTermEnum extends LuceneTestCase {
|
||||
private IndexReader ir1;
|
||||
private IndexReader ir2;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
super.setUp();
|
||||
Document doc;
|
||||
|
||||
|
@ -67,6 +68,7 @@ public class TestParallelTermEnum extends TestCase {
|
|||
|
||||
protected void tearDown() throws Exception {
|
||||
super.tearDown();
|
||||
super.tearDown();
|
||||
|
||||
ir1.close();
|
||||
ir2.close();
|
||||
|
|
|
@ -26,7 +26,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
import org.apache.lucene.analysis.Analyzer;
|
||||
import org.apache.lucene.analysis.Token;
|
||||
|
@ -41,7 +41,7 @@ import org.apache.lucene.store.FSDirectory;
|
|||
import org.apache.lucene.store.RAMDirectory;
|
||||
|
||||
|
||||
public class TestPayloads extends TestCase {
|
||||
public class TestPayloads extends LuceneTestCase {
|
||||
|
||||
// Simple tests to test the Payload class
|
||||
public void testPayload() throws Exception {
|
||||
|
|
|
@ -15,14 +15,14 @@ package org.apache.lucene.index;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.BitSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
public class TestPositionBasedTermVectorMapper extends TestCase {
|
||||
public class TestPositionBasedTermVectorMapper extends LuceneTestCase {
|
||||
protected String[] tokens;
|
||||
protected int[][] thePositions;
|
||||
protected TermVectorOffsetInfo[][] offsets;
|
||||
|
@ -33,7 +33,8 @@ public class TestPositionBasedTermVectorMapper extends TestCase {
|
|||
super(s);
|
||||
}
|
||||
|
||||
protected void setUp() {
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
tokens = new String[]{"here", "is", "some", "text", "to", "test", "extra"};
|
||||
thePositions = new int[tokens.length][];
|
||||
offsets = new TermVectorOffsetInfo[tokens.length][];
|
||||
|
@ -57,10 +58,6 @@ public class TestPositionBasedTermVectorMapper extends TestCase {
|
|||
offsets[tokens.length - 1][0] = new TermVectorOffsetInfo(0, 1);
|
||||
}
|
||||
|
||||
protected void tearDown() {
|
||||
|
||||
}
|
||||
|
||||
public void test() throws IOException {
|
||||
PositionBasedTermVectorMapper mapper = new PositionBasedTermVectorMapper();
|
||||
|
||||
|
@ -104,4 +101,4 @@ public class TestPositionBasedTermVectorMapper extends TestCase {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.index;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.store.Directory;
|
||||
import org.apache.lucene.store.RAMDirectory;
|
||||
import org.apache.lucene.document.Document;
|
||||
|
@ -25,7 +25,7 @@ import org.apache.lucene.document.Document;
|
|||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
|
||||
public class TestSegmentMerger extends TestCase {
|
||||
public class TestSegmentMerger extends LuceneTestCase {
|
||||
//The variables for the new merged segment
|
||||
private Directory mergedDir = new RAMDirectory();
|
||||
private String mergedSegment = "test";
|
||||
|
@ -43,7 +43,8 @@ public class TestSegmentMerger extends TestCase {
|
|||
super(s);
|
||||
}
|
||||
|
||||
protected void setUp() throws IOException {
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
DocHelper.setupDoc(doc1);
|
||||
SegmentInfo info1 = DocHelper.writeDoc(merge1Dir, doc1);
|
||||
DocHelper.setupDoc(doc2);
|
||||
|
|
|
@ -22,14 +22,14 @@ import java.util.Collection;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
import org.apache.lucene.document.Document;
|
||||
import org.apache.lucene.document.Fieldable;
|
||||
import org.apache.lucene.search.DefaultSimilarity;
|
||||
import org.apache.lucene.store.RAMDirectory;
|
||||
|
||||
public class TestSegmentReader extends TestCase {
|
||||
public class TestSegmentReader extends LuceneTestCase {
|
||||
private RAMDirectory dir = new RAMDirectory();
|
||||
private Document testDoc = new Document();
|
||||
private SegmentReader reader = null;
|
||||
|
@ -39,16 +39,13 @@ public class TestSegmentReader extends TestCase {
|
|||
}
|
||||
|
||||
//TODO: Setup the reader w/ multiple documents
|
||||
protected void setUp() throws IOException {
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
DocHelper.setupDoc(testDoc);
|
||||
SegmentInfo info = DocHelper.writeDoc(dir, testDoc);
|
||||
reader = SegmentReader.get(info);
|
||||
}
|
||||
|
||||
protected void tearDown() {
|
||||
|
||||
}
|
||||
|
||||
public void test() {
|
||||
assertTrue(dir != null);
|
||||
assertTrue(reader != null);
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.index;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.store.RAMDirectory;
|
||||
import org.apache.lucene.store.Directory;
|
||||
import org.apache.lucene.analysis.WhitespaceAnalyzer;
|
||||
|
@ -26,7 +26,7 @@ import org.apache.lucene.document.Field;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
public class TestSegmentTermDocs extends TestCase {
|
||||
public class TestSegmentTermDocs extends LuceneTestCase {
|
||||
private Document testDoc = new Document();
|
||||
private Directory dir = new RAMDirectory();
|
||||
private SegmentInfo info;
|
||||
|
@ -35,16 +35,12 @@ public class TestSegmentTermDocs extends TestCase {
|
|||
super(s);
|
||||
}
|
||||
|
||||
protected void setUp() throws IOException {
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
DocHelper.setupDoc(testDoc);
|
||||
info = DocHelper.writeDoc(dir, testDoc);
|
||||
}
|
||||
|
||||
|
||||
protected void tearDown() {
|
||||
|
||||
}
|
||||
|
||||
public void test() {
|
||||
assertTrue(dir != null);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.apache.lucene.index;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
import org.apache.lucene.analysis.WhitespaceAnalyzer;
|
||||
import org.apache.lucene.document.Document;
|
||||
|
@ -34,7 +34,7 @@ import org.apache.lucene.store.RAMDirectory;
|
|||
/**
|
||||
* @author goller
|
||||
*/
|
||||
public class TestSegmentTermEnum extends TestCase
|
||||
public class TestSegmentTermEnum extends LuceneTestCase
|
||||
{
|
||||
Directory dir = new RAMDirectory();
|
||||
|
||||
|
|
|
@ -24,12 +24,12 @@ import org.apache.lucene.index.*;
|
|||
import org.apache.lucene.search.*;
|
||||
import org.apache.lucene.queryParser.*;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
import java.util.Random;
|
||||
import java.io.File;
|
||||
|
||||
public class TestStressIndexing extends TestCase {
|
||||
public class TestStressIndexing extends LuceneTestCase {
|
||||
private static final Analyzer ANALYZER = new SimpleAnalyzer();
|
||||
private static final Random RANDOM = new Random();
|
||||
|
||||
|
|
|
@ -17,9 +17,9 @@ package org.apache.lucene.index;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
public class TestTerm extends TestCase {
|
||||
public class TestTerm extends LuceneTestCase {
|
||||
|
||||
public void testEquals() {
|
||||
final Term base = new Term("same", "same");
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.index;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.store.MockRAMDirectory;
|
||||
import org.apache.lucene.analysis.Analyzer;
|
||||
import org.apache.lucene.analysis.TokenStream;
|
||||
|
@ -32,7 +32,7 @@ import java.util.Iterator;
|
|||
import java.util.Map;
|
||||
import java.util.SortedSet;
|
||||
|
||||
public class TestTermVectorsReader extends TestCase {
|
||||
public class TestTermVectorsReader extends LuceneTestCase {
|
||||
//Must be lexicographically sorted, will do in setup, versus trying to maintain here
|
||||
private String[] testFields = {"f1", "f2", "f3", "f4"};
|
||||
private boolean[] testFieldsStorePos = {true, false, true, false};
|
||||
|
@ -61,7 +61,8 @@ public class TestTermVectorsReader extends TestCase {
|
|||
|
||||
TestToken[] tokens = new TestToken[testTerms.length * TERM_FREQ];
|
||||
|
||||
protected void setUp() throws IOException {
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
/*
|
||||
for (int i = 0; i < testFields.length; i++) {
|
||||
fieldInfos.add(testFields[i], true, true, testFieldsStorePos[i], testFieldsStoreOff[i]);
|
||||
|
@ -141,10 +142,6 @@ public class TestTermVectorsReader extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
protected void tearDown() {
|
||||
|
||||
}
|
||||
|
||||
public void test() {
|
||||
//Check to see the files were created properly in setup
|
||||
assertTrue(dir.fileExists(seg + "." + IndexFileNames.VECTORS_DOCUMENTS_EXTENSION));
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.index;
|
|||
*/
|
||||
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.store.Directory;
|
||||
import org.apache.lucene.store.RAMDirectory;
|
||||
import org.apache.lucene.analysis.Analyzer;
|
||||
|
@ -49,7 +49,7 @@ class RepeatingTokenStream extends TokenStream {
|
|||
}
|
||||
|
||||
|
||||
public class TestTermdocPerf extends TestCase {
|
||||
public class TestTermdocPerf extends LuceneTestCase {
|
||||
|
||||
void addDocs(Directory dir, final int ndocs, String field, final String val, final int maxTF, final float percentDocs) throws IOException {
|
||||
final Random random = new Random(0);
|
||||
|
|
|
@ -27,12 +27,12 @@ import org.apache.lucene.document.Field;
|
|||
import org.apache.lucene.util._TestUtil;
|
||||
import org.apache.lucene.util.English;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.File;
|
||||
|
||||
public class TestThreadedOptimize extends TestCase {
|
||||
public class TestThreadedOptimize extends LuceneTestCase {
|
||||
|
||||
private static final Analyzer ANALYZER = new SimpleAnalyzer();
|
||||
|
||||
|
|
|
@ -22,11 +22,11 @@ import java.io.IOException;
|
|||
import java.io.StringReader;
|
||||
import java.util.HashSet;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
import org.apache.lucene.analysis.WordlistLoader;
|
||||
|
||||
public class TestWordlistLoader extends TestCase {
|
||||
public class TestWordlistLoader extends LuceneTestCase {
|
||||
|
||||
public void testWordlistLoading() throws IOException {
|
||||
String s = "ONE\n two \nthree";
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.io.ObjectOutputStream;
|
|||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
import org.apache.lucene.analysis.WhitespaceAnalyzer;
|
||||
import org.apache.lucene.document.Document;
|
||||
|
@ -47,7 +47,7 @@ import org.apache.lucene.store.MockRAMDirectory;
|
|||
*
|
||||
* @version $Id: RAMDirectory.java 150537 2004-09-28 22:45:26 +0200 (Di, 28 Sep 2004) cutting $
|
||||
*/
|
||||
public class TestRAMDirectory extends TestCase {
|
||||
public class TestRAMDirectory extends LuceneTestCase {
|
||||
|
||||
private File indexDir = null;
|
||||
|
||||
|
@ -55,7 +55,8 @@ public class TestRAMDirectory extends TestCase {
|
|||
private final int docsToAdd = 500;
|
||||
|
||||
// setup the index
|
||||
public void setUp () throws IOException {
|
||||
public void setUp () throws Exception {
|
||||
super.setUp();
|
||||
String tempDir = System.getProperty("java.io.tmpdir");
|
||||
if (tempDir == null)
|
||||
throw new IOException("java.io.tmpdir undefined, cannot run test");
|
||||
|
@ -206,7 +207,8 @@ public class TestRAMDirectory extends TestCase {
|
|||
assertTrue("contains more then just header", headerSize < bos.size());
|
||||
}
|
||||
|
||||
public void tearDown() {
|
||||
public void tearDown() throws Exception {
|
||||
super.tearDown();
|
||||
// cleanup
|
||||
if (indexDir != null && indexDir.exists()) {
|
||||
rmDir (indexDir);
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.apache.lucene.queryParser;
|
|||
|
||||
import java.io.Reader;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.apache.lucene.analysis.Analyzer;
|
||||
|
@ -36,7 +36,7 @@ import org.apache.lucene.analysis.standard.StandardTokenizer;
|
|||
*
|
||||
* @author Daniel Naber
|
||||
*/
|
||||
public class TestMultiAnalyzer extends TestCase {
|
||||
public class TestMultiAnalyzer extends LuceneTestCase {
|
||||
|
||||
private static int multiToken = 0;
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.queryParser;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.analysis.Analyzer;
|
||||
import org.apache.lucene.analysis.Token;
|
||||
import org.apache.lucene.analysis.TokenStream;
|
||||
|
@ -42,7 +42,7 @@ import java.util.Map;
|
|||
* Tests QueryParser.
|
||||
* @author Daniel Naber
|
||||
*/
|
||||
public class TestMultiFieldQueryParser extends TestCase {
|
||||
public class TestMultiFieldQueryParser extends LuceneTestCase {
|
||||
|
||||
/** test stop words arsing for both the non static form, and for the
|
||||
* corresponding static form (qtxt, fields[]). */
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.queryParser;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.analysis.*;
|
||||
import org.apache.lucene.analysis.Token;
|
||||
import org.apache.lucene.analysis.standard.StandardAnalyzer;
|
||||
|
@ -40,7 +40,7 @@ import java.util.Locale;
|
|||
/**
|
||||
* Tests QueryParser.
|
||||
*/
|
||||
public class TestQueryParser extends TestCase {
|
||||
public class TestQueryParser extends LuceneTestCase {
|
||||
|
||||
public static Analyzer qpAnalyzer = new QPTestAnalyzer();
|
||||
|
||||
|
@ -98,7 +98,8 @@ public class TestQueryParser extends TestCase {
|
|||
|
||||
private int originalMaxClauses;
|
||||
|
||||
public void setUp() {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
originalMaxClauses = BooleanQuery.getMaxClauseCount();
|
||||
}
|
||||
|
||||
|
@ -861,7 +862,8 @@ public class TestQueryParser extends TestCase {
|
|||
iw.addDocument(d);
|
||||
}
|
||||
|
||||
public void tearDown() {
|
||||
public void tearDown() throws Exception {
|
||||
super.tearDown();
|
||||
BooleanQuery.setMaxClauseCount(originalMaxClauses);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.apache.lucene.search;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
import org.apache.lucene.analysis.SimpleAnalyzer;
|
||||
import org.apache.lucene.document.Document;
|
||||
|
@ -27,7 +27,7 @@ import org.apache.lucene.document.Field;
|
|||
import org.apache.lucene.index.IndexWriter;
|
||||
import org.apache.lucene.store.RAMDirectory;
|
||||
|
||||
public class BaseTestRangeFilter extends TestCase {
|
||||
public class BaseTestRangeFilter extends LuceneTestCase {
|
||||
|
||||
public static final boolean F = false;
|
||||
public static final boolean T = true;
|
||||
|
|
|
@ -31,19 +31,20 @@ import org.apache.lucene.document.Field;
|
|||
import org.apache.lucene.queryParser.QueryParser;
|
||||
import org.apache.lucene.queryParser.ParseException;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/** Test BooleanQuery2 against BooleanQuery by overriding the standard query parser.
|
||||
* This also tests the scoring order of BooleanQuery.
|
||||
*/
|
||||
public class TestBoolean2 extends TestCase {
|
||||
public class TestBoolean2 extends LuceneTestCase {
|
||||
private IndexSearcher searcher;
|
||||
|
||||
public static final String field = "field";
|
||||
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
RAMDirectory directory = new RAMDirectory();
|
||||
IndexWriter writer= new IndexWriter(directory, new WhitespaceAnalyzer(), true);
|
||||
for (int i = 0; i < docFields.length; i++) {
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.lucene.search;
|
|||
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.analysis.WhitespaceAnalyzer;
|
||||
import org.apache.lucene.document.Document;
|
||||
import org.apache.lucene.document.Field;
|
||||
|
@ -33,7 +34,7 @@ import java.util.Random;
|
|||
|
||||
/** Test that BooleanQuery.setMinimumNumberShouldMatch works.
|
||||
*/
|
||||
public class TestBooleanMinShouldMatch extends TestCase {
|
||||
public class TestBooleanMinShouldMatch extends LuceneTestCase {
|
||||
|
||||
|
||||
public Directory index;
|
||||
|
@ -43,6 +44,9 @@ public class TestBooleanMinShouldMatch extends TestCase {
|
|||
public void setUp() throws Exception {
|
||||
|
||||
|
||||
super.setUp();
|
||||
|
||||
|
||||
String[] data = new String [] {
|
||||
"A 1 2 3 4 5 6",
|
||||
"Z 4 5 6",
|
||||
|
@ -325,9 +329,9 @@ public class TestBooleanMinShouldMatch extends TestCase {
|
|||
// should be a superset to the unconstrained query.
|
||||
if (top2.totalHits > top1.totalHits) {
|
||||
TestCase.fail("Constrained results not a subset:\n"
|
||||
+ CheckHits.topdocsString(top1,0,0)
|
||||
+ CheckHits.topdocsString(top2,0,0)
|
||||
+ "for query:" + q2.toString());
|
||||
+ CheckHits.topdocsString(top1,0,0)
|
||||
+ CheckHits.topdocsString(top2,0,0)
|
||||
+ "for query:" + q2.toString());
|
||||
}
|
||||
|
||||
for (int hit=0; hit<top2.totalHits; hit++) {
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.search;
|
|||
*/
|
||||
import java.io.IOException;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
import org.apache.lucene.analysis.standard.StandardAnalyzer;
|
||||
import org.apache.lucene.document.Document;
|
||||
|
@ -36,7 +36,7 @@ import org.apache.lucene.store.RAMDirectory;
|
|||
* <br>Adapted to Lucene testcase by Paul Elschot.
|
||||
* @author appler@gmail.com
|
||||
*/
|
||||
public class TestBooleanOr extends TestCase {
|
||||
public class TestBooleanOr extends LuceneTestCase {
|
||||
|
||||
private static String FIELD_T = "T";
|
||||
private static String FIELD_C = "C";
|
||||
|
@ -134,6 +134,7 @@ public class TestBooleanOr extends TestCase {
|
|||
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
super.setUp();
|
||||
|
||||
//
|
||||
RAMDirectory rd = new RAMDirectory();
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.search;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
import junit.textui.TestRunner;
|
||||
|
@ -39,7 +39,7 @@ import java.io.IOException;
|
|||
* @version $Id$
|
||||
**/
|
||||
|
||||
public class TestBooleanPrefixQuery extends TestCase {
|
||||
public class TestBooleanPrefixQuery extends LuceneTestCase {
|
||||
|
||||
public static void main(String[] args) {
|
||||
TestRunner.run(suite());
|
||||
|
|
|
@ -17,10 +17,10 @@ package org.apache.lucene.search;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.index.Term;
|
||||
|
||||
public class TestBooleanQuery extends TestCase {
|
||||
public class TestBooleanQuery extends LuceneTestCase {
|
||||
|
||||
public void testEquality() throws Exception {
|
||||
BooleanQuery bq1 = new BooleanQuery();
|
||||
|
|
|
@ -26,13 +26,13 @@ import org.apache.lucene.index.IndexWriter;
|
|||
import org.apache.lucene.index.Term;
|
||||
import org.apache.lucene.store.RAMDirectory;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @version $rcs = ' $Id$ ' ;
|
||||
*/
|
||||
public class TestBooleanScorer extends TestCase
|
||||
public class TestBooleanScorer extends LuceneTestCase
|
||||
{
|
||||
|
||||
public TestBooleanScorer(String name) {
|
||||
|
|
|
@ -17,14 +17,14 @@ package org.apache.lucene.search;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.store.Directory;
|
||||
import org.apache.lucene.store.RAMDirectory;
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
import org.apache.lucene.index.IndexWriter;
|
||||
import org.apache.lucene.analysis.standard.StandardAnalyzer;
|
||||
|
||||
public class TestCachingWrapperFilter extends TestCase {
|
||||
public class TestCachingWrapperFilter extends LuceneTestCase {
|
||||
public void testCachingWorks() throws Exception {
|
||||
Directory dir = new RAMDirectory();
|
||||
IndexWriter writer = new IndexWriter(dir, new StandardAnalyzer(), true);
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.search;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.analysis.SimpleAnalyzer;
|
||||
import org.apache.lucene.document.DateTools;
|
||||
import org.apache.lucene.document.Document;
|
||||
|
@ -35,7 +35,7 @@ import java.io.IOException;
|
|||
* @version $Revision$
|
||||
*/
|
||||
public class TestDateFilter
|
||||
extends TestCase
|
||||
extends LuceneTestCase
|
||||
{
|
||||
public TestDateFilter(String name)
|
||||
{
|
||||
|
|
|
@ -18,7 +18,7 @@ package org.apache.lucene.search;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.analysis.WhitespaceAnalyzer;
|
||||
import org.apache.lucene.document.Document;
|
||||
import org.apache.lucene.document.Field;
|
||||
|
@ -35,7 +35,7 @@ import java.io.IOException;
|
|||
* Test of the DisjunctionMaxQuery.
|
||||
*
|
||||
*/
|
||||
public class TestDisjunctionMaxQuery extends TestCase{
|
||||
public class TestDisjunctionMaxQuery extends LuceneTestCase{
|
||||
|
||||
/** threshold for comparing floats */
|
||||
public static final float SCORE_COMP_THRESH = 0.0000f;
|
||||
|
@ -73,6 +73,8 @@ public class TestDisjunctionMaxQuery extends TestCase{
|
|||
|
||||
public void setUp() throws Exception {
|
||||
|
||||
super.setUp();
|
||||
|
||||
index = new RAMDirectory();
|
||||
IndexWriter writer = new IndexWriter(index,
|
||||
new WhitespaceAnalyzer(),
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.search;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.analysis.SimpleAnalyzer;
|
||||
import org.apache.lucene.document.*;
|
||||
import org.apache.lucene.index.IndexWriter;
|
||||
|
@ -29,7 +29,7 @@ import org.apache.lucene.store.RAMDirectory;
|
|||
*
|
||||
* @version $Revision$
|
||||
*/
|
||||
public class TestDocBoost extends TestCase {
|
||||
public class TestDocBoost extends LuceneTestCase {
|
||||
public TestDocBoost(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.apache.lucene.document.Field;
|
|||
import org.apache.lucene.queryParser.QueryParser;
|
||||
import org.apache.lucene.queryParser.ParseException;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.BitSet;
|
||||
|
@ -49,7 +49,7 @@ import java.util.BitSet;
|
|||
*
|
||||
* @see "Subclasses for actual tests"
|
||||
*/
|
||||
public class TestExplanations extends TestCase {
|
||||
public class TestExplanations extends LuceneTestCase {
|
||||
protected IndexSearcher searcher;
|
||||
|
||||
public static final String FIELD = "field";
|
||||
|
@ -57,10 +57,12 @@ public class TestExplanations extends TestCase {
|
|||
new QueryParser(FIELD, new WhitespaceAnalyzer());
|
||||
|
||||
public void tearDown() throws Exception {
|
||||
super.tearDown();
|
||||
searcher.close();
|
||||
}
|
||||
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
RAMDirectory directory = new RAMDirectory();
|
||||
IndexWriter writer= new IndexWriter(directory, new WhitespaceAnalyzer(), true);
|
||||
for (int i = 0; i < docFields.length; i++) {
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.apache.lucene.search;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.analysis.WhitespaceAnalyzer;
|
||||
import org.apache.lucene.document.Document;
|
||||
import org.apache.lucene.document.Field;
|
||||
|
@ -32,7 +32,7 @@ import org.apache.lucene.store.RAMDirectory;
|
|||
*
|
||||
* @author Daniel Naber
|
||||
*/
|
||||
public class TestFuzzyQuery extends TestCase {
|
||||
public class TestFuzzyQuery extends LuceneTestCase {
|
||||
|
||||
public void testFuzziness() throws Exception {
|
||||
RAMDirectory directory = new RAMDirectory();
|
||||
|
|
|
@ -25,14 +25,14 @@ import org.apache.lucene.index.IndexWriter;
|
|||
import org.apache.lucene.index.Term;
|
||||
import org.apache.lucene.store.RAMDirectory;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
/**
|
||||
* Tests MatchAllDocsQuery.
|
||||
*
|
||||
* @author Daniel Naber
|
||||
*/
|
||||
public class TestMatchAllDocsQuery extends TestCase {
|
||||
public class TestMatchAllDocsQuery extends LuceneTestCase {
|
||||
|
||||
public void testQuery() throws IOException {
|
||||
RAMDirectory dir = new RAMDirectory();
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.apache.lucene.analysis.standard.StandardAnalyzer;
|
|||
import org.apache.lucene.document.Document;
|
||||
import org.apache.lucene.document.Field;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedList;
|
||||
|
@ -39,7 +39,7 @@ import java.util.LinkedList;
|
|||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
public class TestMultiPhraseQuery extends TestCase
|
||||
public class TestMultiPhraseQuery extends LuceneTestCase
|
||||
{
|
||||
public TestMultiPhraseQuery(String name) {
|
||||
super(name);
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.search;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.analysis.KeywordAnalyzer;
|
||||
import org.apache.lucene.analysis.standard.StandardAnalyzer;
|
||||
import org.apache.lucene.document.Document;
|
||||
|
@ -41,7 +41,7 @@ import java.util.Set;
|
|||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
public class TestMultiSearcher extends TestCase
|
||||
public class TestMultiSearcher extends LuceneTestCase
|
||||
{
|
||||
public TestMultiSearcher(String name)
|
||||
{
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.search;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.analysis.standard.StandardAnalyzer;
|
||||
import org.apache.lucene.document.Document;
|
||||
import org.apache.lucene.document.Field;
|
||||
|
@ -35,7 +35,7 @@ import java.io.IOException;
|
|||
*
|
||||
* @version $Id: TestMultiSearcher.java 150492 2004-09-06 22:01:49Z dnaber $
|
||||
*/
|
||||
public class TestMultiSearcherRanking extends TestCase {
|
||||
public class TestMultiSearcherRanking extends LuceneTestCase {
|
||||
|
||||
private final boolean verbose = false; // set to true to output hits
|
||||
private final String FIELD_NAME = "body";
|
||||
|
@ -111,6 +111,7 @@ public class TestMultiSearcherRanking extends TestCase {
|
|||
* initializes multiSearcher and singleSearcher with the same document set
|
||||
*/
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
// create MultiSearcher from two seperate searchers
|
||||
Directory d1 = new RAMDirectory();
|
||||
IndexWriter iw1 = new IndexWriter(d1, new StandardAnalyzer(), true);
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.search;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.analysis.SimpleAnalyzer;
|
||||
import org.apache.lucene.document.*;
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
|
@ -32,7 +32,7 @@ import java.io.IOException;
|
|||
*
|
||||
* @version $rcs = ' $Id$ ' ;
|
||||
*/
|
||||
public class TestMultiThreadTermVectors extends TestCase {
|
||||
public class TestMultiThreadTermVectors extends LuceneTestCase {
|
||||
private RAMDirectory directory = new RAMDirectory();
|
||||
public int numDocs = 100;
|
||||
public int numThreads = 3;
|
||||
|
@ -42,6 +42,7 @@ public class TestMultiThreadTermVectors extends TestCase {
|
|||
}
|
||||
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
IndexWriter writer
|
||||
= new IndexWriter(directory, new SimpleAnalyzer(), true);
|
||||
//writer.setUseCompoundFile(false);
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.search;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
import org.apache.lucene.index.IndexWriter;
|
||||
import org.apache.lucene.queryParser.QueryParser;
|
||||
|
@ -31,7 +31,7 @@ import org.apache.lucene.document.Field;
|
|||
*
|
||||
* @version $Revision$
|
||||
*/
|
||||
public class TestNot extends TestCase {
|
||||
public class TestNot extends LuceneTestCase {
|
||||
public TestNot(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.search;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.analysis.SimpleAnalyzer;
|
||||
import org.apache.lucene.document.Document;
|
||||
import org.apache.lucene.document.Field;
|
||||
|
@ -37,7 +37,7 @@ import java.util.LinkedList;
|
|||
* @version $Id$
|
||||
*/
|
||||
public class TestPhrasePrefixQuery
|
||||
extends TestCase
|
||||
extends LuceneTestCase
|
||||
{
|
||||
public TestPhrasePrefixQuery(String name)
|
||||
{
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.search;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.analysis.*;
|
||||
import org.apache.lucene.document.*;
|
||||
import org.apache.lucene.index.IndexWriter;
|
||||
|
@ -34,7 +34,7 @@ import java.io.Reader;
|
|||
* @see TestPositionIncrement
|
||||
* @author Erik Hatcher
|
||||
*/
|
||||
public class TestPhraseQuery extends TestCase {
|
||||
public class TestPhraseQuery extends LuceneTestCase {
|
||||
|
||||
/** threshold for comparing floats */
|
||||
public static final float SCORE_COMP_THRESH = 1e-6f;
|
||||
|
@ -44,6 +44,7 @@ public class TestPhraseQuery extends TestCase {
|
|||
private RAMDirectory directory;
|
||||
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
directory = new RAMDirectory();
|
||||
Analyzer analyzer = new Analyzer() {
|
||||
public TokenStream tokenStream(String fieldName, Reader reader) {
|
||||
|
@ -80,6 +81,7 @@ public class TestPhraseQuery extends TestCase {
|
|||
}
|
||||
|
||||
public void tearDown() throws Exception {
|
||||
super.tearDown();
|
||||
searcher.close();
|
||||
directory.close();
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.lucene.document.Field;
|
|||
import java.io.Reader;
|
||||
import java.io.StringReader;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
/**
|
||||
* Term position unit test.
|
||||
|
@ -41,7 +41,7 @@ import junit.framework.TestCase;
|
|||
*
|
||||
* @version $Revision$
|
||||
*/
|
||||
public class TestPositionIncrement extends TestCase {
|
||||
public class TestPositionIncrement extends LuceneTestCase {
|
||||
|
||||
public void testSetPosition() throws Exception {
|
||||
Analyzer analyzer = new Analyzer() {
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.search;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.store.RAMDirectory;
|
||||
import org.apache.lucene.index.IndexWriter;
|
||||
import org.apache.lucene.index.Term;
|
||||
|
@ -31,7 +31,7 @@ import org.apache.lucene.document.Field;
|
|||
* @author Yura Smolsky
|
||||
* @author yonik
|
||||
*/
|
||||
public class TestPrefixFilter extends TestCase {
|
||||
public class TestPrefixFilter extends LuceneTestCase {
|
||||
public void testPrefixFilter() throws Exception {
|
||||
RAMDirectory directory = new RAMDirectory();
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.search;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.store.RAMDirectory;
|
||||
import org.apache.lucene.index.IndexWriter;
|
||||
import org.apache.lucene.index.Term;
|
||||
|
@ -30,7 +30,7 @@ import org.apache.lucene.document.Field;
|
|||
*
|
||||
* @author Erik Hatcher
|
||||
*/
|
||||
public class TestPrefixQuery extends TestCase {
|
||||
public class TestPrefixQuery extends LuceneTestCase {
|
||||
public void testPrefixQuery() throws Exception {
|
||||
RAMDirectory directory = new RAMDirectory();
|
||||
|
||||
|
|
|
@ -17,23 +17,16 @@ package org.apache.lucene.search;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.analysis.WhitespaceAnalyzer;
|
||||
|
||||
public class TestQueryTermVector extends TestCase {
|
||||
public class TestQueryTermVector extends LuceneTestCase {
|
||||
|
||||
|
||||
public TestQueryTermVector(String s) {
|
||||
super(s);
|
||||
}
|
||||
|
||||
protected void setUp() {
|
||||
}
|
||||
|
||||
protected void tearDown() {
|
||||
|
||||
}
|
||||
|
||||
public void testConstructor() {
|
||||
String [] queryTerm = {"foo", "bar", "foo", "again", "foo", "bar", "go", "go", "go"};
|
||||
//Items are sorted lexicographically
|
||||
|
|
|
@ -24,18 +24,19 @@ import org.apache.lucene.index.IndexWriter;
|
|||
import org.apache.lucene.index.Term;
|
||||
import org.apache.lucene.store.RAMDirectory;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author goller
|
||||
*/
|
||||
public class TestRangeQuery extends TestCase {
|
||||
public class TestRangeQuery extends LuceneTestCase {
|
||||
|
||||
private int docCount = 0;
|
||||
private RAMDirectory dir;
|
||||
|
||||
public void setUp() {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
dir = new RAMDirectory();
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.apache.lucene.search;
|
|||
import java.rmi.Naming;
|
||||
import java.rmi.registry.LocateRegistry;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
import org.apache.lucene.analysis.SimpleAnalyzer;
|
||||
import org.apache.lucene.document.Document;
|
||||
|
@ -34,7 +34,7 @@ import org.apache.lucene.store.RAMDirectory;
|
|||
* NOTE: This is copied from TestRemoteSearchable since it already had a remote index set up.
|
||||
* @author Matt Ericson
|
||||
*/
|
||||
public class TestRemoteCachingWrapperFilter extends TestCase {
|
||||
public class TestRemoteCachingWrapperFilter extends LuceneTestCase {
|
||||
public TestRemoteCachingWrapperFilter(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.search;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.analysis.SimpleAnalyzer;
|
||||
import org.apache.lucene.document.*;
|
||||
import org.apache.lucene.index.IndexWriter;
|
||||
|
@ -33,7 +33,7 @@ import java.util.HashSet;
|
|||
/**
|
||||
* @version $Id$
|
||||
*/
|
||||
public class TestRemoteSearchable extends TestCase {
|
||||
public class TestRemoteSearchable extends LuceneTestCase {
|
||||
public TestRemoteSearchable(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.apache.lucene.search;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.BitSet;
|
||||
|
@ -37,7 +37,7 @@ import org.apache.lucene.document.Field;
|
|||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
public class TestScorerPerf extends TestCase {
|
||||
public class TestScorerPerf extends LuceneTestCase {
|
||||
Random r = new Random(0);
|
||||
boolean validate = true; // set to false when doing performance testing
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.search;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.analysis.SimpleAnalyzer;
|
||||
import org.apache.lucene.document.*;
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
|
@ -30,7 +30,7 @@ import org.apache.lucene.store.RAMDirectory;
|
|||
*
|
||||
* @version $Revision$
|
||||
*/
|
||||
public class TestSetNorm extends TestCase {
|
||||
public class TestSetNorm extends LuceneTestCase {
|
||||
public TestSetNorm(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.search;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
|
@ -34,7 +34,7 @@ import org.apache.lucene.document.Field;
|
|||
*
|
||||
* @version $Revision$
|
||||
*/
|
||||
public class TestSimilarity extends TestCase {
|
||||
public class TestSimilarity extends LuceneTestCase {
|
||||
public TestSimilarity(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ package org.apache.lucene.search;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.analysis.SimpleAnalyzer;
|
||||
import org.apache.lucene.document.Document;
|
||||
import org.apache.lucene.document.Field;
|
||||
|
@ -32,20 +32,13 @@ import java.util.BitSet;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class TestSpanQueryFilter extends TestCase {
|
||||
public class TestSpanQueryFilter extends LuceneTestCase {
|
||||
|
||||
|
||||
public TestSpanQueryFilter(String s) {
|
||||
super(s);
|
||||
}
|
||||
|
||||
protected void setUp() {
|
||||
}
|
||||
|
||||
protected void tearDown() {
|
||||
|
||||
}
|
||||
|
||||
public void testFilterWorks() throws Exception {
|
||||
Directory dir = new RAMDirectory();
|
||||
IndexWriter writer = new IndexWriter(dir, new SimpleAnalyzer(), true);
|
||||
|
@ -78,4 +71,4 @@ public class TestSpanQueryFilter extends TestCase {
|
|||
}
|
||||
reader.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import java.io.IOException;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.analysis.WhitespaceAnalyzer;
|
||||
import org.apache.lucene.document.Document;
|
||||
import org.apache.lucene.document.Field;
|
||||
|
@ -30,7 +30,7 @@ import org.apache.lucene.index.IndexWriter;
|
|||
import org.apache.lucene.index.Term;
|
||||
import org.apache.lucene.store.RAMDirectory;
|
||||
|
||||
public class TestTermScorer extends TestCase
|
||||
public class TestTermScorer extends LuceneTestCase
|
||||
{
|
||||
protected RAMDirectory directory;
|
||||
private static final String FIELD = "field";
|
||||
|
@ -45,8 +45,9 @@ public class TestTermScorer extends TestCase
|
|||
super(s);
|
||||
}
|
||||
|
||||
protected void setUp() throws IOException
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
directory = new RAMDirectory();
|
||||
|
||||
|
||||
|
@ -62,11 +63,6 @@ public class TestTermScorer extends TestCase
|
|||
indexReader = indexSearcher.getIndexReader();
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected void tearDown()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void test() throws IOException
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.search;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.analysis.SimpleAnalyzer;
|
||||
import org.apache.lucene.document.Document;
|
||||
import org.apache.lucene.document.Field;
|
||||
|
@ -32,7 +32,7 @@ import java.util.Iterator;
|
|||
import java.util.Map;
|
||||
import java.util.SortedSet;
|
||||
|
||||
public class TestTermVectors extends TestCase {
|
||||
public class TestTermVectors extends LuceneTestCase {
|
||||
private IndexSearcher searcher;
|
||||
private RAMDirectory directory = new RAMDirectory();
|
||||
public TestTermVectors(String s) {
|
||||
|
@ -40,6 +40,7 @@ public class TestTermVectors extends TestCase {
|
|||
}
|
||||
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
IndexWriter writer
|
||||
= new IndexWriter(directory, new SimpleAnalyzer(), true);
|
||||
//writer.setUseCompoundFile(true);
|
||||
|
@ -69,10 +70,6 @@ public class TestTermVectors extends TestCase {
|
|||
searcher = new IndexSearcher(directory);
|
||||
}
|
||||
|
||||
protected void tearDown() {
|
||||
|
||||
}
|
||||
|
||||
public void test() {
|
||||
assertTrue(searcher != null);
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ package org.apache.lucene.search;
|
|||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.store.Directory;
|
||||
import org.apache.lucene.store.RAMDirectory;
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
|
@ -32,7 +33,7 @@ import java.io.IOException;
|
|||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
public class TestThreadSafe extends TestCase {
|
||||
public class TestThreadSafe extends LuceneTestCase {
|
||||
Random r = new Random();
|
||||
Directory dir1;
|
||||
Directory dir2;
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.search;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.analysis.SimpleAnalyzer;
|
||||
import org.apache.lucene.analysis.WhitespaceAnalyzer;
|
||||
import org.apache.lucene.document.Document;
|
||||
|
@ -38,7 +38,7 @@ import java.io.IOException;
|
|||
*
|
||||
*/
|
||||
public class TestWildcard
|
||||
extends TestCase {
|
||||
extends LuceneTestCase {
|
||||
public void testEquals() {
|
||||
WildcardQuery wq1 = new WildcardQuery(new Term("field", "b*a"));
|
||||
WildcardQuery wq2 = new WildcardQuery(new Term("field", "b*a"));
|
||||
|
|
|
@ -26,12 +26,12 @@ import org.apache.lucene.index.IndexWriter;
|
|||
import org.apache.lucene.store.Directory;
|
||||
import org.apache.lucene.store.RAMDirectory;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
/**
|
||||
* Setup for function tests
|
||||
*/
|
||||
public abstract class FunctionTestSetup extends TestCase {
|
||||
public abstract class FunctionTestSetup extends LuceneTestCase {
|
||||
|
||||
/**
|
||||
* Actual score computation order is slightly different than assumptios
|
||||
|
@ -75,6 +75,7 @@ public abstract class FunctionTestSetup extends TestCase {
|
|||
|
||||
/* @override */
|
||||
protected void tearDown() throws Exception {
|
||||
super.tearDown();
|
||||
super.tearDown();
|
||||
dir = null;
|
||||
anlzr = null;
|
||||
|
@ -82,6 +83,7 @@ public abstract class FunctionTestSetup extends TestCase {
|
|||
|
||||
/* @override */
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
// prepare a small index with just a few documents.
|
||||
super.setUp();
|
||||
dir = new RAMDirectory();
|
||||
|
|
|
@ -16,7 +16,7 @@ package org.apache.lucene.search.payloads;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.analysis.*;
|
||||
import org.apache.lucene.document.Document;
|
||||
import org.apache.lucene.document.Field;
|
||||
|
@ -32,7 +32,7 @@ import org.apache.lucene.util.English;
|
|||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
|
||||
public class TestBoostingTermQuery extends TestCase {
|
||||
public class TestBoostingTermQuery extends LuceneTestCase {
|
||||
private IndexSearcher searcher;
|
||||
private BoostingSimilarity similarity = new BoostingSimilarity();
|
||||
private byte[] payloadField = new byte[]{1};
|
||||
|
@ -81,7 +81,8 @@ public class TestBoostingTermQuery extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
protected void setUp() throws IOException {
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
RAMDirectory directory = new RAMDirectory();
|
||||
PayloadAnalyzer analyzer = new PayloadAnalyzer();
|
||||
IndexWriter writer
|
||||
|
@ -104,11 +105,6 @@ public class TestBoostingTermQuery extends TestCase {
|
|||
searcher.setSimilarity(similarity);
|
||||
}
|
||||
|
||||
|
||||
protected void tearDown() {
|
||||
|
||||
}
|
||||
|
||||
public void test() throws IOException {
|
||||
BoostingTermQuery query = new BoostingTermQuery(new Term("field", "seventy"));
|
||||
TopDocs hits = searcher.search(query, null, 100);
|
||||
|
@ -231,4 +227,4 @@ public class TestBoostingTermQuery extends TestCase {
|
|||
return freq == 0 ? 0 : 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue