Package org.springframework.data.solr.server.support

Examples of org.springframework.data.solr.server.support.HttpSolrServerFactory


  public SolrTemplate(SolrServer solrServer) {
    this(solrServer, null);
  }

  public SolrTemplate(SolrServer solrServer, String core) {
    this(new HttpSolrServerFactory(solrServer, core));
    this.solrCore = core;
  }
View Full Code Here


  private SolrRepositoryFactory factory;

  @Before
  public void setUp() {
    SolrTemplate template = new SolrTemplate(new HttpSolrServerFactory(solrServer));
    template.afterPropertiesSet();
    factory = new SolrRepositoryFactory(template);
  }
View Full Code Here

    solrServer = null;
  }

  @Test
  public void testInitFactory() {
    HttpSolrServerFactory factory = new HttpSolrServerFactory(solrServer);
    Assert.assertNotNull(factory.getCores());
    Assert.assertThat(factory.getCores(), IsEmptyCollection.emptyCollectionOf(String.class));
    Assert.assertEquals(solrServer, factory.getSolrServer());
    Assert.assertEquals(URL, ((HttpSolrServer) factory.getSolrServer()).getBaseURL());
  }
View Full Code Here

    Assert.assertEquals(URL, ((HttpSolrServer) factory.getSolrServer()).getBaseURL());
  }

  @Test
  public void testFactoryReturnsReferenceSolrServerWhenCallingGetWithCoreNameAndNoCoreSet() {
    HttpSolrServerFactory factory = new HttpSolrServerFactory(solrServer);
    Assert.assertEquals(solrServer, factory.getSolrServer("AnyCoreName"));
  }
View Full Code Here

    Assert.assertEquals(solrServer, factory.getSolrServer("AnyCoreName"));
  }

  @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

    Assert.assertEquals(URL + "/core", ((HttpSolrServer) factory.getSolrServer()).getBaseURL());
  }

  @Test
  public void testFactoryReturnsReferenceSolrServerWhenCallingGetWithCoreNameAndCoreSet() {
    HttpSolrServerFactory factory = new HttpSolrServerFactory(solrServer, "core");
    Assert.assertEquals(solrServer, factory.getSolrServer("AnyCoreName"));
  }
View Full Code Here

    Assert.assertEquals(solrServer, factory.getSolrServer("AnyCoreName"));
  }

  @Test
  public void testInitFactoryWithEmptyCore() {
    HttpSolrServerFactory factory = new HttpSolrServerFactory(solrServer, StringUtils.EMPTY);
    Assert.assertEquals(URL, ((HttpSolrServer) factory.getSolrServer()).getBaseURL());
  }
View Full Code Here

    Assert.assertEquals(URL, ((HttpSolrServer) factory.getSolrServer()).getBaseURL());
  }

  @Test(expected = IllegalArgumentException.class)
  public void testInitFactoryWithNullServer() {
    new HttpSolrServerFactory(null);
  }
View Full Code Here

    new HttpSolrServerFactory(null);
  }

  @Test
  public void testInitFactoryWithAuthentication() {
    HttpSolrServerFactory factory = new HttpSolrServerFactory(solrServer, "core", new UsernamePasswordCredentials(
        "username", "password"), "BASIC");

    AbstractHttpClient solrHttpClient = (AbstractHttpClient) ((HttpSolrServer) factory.getSolrServer()).getHttpClient();
    Assert.assertNotNull(solrHttpClient.getCredentialsProvider().getCredentials(AuthScope.ANY));
    Assert.assertNotNull(solrHttpClient.getParams().getParameter(AuthPNames.TARGET_AUTH_PREF));
    Assert.assertEquals("username", ((UsernamePasswordCredentials) solrHttpClient.getCredentialsProvider()
        .getCredentials(AuthScope.ANY)).getUserName());
    Assert.assertEquals("password", ((UsernamePasswordCredentials) solrHttpClient.getCredentialsProvider()
View Full Code Here

        .getCredentials(AuthScope.ANY)).getPassword());
  }

  @Test(expected = IllegalArgumentException.class)
  public void testInitFactoryWithoutAuthenticationSchema() {
    new HttpSolrServerFactory(solrServer, "core", new UsernamePasswordCredentials("username", "password"), "");
  }
View Full Code Here

TOP

Related Classes of org.springframework.data.solr.server.support.HttpSolrServerFactory

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.