Apache Lucene open-source search software
improve TestXIncludeConfig to also check entity includes
Chris M. Hostettera17ba3674e0a
diff --git a/solr/core/src/test-files/solr/collection1/conf/schema-snippet-types.incl b/solr/core/src/test-files/solr/collection1/conf/schema-snippet-types.inclnew file mode 100644index 00000000000..fe9fd6d7a7b--- /dev/null+++ b/solr/core/src/test-files/solr/collection1/conf/schema-snippet-types.incl@@ -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" />diff --git a/solr/core/src/test-files/solr/collection1/conf/schema-xinclude.xml b/solr/core/src/test-files/solr/collection1/conf/schema-xinclude.xmlindex 17a7b9fb4ec..94194df6192 100644--- a/solr/core/src/test-files/solr/collection1/conf/schema-xinclude.xml+++ b/solr/core/src/test-files/solr/collection1/conf/schema-xinclude.xml@@ -1,4 +1,7 @@<?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 morecontributor license agreements. See the NOTICE file distributed with@@ -19,6 +22,7 @@<types><fieldType name="string" class="solr.StrField"/><xi:include href="schema-snippet-type.xml" />+ &schema_entity_include;</types><fields><xi:include href="schema-snippet-field.xml" />diff --git a/solr/core/src/test/org/apache/solr/core/TestXIncludeConfig.java b/solr/core/src/test/org/apache/solr/core/TestXIncludeConfig.javaindex 23a4fc2ddbc..e78be2f6c67 100644--- a/solr/core/src/test/org/apache/solr/core/TestXIncludeConfig.java+++ b/solr/core/src/test/org/apache/solr/core/TestXIncludeConfig.java@@ -26,6 +26,9 @@ import org.apache.solr.util.AbstractSolrTestCase;import org.junit.Assume;import org.junit.BeforeClass;+/**+ * Test both XInclude as well as more old school "entity includes"+ */public class TestXIncludeConfig extends AbstractSolrTestCase {@BeforeClass@@ -62,7 +65,20 @@ public class TestXIncludeConfig extends AbstractSolrTestCase {chain.getFactories()[0].getClass());IndexSchema schema = core.getLatestSchema();++ // xincludeassertNotNull("ft-included is null", schema.getFieldTypeByName("ft-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"));+}}