You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by is...@apache.org on 2020/09/19 04:25:08 UTC
[lucene-solr] branch jira/solr-14151-revert-2 updated: SOLR-14151:
Reverting schema tests from TestPackages
This is an automated email from the ASF dual-hosted git repository.
ishan pushed a commit to branch jira/solr-14151-revert-2
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/jira/solr-14151-revert-2 by this push:
new 8e19fa6 SOLR-14151: Reverting schema tests from TestPackages
8e19fa6 is described below
commit 8e19fa6713cdd88bd400d624e3b60196303e0cd1
Author: Ishan Chattopadhyaya <is...@apache.org>
AuthorDate: Sat Sep 19 09:54:52 2020 +0530
SOLR-14151: Reverting schema tests from TestPackages
---
.../src/test/org/apache/solr/pkg/TestPackages.java | 138 ---------------------
1 file changed, 138 deletions(-)
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 51642a5..5a21a25 100644
--- a/solr/core/src/test/org/apache/solr/pkg/TestPackages.java
+++ b/solr/core/src/test/org/apache/solr/pkg/TestPackages.java
@@ -639,144 +639,6 @@ public class TestPackages extends SolrCloudTestCase {
}
}
- @SuppressWarnings("rawtypes")
- public void testSchemaPlugins() throws Exception {
- String COLLECTION_NAME = "testSchemaLoadingColl";
- System.setProperty("managed.schema.mutable", "true");
-
- MiniSolrCloudCluster cluster =
- configureCluster(4)
- .withJettyConfig(jetty -> jetty.enableV2(true))
- .addConfig("conf", configset("cloud-managed"))
- .configure();
- try {
- String FILE1 = "/schemapkg/schema-plugins.jar";
- byte[] derFile = readFile("cryptokeys/pub_key512.der");
- uploadKey(derFile, PackageStoreAPI.KEYS_DIR+"/pub_key512.der", cluster);
- postFileAndWait(cluster, "runtimecode/schema-plugins.jar.bin", FILE1,
- "iSRhrogDyt9P1htmSf/krh1kx9oty3TYyWm4GKHQGlb8a+X4tKCe9kKk+3tGs+bU9zq5JBZ5txNXsn96aZem5A==");
-
- Package.AddVersion add = new Package.AddVersion();
- add.version = "1.0";
- add.pkg = "schemapkg";
- add.files = Arrays.asList(new String[]{FILE1});
- V2Request req = new V2Request.Builder("/cluster/package")
- .forceV2(true)
- .withMethod(SolrRequest.METHOD.POST)
- .withPayload(Collections.singletonMap("add", add))
- .build();
- req.process(cluster.getSolrClient());
-
- TestDistribPackageStore.assertResponseValues(10,
- () -> new V2Request.Builder("/cluster/package").
- withMethod(SolrRequest.METHOD.GET)
- .build().process(cluster.getSolrClient()),
- Utils.makeMap(
- ":result:packages:schemapkg[0]:version", "1.0",
- ":result:packages:schemapkg[0]:files[0]", FILE1
- ));
-
- CollectionAdminRequest
- .createCollection(COLLECTION_NAME, "conf", 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.ASCIIFoldingFilterFactory' }]\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",
- ":fieldType:_packageinfo_:version","1.0"));
-
- add = new Package.AddVersion();
- add.version = "2.0";
- add.pkg = "schemapkg";
- add.files = Arrays.asList(new String[]{FILE1});
- req = new V2Request.Builder("/cluster/package")
- .forceV2(true)
- .withMethod(SolrRequest.METHOD.POST)
- .withPayload(Collections.singletonMap("add", add))
- .build();
- req.process(cluster.getSolrClient());
-
- TestDistribPackageStore.assertResponseValues(10,
- () -> new V2Request.Builder("/cluster/package").
- withMethod(SolrRequest.METHOD.GET)
- .build().process(cluster.getSolrClient()),
- Utils.makeMap(
- ":result:packages:schemapkg[0]:version", "2.0",
- ":result:packages:schemapkg[0]:files[0]", FILE1
- ));
-
- verifySchemaComponent(cluster.getSolrClient(), COLLECTION_NAME, "/schema/fieldtypes/myNewTextFieldWithAnalyzerClass",
- Utils.makeMap(":fieldType:analyzer:charFilters[0]:_packageinfo_:version" ,"2.0",
- ":fieldType:analyzer:tokenizer:_packageinfo_:version","2.0",
- ":fieldType:_packageinfo_:version","2.0"));
-
- } finally {
- cluster.shutdown();
- }
-
- }
- @SuppressWarnings({"rawtypes","unchecked"})
- private void verifySchemaComponent(SolrClient client, String COLLECTION_NAME, String path,
- Map expected) throws Exception {
- SolrParams params = new MapSolrParams((Map) Utils.makeMap("collection", COLLECTION_NAME,
- WT, JAVABIN,
- "meta", "true"));
-
- GenericSolrRequest req = new GenericSolrRequest(SolrRequest.METHOD.GET,path
- , params);
- TestDistribPackageStore.assertResponseValues(10,
- client,
- req, expected);
- }
-
public static void postFileAndWait(MiniSolrCloudCluster cluster, String fname, String path, String sig) throws Exception {
ByteBuffer fileContent = getFileContent(fname);
String sha512 = DigestUtils.sha512Hex(fileContent.array());