improve TestXIncludeConfig to also check entity includes

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1505747 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris M. Hostetter 2013-07-22 17:55:08 +00:00
parent 9bf5a47394
commit a17ba3674e
3 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,19 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- example of a snippet of xml for use with xml entity includes -->
<fieldType name="ft-entity-include1" class="solr.StrField" />
<fieldType name="ft-entity-include2" class="solr.StrField" />

View File

@ -1,4 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE schema [
<!ENTITY schema_entity_include SYSTEM "schema-snippet-types.incl">
]>
<!-- <!--
Licensed to the Apache Software Foundation (ASF) under one or more Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with contributor license agreements. See the NOTICE file distributed with
@ -19,6 +22,7 @@
<types> <types>
<fieldType name="string" class="solr.StrField"/> <fieldType name="string" class="solr.StrField"/>
<xi:include href="schema-snippet-type.xml" /> <xi:include href="schema-snippet-type.xml" />
&schema_entity_include;
</types> </types>
<fields> <fields>
<xi:include href="schema-snippet-field.xml" /> <xi:include href="schema-snippet-field.xml" />

View File

@ -26,6 +26,9 @@ import org.apache.solr.util.AbstractSolrTestCase;
import org.junit.Assume; import org.junit.Assume;
import org.junit.BeforeClass; import org.junit.BeforeClass;
/**
* Test both XInclude as well as more old school "entity includes"
*/
public class TestXIncludeConfig extends AbstractSolrTestCase { public class TestXIncludeConfig extends AbstractSolrTestCase {
@BeforeClass @BeforeClass
@ -62,7 +65,20 @@ public class TestXIncludeConfig extends AbstractSolrTestCase {
chain.getFactories()[0].getClass()); chain.getFactories()[0].getClass());
IndexSchema schema = core.getLatestSchema(); IndexSchema schema = core.getLatestSchema();
// xinclude
assertNotNull("ft-included is null", schema.getFieldTypeByName("ft-included")); assertNotNull("ft-included is null", schema.getFieldTypeByName("ft-included"));
assertNotNull("field-included is null", schema.getFieldOrNull("field-included")); assertNotNull("field-included is null", schema.getFieldOrNull("field-included"));
// entity include
assertNotNull("ft-entity-include1 is null",
schema.getFieldTypeByName("ft-entity-include1"));
assertNotNull("ft-entity-include2 is null",
schema.getFieldTypeByName("ft-entity-include2"));
// sanity check
assertNull("ft-entity-include3 is not null", // Does Not Exist Anywhere
schema.getFieldTypeByName("ft-entity-include3"));
} }
} }