Example usage for org.apache.solr.cloud MiniSolrCloudCluster MiniSolrCloudCluster

List of usage examples for org.apache.solr.cloud MiniSolrCloudCluster MiniSolrCloudCluster

Introduction

In this page you can find the example usage for org.apache.solr.cloud MiniSolrCloudCluster MiniSolrCloudCluster.

Prototype

public MiniSolrCloudCluster(int numServers, Path baseDir, JettyConfig jettyConfig) throws Exception 

Source Link

Document

Create a MiniSolrCloudCluster with default solr.xml

Usage

From source file:com.yahoo.ycsb.db.solr.SolrClientBaseTest.java

License:Open Source License

@BeforeClass
public static void onlyOnce() throws Exception {
    Path miniSolrCloudClusterTempDirectory = Files.createTempDirectory("miniSolrCloudCluster");
    miniSolrCloudClusterTempDirectory.toFile().deleteOnExit();
    miniSolrCloudCluster = new MiniSolrCloudCluster(1, miniSolrCloudClusterTempDirectory,
            JettyConfig.builder().build());

    // Upload Solr configuration
    URL configDir = SolrClientBaseTest.class.getClassLoader().getResource("solr_config");
    assertNotNull(configDir);/*from w w w . j  a va2s . c  om*/
    miniSolrCloudCluster.uploadConfigDir(new File(configDir.toURI()), MOCK_TABLE);
}

From source file:ddf.catalog.source.solr.SolrProviderRealTimeQueryTest.java

License:Open Source License

@BeforeClass
public static void beforeClass() throws Exception {
    ConfigurationStore store = ConfigurationStore.getInstance();
    // Set to false for real time query by ID tests
    store.setForceAutoCommit(false);//from ww w.ja va 2  s  .co m
    String solrDataPath = Paths.get("target/surefire/solr/realtime").toString();
    System.setProperty("solr.data.dir", solrDataPath);
    store.setDataDirectoryPath(solrDataPath);

    System.setProperty("jute.maxbuffer", "20000000"); // windows solution

    miniSolrCloud = new MiniSolrCloudCluster(1, baseDir.getRoot().toPath(),
            JettyConfig.builder().setContext("/solr").build());

    System.setProperty("solr.cloud.shardCount", "1");
    System.setProperty("solr.cloud.replicationFactor", "1");
    System.setProperty("solr.cloud.maxShardPerNode", "1");
    System.setProperty("solr.cloud.zookeeper.chroot", "/solr");
    System.setProperty("solr.cloud.zookeeper", miniSolrCloud.getZkServer().getZkHost());
    // Set soft commit and hard commit times high, so they will not impact the tests.
    System.setProperty("solr.autoSoftCommit.maxTime", String.valueOf(TimeUnit.MINUTES.toMillis(30)));
    System.setProperty("solr.autoCommit.maxTime", String.valueOf(TimeUnit.MINUTES.toMillis((45))));
    System.setProperty("solr.commit.nrt.metacardTypes", COMMIT_NRT_TYPE);
    System.setProperty("solr.commit.nrt.commitWithinMs", "1");

    SolrCloudClientFactory solrClientFactory = new SolrCloudClientFactory();
    solrClient = solrClientFactory.newClient("catalog");

    Assert.assertThat("Solr client is not available for testing", solrClient.isAvailable(30L, TimeUnit.SECONDS),
            Matchers.equalTo(true));

    provider = new SolrCatalogProvider(solrClient, new GeotoolsFilterAdapterImpl(),
            new SolrFilterDelegateFactoryImpl());

    // Mask the id, this is something that the CatalogFramework would usually do
    provider.setId(MASKED_ID);
}

From source file:ddf.catalog.source.solr.SolrProviderTest.java

License:Open Source License

@BeforeClass
public static void beforeClass() throws Exception {
    ConfigurationStore store = ConfigurationStore.getInstance();
    store.setForceAutoCommit(true);//  w  ww .j a  v a 2  s. c om
    String solrDataPath = Paths.get("target/surefire/solr").toString();
    System.setProperty("solr.data.dir", solrDataPath);
    store.setDataDirectoryPath(solrDataPath);

    System.setProperty("jute.maxbuffer", "20000000"); // windows solution

    miniSolrCloud = new MiniSolrCloudCluster(1, baseDir.getRoot().toPath(),
            JettyConfig.builder().setContext("/solr").build());

    System.setProperty("solr.cloud.shardCount", "1");
    System.setProperty("solr.cloud.replicationFactor", "1");
    System.setProperty("solr.cloud.maxShardPerNode", "1");
    System.setProperty("solr.cloud.zookeeper.chroot", "/solr");
    System.setProperty("solr.cloud.zookeeper", miniSolrCloud.getZkServer().getZkHost());
    System.setProperty("metadata.size.limit", Integer.toString(FIVE_MEGABYTES));

    SolrCloudClientFactory solrClientFactory = new SolrCloudClientFactory();
    solrClient = solrClientFactory.newClient("catalog");

    Assert.assertThat("Solr client is not available for testing", solrClient.isAvailable(30L, TimeUnit.SECONDS),
            Matchers.equalTo(true));

    provider = new SolrCatalogProvider(solrClient, new GeotoolsFilterAdapterImpl(),
            new SolrFilterDelegateFactoryImpl());

    // Mask the id, this is something that the CatalogFramework would usually do
    provider.setId(MASKED_ID);
}

From source file:org.codice.ddf.commands.solr.SolrCommandTest.java

License:Open Source License

protected static void createMiniSolrCloudCluster() throws Exception {
    miniSolrCloud = new MiniSolrCloudCluster(1, getBaseDirPath(),
            JettyConfig.builder().setContext("/solr").build());
    miniSolrCloud.getSolrClient().connect();
    System.setProperty("solr.cloud.shardCount", "1");
    System.setProperty("solr.cloud.replicationFactor", "1");
    System.setProperty("solr.cloud.maxShardPerNode", "1");
    System.setProperty("solr.cloud.zookeeper.chroot", "/solr");
    System.setProperty(SolrCommands.ZOOKEEPER_HOSTS_PROP, miniSolrCloud.getZkServer().getZkHost());
    // Set soft commit and hard commit times high, so they will not impact the tests.
    System.setProperty("solr.autoSoftCommit.maxTime", String.valueOf(100));
    System.setProperty("solr.autoCommit.maxTime", String.valueOf(100));
}