pjmcarthur commented on code in PR #2126: URL: https://github.com/apache/solr/pull/2126#discussion_r1423015389
########## solr/core/src/test/org/apache/solr/api/NodeConfigContainerPluginsSourceTest.java: ########## @@ -0,0 +1,287 @@ +/* + * 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. + */ + +package org.apache.solr.api; + +import static org.apache.solr.client.solrj.SolrRequest.METHOD.GET; + +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import org.apache.solr.client.solrj.impl.BaseHttpSolrClient; +import org.apache.solr.client.solrj.request.V2Request; +import org.apache.solr.client.solrj.request.beans.PluginMeta; +import org.apache.solr.client.solrj.response.V2Response; +import org.apache.solr.cloud.ClusterSingleton; +import org.apache.solr.cloud.MiniSolrCloudCluster; +import org.apache.solr.cloud.SolrCloudTestCase; +import org.apache.solr.common.MapWriter; +import org.apache.solr.common.annotation.JsonProperty; +import org.apache.solr.common.util.ReflectMapWriter; +import org.apache.solr.core.CoreContainer; +import org.apache.solr.request.SolrQueryRequest; +import org.apache.solr.response.SolrQueryResponse; +import org.apache.solr.security.PermissionNameProvider; +import org.junit.BeforeClass; +import org.junit.Test; + +/** Tests that verify initialization of container plugins that are declared in solr.xml */ +public class NodeConfigContainerPluginsSourceTest extends SolrCloudTestCase { + + private static final String NODE_CONFIG_PLUGINS_SOURCE_XML = + "<containerPluginsSource class=\"org.apache.solr.api.NodeConfigContainerPluginsSource\"/>"; + + @BeforeClass + public static void setupCluster() throws Exception { + configureCluster(1) + .withSolrXml( + MiniSolrCloudCluster.DEFAULT_CLOUD_SOLR_XML.replace( + "</solr>", + NODE_CONFIG_PLUGINS_SOURCE_XML + SingletonNoConfig.xmlConfig() + "</solr>")) + .addConfig( + "conf", TEST_PATH().resolve("configsets").resolve("cloud-minimal").resolve("conf")) + .configure(); + } + + /** Verifies that a cluster singleton config declared in solr.xml is loaded into the registry */ + public void testOneClusterSingleton() { + CoreContainer cc = newCoreContainer(solrXml(SingletonNoConfig.xmlConfig())); Review Comment: Yes, I can get rid of newCoreContainer here. The question of whether or not to use EmbeddedSolrServerTestRule brings up an interesting point for discussion that I think was also raised by @pvcnt; the embedded server it creates isn't ZK aware, and so it doesn't have the /cluster/plugins APIs registered. This obviously makes sense when the only source for plugin configs is ZK, but if NodeConfig is also a source, should the /cluster/plugin API be available in non-cloud mode? I'm tempted to say no, at least for now, especially because the cluster singleton plugins I want to declare only apply to cloud mode anyway, and theoretically its easier to enable this in future (enable /cluster/plugins in non-cloud mode) than it is to undo it. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org