Package org.apache.solr.client.solrj.impl

Examples of org.apache.solr.client.solrj.impl.HttpSolrServer


  @Test
  public void testInitFactoryWithCore() throws MalformedURLException {
    HttpSolrServerFactory factory = new HttpSolrServerFactory(solrServer, "core");
    Assert.assertEquals(URL + "/core", ((HttpSolrServer) factory.getSolrServer()).getBaseURL());

    factory = new HttpSolrServerFactory(new HttpSolrServer(URL + "/"), "core");
    Assert.assertEquals(URL + "/core", ((HttpSolrServer) factory.getSolrServer()).getBaseURL());
  }
View Full Code Here


    SolrServerUtils.clone(null);
  }

  @Test
  public void testClonesHttpSolrServerCorrectly() {
    HttpSolrServer httpSolrServer = new HttpSolrServer(BASE_URL);
    httpSolrServer.setDefaultMaxConnectionsPerHost(10);
    httpSolrServer.setFollowRedirects(true);
    httpSolrServer.setMaxRetries(3);
    httpSolrServer.setUseMultiPartPost(true);

    HttpSolrServer clone = SolrServerUtils.clone(httpSolrServer);
    Assert.assertEquals(httpSolrServer.getBaseURL(), clone.getBaseURL());
    assertHttpSolrServerProperties(httpSolrServer, clone);
  }
View Full Code Here

    assertHttpSolrServerProperties(httpSolrServer, clone);
  }

  @Test
  public void testClonesHttpSolrServerForCoreCorrectly() {
    HttpSolrServer httpSolrServer = new HttpSolrServer(BASE_URL);
    httpSolrServer.setDefaultMaxConnectionsPerHost(10);
    httpSolrServer.setFollowRedirects(true);
    httpSolrServer.setMaxRetries(3);
    httpSolrServer.setUseMultiPartPost(true);

    HttpSolrServer clone = SolrServerUtils.clone(httpSolrServer, CORE_NAME);

    Assert.assertEquals(CORE_URL, clone.getBaseURL());

    assertHttpSolrServerProperties(httpSolrServer, clone);
  }
View Full Code Here

    HttpParams params = new BasicHttpParams();
    params.setParameter("foo", "bar");
    DefaultHttpClient client = new DefaultHttpClient(params);

    HttpSolrServer solrServer = new HttpSolrServer(BASE_URL, client);
    HttpSolrServer cloned = SolrServerUtils.clone(solrServer);

    Assert.assertThat(cloned.getHttpClient().getParams(), IsEqual.equalTo(params));
  }
View Full Code Here

    credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials("foo", "bar"));

    DefaultHttpClient client = new DefaultHttpClient();
    client.setCredentialsProvider(credentialsProvider);

    HttpSolrServer solrServer = new HttpSolrServer(BASE_URL, client);
    HttpSolrServer cloned = SolrServerUtils.clone(solrServer);

    Assert.assertThat(((AbstractHttpClient) cloned.getHttpClient()).getCredentialsProvider(),
        IsEqual.<CredentialsProvider> equalTo(credentialsProvider));
  }
View Full Code Here

    this.solrServer = solrServer;
  }

  @Parameters
  public static Collection<Object[]> data() throws MalformedURLException {
    Object[][] data = new Object[][] { { new HttpSolrServer("http://127.0.0.1:8983") },
        { new LBHttpSolrServer("http://127.0.0.1:8983", "http://127.0.0.1:6666") },
        { new CloudSolrServer("http://127.0.0.1:8080") } };
    return Arrays.asList(data);
  }
View Full Code Here

    Assert.assertNull(factory.getSolrServer("NoSuchCore"));
  }

  @Test
  public void testAddSolrServerForCoreNotConfigured() {
    HttpSolrServer ref = new HttpSolrServer("http://some.server.added/manually");
    factory.addSolrServerForCore(ref, "core1");

    Assert.assertThat(factory.getCores(), IsEqual.equalTo(Arrays.asList("spring", "data", "solr", "core1")));

    SolrServer solrServer = factory.getSolrServer("core1");
View Full Code Here

    Assert.assertSame(ref, solrServer);
  }

  @Test
  public void testAddSolrServerOverwritesExistingWhenCoreAlreayConfigured() {
    HttpSolrServer ref = new HttpSolrServer("http://some.server.added/manually");
    factory.addSolrServerForCore(ref, "solr");

    Assert.assertThat(factory.getCores(), IsEqual.equalTo(Arrays.asList("spring", "data", "solr")));

    SolrServer solrServer = factory.getSolrServer("solr");
View Full Code Here

  public ExternalServerWithManagedSchemaRule(String baseUrl) {
    this.baseUrl = baseUrl;
  }

  public ExternalServerWithManagedSchemaRule init() {
    SolrTemplate template = new SolrTemplate(new HttpSolrServer(baseUrl));

    try {
      String schemaName = template.getSchemaName("collection1");
      if (!schemaName.equalsIgnoreCase("example-schemaless")) {
        errMsg = "Expected to run in schemaless mode";
View Full Code Here

                    Thread.currentThread().setContextClassLoader(classLoader);
                }
                if (log.isInfoEnabled()) {
                    log.info("starting HTTP Solr server");
                }
                HttpSolrServer httpSolrServer = new HttpSolrServer(new StringBuilder(
                        SolrServerConfigurationDefaults.LOCAL_BASE_URL).append(':')
                        .append(httpPort).append(context).append('/').append(coreName)
                        .toString());
                return httpSolrServer;
            } else {
View Full Code Here

TOP

Related Classes of org.apache.solr.client.solrj.impl.HttpSolrServer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.