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/01/22 01:37:55 UTC
svn commit: r1436703 - in /lucene/dev/branches/lucene4547/lucene: ./
core/src/java/org/apache/lucene/codecs/lucene42/
test-framework/src/java/org/apache/lucene/util/
Author: rmuir
Date: Tue Jan 22 00:37:55 2013
New Revision: 1436703
URL: http://svn.apache.org/viewvc?rev=1436703&view=rev
Log:
add tests.docvaluesformat
Modified:
lucene/dev/branches/lucene4547/lucene/common-build.xml
lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/codecs/lucene42/Lucene42Codec.java
lucene/dev/branches/lucene4547/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
lucene/dev/branches/lucene4547/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java
Modified: lucene/dev/branches/lucene4547/lucene/common-build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/common-build.xml?rev=1436703&r1=1436702&r2=1436703&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/common-build.xml (original)
+++ lucene/dev/branches/lucene4547/lucene/common-build.xml Tue Jan 22 00:37:55 2013
@@ -88,6 +88,7 @@
<property name="tests.multiplier" value="1" />
<property name="tests.codec" value="random" />
<property name="tests.postingsformat" value="random" />
+ <property name="tests.docvaluesformat" value="random" />
<property name="tests.locale" value="random" />
<property name="tests.timezone" value="random" />
<property name="tests.directory" value="random" />
@@ -864,6 +865,8 @@
<sysproperty key="tests.codec" value="${tests.codec}"/>
<!-- set the postingsformat tests should run with -->
<sysproperty key="tests.postingsformat" value="${tests.postingsformat}"/>
+ <!-- set the docvaluesformat tests should run with -->
+ <sysproperty key="tests.docvaluesformat" value="${tests.docvaluesformat}"/>
<!-- set the locale tests should run with -->
<sysproperty key="tests.locale" value="${tests.locale}"/>
<!-- set the timezone tests should run with -->
Modified: lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/codecs/lucene42/Lucene42Codec.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/codecs/lucene42/Lucene42Codec.java?rev=1436703&r1=1436702&r2=1436703&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/codecs/lucene42/Lucene42Codec.java (original)
+++ lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/codecs/lucene42/Lucene42Codec.java Tue Jan 22 00:37:55 2013
@@ -123,7 +123,7 @@ public class Lucene42Codec extends Codec
}
@Override
- public DocValuesFormat docValuesFormat() {
+ public final DocValuesFormat docValuesFormat() {
return docValuesFormat;
}
@@ -133,7 +133,7 @@ public class Lucene42Codec extends Codec
private final NormsFormat normsFormat = new Lucene42NormsFormat();
@Override
- public NormsFormat normsFormat() {
+ public final NormsFormat normsFormat() {
return normsFormat;
}
}
Modified: lucene/dev/branches/lucene4547/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java?rev=1436703&r1=1436702&r2=1436703&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java (original)
+++ lucene/dev/branches/lucene4547/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java Tue Jan 22 00:37:55 2013
@@ -253,6 +253,9 @@ public abstract class LuceneTestCase ext
/** Gets the postingsFormat to run tests with. */
public static final String TEST_POSTINGSFORMAT = System.getProperty("tests.postingsformat", "random");
+
+ /** Gets the docValuesFormat to run tests with */
+ public static final String TEST_DOCVALUESFORMAT = System.getProperty("tests.docvaluesformat", "random");
/** Gets the directory to run tests with */
public static final String TEST_DIRECTORY = System.getProperty("tests.directory", "random");
Modified: lucene/dev/branches/lucene4547/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java?rev=1436703&r1=1436702&r2=1436703&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java (original)
+++ lucene/dev/branches/lucene4547/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java Tue Jan 22 00:37:55 2013
@@ -28,6 +28,7 @@ import java.util.Set;
import java.util.TimeZone;
import org.apache.lucene.codecs.Codec;
+import org.apache.lucene.codecs.DocValuesFormat;
import org.apache.lucene.codecs.PostingsFormat;
import org.apache.lucene.codecs.asserting.AssertingCodec;
import org.apache.lucene.codecs.compressing.CompressingCodec;
@@ -137,23 +138,37 @@ final class TestRuleSetupAndRestoreClass
int randomVal = random.nextInt(10);
if ("Lucene40".equals(TEST_CODEC) || ("random".equals(TEST_CODEC) &&
"random".equals(TEST_POSTINGSFORMAT) &&
+ "random".equals(TEST_DOCVALUESFORMAT) &&
randomVal == 0 &&
!shouldAvoidCodec("Lucene40"))) {
codec = Codec.forName("Lucene40");
assert (PostingsFormat.forName("Lucene40") instanceof Lucene40RWPostingsFormat) : "fix your classpath to have tests-framework.jar before lucene-core.jar";
} else if ("Lucene41".equals(TEST_CODEC) || ("random".equals(TEST_CODEC) &&
"random".equals(TEST_POSTINGSFORMAT) &&
+ "random".equals(TEST_DOCVALUESFORMAT) &&
randomVal == 1 &&
!shouldAvoidCodec("Lucene41"))) {
codec = Codec.forName("Lucene41");
assert codec instanceof Lucene41RWCodec : "fix your classpath to have tests-framework.jar before lucene-core.jar";
- } else if (!"random".equals(TEST_POSTINGSFORMAT)) {
+ } else if (("random".equals(TEST_POSTINGSFORMAT) == false) || ("random".equals(TEST_DOCVALUESFORMAT) == false)) {
+ // the user wired postings or DV
+
final PostingsFormat format;
- if ("MockRandom".equals(TEST_POSTINGSFORMAT)) {
+ if ("MockRandom".equals(TEST_POSTINGSFORMAT) || "random".equals(TEST_POSTINGSFORMAT)) {
format = new MockRandomPostingsFormat(random);
} else {
format = PostingsFormat.forName(TEST_POSTINGSFORMAT);
}
+
+ final DocValuesFormat dvFormat;
+ if ("random".equals(TEST_DOCVALUESFORMAT)) {
+ // pick one from SPI
+ String formats[] = DocValuesFormat.availableDocValuesFormats().toArray(new String[0]);
+ dvFormat = DocValuesFormat.forName(formats[random.nextInt(formats.length)]);
+ } else {
+ dvFormat = DocValuesFormat.forName(TEST_DOCVALUESFORMAT);
+ }
+
codec = new Lucene42Codec() {
@Override
public PostingsFormat getPostingsFormatForField(String field) {
@@ -161,8 +176,13 @@ final class TestRuleSetupAndRestoreClass
}
@Override
+ public DocValuesFormat getDocValuesFormatForField(String field) {
+ return dvFormat;
+ }
+
+ @Override
public String toString() {
- return super.toString() + ": " + format.toString();
+ return super.toString() + ": " + format.toString() + ", " + dvFormat.toString();
}
};
} else if ("SimpleText".equals(TEST_CODEC) || ("random".equals(TEST_CODEC) && randomVal == 9 && !shouldAvoidCodec("SimpleText"))) {