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 03:05:45 UTC
[lucene-solr] branch branch_8x updated: SOLR-14879: address
TestPackages test failures
This is an automated email from the ASF dual-hosted git repository.
noble pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/branch_8x by this push:
new 798b619 SOLR-14879: address TestPackages test failures
798b619 is described below
commit 798b6198558033796e748a50411f6dd85e0242cb
Author: Noble Paul <no...@users.noreply.github.com>
AuthorDate: Sun Sep 20 13:01:47 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 | 63 ++++------------------
3 files changed, 110 insertions(+), 54 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..7d7b3d3
--- /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>
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 e7d9ced..6ec5044 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;
@@ -648,10 +645,10 @@ public class TestPackages extends SolrCloudTestCase {
System.setProperty("managed.schema.mutable", "true");
MiniSolrCloudCluster cluster =
- configureCluster(4)
- .withJettyConfig(jetty -> jetty.enableV2(true))
- .addConfig("conf", configset("cloud-managed"))
- .configure();
+ configureCluster(4)
+ .withJettyConfig(jetty -> jetty.enableV2(true))
+ .addConfig("conf1", configset("schema-package"))
+ .configure();
try {
String FILE1 = "/schemapkg/schema-plugins.jar";
byte[] derFile = readFile("cryptokeys/pub_key512.der");
@@ -684,56 +681,14 @@ public class TestPackages extends SolrCloudTestCase {
));
CollectionAdminRequest
- .createCollection(COLLECTION_NAME, "conf", 2, 2)
- .process(cluster.getSolrClient());
+ .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();
- }
- });
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",
- ":fieldType:_packageinfo_:version","1.0"));
+ Utils.makeMap(":fieldType:analyzer:charFilters[0]:_packageinfo_:version" ,"1.0",
+ ":fieldType:analyzer:tokenizer:_packageinfo_:version","1.0",
+ ":fieldType:_packageinfo_:version","1.0"));
add = new Package.AddVersion();
add.version = "2.0";