Search in sources :

Example 1 with JettyConfig

use of org.apache.solr.client.solrj.embedded.JettyConfig in project lucene-solr by apache.

the class TestMiniSolrCloudClusterSSL method checkClusterWithNodeReplacement.

/**
   * Constructs a cluster with the specified sslConfigs, runs {@link #checkClusterWithCollectionCreations}, 
   * then verifies that if we modify the default SSLContext (mimicing <code>javax.net.ssl.*</code> 
   * sysprops set on JVM startup) and reset to the default HttpClientBuilder, new HttpSolrClient instances 
   * will still be able to talk to our servers.
   *
   * @see SSLContext#setDefault
   * @see HttpClientUtil#resetHttpClientBuilder
   * @see #checkClusterWithCollectionCreations
   */
private void checkClusterWithNodeReplacement(SSLTestConfig sslConfig) throws Exception {
    final JettyConfig config = JettyConfig.builder().withSSLConfig(sslConfig).build();
    final MiniSolrCloudCluster cluster = new MiniSolrCloudCluster(NUM_SERVERS, createTempDir(), config);
    try {
        checkClusterWithCollectionCreations(cluster, sslConfig);
        // Change the defaul SSLContext to match our test config, or to match our original system default if
        // our test config doesn't use SSL, and reset HttpClientUtil to it's defaults so it picks up our
        // SSLContext that way.
        SSLContext.setDefault(sslConfig.isSSLMode() ? sslConfig.buildClientSSLContext() : DEFAULT_SSL_CONTEXT);
        HttpClientUtil.resetHttpClientBuilder();
        // recheck that we can communicate with all the jetty instances in our cluster
        checkClusterJettys(cluster, sslConfig);
    } finally {
        cluster.shutdown();
    }
}
Also used : JettyConfig(org.apache.solr.client.solrj.embedded.JettyConfig)

Example 2 with JettyConfig

use of org.apache.solr.client.solrj.embedded.JettyConfig in project lucene-solr by apache.

the class MiniSolrCloudCluster method startJettySolrRunner.

/**
   * Start a new Solr instance on a particular servlet context
   *
   * @param name the instance name
   * @param hostContext the context to run on
   * @param config a JettyConfig for the instance's {@link org.apache.solr.client.solrj.embedded.JettySolrRunner}
   *
   * @return a JettySolrRunner
   */
public JettySolrRunner startJettySolrRunner(String name, String hostContext, JettyConfig config) throws Exception {
    Path runnerPath = createInstancePath(name);
    String context = getHostContextSuitableForServletContext(hostContext);
    JettyConfig newConfig = JettyConfig.builder(config).setContext(context).build();
    JettySolrRunner jetty = new JettySolrRunner(runnerPath.toString(), newConfig);
    jetty.start();
    jettys.add(jetty);
    return jetty;
}
Also used : Path(java.nio.file.Path) JettyConfig(org.apache.solr.client.solrj.embedded.JettyConfig) JettySolrRunner(org.apache.solr.client.solrj.embedded.JettySolrRunner)

Example 3 with JettyConfig

use of org.apache.solr.client.solrj.embedded.JettyConfig in project lucene-solr by apache.

the class ConcurrentUpdateSolrClientTest method beforeTest.

// end TestServlet
@BeforeClass
public static void beforeTest() throws Exception {
    JettyConfig jettyConfig = JettyConfig.builder().withServlet(new ServletHolder(TestServlet.class), "/cuss/*").withSSLConfig(sslConfig).build();
    createJetty(legacyExampleCollection1SolrHome(), jettyConfig);
}
Also used : JettyConfig(org.apache.solr.client.solrj.embedded.JettyConfig) ServletHolder(org.eclipse.jetty.servlet.ServletHolder) BeforeClass(org.junit.BeforeClass)

Example 4 with JettyConfig

use of org.apache.solr.client.solrj.embedded.JettyConfig in project lucene-solr by apache.

the class TestReplicationHandler method createJetty.

private static JettySolrRunner createJetty(SolrInstance instance) throws Exception {
    FileUtils.copyFile(new File(SolrTestCaseJ4.TEST_HOME(), "solr.xml"), new File(instance.getHomeDir(), "solr.xml"));
    Properties nodeProperties = new Properties();
    nodeProperties.setProperty("solr.data.dir", instance.getDataDir());
    JettyConfig jettyConfig = JettyConfig.builder().setContext("/solr").setPort(0).build();
    JettySolrRunner jetty = new JettySolrRunner(instance.getHomeDir(), nodeProperties, jettyConfig);
    jetty.start();
    return jetty;
}
Also used : JettyConfig(org.apache.solr.client.solrj.embedded.JettyConfig) JettySolrRunner(org.apache.solr.client.solrj.embedded.JettySolrRunner) Properties(java.util.Properties) File(java.io.File)

Example 5 with JettyConfig

use of org.apache.solr.client.solrj.embedded.JettyConfig in project lucene-solr by apache.

the class TestRestoreCore method createJetty.

private static JettySolrRunner createJetty(TestReplicationHandler.SolrInstance instance) throws Exception {
    FileUtils.copyFile(new File(SolrTestCaseJ4.TEST_HOME(), "solr.xml"), new File(instance.getHomeDir(), "solr.xml"));
    Properties nodeProperties = new Properties();
    nodeProperties.setProperty("solr.data.dir", instance.getDataDir());
    JettyConfig jettyConfig = JettyConfig.builder().setContext("/solr").setPort(0).build();
    JettySolrRunner jetty = new JettySolrRunner(instance.getHomeDir(), nodeProperties, jettyConfig);
    jetty.start();
    return jetty;
}
Also used : JettyConfig(org.apache.solr.client.solrj.embedded.JettyConfig) JettySolrRunner(org.apache.solr.client.solrj.embedded.JettySolrRunner) Properties(java.util.Properties) File(java.io.File)

Aggregations

JettyConfig (org.apache.solr.client.solrj.embedded.JettyConfig)15 JettySolrRunner (org.apache.solr.client.solrj.embedded.JettySolrRunner)10 Properties (java.util.Properties)8 File (java.io.File)4 Path (java.nio.file.Path)2 ServletHolder (org.eclipse.jetty.servlet.ServletHolder)2 BeforeClass (org.junit.BeforeClass)2 Test (org.junit.Test)2 IOException (java.io.IOException)1 URL (java.net.URL)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 MiniSolrCloudCluster (org.apache.solr.cloud.MiniSolrCloudCluster)1