List of usage examples for org.apache.solr.client.solrj.impl LBHttpSolrClient getHttpClient
public HttpClient getHttpClient()
From source file:org.dbflute.solr.bhv.AbstractSolrBehavior.java
License:Apache License
/** * Create LBHttpSolrClient associated with the assigned list of URLs. * @param urlList List of URL (NotNull)/*from w w w . j av a2 s . c o m*/ * @return LBHttpSolrClient (NotNull) */ protected LBHttpSolrClient createLBHttpSolrClient(List<String> urlList) { LBHttpSolrClient client; try { client = new LBHttpSolrClient(urlList.toArray(new String[] {})); } catch (MalformedURLException e) { throw new SolrException("Failed to create Select Solr Client", e); } client.setConnectionTimeout(getConnectionTimeout()); client.setSoTimeout(getSocketTimeout()); client.setAliveCheckInterval(getAliveCheckInterval()); adjustHttpClient(client.getHttpClient()); return client; }
From source file:org.springframework.data.solr.server.support.SolrClientUtilTests.java
License:Apache License
/** * @see DATASOLR-189//w ww .j a va2 s . c o m */ @Test public void cloningLBHttpSolrClientShouldCopyHttpParamsCorrectly() throws MalformedURLException { HttpParams params = new BasicHttpParams(); params.setParameter("foo", "bar"); DefaultHttpClient client = new DefaultHttpClient(params); LBHttpSolrClient lbSolrClient = new LBHttpSolrClient(client, BASE_URL, ALTERNATE_BASE_URL); LBHttpSolrClient cloned = SolrClientUtils.clone(lbSolrClient, CORE_NAME); Assert.assertThat(cloned.getHttpClient().getParams(), IsEqual.equalTo(params)); }
From source file:org.springframework.data.solr.server.support.SolrClientUtilTests.java
License:Apache License
/** * @see DATASOLR-189/*from w w w . jav a2 s .co m*/ */ @Test public void cloningLBHttpSolrClientShouldCopyCredentialsProviderCorrectly() { BasicCredentialsProvider credentialsProvider = new BasicCredentialsProvider(); credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials("foo", "bar")); DefaultHttpClient client = new DefaultHttpClient(); client.setCredentialsProvider(credentialsProvider); LBHttpSolrClient lbSolrClient = new LBHttpSolrClient(client, BASE_URL, ALTERNATE_BASE_URL); LBHttpSolrClient cloned = SolrClientUtils.clone(lbSolrClient, CORE_NAME); Assert.assertThat(((AbstractHttpClient) cloned.getHttpClient()).getCredentialsProvider(), IsEqual.<CredentialsProvider>equalTo(credentialsProvider)); }