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/21 09:47:33 UTC
svn commit: r912319 - in /lucene/java/trunk/src/test/org/apache/lucene:
search/TestNumericRangeQuery32.java search/TestNumericRangeQuery64.java
util/LuceneTestCase.java
Author: uschindler
Date: Sun Feb 21 08:47:33 2010
New Revision: 912319
URL: http://svn.apache.org/viewvc?rev=912319&view=rev
Log:
Save/Restore BQ.maxCluseCount in LuceneTestCase
Modified:
lucene/java/trunk/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java
lucene/java/trunk/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java
lucene/java/trunk/src/test/org/apache/lucene/util/LuceneTestCase.java
Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java?rev=912319&r1=912318&r2=912319&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java Sun Feb 21 08:47:33 2010
@@ -42,9 +42,6 @@
private static final IndexSearcher searcher;
static {
try {
- // set the theoretical maximum term count for 8bit (see docs for the number)
- BooleanQuery.setMaxClauseCount(3*255*2 + 255);
-
directory = new RAMDirectory();
IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(TEST_VERSION_CURRENT),
true, MaxFieldLength.UNLIMITED);
@@ -87,6 +84,14 @@
}
}
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ // set the theoretical maximum term count for 8bit (see docs for the number)
+ // super.tearDown will restore the default
+ BooleanQuery.setMaxClauseCount(3*255*2 + 255);
+ }
+
/** test for both constant score and boolean query, the other tests only use the constant score mode */
private void testRange(int precisionStep) throws Exception {
String field="field"+precisionStep;
Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java?rev=912319&r1=912318&r2=912319&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java Sun Feb 21 08:47:33 2010
@@ -41,9 +41,6 @@
private static final IndexSearcher searcher;
static {
try {
- // set the theoretical maximum term count for 8bit (see docs for the number)
- BooleanQuery.setMaxClauseCount(7*255*2 + 255);
-
directory = new RAMDirectory();
IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(TEST_VERSION_CURRENT),
true, MaxFieldLength.UNLIMITED);
@@ -90,6 +87,14 @@
}
}
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ // set the theoretical maximum term count for 8bit (see docs for the number)
+ // super.tearDown will restore the default
+ BooleanQuery.setMaxClauseCount(7*255*2 + 255);
+ }
+
/** test for constant score + boolean query + filter, the other tests only use the constant score mode */
private void testRange(int precisionStep) throws Exception {
String field="field"+precisionStep;
Modified: lucene/java/trunk/src/test/org/apache/lucene/util/LuceneTestCase.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/util/LuceneTestCase.java?rev=912319&r1=912318&r2=912319&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/util/LuceneTestCase.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/util/LuceneTestCase.java Sun Feb 21 08:47:33 2010
@@ -25,6 +25,7 @@
import junit.framework.TestCase;
import org.apache.lucene.index.ConcurrentMergeScheduler;
+import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.FieldCache;
import org.apache.lucene.search.FieldCache.CacheEntry;
import org.apache.lucene.util.FieldCacheSanityChecker.Insanity;
@@ -54,6 +55,7 @@
public abstract class LuceneTestCase extends TestCase {
public static final Version TEST_VERSION_CURRENT = LuceneTestCaseJ4.TEST_VERSION_CURRENT;
+ private int savedBoolMaxClauseCount;
public LuceneTestCase() {
super();
@@ -67,6 +69,7 @@
protected void setUp() throws Exception {
super.setUp();
ConcurrentMergeScheduler.setTestMode();
+ savedBoolMaxClauseCount = BooleanQuery.getMaxClauseCount();
}
/**
@@ -89,6 +92,7 @@
@Override
protected void tearDown() throws Exception {
+ BooleanQuery.setMaxClauseCount(savedBoolMaxClauseCount);
try {
// this isn't as useful as calling directly from the scope where the
// index readers are used, because they could be gc'ed just before