You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@lucene.apache.org by us...@apache.org on 2010/02/27 23:51:55 UTC
svn commit: r917067 [8/8] - in /lucene/java/branches/flex_1458: ./ contrib/
contrib/analyzers/common/src/java/org/apache/lucene/analysis/ar/
contrib/analyzers/common/src/java/org/apache/lucene/analysis/bg/
contrib/analyzers/common/src/java/org/apache/l...
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/CachingWrapperFilterHelper.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/CachingWrapperFilterHelper.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/CachingWrapperFilterHelper.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/CachingWrapperFilterHelper.java Sat Feb 27 22:51:44 2010
@@ -20,8 +20,7 @@
import java.io.IOException;
import java.util.WeakHashMap;
-import junit.framework.TestCase;
-
+import junit.framework.Assert;
import org.apache.lucene.index.IndexReader;
/**
@@ -51,9 +50,9 @@
synchronized (cache) { // check cache
DocIdSet cached = cache.get(reader);
if (shouldHaveCache) {
- TestCase.assertNotNull("Cache should have data ", cached);
+ Assert.assertNotNull("Cache should have data ", cached);
} else {
- TestCase.assertNull("Cache should be null " + cached , cached);
+ Assert.assertNull("Cache should be null " + cached , cached);
}
if (cached != null) {
return cached;
@@ -77,7 +76,7 @@
@Override
public boolean equals(Object o) {
if (!(o instanceof CachingWrapperFilterHelper)) return false;
- return this.filter.equals((CachingWrapperFilterHelper)o);
+ return this.filter.equals(o);
}
@Override
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/CheckHits.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/CheckHits.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/CheckHits.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/CheckHits.java Sat Feb 27 22:51:44 2010
@@ -76,7 +76,7 @@
* @param searcher the searcher to test the query against
* @param defaultFieldName used for displaying the query in assertion messages
* @param results a list of documentIds that must match the query
- * @see Searcher#search(Query,HitCollector)
+ * @see Searcher#search(Query,Collector)
* @see #checkHits
*/
public static void checkHitCollector(Query query, String defaultFieldName,
@@ -149,7 +149,7 @@
* @param searcher the searcher to test the query against
* @param defaultFieldName used for displaing the query in assertion messages
* @param results a list of documentIds that must match the query
- * @see Searcher#search(Query)
+ * @see Searcher#search(Query, int)
* @see #checkHitCollector
*/
public static void checkHits(
@@ -159,7 +159,7 @@
int[] results)
throws IOException {
- ScoreDoc[] hits = searcher.search(query, null, 1000).scoreDocs;
+ ScoreDoc[] hits = searcher.search(query, 1000).scoreDocs;
Set<Integer> correct = new TreeSet<Integer>();
for (int i = 0; i < results.length; i++) {
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/JustCompileSearch.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/JustCompileSearch.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/JustCompileSearch.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/JustCompileSearch.java Sat Feb 27 22:51:44 2010
@@ -246,7 +246,7 @@
}
@Override
- public Comparable value(int slot) {
+ public Comparable<?> value(int slot) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestBoolean2.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestBoolean2.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestBoolean2.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestBoolean2.java Sat Feb 27 22:51:44 2010
@@ -47,7 +47,7 @@
private int mulFactor;
@Override
- public void setUp() throws Exception {
+ protected void setUp() throws Exception {
super.setUp();
RAMDirectory directory = new RAMDirectory();
IndexWriter writer= new IndexWriter(directory, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), true, IndexWriter.MaxFieldLength.LIMITED);
@@ -93,9 +93,10 @@
}
@Override
- public void tearDown() throws Exception {
+ protected void tearDown() throws Exception {
reader.close();
dir2.close();
+ super.tearDown();
}
private String[] docFields = {
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java Sat Feb 27 22:51:44 2010
@@ -18,7 +18,6 @@
*/
-import junit.framework.TestCase;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.analysis.WhitespaceAnalyzer;
import org.apache.lucene.document.Document;
@@ -42,7 +41,7 @@
public IndexSearcher s;
@Override
- public void setUp() throws Exception {
+ protected void setUp() throws Exception {
super.setUp();
@@ -338,7 +337,7 @@
// The constrained query
// should be a superset to the unconstrained query.
if (top2.totalHits > top1.totalHits) {
- TestCase.fail("Constrained results not a subset:\n"
+ fail("Constrained results not a subset:\n"
+ CheckHits.topdocsString(top1,0,0)
+ CheckHits.topdocsString(top2,0,0)
+ "for query:" + q2.toString());
@@ -355,7 +354,7 @@
float otherScore = top1.scoreDocs[other].score;
// check if scores match
if (Math.abs(otherScore-score)>1.0e-6f) {
- TestCase.fail("Doc " + id + " scores don't match\n"
+ fail("Doc " + id + " scores don't match\n"
+ CheckHits.topdocsString(top1,0,0)
+ CheckHits.topdocsString(top2,0,0)
+ "for query:" + q2.toString());
@@ -364,7 +363,7 @@
}
// check if subset
- if (!found) TestCase.fail("Doc " + id + " not found\n"
+ if (!found) fail("Doc " + id + " not found\n"
+ CheckHits.topdocsString(top1,0,0)
+ CheckHits.topdocsString(top2,0,0)
+ "for query:" + q2.toString());
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestComplexExplanations.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestComplexExplanations.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestComplexExplanations.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestComplexExplanations.java Sat Feb 27 22:51:44 2010
@@ -32,7 +32,7 @@
* nice with boosts of 0.0
*/
@Override
- public void setUp() throws Exception {
+ protected void setUp() throws Exception {
super.setUp();
searcher.setSimilarity(createQnorm1Similarity());
}
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestCustomSearcherSort.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestCustomSearcherSort.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestCustomSearcherSort.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestCustomSearcherSort.java Sat Feb 27 22:51:44 2010
@@ -93,7 +93,7 @@
* Create index and query for test cases.
*/
@Override
- public void setUp() throws Exception {
+ protected void setUp() throws Exception {
super.setUp();
index = getIndex();
query = new TermQuery( new Term("content", "test"));
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestDateSort.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestDateSort.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestDateSort.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestDateSort.java Sat Feb 27 22:51:44 2010
@@ -46,7 +46,7 @@
private static Directory directory;
@Override
- public void setUp() throws Exception {
+ protected void setUp() throws Exception {
super.setUp();
// Create an index writer.
directory = new RAMDirectory();
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java Sat Feb 27 22:51:44 2010
@@ -74,7 +74,7 @@
public IndexSearcher s;
@Override
- public void setUp() throws Exception {
+ protected void setUp() throws Exception {
super.setUp();
index = new RAMDirectory();
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestDocIdSet.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestDocIdSet.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestDocIdSet.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestDocIdSet.java Sat Feb 27 22:51:44 2010
@@ -35,7 +35,6 @@
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.RAMDirectory;
import org.apache.lucene.util.LuceneTestCase;
-import org.apache.lucene.util._TestUtil;
public class TestDocIdSet extends LuceneTestCase {
public void testFilteredDocIdSet() throws Exception {
@@ -95,8 +94,8 @@
int[] answer = new int[]{4,6,8};
boolean same = Arrays.equals(answer, docs);
if (!same) {
- System.out.println("answer: "+_TestUtil.arrayToString(answer));
- System.out.println("gotten: "+_TestUtil.arrayToString(docs));
+ System.out.println("answer: " + Arrays.toString(answer));
+ System.out.println("gotten: " + Arrays.toString(docs));
fail();
}
}
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestElevationComparator.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestElevationComparator.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestElevationComparator.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestElevationComparator.java Sat Feb 27 22:51:44 2010
@@ -21,6 +21,7 @@
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.index.*;
+import org.apache.lucene.search.FieldValueHitQueue.Entry;
import org.apache.lucene.store.*;
import org.apache.lucene.util.LuceneTestCase;
import java.io.IOException;
@@ -70,7 +71,7 @@
new SortField(null, SortField.SCORE, reversed)
);
- TopDocsCollector topCollector = TopFieldCollector.create(sort, 50, false, true, true, true);
+ TopDocsCollector<Entry> topCollector = TopFieldCollector.create(sort, 50, false, true, true, true);
searcher.search(newq, null, topCollector);
TopDocs topDocs = topCollector.topDocs(0, 10);
@@ -171,7 +172,7 @@
}
@Override
- public Comparable value(int slot) {
+ public Comparable<?> value(int slot) {
return Integer.valueOf(values[slot]);
}
};
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestExplanations.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestExplanations.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestExplanations.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestExplanations.java Sat Feb 27 22:51:44 2010
@@ -54,13 +54,13 @@
new QueryParser(TEST_VERSION_CURRENT, FIELD, new WhitespaceAnalyzer(TEST_VERSION_CURRENT));
@Override
- public void tearDown() throws Exception {
- super.tearDown();
+ protected void tearDown() throws Exception {
searcher.close();
+ super.tearDown();
}
@Override
- public void setUp() throws Exception {
+ protected void setUp() throws Exception {
super.setUp();
RAMDirectory directory = new RAMDirectory();
IndexWriter writer= new IndexWriter(directory, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), true,
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestFieldCache.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestFieldCache.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestFieldCache.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestFieldCache.java Sat Feb 27 22:51:44 2010
@@ -65,8 +65,8 @@
FieldCache cache = FieldCache.DEFAULT;
ByteArrayOutputStream bos = new ByteArrayOutputStream(1024);
cache.setInfoStream(new PrintStream(bos));
- double [] doubles = cache.getDoubles(reader, "theDouble");
- float [] floats = cache.getFloats(reader, "theDouble");
+ cache.getDoubles(reader, "theDouble");
+ cache.getFloats(reader, "theDouble");
assertTrue(bos.toString().indexOf("WARNING") != -1);
} finally {
FieldCache.DEFAULT.purgeAllCaches();
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestFieldCacheRangeFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestFieldCacheRangeFilter.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestFieldCacheRangeFilter.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestFieldCacheRangeFilter.java Sat Feb 27 22:51:44 2010
@@ -479,7 +479,7 @@
int numDocs = reader.numDocs();
Float minIdO = Float.valueOf(minId + .5f);
- Float medIdO = Float.valueOf(minIdO.floatValue() + ((float) (maxId-minId))/2.0f);
+ Float medIdO = Float.valueOf(minIdO.floatValue() + ((maxId-minId))/2.0f);
ScoreDoc[] result;
Query q = new TermQuery(new Term("body","body"));
@@ -507,7 +507,7 @@
int numDocs = reader.numDocs();
Double minIdO = Double.valueOf(minId + .5);
- Double medIdO = Double.valueOf(minIdO.floatValue() + ((double) (maxId-minId))/2.0);
+ Double medIdO = Double.valueOf(minIdO.floatValue() + ((maxId-minId))/2.0);
ScoreDoc[] result;
Query q = new TermQuery(new Term("body","body"));
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestFilteredQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestFilteredQuery.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestFilteredQuery.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestFilteredQuery.java Sat Feb 27 22:51:44 2010
@@ -45,7 +45,7 @@
private Filter filter;
@Override
- public void setUp() throws Exception {
+ protected void setUp() throws Exception {
super.setUp();
directory = new RAMDirectory();
IndexWriter writer = new IndexWriter (directory, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), true, IndexWriter.MaxFieldLength.LIMITED);
@@ -92,8 +92,7 @@
}
@Override
- public void tearDown()
- throws Exception {
+ protected void tearDown() throws Exception {
searcher.close();
directory.close();
super.tearDown();
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java Sat Feb 27 22:51:44 2010
@@ -56,7 +56,7 @@
}
@Override
- public void setUp() throws Exception {
+ protected void setUp() throws Exception {
super.setUp();
String[] data = new String[] { "A 1 2 3 4 5 6", "Z 4 5 6", null,
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestMultiThreadTermVectors.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestMultiThreadTermVectors.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestMultiThreadTermVectors.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestMultiThreadTermVectors.java Sat Feb 27 22:51:44 2010
@@ -38,7 +38,7 @@
}
@Override
- public void setUp() throws Exception {
+ protected void setUp() throws Exception {
super.setUp();
IndexWriter writer
= new IndexWriter(directory, new SimpleAnalyzer(TEST_VERSION_CURRENT), true, IndexWriter.MaxFieldLength.LIMITED);
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestPhraseQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestPhraseQuery.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestPhraseQuery.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestPhraseQuery.java Sat Feb 27 22:51:44 2010
@@ -86,10 +86,10 @@
}
@Override
- public void tearDown() throws Exception {
- super.tearDown();
+ protected void tearDown() throws Exception {
searcher.close();
directory.close();
+ super.tearDown();
}
public void testNotCloseEnough() throws Exception {
@@ -474,7 +474,7 @@
query.add(new Term("palindrome", "three"));
hits = searcher.search(query, null, 1000).scoreDocs;
assertEquals("just sloppy enough", 1, hits.length);
- float score2 = hits[0].score;
+ //float score2 = hits[0].score;
//System.out.println("palindrome: two three: "+score2);
QueryUtils.check(query,searcher);
@@ -488,7 +488,7 @@
query.add(new Term("palindrome", "two"));
hits = searcher.search(query, null, 1000).scoreDocs;
assertEquals("just sloppy enough", 1, hits.length);
- float score3 = hits[0].score;
+ //float score3 = hits[0].score;
//System.out.println("palindrome: three two: "+score3);
QueryUtils.check(query,searcher);
@@ -536,7 +536,7 @@
query.add(new Term("palindrome", "three"));
hits = searcher.search(query, null, 1000).scoreDocs;
assertEquals("just sloppy enough", 1, hits.length);
- float score2 = hits[0].score;
+ //float score2 = hits[0].score;
//System.out.println("palindrome: one two three: "+score2);
QueryUtils.check(query,searcher);
@@ -551,7 +551,7 @@
query.add(new Term("palindrome", "one"));
hits = searcher.search(query, null, 1000).scoreDocs;
assertEquals("just sloppy enough", 1, hits.length);
- float score3 = hits[0].score;
+ //float score3 = hits[0].score;
//System.out.println("palindrome: three two one: "+score3);
QueryUtils.check(query,searcher);
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestQueryTermVector.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestQueryTermVector.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestQueryTermVector.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestQueryTermVector.java Sat Feb 27 22:51:44 2010
@@ -33,7 +33,6 @@
String [] gold = {"again", "bar", "foo", "go"};
int [] goldFreqs = {1, 2, 3, 3};
QueryTermVector result = new QueryTermVector(queryTerm);
- assertTrue(result != null);
String [] terms = result.getTerms();
assertTrue(terms.length == 4);
int [] freq = result.getTermFrequencies();
@@ -43,7 +42,6 @@
assertTrue(result.getTerms().length == 0);
result = new QueryTermVector("foo bar foo again foo bar go go go", new WhitespaceAnalyzer(TEST_VERSION_CURRENT));
- assertTrue(result != null);
terms = result.getTerms();
assertTrue(terms.length == 4);
freq = result.getTermFrequencies();
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestScorerPerf.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestScorerPerf.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestScorerPerf.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestScorerPerf.java Sat Feb 27 22:51:44 2010
@@ -143,7 +143,7 @@
@Override
public DocIdSet getDocIdSet(IndexReader reader) {
return new DocIdBitSet(rnd);
- };
+ }
});
bq.add(q, BooleanClause.Occur.MUST);
if (validate) {
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestSort.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestSort.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestSort.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestSort.java Sat Feb 27 22:51:44 2010
@@ -38,6 +38,7 @@
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.queryParser.ParseException;
import org.apache.lucene.search.BooleanClause.Occur;
+import org.apache.lucene.search.FieldValueHitQueue.Entry;
import org.apache.lucene.store.LockObtainFailedException;
import org.apache.lucene.store.RAMDirectory;
import org.apache.lucene.util.DocIdBitSet;
@@ -208,7 +209,7 @@
}
@Override
- public void setUp() throws Exception {
+ protected void setUp() throws Exception {
super.setUp();
full = getFullIndex();
searchX = getXIndex();
@@ -447,7 +448,7 @@
}
@Override
- public Comparable value(int slot) {
+ public Comparable<?> value(int slot) {
return Integer.valueOf(slotValues[slot]);
}
}
@@ -748,7 +749,7 @@
Sort[] sort = new Sort[] { new Sort(SortField.FIELD_DOC), new Sort() };
for (int i = 0; i < sort.length; i++) {
Query q = new MatchAllDocsQuery();
- TopDocsCollector tdc = TopFieldCollector.create(sort[i], 10, false,
+ TopDocsCollector<Entry> tdc = TopFieldCollector.create(sort[i], 10, false,
false, false, true);
full.search(q, tdc);
@@ -767,7 +768,7 @@
Sort[] sort = new Sort[] {new Sort(SortField.FIELD_DOC), new Sort() };
for (int i = 0; i < sort.length; i++) {
Query q = new MatchAllDocsQuery();
- TopDocsCollector tdc = TopFieldCollector.create(sort[i], 10, true, false,
+ TopDocsCollector<Entry> tdc = TopFieldCollector.create(sort[i], 10, true, false,
false, true);
full.search(q, tdc);
@@ -787,7 +788,7 @@
Sort[] sort = new Sort[] {new Sort(SortField.FIELD_DOC), new Sort() };
for (int i = 0; i < sort.length; i++) {
Query q = new MatchAllDocsQuery();
- TopDocsCollector tdc = TopFieldCollector.create(sort[i], 10, true, true,
+ TopDocsCollector<Entry> tdc = TopFieldCollector.create(sort[i], 10, true, true,
false, true);
full.search(q, tdc);
@@ -807,7 +808,7 @@
Sort[] sort = new Sort[] {new Sort(SortField.FIELD_DOC), new Sort() };
for (int i = 0; i < sort.length; i++) {
Query q = new MatchAllDocsQuery();
- TopDocsCollector tdc = TopFieldCollector.create(sort[i], 10, true, true,
+ TopDocsCollector<Entry> tdc = TopFieldCollector.create(sort[i], 10, true, true,
true, true);
full.search(q, tdc);
@@ -855,7 +856,7 @@
bq.setMinimumNumberShouldMatch(1);
for (int i = 0; i < sort.length; i++) {
for (int j = 0; j < tfcOptions.length; j++) {
- TopDocsCollector tdc = TopFieldCollector.create(sort[i], 10,
+ TopDocsCollector<Entry> tdc = TopFieldCollector.create(sort[i], 10,
tfcOptions[j][0], tfcOptions[j][1], tfcOptions[j][2], false);
assertTrue(tdc.getClass().getName().endsWith("$"+actualTFCClasses[j]));
@@ -874,7 +875,7 @@
// Two Sort criteria to instantiate the multi/single comparators.
Sort[] sort = new Sort[] {new Sort(SortField.FIELD_DOC), new Sort() };
for (int i = 0; i < sort.length; i++) {
- TopDocsCollector tdc = TopFieldCollector.create(sort[i], 10, true, true, true, true);
+ TopDocsCollector<Entry> tdc = TopFieldCollector.create(sort[i], 10, true, true, true, true);
TopDocs td = tdc.topDocs();
assertEquals(0, td.totalHits);
assertTrue(Float.isNaN(td.getMaxScore()));
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestTermRangeFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestTermRangeFilter.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestTermRangeFilter.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestTermRangeFilter.java Sat Feb 27 22:51:44 2010
@@ -400,8 +400,6 @@
Query q = new TermQuery(new Term("body","body"));
Collator collator = Collator.getInstance(new Locale("da", "dk"));
- Query query = new TermRangeQuery
- ("content", "H\u00D8T", "MAND", false, false, collator);
// Unicode order would not include "H\u00C5T" in [ "H\u00D8T", "MAND" ],
// but Danish collation does.
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestTermRangeQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestTermRangeQuery.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestTermRangeQuery.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestTermRangeQuery.java Sat Feb 27 22:51:44 2010
@@ -43,7 +43,7 @@
private RAMDirectory dir;
@Override
- public void setUp() throws Exception {
+ protected void setUp() throws Exception {
super.setUp();
dir = new RAMDirectory();
}
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestTermVectors.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestTermVectors.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestTermVectors.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestTermVectors.java Sat Feb 27 22:51:44 2010
@@ -39,7 +39,7 @@
}
@Override
- public void setUp() throws Exception {
+ protected void setUp() throws Exception {
super.setUp();
IndexWriter writer = new IndexWriter(directory, new SimpleAnalyzer(TEST_VERSION_CURRENT), true,
IndexWriter.MaxFieldLength.LIMITED);
@@ -233,7 +233,6 @@
try {
IndexWriter writer = new IndexWriter(dir, new SimpleAnalyzer(TEST_VERSION_CURRENT), true,
IndexWriter.MaxFieldLength.LIMITED);
- assertTrue(writer != null);
writer.addDocument(testDoc1);
writer.addDocument(testDoc2);
writer.addDocument(testDoc3);
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestThreadSafe.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestThreadSafe.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestThreadSafe.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestThreadSafe.java Sat Feb 27 22:51:44 2010
@@ -16,7 +16,6 @@
* 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;
@@ -65,7 +64,7 @@
}
} catch (Throwable th) {
failure=th.toString();
- TestCase.fail(failure);
+ fail(failure);
}
}
@@ -135,7 +134,7 @@
tarr[i].join();
}
if (failure!=null) {
- TestCase.fail(failure);
+ fail(failure);
}
}
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestTimeLimitingCollector.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestTimeLimitingCollector.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestTimeLimitingCollector.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestTimeLimitingCollector.java Sat Feb 27 22:51:44 2010
@@ -97,7 +97,7 @@
}
@Override
- public void tearDown() throws Exception {
+ protected void tearDown() throws Exception {
searcher.close();
super.tearDown();
}
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/function/TestCustomScoreQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/function/TestCustomScoreQuery.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/function/TestCustomScoreQuery.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/function/TestCustomScoreQuery.java Sat Feb 27 22:51:44 2010
@@ -84,7 +84,6 @@
}
// must have static class otherwise serialization tests fail
- @SuppressWarnings({"SerializableHasSerializationMethods", "serial"})
private static class CustomAddQuery extends CustomScoreQuery {
// constructor
CustomAddQuery(Query q, ValueSourceQuery qValSrc) {
@@ -120,7 +119,6 @@
}
// must have static class otherwise serialization tests fail
- @SuppressWarnings({"SerializableHasSerializationMethods", "serial"})
private static class CustomMulAddQuery extends CustomScoreQuery {
// constructor
CustomMulAddQuery(Query q, ValueSourceQuery qValSrc1, ValueSourceQuery qValSrc2) {
@@ -179,7 +177,7 @@
@Override
public float customScore(int doc, float subScore, float valSrcScore) throws IOException {
assertTrue(doc <= reader.maxDoc());
- return (float) values[doc];
+ return values[doc];
}
};
}
@@ -224,7 +222,6 @@
original = new CustomScoreQuery(q);
rewritten = (CustomScoreQuery) original.rewrite(s.getIndexReader());
assertTrue("rewritten query should not be identical, as TermRangeQuery rewrites", original != rewritten);
- assertTrue("rewritten query should be a CustomScoreQuery", rewritten instanceof CustomScoreQuery);
assertTrue("no hits for query", s.search(rewritten,1).totalHits > 0);
assertEquals(s.search(q,1).totalHits, s.search(original,1).totalHits);
assertEquals(s.search(q,1).totalHits, s.search(rewritten,1).totalHits);
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/function/TestFieldScoreQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/function/TestFieldScoreQuery.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/function/TestFieldScoreQuery.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/function/TestFieldScoreQuery.java Sat Feb 27 22:51:44 2010
@@ -39,7 +39,6 @@
* <p>
* The exact score tests use TopDocs top to verify the exact score.
*/
-@SuppressWarnings({"UseOfSystemOutOrSystemErr"})
public class TestFieldScoreQuery extends FunctionTestSetup {
/* @override constructor */
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/function/TestOrdValues.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/function/TestOrdValues.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/function/TestOrdValues.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/function/TestOrdValues.java Sat Feb 27 22:51:44 2010
@@ -34,7 +34,6 @@
* <p/>
* The exact score tests use TopDocs top to verify the exact score.
*/
-@SuppressWarnings({"UseOfSystemOutOrSystemErr"})
public class TestOrdValues extends FunctionTestSetup {
/* @override constructor */
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java Sat Feb 27 22:51:44 2010
@@ -188,10 +188,10 @@
TopDocs hits;
query = newPhraseQuery("field", "nine hundred ninety nine", true);
hits = searcher.search(query, null, 100);
+ assertTrue("hits is null and it shouldn't be", hits != null);
ScoreDoc doc = hits.scoreDocs[0];
// System.out.println("Doc: " + doc.toString());
// System.out.println("Explain: " + searcher.explain(query, doc.doc));
- assertTrue("hits is null and it shouldn't be", hits != null);
assertTrue("there should only be one hit", hits.totalHits == 1);
// should have score = 3 because adjacent terms have payloads of 2,4
assertTrue(doc.score + " does not equal: " + 3, doc.score == 3);
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/spans/TestBasics.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/spans/TestBasics.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/spans/TestBasics.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/spans/TestBasics.java Sat Feb 27 22:51:44 2010
@@ -52,7 +52,7 @@
private IndexSearcher searcher;
@Override
- public void setUp() throws Exception {
+ protected void setUp() throws Exception {
super.setUp();
RAMDirectory directory = new RAMDirectory();
IndexWriter writer = new IndexWriter(directory, new SimpleAnalyzer(TEST_VERSION_CURRENT), true,
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/spans/TestFieldMaskingSpanQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/spans/TestFieldMaskingSpanQuery.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/spans/TestFieldMaskingSpanQuery.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/spans/TestFieldMaskingSpanQuery.java Sat Feb 27 22:51:44 2010
@@ -50,7 +50,7 @@
protected IndexSearcher searcher;
@Override
- public void setUp() throws Exception {
+ protected void setUp() throws Exception {
super.setUp();
RAMDirectory directory = new RAMDirectory();
IndexWriter writer= new IndexWriter(directory,
@@ -116,9 +116,9 @@
}
@Override
- public void tearDown() throws Exception {
- super.tearDown();
+ protected void tearDown() throws Exception {
searcher.close();
+ super.tearDown();
}
protected void check(SpanQuery q, int[] docs) throws Exception {
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/spans/TestNearSpansOrdered.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/spans/TestNearSpansOrdered.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/spans/TestNearSpansOrdered.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/spans/TestNearSpansOrdered.java Sat Feb 27 22:51:44 2010
@@ -39,13 +39,13 @@
new QueryParser(TEST_VERSION_CURRENT, FIELD, new WhitespaceAnalyzer(TEST_VERSION_CURRENT));
@Override
- public void tearDown() throws Exception {
- super.tearDown();
+ protected void tearDown() throws Exception {
searcher.close();
+ super.tearDown();
}
@Override
- public void setUp() throws Exception {
+ protected void setUp() throws Exception {
super.setUp();
RAMDirectory directory = new RAMDirectory();
IndexWriter writer= new IndexWriter(directory, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), true, IndexWriter.MaxFieldLength.LIMITED);
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/spans/TestSpans.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/spans/TestSpans.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/spans/TestSpans.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/spans/TestSpans.java Sat Feb 27 22:51:44 2010
@@ -46,7 +46,7 @@
public static final String field = "field";
@Override
- public void setUp() throws Exception {
+ protected void setUp() throws Exception {
super.setUp();
RAMDirectory directory = new RAMDirectory();
IndexWriter writer= new IndexWriter(directory, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), true, IndexWriter.MaxFieldLength.LIMITED);
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/spans/TestSpansAdvanced.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/spans/TestSpansAdvanced.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/spans/TestSpansAdvanced.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/spans/TestSpansAdvanced.java Sat Feb 27 22:51:44 2010
@@ -38,7 +38,7 @@
public class TestSpansAdvanced extends LuceneTestCase {
// location to the index
- protected Directory mDirectory;;
+ protected Directory mDirectory;
protected IndexSearcher searcher;
@@ -52,7 +52,6 @@
@Override
protected void setUp() throws Exception {
super.setUp();
- super.setUp();
// create test index
mDirectory = new RAMDirectory();
@@ -67,10 +66,10 @@
@Override
protected void tearDown() throws Exception {
- super.tearDown();
searcher.close();
mDirectory.close();
mDirectory = null;
+ super.tearDown();
}
/**
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/store/TestBufferedIndexInput.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/store/TestBufferedIndexInput.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/store/TestBufferedIndexInput.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/store/TestBufferedIndexInput.java Sat Feb 27 22:51:44 2010
@@ -307,7 +307,7 @@
//int count = 0;
for (final IndexInput ip : allIndexInputs) {
BufferedIndexInput bii = (BufferedIndexInput) ip;
- int bufferSize = 1024+(int) Math.abs(rand.nextInt() % 32768);
+ int bufferSize = 1024+Math.abs(rand.nextInt() % 32768);
bii.setBufferSize(bufferSize);
//count++;
}
@@ -317,7 +317,7 @@
@Override
public IndexInput openInput(String name, int bufferSize) throws IOException {
// Make random changes to buffer size
- bufferSize = 1+(int) Math.abs(rand.nextInt() % 10);
+ bufferSize = 1+Math.abs(rand.nextInt() % 10);
IndexInput f = dir.openInput(name, bufferSize);
allIndexInputs.add(f);
return f;
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/store/TestLockFactory.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/store/TestLockFactory.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/store/TestLockFactory.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/store/TestLockFactory.java Sat Feb 27 22:51:44 2010
@@ -30,7 +30,6 @@
import org.apache.lucene.index.Term;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
-import org.apache.lucene.search.ScoreDoc;
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util._TestUtil;
@@ -331,26 +330,22 @@
e.printStackTrace(System.out);
break;
}
- if (searcher != null) {
- ScoreDoc[] hits = null;
- try {
- hits = searcher.search(query, null, 1000).scoreDocs;
- } catch (IOException e) {
- hitException = true;
- System.out.println("Stress Test Index Searcher: search hit unexpected exception: " + e.toString());
- e.printStackTrace(System.out);
- break;
- }
- // System.out.println(hits.length() + " total results");
- try {
- searcher.close();
- } catch (IOException e) {
- hitException = true;
- System.out.println("Stress Test Index Searcher: close hit unexpected exception: " + e.toString());
- e.printStackTrace(System.out);
- break;
- }
- searcher = null;
+ try {
+ searcher.search(query, null, 1000);
+ } catch (IOException e) {
+ hitException = true;
+ System.out.println("Stress Test Index Searcher: search hit unexpected exception: " + e.toString());
+ e.printStackTrace(System.out);
+ break;
+ }
+ // System.out.println(hits.length() + " total results");
+ try {
+ searcher.close();
+ } catch (IOException e) {
+ hitException = true;
+ System.out.println("Stress Test Index Searcher: close hit unexpected exception: " + e.toString());
+ e.printStackTrace(System.out);
+ break;
}
}
}
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/store/TestRAMDirectory.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/store/TestRAMDirectory.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/store/TestRAMDirectory.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/store/TestRAMDirectory.java Sat Feb 27 22:51:44 2010
@@ -46,7 +46,7 @@
// setup the index
@Override
- public void setUp () throws Exception {
+ protected void setUp () throws Exception {
super.setUp();
String tempDir = System.getProperty("java.io.tmpdir");
if (tempDir == null)
@@ -152,12 +152,12 @@
}
@Override
- public void tearDown() throws Exception {
- super.tearDown();
+ protected void tearDown() throws Exception {
// cleanup
if (indexDir != null && indexDir.exists()) {
rmDir (indexDir);
}
+ super.tearDown();
}
// LUCENE-1196
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/store/TestWindowsMMap.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/store/TestWindowsMMap.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/store/TestWindowsMMap.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/store/TestWindowsMMap.java Sat Feb 27 22:51:44 2010
@@ -35,7 +35,7 @@
private Random random;
@Override
- public void setUp() throws Exception {
+ protected void setUp() throws Exception {
super.setUp();
random = newRandom();
}
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/LuceneTestCase.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/LuceneTestCase.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/LuceneTestCase.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/LuceneTestCase.java Sat Feb 27 22:51:44 2010
@@ -51,10 +51,7 @@
* </p>
* @see #assertSaneFieldCaches
*
- * @deprecated Replaced by {@link #LuceneTestCaseJ4}
- *
*/
-@Deprecated
public abstract class LuceneTestCase extends TestCase {
public static final Version TEST_VERSION_CURRENT = LuceneTestCaseJ4.TEST_VERSION_CURRENT;
@@ -213,7 +210,7 @@
/**
* Convinience method for logging an array. Wraps the array in an iterator and delegates
- * @see dumpIterator(String,Iterator,PrintStream)
+ * @see #dumpIterator(String,Iterator,PrintStream)
*/
public static void dumpArray(String label, Object[] objs,
PrintStream stream) {
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/LuceneTestCaseJ4.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/LuceneTestCaseJ4.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/LuceneTestCaseJ4.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/LuceneTestCaseJ4.java Sat Feb 27 22:51:44 2010
@@ -26,6 +26,7 @@
import org.junit.Before;
import org.junit.Rule;
import org.junit.rules.TestWatchman;
+import org.junit.runners.model.FrameworkMethod;
import java.io.PrintStream;
import java.util.Arrays;
@@ -55,17 +56,16 @@
* @Before - replaces teardown
* @Test - any public method with this annotation is a test case, regardless
* of its name
- * <p/>
- * <p/>
+ * <p>
+ * <p>
* See Junit4 documentation for a complete list of features at
* http://junit.org/junit/javadoc/4.7/
- * <p/>
+ * <p>
* Import from org.junit rather than junit.framework.
- * <p/>
+ * <p>
* You should be able to use this class anywhere you used LuceneTestCase
* if you annotate your derived class correctly with the annotations above
- * @see assertSaneFieldCaches
- * <p/>
+ * @see #assertSaneFieldCaches(String)
*/
@@ -75,7 +75,7 @@
// every test. But the functionality we used to
// get from that override is provided by InterceptTestCaseEvents
//@RunWith(RunBareWrapper.class)
-public class LuceneTestCaseJ4 extends TestWatchman {
+public class LuceneTestCaseJ4 {
/** Change this when development starts for new Lucene version: */
public static final Version TEST_VERSION_CURRENT = Version.LUCENE_31;
@@ -99,14 +99,21 @@
// Think of this as start/end/success/failed
// events.
@Rule
- public InterceptTestCaseEvents intercept = new InterceptTestCaseEvents(this);
+ public final TestWatchman intercept = new TestWatchman() {
- public LuceneTestCaseJ4() {
- }
+ @Override
+ public void failed(Throwable e, FrameworkMethod method) {
+ reportAdditionalFailureInfo();
+ super.failed(e, method);
+ }
- public LuceneTestCaseJ4(String name) {
- this.name = name;
- }
+ @Override
+ public void starting(FrameworkMethod method) {
+ LuceneTestCaseJ4.this.name = method.getName();
+ super.starting(method);
+ }
+
+ };
@Before
public void setUp() throws Exception {
@@ -225,7 +232,7 @@
* @param iter Each next() is toString()ed and logged on it's own line. If iter is null this is logged differnetly then an empty iterator.
* @param stream Stream to log messages to.
*/
- public static void dumpIterator(String label, Iterator iter,
+ public static void dumpIterator(String label, Iterator<?> iter,
PrintStream stream) {
stream.println("*** BEGIN " + label + " ***");
if (null == iter) {
@@ -241,11 +248,11 @@
/**
* Convinience method for logging an array. Wraps the array in an iterator and delegates
*
- * @see dumpIterator(String,Iterator,PrintStream)
+ * @see #dumpIterator(String,Iterator,PrintStream)
*/
public static void dumpArray(String label, Object[] objs,
PrintStream stream) {
- Iterator iter = (null == objs) ? null : Arrays.asList(objs).iterator();
+ Iterator<?> iter = (null == objs) ? null : Arrays.asList(objs).iterator();
dumpIterator(label, iter, stream);
}
@@ -279,7 +286,7 @@
return this.name;
}
- // We get here fro InterceptTestCaseEvents on the 'failed' event....
+ // We get here from InterceptTestCaseEvents on the 'failed' event....
public void reportAdditionalFailureInfo() {
if (seed != null) {
System.out.println("NOTE: random seed of testcase '" + getName() + "' was: " + seed);
@@ -292,6 +299,6 @@
// static members
private static final Random seedRnd = new Random();
- private String name = "";
+ private String name = "<unknown>";
}
Propchange: lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/TestAttributeSource.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Feb 27 22:51:44 2010
@@ -1 +1,2 @@
/lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/util/TestAttributeSource.java:909334
+/lucene/java/trunk/src/test/org/apache/lucene/util/TestAttributeSource.java:916596,916685,916769,917019
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/TestBitVector.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/TestBitVector.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/TestBitVector.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/TestBitVector.java Sat Feb 27 22:51:44 2010
@@ -159,7 +159,6 @@
/**
* Test r/w when size/count cause switching between bit-set and d-gaps file formats.
- * @throws Exception
*/
public void testDgaps() throws IOException {
doTestDgaps(1,0,1);
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/TestFieldCacheSanityChecker.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/TestFieldCacheSanityChecker.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/TestFieldCacheSanityChecker.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/TestFieldCacheSanityChecker.java Sat Feb 27 22:51:44 2010
@@ -78,29 +78,23 @@
}
@Override
- public void tearDown() throws Exception {
- super.tearDown();
+ protected void tearDown() throws Exception {
readerA.close();
readerB.close();
readerX.close();
+ super.tearDown();
}
public void testSanity() throws IOException {
FieldCache cache = FieldCache.DEFAULT;
cache.purgeAllCaches();
- double [] doubles;
- int [] ints;
+ cache.getDoubles(readerA, "theDouble");
+ cache.getDoubles(readerA, "theDouble", FieldCache.DEFAULT_DOUBLE_PARSER);
+ cache.getDoubles(readerB, "theDouble", FieldCache.DEFAULT_DOUBLE_PARSER);
- doubles = cache.getDoubles(readerA, "theDouble");
- doubles = cache.getDoubles(readerA, "theDouble",
- FieldCache.DEFAULT_DOUBLE_PARSER);
- doubles = cache.getDoubles(readerB, "theDouble",
- FieldCache.DEFAULT_DOUBLE_PARSER);
-
- ints = cache.getInts(readerX, "theInt");
- ints = cache.getInts(readerX, "theInt",
- FieldCache.DEFAULT_INT_PARSER);
+ cache.getInts(readerX, "theInt");
+ cache.getInts(readerX, "theInt", FieldCache.DEFAULT_INT_PARSER);
// // //
@@ -118,15 +112,9 @@
FieldCache cache = FieldCache.DEFAULT;
cache.purgeAllCaches();
- int [] ints;
- String [] strings;
- byte [] bytes;
-
- ints = cache.getInts(readerX, "theInt", FieldCache.DEFAULT_INT_PARSER);
- strings = cache.getStrings(readerX, "theInt");
-
- // this one is ok
- bytes = cache.getBytes(readerX, "theByte");
+ cache.getInts(readerX, "theInt", FieldCache.DEFAULT_INT_PARSER);
+ cache.getStrings(readerX, "theInt");
+ cache.getBytes(readerX, "theByte");
// // //
@@ -148,15 +136,11 @@
FieldCache cache = FieldCache.DEFAULT;
cache.purgeAllCaches();
- String [] strings;
- byte [] bytes;
-
- strings = cache.getStrings(readerA, "theString");
- strings = cache.getStrings(readerB, "theString");
- strings = cache.getStrings(readerX, "theString");
+ cache.getStrings(readerA, "theString");
+ cache.getStrings(readerB, "theString");
+ cache.getStrings(readerX, "theString");
- // this one is ok
- bytes = cache.getBytes(readerX, "theByte");
+ cache.getBytes(readerX, "theByte");
// // //
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/TestIndexableBinaryStringTools.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/TestIndexableBinaryStringTools.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/TestIndexableBinaryStringTools.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/TestIndexableBinaryStringTools.java Sat Feb 27 22:51:44 2010
@@ -338,7 +338,7 @@
public String binaryDump(byte[] binary, int numBytes) {
StringBuilder buf = new StringBuilder();
for (int byteNum = 0 ; byteNum < numBytes ; ++byteNum) {
- String hex = Integer.toHexString((int)binary[byteNum] & 0xFF);
+ String hex = Integer.toHexString(binary[byteNum] & 0xFF);
if (hex.length() == 1) {
buf.append('0');
}
@@ -359,7 +359,7 @@
public String charArrayDump(char[] charArray, int numBytes) {
StringBuilder buf = new StringBuilder();
for (int charNum = 0 ; charNum < numBytes ; ++charNum) {
- String hex = Integer.toHexString((int)charArray[charNum]);
+ String hex = Integer.toHexString(charArray[charNum]);
for (int digit = 0 ; digit < 4 - hex.length() ; ++digit) {
buf.append('0');
}
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/TestRamUsageEstimator.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/TestRamUsageEstimator.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/TestRamUsageEstimator.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/TestRamUsageEstimator.java Sat Feb 27 22:51:44 2010
@@ -22,23 +22,17 @@
public class TestRamUsageEstimator extends TestCase {
public void testBasic() {
- String string = new String("test str");
RamUsageEstimator rue = new RamUsageEstimator();
- long size = rue.estimateRamUsage(string);
- //System.out.println("size:" + size);
+ rue.estimateRamUsage("test str");
- string = new String("test strin");
- size = rue.estimateRamUsage(string);
- //System.out.println("size:" + size);
+ rue.estimateRamUsage("test strin");
Holder holder = new Holder();
holder.holder = new Holder("string2", 5000L);
- size = rue.estimateRamUsage(holder);
- //System.out.println("size:" + size);
+ rue.estimateRamUsage(holder);
String[] strings = new String[]{new String("test strin"), new String("hollow"), new String("catchmaster")};
- size = rue.estimateRamUsage(strings);
- //System.out.println("size:" + size);
+ rue.estimateRamUsage(strings);
}
private static final class Holder {
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/TestStringIntern.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/TestStringIntern.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/TestStringIntern.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/TestStringIntern.java Sat Feb 27 22:51:44 2010
@@ -16,9 +16,6 @@
*/
package org.apache.lucene.util;
-
-import junit.framework.TestCase;
-
import java.util.Random;
public class TestStringIntern extends LuceneTestCase {
@@ -48,7 +45,6 @@
int nThreads = 20;
// final int iter=100000;
final int iter=1000000;
- final boolean newStrings=true;
// try native intern
// StringHelper.interner = new StringInterner();
@@ -64,20 +60,20 @@
for (int j=0; j<iter; j++) {
int idx = rand.nextInt(testStrings.length);
String s = testStrings[idx];
- if (newStrings == true && rand.nextBoolean()) s = new String(s); // make a copy half of the time
+ if (rand.nextBoolean()) s = new String(s); // make a copy half of the time
String interned = StringHelper.intern(s);
String prevInterned = myInterned[idx];
String otherInterned = internedStrings[idx];
// test against other threads
if (otherInterned != null && otherInterned != interned) {
- TestCase.fail();
+ fail();
}
internedStrings[idx] = interned;
// test against local copy
if (prevInterned != null && prevInterned != interned) {
- TestCase.fail();
+ fail();
}
myInterned[idx] = interned;
}
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/TestVirtualMethod.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/TestVirtualMethod.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/TestVirtualMethod.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/TestVirtualMethod.java Sat Feb 27 22:51:44 2010
@@ -50,7 +50,7 @@
static class TestClass5 extends TestClass4 {
}
- public void test() {
+ public void testGeneral() {
assertEquals(0, publicTestMethod.getImplementationDistance(this.getClass()));
assertEquals(1, publicTestMethod.getImplementationDistance(TestClass1.class));
assertEquals(1, publicTestMethod.getImplementationDistance(TestClass2.class));
@@ -67,10 +67,13 @@
assertTrue(VirtualMethod.compareImplementationDistance(TestClass3.class, publicTestMethod, protectedTestMethod) > 0);
assertEquals(0, VirtualMethod.compareImplementationDistance(TestClass5.class, publicTestMethod, protectedTestMethod));
-
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testExceptions() {
try {
// cast to Class to remove generics:
- @SuppressWarnings("unchecked") int dist = publicTestMethod.getImplementationDistance((Class) LuceneTestCase.class);
+ publicTestMethod.getImplementationDistance((Class) LuceneTestCase.class);
fail("LuceneTestCase is not a subclass and can never override publicTest(String)");
} catch (IllegalArgumentException arg) {
// pass
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/cache/TestDoubleBarrelLRUCache.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/cache/TestDoubleBarrelLRUCache.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/cache/TestDoubleBarrelLRUCache.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/cache/TestDoubleBarrelLRUCache.java Sat Feb 27 22:51:44 2010
@@ -89,7 +89,7 @@
}
final CacheThread[] threads = new CacheThread[NUM_THREADS];
- final long endTime = System.currentTimeMillis()+((long) 1000);
+ final long endTime = System.currentTimeMillis()+1000L;
for(int i=0;i<NUM_THREADS;i++) {
threads[i] = new CacheThread(c, objs, endTime);
threads[i].start();