org.apache.solr.SolrJettyTestBase Java Examples
The following examples show how to use
org.apache.solr.SolrJettyTestBase.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JettyWebappTest.java From lucene-solr with Apache License 2.0 | 5 votes |
@Override public void setUp() throws Exception { super.setUp(); System.setProperty("solr.solr.home", SolrJettyTestBase.legacyExampleCollection1SolrHome()); System.setProperty("tests.shardhandler.randomSeed", Long.toString(random().nextLong())); System.setProperty("solr.tests.doContainerStreamCloseAssert", "false"); File dataDir = createTempDir().toFile(); dataDir.mkdirs(); System.setProperty("solr.data.dir", dataDir.getCanonicalPath()); String path = ExternalPaths.WEBAPP_HOME; server = new Server(port); // insecure: only use for tests!!!! server.setSessionIdManager(new DefaultSessionIdManager(server, new Random(random().nextLong()))); new WebAppContext(server, path, context ); ServerConnector connector = new ServerConnector(server, new HttpConnectionFactory()); connector.setIdleTimeout(1000 * 60 * 60); connector.setPort(0); server.setConnectors(new Connector[]{connector}); server.setStopAtShutdown( true ); server.start(); port = connector.getLocalPort(); }
Example #2
Source File: ZkCLITest.java From lucene-solr with Apache License 2.0 | 5 votes |
@Override public void setUp() throws Exception { super.setUp(); if (log.isInfoEnabled()) { log.info("####SETUP_START {}", getTestName()); } String exampleHome = SolrJettyTestBase.legacyExampleCollection1SolrHome(); Path tmpDir = createTempDir(); solrHome = exampleHome; zkDir = tmpDir.resolve("zookeeper/server1/data"); log.info("ZooKeeper dataDir:{}", zkDir); zkServer = new ZkTestServer(zkDir); zkServer.run(); System.setProperty("zkHost", zkServer.getZkAddress()); SolrZkClient zkClient = new SolrZkClient(zkServer.getZkHost(), AbstractZkTestCase.TIMEOUT); zkClient.makePath("/solr", false, true); zkClient.close(); this.zkClient = new SolrZkClient(zkServer.getZkAddress(), AbstractZkTestCase.TIMEOUT); if (log.isInfoEnabled()) { log.info("####SETUP_END {}", getTestName()); } }