You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2020/09/06 00:24:07 UTC
[lucene-solr] branch reference_impl_dev updated: @751 Simplify test
that is tricky to get 100% solid - there are better ways to only test the
other constructor options.
This is an automated email from the ASF dual-hosted git repository.
markrmiller pushed a commit to branch reference_impl_dev
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/reference_impl_dev by this push:
new 5a1a8c0 @751 Simplify test that is tricky to get 100% solid - there are better ways to only test the other constructor options.
5a1a8c0 is described below
commit 5a1a8c0c736fa07835190ef34d65ba155a57c21c
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Sat Sep 5 19:22:15 2020 -0500
@751 Simplify test that is tricky to get 100% solid - there are better ways to only test the other constructor options.
---
.../client/solrj/impl/CloudHttp2SolrClientTest.java | 19 +++----------------
1 file changed, 3 insertions(+), 16 deletions(-)
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java
index 2e18e87..70c6276 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java
@@ -99,7 +99,6 @@ public class CloudHttp2SolrClientTest extends SolrCloudTestCase {
private static final int TIMEOUT = 30;
private static final int NODE_COUNT = 3;
- private CloudHttp2SolrClient httpBasedCloudSolrClient = null;
private CloudHttp2SolrClient zkBasedCloudSolrClient = null;
@BeforeClass
@@ -112,23 +111,12 @@ public class CloudHttp2SolrClientTest extends SolrCloudTestCase {
@Before
public void initTestClients() {
- final List<String> solrUrls = new ArrayList<>();
- solrUrls.add(cluster.getJettySolrRunner(0).getBaseUrl().toString());
- httpBasedCloudSolrClient = new CloudHttp2SolrClient.Builder(solrUrls).build();
zkBasedCloudSolrClient = new CloudHttp2SolrClient.Builder(Collections.singletonList(cluster.getZkServer().getZkAddress()), Optional.empty()).build();
+ zkBasedCloudSolrClient.connect();
}
@After
public void tearDown() throws Exception {
- if (httpBasedCloudSolrClient != null) {
- try {
- httpBasedCloudSolrClient.close();
- } catch (IOException e) {
- throw new RuntimeException(e);
- } finally {
- httpBasedCloudSolrClient = null;
- }
- }
if (zkBasedCloudSolrClient != null) {
try {
zkBasedCloudSolrClient.close();
@@ -159,8 +147,7 @@ public class CloudHttp2SolrClientTest extends SolrCloudTestCase {
* Randomly return the cluster's ZK based CSC, or HttpClusterProvider based CSC.
*/
private CloudHttp2SolrClient getRandomClient() {
-// return random().nextBoolean()? zkBasedCloudSolrClient : httpBasedCloudSolrClient;
- return httpBasedCloudSolrClient;
+ return zkBasedCloudSolrClient;
}
@Test
@@ -829,7 +816,7 @@ public class CloudHttp2SolrClientTest extends SolrCloudTestCase {
public void testInitializationWithSolrUrls() throws Exception {
String collection = "testInitializationWithSolrUrls";
createTestCollection(collection);
- CloudHttp2SolrClient client = httpBasedCloudSolrClient;
+ CloudHttp2SolrClient client = zkBasedCloudSolrClient;
SolrInputDocument doc = new SolrInputDocument("id", "1", "title_s", "my doc");
client.add(collection, doc);
client.commit(collection);