Example usage for org.apache.solr.client.solrj.impl LBHttpSolrClient LBHttpSolrClient

List of usage examples for org.apache.solr.client.solrj.impl LBHttpSolrClient LBHttpSolrClient

Introduction

In this page you can find the example usage for org.apache.solr.client.solrj.impl LBHttpSolrClient LBHttpSolrClient.

Prototype

@Deprecated
protected LBHttpSolrClient(HttpClient httpClient, ResponseParser parser, String... solrServerUrl) 

Source Link

Document

The provided httpClient should use a multi-threaded connection manager

Usage

From source file:org.springframework.data.solr.server.support.SolrClientUtilTests.java

License:Apache License

/**
 * @see DATASOLR-189//from  ww  w  . ja  v a 2s .  co  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 ww.  j a v a  2  s .  c o 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));
}