|
27 | 27 | import java.util.Locale; |
28 | 28 | import java.util.Map; |
29 | 29 | import java.util.Objects; |
| 30 | +import java.util.concurrent.atomic.AtomicReference; |
30 | 31 | import org.apache.commons.io.input.ReversedLinesFileReader; |
31 | 32 | import org.apache.lucene.tests.util.LuceneTestCase; |
| 33 | +import org.apache.solr.client.solrj.impl.CloudSolrClient; |
32 | 34 | import org.apache.solr.client.solrj.io.SolrClientCache; |
33 | 35 | import org.apache.solr.client.solrj.io.Tuple; |
34 | 36 | import org.apache.solr.client.solrj.io.stream.CloudSolrStream; |
@@ -193,7 +195,10 @@ public void testWritingToLogUbiQueryStream() throws Exception { |
193 | 195 | streamContext.setSolrClientCache(solrClientCache); |
194 | 196 | StreamFactory factory = |
195 | 197 | new StreamFactory() |
196 | | - .withCollectionZkHost(COLLECTIONORALIAS, cluster.getZkServer().getZkAddress()) |
| 198 | + .withCollectionUseThisConnection( |
| 199 | + COLLECTIONORALIAS, |
| 200 | + CloudSolrClient.CloudSolrClientConnection.parse( |
| 201 | + cluster.getZkServer().getZkAddress())) |
197 | 202 | .withFunctionName("search", CloudSolrStream.class) |
198 | 203 | .withFunctionName("ubiQuery", UBIComponent.UBIQueryStream.class) |
199 | 204 | .withFunctionName("logging", LoggingStream.class); |
@@ -260,7 +265,10 @@ public void testWritingToSolrUbiQueryStream() throws Exception { |
260 | 265 | streamContext.setSolrClientCache(solrClientCache); |
261 | 266 | StreamFactory factory = |
262 | 267 | new StreamFactory() |
263 | | - .withCollectionZkHost(COLLECTIONORALIAS, cluster.getZkServer().getZkAddress()) |
| 268 | + .withCollectionUseThisConnection( |
| 269 | + COLLECTIONORALIAS, |
| 270 | + CloudSolrClient.CloudSolrClientConnection.parse( |
| 271 | + cluster.getZkServer().getZkAddress())) |
264 | 272 | .withFunctionName("search", CloudSolrStream.class) |
265 | 273 | .withFunctionName("update", UpdateStream.class) |
266 | 274 | .withFunctionName("select", SelectStream.class) |
@@ -356,10 +364,10 @@ protected void assertFields(List<Tuple> tuples, String... fields) throws Excepti |
356 | 364 |
|
357 | 365 | private static SolrCore findSolrCore() { |
358 | 366 | for (JettySolrRunner solrRunner : cluster.getJettySolrRunners()) { |
359 | | - for (SolrCore solrCore : solrRunner.getCoreContainer().getCores()) { |
360 | | - if (solrCore != null) { |
361 | | - return solrCore; |
362 | | - } |
| 367 | + AtomicReference<SolrCore> found = new AtomicReference<>(); |
| 368 | + solrRunner.getCoreContainer().forEachLoadedCore(found::set); |
| 369 | + if (found.get() != null) { |
| 370 | + return found.get(); |
363 | 371 | } |
364 | 372 | } |
365 | 373 | throw new RuntimeException("Didn't find any valid cores."); |
|
0 commit comments