dsmiley commented on code in PR #4214: URL: https://github.com/apache/solr/pull/4214#discussion_r2935633151
########## solr/test-framework/src/java/org/apache/solr/SolrBackend.java: ########## @@ -0,0 +1,169 @@ +/* + * 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; + +import java.io.IOException; +import java.io.PrintStream; +import java.nio.file.Path; +import java.util.Random; +import org.apache.solr.client.solrj.SolrClient; +import org.apache.solr.client.solrj.SolrRequest; +import org.apache.solr.client.solrj.SolrServerException; +import org.apache.solr.client.solrj.impl.CloudSolrClient; +import org.apache.solr.client.solrj.impl.HttpSolrClientBase; +import org.apache.solr.client.solrj.request.CollectionAdminRequest; +import org.apache.solr.client.solrj.request.GenericSolrRequest; +import org.apache.solr.client.solrj.request.MetricsRequest; +import org.apache.solr.client.solrj.response.InputStreamResponseParser; +import org.apache.solr.common.params.SolrParams; +import org.apache.solr.common.util.URLUtil; +import org.apache.solr.core.CoreContainer; +import org.apache.solr.embedded.EmbeddedSolrBackend; +import org.apache.solr.embedded.JettySolrRunner; + +/** + * Abstraction over a running Solr deployment for use in tests and benchmarks. The abstraction + * normalizes how to shut down and perform other common operations as the methods indicate. + */ +public interface SolrBackend extends AutoCloseable { + + /** + * Creates a new {@link SolrClient} defaulted to the given collection. The <em>caller</em> owns + * this client and is responsible for closing it. Callers that want a long-lived client should + * cache it themselves. + */ + SolrClient newClient(String collection); // nocommit or newSolrClient ? + + /** + * Returns the admin (collection-less) {@link SolrClient} owned by this backend, to be used for + * tasks that are not the subject of what is being tested, and thus the details of the type or + * configuration of this client doesn't matter. The caller must NOT close it; it is released when + * this backend is {@link #close()}d. A {@link CloudSolrClient} should be returned if possible. + * nocommit + */ + SolrClient getAdminClient(); // nocommit or "getNodeClient" or getSolrClient ? Review Comment: nocommit; seeking feedback ########## solr/test-framework/src/java/org/apache/solr/SolrBackend.java: ########## @@ -0,0 +1,169 @@ +/* + * 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; + +import java.io.IOException; +import java.io.PrintStream; +import java.nio.file.Path; +import java.util.Random; +import org.apache.solr.client.solrj.SolrClient; +import org.apache.solr.client.solrj.SolrRequest; +import org.apache.solr.client.solrj.SolrServerException; +import org.apache.solr.client.solrj.impl.CloudSolrClient; +import org.apache.solr.client.solrj.impl.HttpSolrClientBase; +import org.apache.solr.client.solrj.request.CollectionAdminRequest; +import org.apache.solr.client.solrj.request.GenericSolrRequest; +import org.apache.solr.client.solrj.request.MetricsRequest; +import org.apache.solr.client.solrj.response.InputStreamResponseParser; +import org.apache.solr.common.params.SolrParams; +import org.apache.solr.common.util.URLUtil; +import org.apache.solr.core.CoreContainer; +import org.apache.solr.embedded.EmbeddedSolrBackend; +import org.apache.solr.embedded.JettySolrRunner; + +/** + * Abstraction over a running Solr deployment for use in tests and benchmarks. The abstraction + * normalizes how to shut down and perform other common operations as the methods indicate. + */ +public interface SolrBackend extends AutoCloseable { + + /** + * Creates a new {@link SolrClient} defaulted to the given collection. The <em>caller</em> owns + * this client and is responsible for closing it. Callers that want a long-lived client should + * cache it themselves. + */ + SolrClient newClient(String collection); // nocommit or newSolrClient ? Review Comment: nocommit; seeking feedback -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
