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

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


    assertHttpSolrServerProperties(httpSolrServer, clone);
  }

  @Test
  public void testClonesLBHttpSolrServerCorrectly() throws MalformedURLException {
    LBHttpSolrServer lbSolrServer = new LBHttpSolrServer(BASE_URL, ALTERNATE_BASE_URL);
    lbSolrServer.setAliveCheckInterval(10);

    LBHttpSolrServer clone = SolrServerUtils.clone(lbSolrServer);

    Assert.assertEquals(ReflectionTestUtils.getField(lbSolrServer, FIELD_ALIVE_SERVERS),
        ReflectionTestUtils.getField(clone, FIELD_ALIVE_SERVERS));
    assertLBHttpSolrServerProperties(lbSolrServer, clone);
  }
View Full Code Here


  }

  @Test
  @SuppressWarnings("unchecked")
  public void testClonesLBHttpSolrServerForCoreCorrectly() throws MalformedURLException {
    LBHttpSolrServer lbSolrServer = new LBHttpSolrServer(BASE_URL, ALTERNATE_BASE_URL);
    lbSolrServer.setAliveCheckInterval(10);

    LBHttpSolrServer clone = SolrServerUtils.clone(lbSolrServer, CORE_NAME);

    Map<String, ?> aliveServers = (Map<String, ?>) ReflectionTestUtils.getField(clone, FIELD_ALIVE_SERVERS);
    Assert.assertThat(aliveServers.keySet(), hasItems(CORE_URL, ALTERNATE_CORE_URL));

    assertLBHttpSolrServerProperties(lbSolrServer, clone);
View Full Code Here

    assertLBHttpSolrServerProperties(lbSolrServer, clone);
  }

  @Test
  public void testClonesCloudSolrServerCorrectly() throws MalformedURLException {
    LBHttpSolrServer lbSolrServer = new LBHttpSolrServer(BASE_URL, ALTERNATE_BASE_URL);
    CloudSolrServer cloudServer = new CloudSolrServer(ZOO_KEEPER_URL, lbSolrServer);

    CloudSolrServer clone = SolrServerUtils.clone(cloudServer);
    Assert.assertEquals(ZOO_KEEPER_URL, ReflectionTestUtils.getField(clone, FIELD_ZOO_KEEPER));

    LBHttpSolrServer lbClone = clone.getLbServer();
    Assert.assertEquals(ReflectionTestUtils.getField(lbSolrServer, FIELD_ALIVE_SERVERS),
        ReflectionTestUtils.getField(lbClone, FIELD_ALIVE_SERVERS));

    assertLBHttpSolrServerProperties(lbSolrServer, lbClone);
  }
View Full Code Here

  }

  @Test
  @SuppressWarnings("unchecked")
  public void testClonesCloudSolrServerForCoreCorrectlyWhenCoreNameIsNotEmpty() throws MalformedURLException {
    LBHttpSolrServer lbSolrServer = new LBHttpSolrServer(BASE_URL, ALTERNATE_BASE_URL);
    CloudSolrServer cloudServer = new CloudSolrServer(ZOO_KEEPER_URL, lbSolrServer);

    CloudSolrServer clone = SolrServerUtils.clone(cloudServer, CORE_NAME);
    Assert.assertEquals(ZOO_KEEPER_URL, ReflectionTestUtils.getField(clone, FIELD_ZOO_KEEPER));

    LBHttpSolrServer lbClone = clone.getLbServer();
    Map<String, ?> aliveServers = (Map<String, ?>) ReflectionTestUtils.getField(lbClone, FIELD_ALIVE_SERVERS);
    Assert.assertThat(aliveServers.keySet(), hasItems(CORE_URL, ALTERNATE_CORE_URL));

    assertLBHttpSolrServerProperties(lbSolrServer, lbClone);
    Assert.assertThat(clone.getDefaultCollection(), equalTo(CORE_NAME));
View Full Code Here

    CloudSolrServer cloudServer = new CloudSolrServer(ZOO_KEEPER_URL);

    CloudSolrServer clone = SolrServerUtils.clone(cloudServer, CORE_NAME);
    Assert.assertEquals(ZOO_KEEPER_URL, ReflectionTestUtils.getField(clone, FIELD_ZOO_KEEPER));

    LBHttpSolrServer lbClone = clone.getLbServer();

    assertLBHttpSolrServerProperties(cloudServer.getLbServer(), lbClone);
    Assert.assertThat(clone.getDefaultCollection(), equalTo(CORE_NAME));
  }
View Full Code Here

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

    LBHttpSolrServer lbSolrServer = new LBHttpSolrServer(client, BASE_URL, ALTERNATE_BASE_URL);

    LBHttpSolrServer cloned = SolrServerUtils.clone(lbSolrServer, CORE_NAME);
    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);

    LBHttpSolrServer lbSolrServer = new LBHttpSolrServer(client, BASE_URL, ALTERNATE_BASE_URL);

    LBHttpSolrServer cloned = SolrServerUtils.clone(lbSolrServer, CORE_NAME);
    Assert.assertThat(((AbstractHttpClient) cloned.getHttpClient()).getCredentialsProvider(),
        IsEqual.<CredentialsProvider> equalTo(credentialsProvider));
  }
View Full Code Here

  }

  @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

        for (int i = 0; i < array.size(); i++) {
            serverUrls[i] = array.get(i);
        }

        try {
            LBHttpSolrServer server = new LBHttpSolrServer(serverUrls);
            return server;

        } catch (MalformedURLException e) {
            throw new RuntimeException(e);
        }
View Full Code Here

TOP

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

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.