You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2013/09/03 18:51:00 UTC
svn commit: r1519756 - in /lucene/dev/trunk/lucene:
core/src/test/org/apache/lucene/index/
facet/src/test/org/apache/lucene/facet/range/
test-framework/src/java/org/apache/lucene/index/
test-framework/src/java/org/apache/lucene/util/
Author: rmuir
Date: Tue Sep 3 16:51:00 2013
New Revision: 1519756
URL: http://svn.apache.org/r1519756
Log:
LUCENE-5199: don't use old codec components mixed in with new ones when using -Ds
Modified:
lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestMultiDocValues.java
lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/range/TestRangeAccumulator.java
lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java
lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java
Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestMultiDocValues.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestMultiDocValues.java?rev=1519756&r1=1519755&r2=1519756&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestMultiDocValues.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestMultiDocValues.java Tue Sep 3 16:51:00 2013
@@ -327,7 +327,7 @@ public class TestMultiDocValues extends
}
public void testDocsWithField() throws Exception {
- assumeTrue("codec does not support docsWithField", defaultCodecSupportsDocsWithField("numbers"));
+ assumeTrue("codec does not support docsWithField", defaultCodecSupportsDocsWithField());
Directory dir = newDirectory();
IndexWriterConfig iwc = newIndexWriterConfig(random(), TEST_VERSION_CURRENT, null);
Modified: lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/range/TestRangeAccumulator.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/range/TestRangeAccumulator.java?rev=1519756&r1=1519755&r2=1519756&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/range/TestRangeAccumulator.java (original)
+++ lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/range/TestRangeAccumulator.java Tue Sep 3 16:51:00 2013
@@ -635,7 +635,7 @@ public class TestRangeAccumulator extend
// LUCENE-5178
public void testMissingValues() throws Exception {
- assumeTrue("codec does not support docsWithField", defaultCodecSupportsDocsWithField("field"));
+ assumeTrue("codec does not support docsWithField", defaultCodecSupportsDocsWithField());
Directory d = newDirectory();
RandomIndexWriter w = new RandomIndexWriter(random(), d);
Document doc = new Document();
Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java?rev=1519756&r1=1519755&r2=1519756&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java Tue Sep 3 16:51:00 2013
@@ -674,7 +674,7 @@ public abstract class BaseDocValuesForma
iwriter.close();
SortedDocValues dv = getOnlySegmentReader(ireader).getSortedDocValues("field");
- if (defaultCodecSupportsDocsWithField("field")) {
+ if (defaultCodecSupportsDocsWithField()) {
assertEquals(-1, dv.getOrd(0));
assertEquals(0, dv.getValueCount());
} else {
@@ -734,7 +734,7 @@ public abstract class BaseDocValuesForma
BytesRef scratch = new BytesRef();
dv.lookupOrd(dv.getOrd(0), scratch);
assertEquals(new BytesRef("hello world 2"), scratch);
- if (defaultCodecSupportsDocsWithField("dv")) {
+ if (defaultCodecSupportsDocsWithField()) {
assertEquals(-1, dv.getOrd(1));
}
dv.get(1, scratch);
@@ -1092,8 +1092,7 @@ public abstract class BaseDocValuesForma
public void testRandomSortedBytes() throws IOException {
Directory dir = newDirectory();
IndexWriterConfig cfg = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random()));
- final boolean defaultCodecSupportsDocsWithField = defaultCodecSupportsDocsWithField("field");
- if (!defaultCodecSupportsDocsWithField) {
+ if (!defaultCodecSupportsDocsWithField()) {
// if the codec doesnt support missing, we expect missing to be mapped to byte[]
// by the impersonator, but we have to give it a chance to merge them to this
cfg.setMergePolicy(newLogMergePolicy());
@@ -1122,14 +1121,14 @@ public abstract class BaseDocValuesForma
doc.add(newTextField("id", "noValue", Field.Store.YES));
w.addDocument(doc);
}
- if (!defaultCodecSupportsDocsWithField) {
+ if (!defaultCodecSupportsDocsWithField()) {
BytesRef bytesRef = new BytesRef();
hash.add(bytesRef); // add empty value for the gaps
}
if (rarely()) {
w.commit();
}
- if (!defaultCodecSupportsDocsWithField) {
+ if (!defaultCodecSupportsDocsWithField()) {
// if the codec doesnt support missing, we expect missing to be mapped to byte[]
// by the impersonator, but we have to give it a chance to merge them to this
w.forceMerge(1);
@@ -1254,7 +1253,7 @@ public abstract class BaseDocValuesForma
}
private void doTestMissingVsFieldCache(LongProducer longs) throws Exception {
- assumeTrue("Codec does not support getDocsWithField", defaultCodecSupportsDocsWithField("indexed", "dv"));
+ assumeTrue("Codec does not support getDocsWithField", defaultCodecSupportsDocsWithField());
Directory dir = newDirectory();
IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random()));
RandomIndexWriter writer = new RandomIndexWriter(random(), dir, conf);
@@ -2357,7 +2356,7 @@ public abstract class BaseDocValuesForma
}
public void testTwoNumbersOneMissing() throws IOException {
- assumeTrue("Codec does not support getDocsWithField", defaultCodecSupportsDocsWithField("dv1"));
+ assumeTrue("Codec does not support getDocsWithField", defaultCodecSupportsDocsWithField());
Directory directory = newDirectory();
IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, null);
conf.setMergePolicy(newLogMergePolicy());
@@ -2386,7 +2385,7 @@ public abstract class BaseDocValuesForma
}
public void testTwoNumbersOneMissingWithMerging() throws IOException {
- assumeTrue("Codec does not support getDocsWithField", defaultCodecSupportsDocsWithField("dv1"));
+ assumeTrue("Codec does not support getDocsWithField", defaultCodecSupportsDocsWithField());
Directory directory = newDirectory();
IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, null);
conf.setMergePolicy(newLogMergePolicy());
@@ -2416,7 +2415,7 @@ public abstract class BaseDocValuesForma
}
public void testThreeNumbersOneMissingWithMerging() throws IOException {
- assumeTrue("Codec does not support getDocsWithField", defaultCodecSupportsDocsWithField("dv1"));
+ assumeTrue("Codec does not support getDocsWithField", defaultCodecSupportsDocsWithField());
Directory directory = newDirectory();
IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, null);
conf.setMergePolicy(newLogMergePolicy());
@@ -2452,7 +2451,7 @@ public abstract class BaseDocValuesForma
}
public void testTwoBytesOneMissing() throws IOException {
- assumeTrue("Codec does not support getDocsWithField", defaultCodecSupportsDocsWithField("dv1"));
+ assumeTrue("Codec does not support getDocsWithField", defaultCodecSupportsDocsWithField());
Directory directory = newDirectory();
IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, null);
conf.setMergePolicy(newLogMergePolicy());
@@ -2484,7 +2483,7 @@ public abstract class BaseDocValuesForma
}
public void testTwoBytesOneMissingWithMerging() throws IOException {
- assumeTrue("Codec does not support getDocsWithField", defaultCodecSupportsDocsWithField("dv1"));
+ assumeTrue("Codec does not support getDocsWithField", defaultCodecSupportsDocsWithField());
Directory directory = newDirectory();
IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, null);
conf.setMergePolicy(newLogMergePolicy());
@@ -2517,7 +2516,7 @@ public abstract class BaseDocValuesForma
}
public void testThreeBytesOneMissingWithMerging() throws IOException {
- assumeTrue("Codec does not support getDocsWithField", defaultCodecSupportsDocsWithField("dv1"));
+ assumeTrue("Codec does not support getDocsWithField", defaultCodecSupportsDocsWithField());
Directory directory = newDirectory();
IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, null);
conf.setMergePolicy(newLogMergePolicy());
@@ -2814,7 +2813,7 @@ public abstract class BaseDocValuesForma
/** Tests dv against stored fields with threads (all types + missing) */
public void testThreads2() throws Exception {
- assumeTrue("Codec does not support getDocsWithField", defaultCodecSupportsDocsWithField("dvBin", "dvSorted", "dvNum", "dvSortedSet"));
+ assumeTrue("Codec does not support getDocsWithField", defaultCodecSupportsDocsWithField());
assumeTrue("Codec does not support SORTED_SET", defaultCodecSupportsSortedSet());
Directory dir = newDirectory();
IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random()));
Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java?rev=1519756&r1=1519755&r2=1519756&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java Tue Sep 3 16:51:00 2013
@@ -29,7 +29,6 @@ import java.util.logging.Logger;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.codecs.Codec;
-import org.apache.lucene.codecs.DocValuesFormat;
import org.apache.lucene.document.Field.Store;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
@@ -1376,19 +1375,11 @@ public abstract class LuceneTestCase ext
/** Returns true if the codec "supports" docsWithField
* (other codecs return MatchAllBits, because you couldnt write missing values before) */
- public static boolean defaultCodecSupportsDocsWithField(String... fields) {
+ public static boolean defaultCodecSupportsDocsWithField() {
String name = Codec.getDefault().getName();
if (name.equals("Lucene40") || name.equals("Lucene41") || name.equals("Lucene42")) {
return false;
}
-
- // check that the actual DocValuesFormat for each field supports docsWithField
- for (String field : fields) {
- String format = _TestUtil.getDocValuesFormat(field);
- if (format.equals("Lucene40") || format.equals("Lucene41") || format.equals("Lucene42")) {
- return false;
- }
- }
return true;
}
Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java?rev=1519756&r1=1519755&r2=1519756&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java Tue Sep 3 16:51:00 2013
@@ -20,6 +20,7 @@ package org.apache.lucene.util;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
@@ -183,10 +184,7 @@ final class TestRuleSetupAndRestoreClass
final DocValuesFormat dvFormat;
if ("random".equals(TEST_DOCVALUESFORMAT)) {
- // pick one from SPI
- List<String> formats = new ArrayList<String>(DocValuesFormat.availableDocValuesFormats());
- formats.remove("Facet42");
- dvFormat = DocValuesFormat.forName(formats.get(random.nextInt(formats.size())));
+ dvFormat = DocValuesFormat.forName("Lucene45");
} else {
dvFormat = DocValuesFormat.forName(TEST_DOCVALUESFORMAT);
}