LUCENE-5969: fix tests

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene5969@1632706 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2014-10-18 00:19:30 +00:00
parent 922d1edbff
commit c9e2d7bead
2 changed files with 10 additions and 9 deletions

View File

@ -21,7 +21,7 @@
<fieldType name="string_simpletext" class="solr.StrField" postingsFormat="SimpleText"/> <fieldType name="string_simpletext" class="solr.StrField" postingsFormat="SimpleText"/>
<fieldType name="string_standard" class="solr.StrField" postingsFormat="Lucene41"/> <fieldType name="string_standard" class="solr.StrField" postingsFormat="Lucene41"/>
<fieldType name="string_disk" class="solr.StrField" docValuesFormat="Lucene410" /> <fieldType name="string_disk" class="solr.StrField" docValuesFormat="Lucene50" />
<fieldType name="string_memory" class="solr.StrField" docValuesFormat="Memory" /> <fieldType name="string_memory" class="solr.StrField" docValuesFormat="Memory" />
<fieldType name="string" class="solr.StrField" /> <fieldType name="string" class="solr.StrField" />

View File

@ -22,6 +22,7 @@ import java.util.Map;
import org.apache.lucene.codecs.Codec; import org.apache.lucene.codecs.Codec;
import org.apache.lucene.codecs.perfield.PerFieldDocValuesFormat; import org.apache.lucene.codecs.perfield.PerFieldDocValuesFormat;
import org.apache.lucene.codecs.perfield.PerFieldPostingsFormat; import org.apache.lucene.codecs.perfield.PerFieldPostingsFormat;
import org.apache.lucene.util.TestUtil;
import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.schema.SchemaField; import org.apache.solr.schema.SchemaField;
import org.junit.BeforeClass; import org.junit.BeforeClass;
@ -43,9 +44,9 @@ public class TestCodecSupport extends SolrTestCaseJ4 {
assertEquals("SimpleText", assertEquals("SimpleText",
format.getPostingsFormatForField(schemaField.getName()).getName()); format.getPostingsFormatForField(schemaField.getName()).getName());
schemaField = fields.get("string_standard_f"); schemaField = fields.get("string_standard_f");
assertEquals("Lucene41", format.getPostingsFormatForField(schemaField.getName()).getName()); assertEquals(TestUtil.getDefaultPostingsFormat().getName(), format.getPostingsFormatForField(schemaField.getName()).getName());
schemaField = fields.get("string_f"); schemaField = fields.get("string_f");
assertEquals("Lucene41", format.getPostingsFormatForField(schemaField.getName()).getName()); assertEquals(TestUtil.getDefaultPostingsFormat().getName(), format.getPostingsFormatForField(schemaField.getName()).getName());
} }
public void testDocValuesFormats() { public void testDocValuesFormats() {
@ -53,12 +54,12 @@ public class TestCodecSupport extends SolrTestCaseJ4 {
Map<String, SchemaField> fields = h.getCore().getLatestSchema().getFields(); Map<String, SchemaField> fields = h.getCore().getLatestSchema().getFields();
SchemaField schemaField = fields.get("string_disk_f"); SchemaField schemaField = fields.get("string_disk_f");
PerFieldDocValuesFormat format = (PerFieldDocValuesFormat) codec.docValuesFormat(); PerFieldDocValuesFormat format = (PerFieldDocValuesFormat) codec.docValuesFormat();
assertEquals("Lucene410", format.getDocValuesFormatForField(schemaField.getName()).getName()); assertEquals(TestUtil.getDefaultDocValuesFormat().getName(), format.getDocValuesFormatForField(schemaField.getName()).getName());
schemaField = fields.get("string_memory_f"); schemaField = fields.get("string_memory_f");
assertEquals("Memory", assertEquals("Memory",
format.getDocValuesFormatForField(schemaField.getName()).getName()); format.getDocValuesFormatForField(schemaField.getName()).getName());
schemaField = fields.get("string_f"); schemaField = fields.get("string_f");
assertEquals("Lucene410", assertEquals(TestUtil.getDefaultDocValuesFormat().getName(),
format.getDocValuesFormatForField(schemaField.getName()).getName()); format.getDocValuesFormatForField(schemaField.getName()).getName());
} }
@ -70,16 +71,16 @@ public class TestCodecSupport extends SolrTestCaseJ4 {
assertEquals("SimpleText", format.getPostingsFormatForField("bar_simple").getName()); assertEquals("SimpleText", format.getPostingsFormatForField("bar_simple").getName());
assertEquals("Direct", format.getPostingsFormatForField("foo_direct").getName()); assertEquals("Direct", format.getPostingsFormatForField("foo_direct").getName());
assertEquals("Direct", format.getPostingsFormatForField("bar_direct").getName()); assertEquals("Direct", format.getPostingsFormatForField("bar_direct").getName());
assertEquals("Lucene41", format.getPostingsFormatForField("foo_standard").getName()); assertEquals(TestUtil.getDefaultPostingsFormat().getName(), format.getPostingsFormatForField("foo_standard").getName());
assertEquals("Lucene41", format.getPostingsFormatForField("bar_standard").getName()); assertEquals(TestUtil.getDefaultPostingsFormat().getName(), format.getPostingsFormatForField("bar_standard").getName());
} }
public void testDynamicFieldsDocValuesFormats() { public void testDynamicFieldsDocValuesFormats() {
Codec codec = h.getCore().getCodec(); Codec codec = h.getCore().getCodec();
PerFieldDocValuesFormat format = (PerFieldDocValuesFormat) codec.docValuesFormat(); PerFieldDocValuesFormat format = (PerFieldDocValuesFormat) codec.docValuesFormat();
assertEquals("Lucene410", format.getDocValuesFormatForField("foo_disk").getName()); assertEquals(TestUtil.getDefaultDocValuesFormat().getName(), format.getDocValuesFormatForField("foo_disk").getName());
assertEquals("Lucene410", format.getDocValuesFormatForField("bar_disk").getName()); assertEquals(TestUtil.getDefaultDocValuesFormat().getName(), format.getDocValuesFormatForField("bar_disk").getName());
assertEquals("Memory", format.getDocValuesFormatForField("foo_memory").getName()); assertEquals("Memory", format.getDocValuesFormatForField("foo_memory").getName());
assertEquals("Memory", format.getDocValuesFormatForField("bar_memory").getName()); assertEquals("Memory", format.getDocValuesFormatForField("bar_memory").getName());
} }