|
37 | 37 | import org.apache.solr.client.solrj.SolrClient;
|
38 | 38 | import org.apache.solr.client.solrj.SolrServerException;
|
39 | 39 | import org.apache.solr.client.solrj.beans.Field;
|
| 40 | +import org.apache.solr.client.solrj.impl.HttpSolrClient; |
40 | 41 | import org.apache.solr.common.SolrInputDocument;
|
41 | 42 | import org.apache.solr.common.params.FacetParams;
|
42 | 43 | import org.apache.solr.common.params.FacetParams.FacetRangeInclude;
|
|
106 | 107 | import org.springframework.data.solr.core.query.result.StatsResult;
|
107 | 108 | import org.springframework.data.solr.core.query.result.TermsFieldEntry;
|
108 | 109 | import org.springframework.data.solr.core.query.result.TermsPage;
|
| 110 | +import org.springframework.data.solr.server.support.MulticoreSolrClientFactory; |
109 | 111 | import org.xml.sax.SAXException;
|
110 | 112 |
|
111 | 113 | import com.google.common.collect.Lists;
|
@@ -1259,6 +1261,23 @@ public void testFindByNameWithSpellcheckSeggestion() {
|
1259 | 1261 | Assert.assertThat(found.getSuggestions(), Matchers.contains("green"));
|
1260 | 1262 | }
|
1261 | 1263 |
|
| 1264 | + @Test // DATSOLR-364 |
| 1265 | + public void shouldUseBaseUrlInCollectionCallbackWhenExecutingCommands() { |
| 1266 | + |
| 1267 | + final HttpSolrClient client = new HttpSolrClient("http://127.0.0.1/solr/"); |
| 1268 | + |
| 1269 | + SolrTemplate solrTemplate = new SolrTemplate(new MulticoreSolrClientFactory(client), "collection-1"); |
| 1270 | + |
| 1271 | + solrTemplate.execute("collection-1", new CollectionCallback<Object>() { |
| 1272 | + @Override |
| 1273 | + public Object doInSolr(SolrClient solrClient, String collection) throws SolrServerException, IOException { |
| 1274 | + |
| 1275 | + Assert.assertThat(((HttpSolrClient)solrClient).getBaseURL(), is("http://127.0.0.1/solr")); |
| 1276 | + return null; |
| 1277 | + } |
| 1278 | + }); |
| 1279 | + } |
| 1280 | + |
1262 | 1281 | private void executeAndCheckStatsRequest(StatsOptions statsOptions) {
|
1263 | 1282 |
|
1264 | 1283 | ExampleSolrBean bean1 = new ExampleSolrBean("id-1", "one", null);
|
|
0 commit comments