You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by no...@apache.org on 2020/09/20 02:19:20 UTC

[lucene-solr] 01/01: SOLR-14879: address TestPackages test failures

This is an automated email from the ASF dual-hosted git repository.

noble pushed a commit to branch jira/solr14879
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit a5e1e5f52369b629c9a3b64bbd53a2067dd889a6
Author: noblepaul <no...@gmail.com>
AuthorDate: Sun Sep 20 12:18:50 2020 +1000

    SOLR-14879: address TestPackages test failures
---
 .../solr/configsets/schema-package/conf/schema.xml | 50 ++++++++++++++++++++
 .../configsets/schema-package/conf/solrconfig.xml  | 51 ++++++++++++++++++++
 .../src/test/org/apache/solr/pkg/TestPackages.java | 54 +---------------------
 3 files changed, 103 insertions(+), 52 deletions(-)

diff --git a/solr/core/src/test-files/solr/configsets/schema-package/conf/schema.xml b/solr/core/src/test-files/solr/configsets/schema-package/conf/schema.xml
new file mode 100644
index 0000000..a984a55
--- /dev/null
+++ b/solr/core/src/test-files/solr/configsets/schema-package/conf/schema.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<schema name="minimal" version="1.1">
+  <uniqueKey>id</uniqueKey>
+  <fieldType name="composite_id_prefix" class="solr.TextField">
+    <analyzer>
+      <tokenizer class="solr.PatternTokenizerFactory" pattern=".*!" group="0"/>
+    </analyzer>
+  </fieldType>
+  <fieldType name="int" class="solr.IntPointField" omitNorms="true" positionIncrementGap="0" docValues="false" precisionStep="0"/>
+  <fieldType name="long" class="solr.LongPointField" omitNorms="true" positionIncrementGap="0" docValues="false" precisionStep="0"/>
+  <fieldType name="myNewTextFieldWithAnalyzerClass" class="schemapkg:my.pkg.MyTextField">
+    <analyzer>
+      <charFilter class="schemapkg:my.pkg.MyPatternReplaceCharFilterFactory" pattern="([a-zA-Z])\\1+" replacement="$1$1"/>
+      <tokenizer class="schemapkg:my.pkg.MyWhitespaceTokenizerFactory"/>
+      <filter class="solr.DelimitedPayloadTokenFilterFactory" encoder="schemapkg:com.o19s.payloads.Base64Encoder"/>
+    </analyzer>
+  </fieldType>
+  <fieldType name="sortabletext" class="solr.SortableTextField" positionIncrementGap="100" multiValued="true">
+    <analyzer type="index">
+      <tokenizer class="solr.StandardTokenizerFactory"/>
+      <filter class="solr.LowerCaseFilterFactory"/>
+    </analyzer>
+    <analyzer type="query">
+      <tokenizer class="solr.StandardTokenizerFactory"/>
+      <filter class="solr.LowerCaseFilterFactory"/>
+    </analyzer>
+  </fieldType>
+  <fieldType name="string" class="solr.StrField"/>
+  <field name="_root_" type="string" multiValued="false" indexed="true" required="false" stored="true"/>
+  <field name="_version_" type="long" indexed="true" stored="true"/>
+  <field name="id" type="string" indexed="true" stored="true"/>
+  <field name="id_prefix" type="composite_id_prefix" indexed="true" stored="false"/>
+  <copyField source="id" dest="id_prefix"/>
+</schema>
\ No newline at end of file
diff --git a/solr/core/src/test-files/solr/configsets/schema-package/conf/solrconfig.xml b/solr/core/src/test-files/solr/configsets/schema-package/conf/solrconfig.xml
new file mode 100644
index 0000000..853ba65
--- /dev/null
+++ b/solr/core/src/test-files/solr/configsets/schema-package/conf/solrconfig.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" ?>
+
+<!--
+ 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.
+-->
+
+<!-- Minimal solrconfig.xml with /select, /admin and /update only -->
+
+<config>
+
+  <dataDir>${solr.data.dir:}</dataDir>
+
+  <directoryFactory name="DirectoryFactory"
+                    class="${solr.directoryFactory:solr.NRTCachingDirectoryFactory}"/>
+  <schemaFactory class="ClassicIndexSchemaFactory"/>
+
+  <luceneMatchVersion>${tests.luceneMatchVersion:LATEST}</luceneMatchVersion>
+
+  <updateHandler class="solr.DirectUpdateHandler2">
+    <commitWithin>
+      <softCommit>${solr.commitwithin.softcommit:true}</softCommit>
+    </commitWithin>
+    <updateLog class="${solr.ulog:solr.UpdateLog}"></updateLog>
+  </updateHandler>
+
+  <requestHandler name="/select" class="solr.SearchHandler">
+    <lst name="defaults">
+      <str name="echoParams">explicit</str>
+      <str name="indent">true</str>
+      <str name="df">text</str>
+    </lst>
+
+  </requestHandler>
+  <indexConfig>
+    <mergeScheduler class="${solr.mscheduler:org.apache.lucene.index.ConcurrentMergeScheduler}"/>
+:  </indexConfig>
+</config>
+
diff --git a/solr/core/src/test/org/apache/solr/pkg/TestPackages.java b/solr/core/src/test/org/apache/solr/pkg/TestPackages.java
index 9473d41..f28233f 100644
--- a/solr/core/src/test/org/apache/solr/pkg/TestPackages.java
+++ b/solr/core/src/test/org/apache/solr/pkg/TestPackages.java
@@ -31,7 +31,6 @@ import org.apache.lucene.analysis.util.ResourceLoaderAware;
 import org.apache.solr.client.solrj.SolrClient;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.client.solrj.SolrRequest;
-import org.apache.solr.client.solrj.SolrResponse;
 import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.client.solrj.embedded.JettySolrRunner;
 import org.apache.solr.client.solrj.impl.BaseHttpSolrClient;
@@ -43,7 +42,6 @@ import org.apache.solr.client.solrj.request.UpdateRequest;
 import org.apache.solr.client.solrj.request.V2Request;
 import org.apache.solr.client.solrj.request.beans.Package;
 import org.apache.solr.client.solrj.response.QueryResponse;
-import org.apache.solr.client.solrj.response.SolrResponseBase;
 import org.apache.solr.client.solrj.util.ClientUtils;
 import org.apache.solr.cloud.MiniSolrCloudCluster;
 import org.apache.solr.cloud.SolrCloudTestCase;
@@ -51,7 +49,6 @@ import org.apache.solr.common.MapWriterMap;
 import org.apache.solr.common.NavigableObject;
 import org.apache.solr.common.SolrInputDocument;
 import org.apache.solr.common.annotation.JsonProperty;
-import org.apache.solr.common.params.CommonParams;
 import org.apache.solr.common.params.MapSolrParams;
 import org.apache.solr.common.params.ModifiableSolrParams;
 import org.apache.solr.common.params.SolrParams;
@@ -653,7 +650,7 @@ public class TestPackages extends SolrCloudTestCase {
     MiniSolrCloudCluster cluster =
             configureCluster(4)
                     .withJettyConfig(jetty -> jetty.enableV2(true))
-                    .addConfig("conf", configset("cloud-managed"))
+                    .addConfig("conf1", configset("schema-package"))
                     .configure();
     try {
       String FILE1 = "/schemapkg/schema-plugins.jar";
@@ -687,57 +684,10 @@ public class TestPackages extends SolrCloudTestCase {
               ));
 
       CollectionAdminRequest
-              .createCollection(COLLECTION_NAME, "conf", 2, 2)
+              .createCollection(COLLECTION_NAME, "conf1", 2, 2)
               .process(cluster.getSolrClient());
       cluster.waitForActiveCollection(COLLECTION_NAME, 2, 4);
 
-      String addFieldTypeAnalyzerWithClass = "{\n" +
-              "'add-field-type' : {" +
-              "    'name' : 'myNewTextFieldWithAnalyzerClass',\n" +
-              "    'class':'schemapkg:my.pkg.MyTextField',\n" +
-              "    'analyzer' : {\n" +
-              "        'luceneMatchVersion':'5.0.0'" ;
-//          + ",\n" +
-//          "        'class':'schemapkg:my.pkg.MyWhitespaceAnalyzer'\n";
-      String charFilters =
-              "        'charFilters' : [{\n" +
-                      "            'class':'schemapkg:my.pkg.MyPatternReplaceCharFilterFactory',\n" +
-                      "            'replacement':'$1$1',\n" +
-                      "            'pattern':'([a-zA-Z])\\\\\\\\1+'\n" +
-                      "        }],\n";
-      String tokenizer =
-              "        'tokenizer' : { 'class':'schemapkg:my.pkg.MyWhitespaceTokenizerFactory' },\n";
-      String filters =
-          "        'filters' : [{ 'class':'solr.DelimitedPayloadTokenFilterFactory', 'encoder' : 'schemapkg:com.o19s.payloads.Base64Encoder'}]\n";
-      String suffix = "    }\n" +
-              "}}";
-      cluster.getSolrClient().request(new SolrRequest(SolrRequest.METHOD.POST, "/schema") {
-
-        @Override
-        public RequestWriter.ContentWriter getContentWriter(String expectedType) {
-          return new RequestWriter.StringPayloadContentWriter(addFieldTypeAnalyzerWithClass + ',' + charFilters + tokenizer + filters + suffix, CommonParams.JSON_MIME);
-        }
-
-        @Override
-        public SolrParams getParams() {
-          return null;
-        }
-
-        @Override
-        public String getCollection() {
-          return COLLECTION_NAME;
-        }
-
-        @Override
-        public SolrResponse createResponse(SolrClient client) {
-          return new SolrResponseBase();
-        }
-
-        @Override
-        public String getRequestType() {
-          return SolrRequestType.UNSPECIFIED.toString();
-        }
-      });
       verifySchemaComponent(cluster.getSolrClient(), COLLECTION_NAME, "/schema/fieldtypes/myNewTextFieldWithAnalyzerClass",
               Utils.makeMap(":fieldType:analyzer:charFilters[0]:_packageinfo_:version" ,"1.0",
                       ":fieldType:analyzer:tokenizer:_packageinfo_:version","1.0",