Example usage for org.apache.solr.client.solrj.embedded JettySolrRunner start

List of usage examples for org.apache.solr.client.solrj.embedded JettySolrRunner start

Introduction

In this page you can find the example usage for org.apache.solr.client.solrj.embedded JettySolrRunner start.

Prototype

public void start() throws Exception 

Source Link

Document

Start the Jetty server If the server has been started before, it will restart using the same port

Usage

From source file:com.cloudera.cdk.morphline.solr.AbstractSolrMorphlineZkTest.java

License:Apache License

@Override
public JettySolrRunner createJetty(File solrHome, String dataDir, String shardList, String solrConfigOverride,
        String schemaOverride) throws Exception {

    JettySolrRunner jetty = new JettySolrRunner(solrHome.getAbsolutePath(), context, 0, solrConfigOverride,
            schemaOverride);/*ww w .  j  a va2  s  . c om*/

    jetty.setShards(shardList);

    if (System.getProperty("collection") == null) {
        System.setProperty("collection", "collection1");
    }

    jetty.start();

    System.clearProperty("collection");

    return jetty;
}

From source file:com.shaie.solr.MiniSolrCloudCluster.java

License:Apache License

private void startSolrNode(String nodeId) {
    final File solrHome = new File(workDir, nodeId);
    if (!solrHome.exists() && !solrHome.mkdirs()) {
        throw new RuntimeException("[" + solrHome + "] does not exist and fails to create");
    }//from  w w w.  j  ava 2s  .  c o m
    try {
        final JettySolrRunner solrRunner = new JettySolrRunner(solrHome.getAbsolutePath(), SOLR_CONTEXT, 0);
        solrRunner.start();
        solrRunners.put(nodeId, solrRunner);
    } catch (final Exception e) {
        throw Throwables.propagate(e);
    }
}

From source file:lux.solr.ZkCloudTest.java

License:Mozilla Public License

@Override
public JettySolrRunner createJetty(File solrHome, String dir, String shardList, String solrConfigOverride,
        String schemaOverride) throws Exception {

    JettySolrRunner jetty = new LuxJettySolrRunner(solrHome.getAbsolutePath(), context, 0, solrConfigOverride,
            schemaOverride, false, getExtraServlets());
    jetty.setShards(shardList);/*from   w w  w . ja  v a2s . co  m*/
    jetty.setDataDir(getDataDir(dir));
    jetty.start();

    return jetty;
}

From source file:org.apache.camel.component.solr.JettySolrFactory.java

License:Apache License

private static JettySolrRunner createJetty(String solrHome, String configFile, String schemaFile,
        String context, boolean stopAtShutdown, SortedMap<ServletHolder, String> extraServlets, boolean ssl)
        throws Exception {
    if (!mockedSslClient) {
        installAllTrustingClientSsl();//from w w  w. j a v a2  s  . c o m
        mockedSslClient = true;
    }
    // Set appropriate paths for Solr to use.
    System.setProperty("solr.solr.home", solrHome);
    System.setProperty("jetty.testMode", "true");
    System.setProperty("solr.data.dir", "target/test-classes/solr/data" + (dataDirNo++));

    // Instruct Solr to keep the index in memory, for faster testing.
    System.setProperty("solr.directoryFactory", "solr.RAMDirectoryFactory");

    SSLConfig sslConfig = buildSSLConfig(ssl, false);

    context = context == null ? "/solr" : context;
    JettySolrRunner jetty = new JettySolrRunner(solrHome, context, 0, configFile, schemaFile, stopAtShutdown,
            extraServlets, sslConfig);

    jetty.start();

    return jetty;
}

From source file:org.kitesdk.morphline.solr.AbstractSolrMorphlineZkTest.java

License:Apache License

@Override
public JettySolrRunner createJetty(File solrHome, String dataDir, String shardList, String solrConfigOverride,
        String schemaOverride) throws Exception {

    JettySolrRunner jetty = new JettySolrRunner(solrHome.getAbsolutePath(), context, 0, solrConfigOverride,
            schemaOverride, true, null, sslConfig);

    jetty.setShards(shardList);/*from   www.  j a v a2  s .  co m*/

    if (System.getProperty("collection") == null) {
        System.setProperty("collection", "collection1");
    }

    jetty.start();

    System.clearProperty("collection");

    return jetty;
}