use of org.apache.solr.client.solrj.embedded.JettyConfig in project lucene-solr by apache.
the class JettySolrRunnerTest method testRestartPorts.
@Test
public void testRestartPorts() throws Exception {
Path solrHome = createTempDir();
Files.write(solrHome.resolve("solr.xml"), MiniSolrCloudCluster.DEFAULT_CLOUD_SOLR_XML.getBytes(Charset.defaultCharset()));
JettyConfig config = JettyConfig.builder().build();
JettySolrRunner jetty = new JettySolrRunner(solrHome.toString(), config);
try {
jetty.start();
URL url = jetty.getBaseUrl();
int usedPort = url.getPort();
jetty.stop();
jetty.start();
assertEquals("After restart, jetty port should be the same", usedPort, jetty.getBaseUrl().getPort());
jetty.stop();
jetty.start(false);
assertThat("After restart, jetty port should be different", jetty.getBaseUrl().getPort(), not(usedPort));
} finally {
if (jetty.isRunning())
jetty.stop();
}
}
use of org.apache.solr.client.solrj.embedded.JettyConfig in project lucene-solr by apache.
the class AbstractFullDistribZkTestBase method createJetty.
public JettySolrRunner createJetty(String dataDir, String ulogDir, String shardList, String solrConfigOverride) throws Exception {
JettyConfig jettyconfig = JettyConfig.builder().setContext(context).stopAtShutdown(false).withServlets(getExtraServlets()).withFilters(getExtraRequestFilters()).withSSLConfig(sslConfig).build();
Properties props = new Properties();
props.setProperty("solr.data.dir", getDataDir(dataDir));
props.setProperty("shards", shardList);
props.setProperty("solr.ulog.dir", ulogDir);
props.setProperty("solrconfig", solrConfigOverride);
JettySolrRunner jetty = new JettySolrRunner(getSolrHome(), props, jettyconfig);
jetty.start();
return jetty;
}
use of org.apache.solr.client.solrj.embedded.JettyConfig in project lucene-solr by apache.
the class BasicHttpSolrClientTest method beforeTest.
@BeforeClass
public static void beforeTest() throws Exception {
JettyConfig jettyConfig = JettyConfig.builder().withServlet(new ServletHolder(RedirectServlet.class), "/redirect/*").withServlet(new ServletHolder(SlowServlet.class), "/slow/*").withServlet(new ServletHolder(DebugServlet.class), "/debug/*").withSSLConfig(sslConfig).build();
createJetty(legacyExampleCollection1SolrHome(), jettyConfig);
}
use of org.apache.solr.client.solrj.embedded.JettyConfig in project lucene-solr by apache.
the class SSLMigrationTest method testMigrateSSL.
public void testMigrateSSL(SSLTestConfig sslConfig) throws Exception {
String urlScheme = sslConfig.isSSLMode() ? "https" : "http";
setUrlScheme(urlScheme);
for (JettySolrRunner runner : jettys) {
runner.stop();
}
HttpClientUtil.setSchemaRegistryProvider(sslConfig.buildClientSchemaRegistryProvider());
for (int i = 0; i < this.jettys.size(); i++) {
JettySolrRunner runner = jettys.get(i);
JettyConfig config = JettyConfig.builder().setContext(context).setPort(runner.getLocalPort()).stopAtShutdown(false).withServlets(getExtraServlets()).withFilters(getExtraRequestFilters()).withSSLConfig(sslConfig).build();
Properties props = new Properties();
if (getSolrConfigFile() != null)
props.setProperty("solrconfig", getSolrConfigFile());
if (getSchemaFile() != null)
props.setProperty("schema", getSchemaFile());
props.setProperty("solr.data.dir", getDataDir(testDir + "/shard" + i + "/data"));
JettySolrRunner newRunner = new JettySolrRunner(runner.getSolrHome(), props, config);
newRunner.start();
jettys.set(i, newRunner);
}
assertReplicaInformation(urlScheme);
}
use of org.apache.solr.client.solrj.embedded.JettyConfig in project lucene-solr by apache.
the class TestReplicationHandlerBackup 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;
}
Aggregations