Search in sources :

Example 1 with SolrCloudClientFactory

use of org.codice.solr.factory.impl.SolrCloudClientFactory in project ddf by codice.

the class SolrProviderRealTimeQueryTest method beforeClass.

@BeforeClass
public static void beforeClass() throws Exception {
    ConfigurationStore store = ConfigurationStore.getInstance();
    // Set to false for real time query by ID tests
    store.setForceAutoCommit(false);
    String solrDataPath = Paths.get("target/surefire/ddf/realtime").toString();
    System.setProperty("ddf.home", solrDataPath);
    store.setDataDirectoryPath(solrDataPath);
    // windows solution
    System.setProperty("jute.maxbuffer", "20000000");
    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));
    DynamicSchemaResolver dynamicSchemaResolver = new DynamicSchemaResolver();
    dynamicSchemaResolver.addMetacardType(BASIC_METACARD);
    provider = new SolrCatalogProviderImpl(solrClient, new GeotoolsFilterAdapterImpl(), new SolrFilterDelegateFactoryImpl(), dynamicSchemaResolver);
    // Mask the id, this is something that the CatalogFramework would usually do
    provider.setId(MASKED_ID);
}
Also used : SolrCloudClientFactory(org.codice.solr.factory.impl.SolrCloudClientFactory) MiniSolrCloudCluster(org.apache.solr.cloud.MiniSolrCloudCluster) GeotoolsFilterAdapterImpl(ddf.catalog.filter.proxy.adapter.GeotoolsFilterAdapterImpl) BeforeClass(org.junit.BeforeClass)

Example 2 with SolrCloudClientFactory

use of org.codice.solr.factory.impl.SolrCloudClientFactory in project ddf by codice.

the class SolrProviderTest method beforeClass.

@BeforeClass
public static void beforeClass() throws Exception {
    ConfigurationStore store = ConfigurationStore.getInstance();
    store.setForceAutoCommit(true);
    String solrDataPath = Paths.get("target/surefire/ddf").toString();
    System.setProperty("ddf.home", solrDataPath);
    store.setDataDirectoryPath(solrDataPath);
    // windows solution
    System.setProperty("jute.maxbuffer", "20000000");
    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));
    System.setProperty("solr.query.sort.caseInsensitive", "true");
    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));
    DynamicSchemaResolver dynamicSchemaResolver = new DynamicSchemaResolver();
    dynamicSchemaResolver.addMetacardType(BASIC_METACARD);
    provider = new SolrCatalogProviderImpl(solrClient, new GeotoolsFilterAdapterImpl(), new SolrFilterDelegateFactoryImpl(), dynamicSchemaResolver);
    // Mask the id, this is something that the CatalogFramework would usually do
    provider.setId(MASKED_ID);
}
Also used : SolrCloudClientFactory(org.codice.solr.factory.impl.SolrCloudClientFactory) MiniSolrCloudCluster(org.apache.solr.cloud.MiniSolrCloudCluster) GeotoolsFilterAdapterImpl(ddf.catalog.filter.proxy.adapter.GeotoolsFilterAdapterImpl) BeforeClass(org.junit.BeforeClass)

Aggregations

GeotoolsFilterAdapterImpl (ddf.catalog.filter.proxy.adapter.GeotoolsFilterAdapterImpl)2 MiniSolrCloudCluster (org.apache.solr.cloud.MiniSolrCloudCluster)2 SolrCloudClientFactory (org.codice.solr.factory.impl.SolrCloudClientFactory)2 BeforeClass (org.junit.BeforeClass)2