org.apache.solr.core.NodeConfig Java Examples

The following examples show how to use org.apache.solr.core.NodeConfig. 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: TestEmbeddedSolrServerConstructors.java    From lucene-solr with Apache License 2.0 6 votes vote down vote up
@Test
public void testNodeConfigConstructor() throws Exception {
  Path path = createTempDir();

  NodeConfig config = new NodeConfig.NodeConfigBuilder("testnode", path)
      .setConfigSetBaseDirectory(Paths.get(TEST_HOME()).resolve("configsets").toString())
      .build();

  try (EmbeddedSolrServer server = new EmbeddedSolrServer(config, "newcore")) {

    CoreAdminRequest.Create createRequest = new CoreAdminRequest.Create();
    createRequest.setCoreName("newcore");
    createRequest.setConfigSet("minimal");
    server.request(createRequest);

    SolrInputDocument doc = new SolrInputDocument();
    doc.addField("articleid", "test");
    server.add("newcore", doc);
    server.commit();

    assertEquals(1, server.query(new SolrQuery("*:*")).getResults().getNumFound());
    assertEquals(1, server.query("newcore", new SolrQuery("*:*")).getResults().getNumFound());

  }
}
 
Example #2
Source File: MetricsConfigTest.java    From lucene-solr with Apache License 2.0 6 votes vote down vote up
@Test
public void testCustomReservoir() throws Exception {
  System.setProperty("timer.reservoir", UniformReservoir.class.getName());
  System.setProperty("histogram.size", "2048");
  System.setProperty("histogram.window", "600");
  System.setProperty("histogram.reservoir", SlidingTimeWindowReservoir.class.getName());
  NodeConfig cfg = loadNodeConfig();
  SolrMetricManager mgr = new SolrMetricManager(cfg.getSolrResourceLoader(), cfg.getMetricsConfig());
  assertTrue(mgr.getCounterSupplier() instanceof MetricSuppliers.DefaultCounterSupplier);
  assertTrue(mgr.getMeterSupplier() instanceof MetricSuppliers.DefaultMeterSupplier);
  assertTrue(mgr.getTimerSupplier() instanceof MetricSuppliers.DefaultTimerSupplier);
  assertTrue(mgr.getHistogramSupplier() instanceof MetricSuppliers.DefaultHistogramSupplier);
  Reservoir rsv = ((MetricSuppliers.DefaultTimerSupplier)mgr.getTimerSupplier()).getReservoir();
  assertTrue(rsv instanceof UniformReservoir);
  rsv = ((MetricSuppliers.DefaultHistogramSupplier)mgr.getHistogramSupplier()).getReservoir();
  assertTrue(rsv instanceof SlidingTimeWindowReservoir);
}
 
Example #3
Source File: JvmMetricsTest.java    From lucene-solr with Apache License 2.0 6 votes vote down vote up
@Test
public void testHiddenSysProps() throws Exception {
  Path home = Paths.get(TEST_HOME());

  // default config
  String solrXml = FileUtils.readFileToString(Paths.get(home.toString(), "solr.xml").toFile(), "UTF-8");
  NodeConfig config = SolrXmlConfig.fromString(home, solrXml);
  NodeConfig.NodeConfigBuilder.DEFAULT_HIDDEN_SYS_PROPS.forEach(s -> {
    assertTrue(s, config.getMetricsConfig().getHiddenSysProps().contains(s));
  });

  // custom config
  solrXml = FileUtils.readFileToString(home.resolve("solr-hiddensysprops.xml").toFile(), "UTF-8");
  NodeConfig config2 = SolrXmlConfig.fromString(home, solrXml);
  Arrays.asList("foo", "bar", "baz").forEach(s -> {
    assertTrue(s, config2.getMetricsConfig().getHiddenSysProps().contains(s));
  });
}
 
Example #4
Source File: JvmMetricsTest.java    From lucene-solr with Apache License 2.0 6 votes vote down vote up
@Test
public void testSystemProperties() throws Exception {
  if (System.getProperty("basicauth") == null) {
    // make sure it's set
    System.setProperty("basicauth", "foo:bar");
  }
  SolrMetricManager metricManager = jetty.getCoreContainer().getMetricManager();
  Map<String,Metric> metrics = metricManager.registry("solr.jvm").getMetrics();
  MetricsMap map = (MetricsMap)((SolrMetricManager.GaugeWrapper)metrics.get("system.properties")).getGauge();
  assertNotNull(map);
  Map<String,Object> values = map.getValue();
  System.getProperties().forEach((k, v) -> {
    if (NodeConfig.NodeConfigBuilder.DEFAULT_HIDDEN_SYS_PROPS.contains(k)) {
      assertNull("hidden property " + k + " present!", values.get(k));
    } else {
      assertEquals(v, values.get(String.valueOf(k)));
    }
  });
}
 
Example #5
Source File: SolrDispatchFilter.java    From lucene-solr with Apache License 2.0 6 votes vote down vote up
/**
 * Get the NodeConfig whether stored on disk, in ZooKeeper, etc.
 * This may also be used by custom filters to load relevant configuration.
 * @return the NodeConfig
 */
public static NodeConfig loadNodeConfig(Path solrHome, Properties nodeProperties) {
  if (!StringUtils.isEmpty(System.getProperty("solr.solrxml.location"))) {
    log.warn("Solr property solr.solrxml.location is no longer supported. Will automatically load solr.xml from ZooKeeper if it exists");
  }

  String zkHost = System.getProperty("zkHost");
  if (!StringUtils.isEmpty(zkHost)) {
    int startUpZkTimeOut = Integer.getInteger("waitForZk", 30);
    startUpZkTimeOut *= 1000;
    try (SolrZkClient zkClient = new SolrZkClient(zkHost, startUpZkTimeOut)) {
      if (zkClient.exists("/solr.xml", true)) {
        log.info("solr.xml found in ZooKeeper. Loading...");
        byte[] data = zkClient.getData("/solr.xml", null, null, true);
        return SolrXmlConfig.fromInputStream(solrHome, new ByteArrayInputStream(data), nodeProperties, true);
      }
    } catch (Exception e) {
      throw new SolrException(ErrorCode.SERVER_ERROR, "Error occurred while loading solr.xml from zookeeper", e);
    }
    log.info("Loading solr.xml from SolrHome (not found in ZooKeeper)");
  }

  return SolrXmlConfig.fromSolrHome(solrHome, nodeProperties);
}
 
Example #6
Source File: TestEmbeddedSolrServerAdminHandler.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
@Test
@SuppressWarnings({"rawtypes"})
public void testPathIsAddedToContext() throws IOException, SolrServerException {

    final NodeConfig config = new NodeConfig.NodeConfigBuilder("testnode", TEST_PATH())
            .setConfigSetBaseDirectory(TEST_PATH().resolve("configsets").toString())
            .build();

    try (final EmbeddedSolrServer server = new EmbeddedSolrServer(config, "collection1")) {
        final SystemInfoRequest info = new SystemInfoRequest();
        final NamedList response = server.request(info);
        assertTrue(response.size() > 0);
    }
}
 
Example #7
Source File: SolrGraphiteReporterTest.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
@Test
public void testReporter() throws Exception {
  int jmxReporter = JmxUtil.findFirstMBeanServer() != null ? 1: 0;
  Path home = Paths.get(TEST_HOME());
  // define these properties, they are used in solrconfig.xml
  System.setProperty("solr.test.sys.prop1", "propone");
  System.setProperty("solr.test.sys.prop2", "proptwo");

  MockGraphite mock = new MockGraphite();
  try {
    mock.start();
    Thread.sleep(1000);
    // define the port where MockGraphite is running
    System.setProperty("mock-graphite-port", String.valueOf(mock.port));
    String solrXml = FileUtils.readFileToString(Paths.get(home.toString(), "solr-graphitereporter.xml").toFile(), "UTF-8");
    NodeConfig cfg = SolrXmlConfig.fromString(home, solrXml);
    CoreContainer cc = createCoreContainer(cfg, new TestHarness.TestCoresLocator
                                           (DEFAULT_TEST_CORENAME, initAndGetDataDir().getAbsolutePath(),
                                            "solrconfig.xml", "schema.xml"));
                                           
    h.coreName = DEFAULT_TEST_CORENAME;
    SolrMetricManager metricManager = cc.getMetricManager();
    Map<String, SolrMetricReporter> reporters = metricManager.getReporters("solr.node");
    assertEquals(1 + jmxReporter, reporters.size());
    SolrMetricReporter reporter = reporters.get("test");
    assertNotNull(reporter);
    assertTrue(reporter instanceof SolrGraphiteReporter);
    Thread.sleep(5000);
    assertTrue(mock.lines.size() >= 3);
    String[] frozenLines = mock.lines.toArray(new String[mock.lines.size()]);
    for (String line : frozenLines) {
      assertTrue(line, line.startsWith("test.solr.node.CONTAINER.cores."));
    }
  } finally {
    mock.close();
  }
}
 
Example #8
Source File: MetricsConfigTest.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
@Test
public void testCustomSupplier() throws Exception {
  System.setProperty("counter.class", MockCounterSupplier.class.getName());
  System.setProperty("meter.class", MockMeterSupplier.class.getName());
  System.setProperty("timer.class", MockTimerSupplier.class.getName());
  System.setProperty("histogram.class", MockHistogramSupplier.class.getName());
  NodeConfig cfg = loadNodeConfig();
  SolrMetricManager mgr = new SolrMetricManager(cfg.getSolrResourceLoader(), cfg.getMetricsConfig());
  assertTrue(mgr.getCounterSupplier() instanceof MockCounterSupplier);
  assertTrue(mgr.getMeterSupplier() instanceof MockMeterSupplier);
  assertTrue(mgr.getTimerSupplier() instanceof MockTimerSupplier);
  assertTrue(mgr.getHistogramSupplier() instanceof MockHistogramSupplier);

  // assert setter-based configuration
  MockCounterSupplier mockCounterSupplier = ((MockCounterSupplier)mgr.getCounterSupplier());
  assertEquals("bar", mockCounterSupplier.foo);
  MockMeterSupplier mockMeterSupplier = ((MockMeterSupplier)mgr.getMeterSupplier());
  assertEquals("bar", mockMeterSupplier.foo);
  MockTimerSupplier mockTimerSupplier = ((MockTimerSupplier)mgr.getTimerSupplier());
  assertEquals(true, mockTimerSupplier.boolParam);
  assertEquals("strParam", mockTimerSupplier.strParam);
  assertEquals(-100, mockTimerSupplier.intParam);

  // assert PluginInfoInitialized-based configuration
  MockHistogramSupplier mockHistogramSupplier = ((MockHistogramSupplier)mgr.getHistogramSupplier());
  assertNotNull(mockHistogramSupplier.info);
}
 
Example #9
Source File: MetricsConfigTest.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
@Test
public void testDefaults() throws Exception {
  NodeConfig cfg = loadNodeConfig();
  SolrMetricManager mgr = new SolrMetricManager(cfg.getSolrResourceLoader(), cfg.getMetricsConfig());
  assertTrue(mgr.getCounterSupplier() instanceof MetricSuppliers.DefaultCounterSupplier);
  assertTrue(mgr.getMeterSupplier() instanceof MetricSuppliers.DefaultMeterSupplier);
  assertTrue(mgr.getTimerSupplier() instanceof MetricSuppliers.DefaultTimerSupplier);
  assertTrue(mgr.getHistogramSupplier() instanceof MetricSuppliers.DefaultHistogramSupplier);
  Clock clk = ((MetricSuppliers.DefaultTimerSupplier)mgr.getTimerSupplier()).clk;
  assertTrue(clk instanceof Clock.UserTimeClock);
  Reservoir rsv = ((MetricSuppliers.DefaultTimerSupplier)mgr.getTimerSupplier()).getReservoir();
  assertTrue(rsv instanceof ExponentiallyDecayingReservoir);
}
 
Example #10
Source File: SolrDispatchFilter.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
/**
 * Override this to change CoreContainer initialization
 * @return a CoreContainer to hold this server's cores
 */
protected CoreContainer createCoreContainer(Path solrHome, Properties extraProperties) {
  NodeConfig nodeConfig = loadNodeConfig(solrHome, extraProperties);
  final CoreContainer coreContainer = new CoreContainer(nodeConfig, true);
  coreContainer.load();
  return coreContainer;
}
 
Example #11
Source File: SolrCoreMetricManager.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
/**
 * Load reporters configured globally and specific to {@link org.apache.solr.core.SolrInfoBean.Group#core}
 * group or with a registry name specific to this core.
 */
public void loadReporters() {
  CoreContainer coreContainer = core.getCoreContainer();
  NodeConfig nodeConfig = coreContainer.getConfig();
  PluginInfo[] pluginInfos = nodeConfig.getMetricsConfig().getMetricReporters();
  metricManager.loadReporters(pluginInfos, core.getResourceLoader(), coreContainer, core, solrMetricsContext.getTag(),
      SolrInfoBean.Group.core, solrMetricsContext.getRegistryName());
  if (cloudMode) {
    metricManager.loadShardReporters(pluginInfos, core);
  }
}
 
Example #12
Source File: TestHarness.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
public static NodeConfig buildTestNodeConfig(Path solrHome) {
  CloudConfig cloudConfig = new CloudConfig.CloudConfigBuilder(System.getProperty("host"),
                                                               Integer.getInteger("hostPort", 8983),
                                                               System.getProperty("hostContext", ""))
      .setZkClientTimeout(Integer.getInteger("zkClientTimeout", 30000))
      .build();
  if (System.getProperty("zkHost") == null)
    cloudConfig = null;
  UpdateShardHandlerConfig updateShardHandlerConfig = new UpdateShardHandlerConfig(
      HttpClientUtil.DEFAULT_MAXCONNECTIONS,
      HttpClientUtil.DEFAULT_MAXCONNECTIONSPERHOST,
      30000, 30000,
      UpdateShardHandlerConfig.DEFAULT_METRICNAMESTRATEGY, UpdateShardHandlerConfig.DEFAULT_MAXRECOVERYTHREADS);
  // universal default metric reporter
  Map<String,Object> attributes = new HashMap<>();
  attributes.put("name", "default");
  attributes.put("class", SolrJmxReporter.class.getName());
  PluginInfo defaultPlugin = new PluginInfo("reporter", attributes);
  MetricsConfig metricsConfig = new MetricsConfig.MetricsConfigBuilder()
      .setMetricReporterPlugins(new PluginInfo[] {defaultPlugin})
      .build();

  return new NodeConfig.NodeConfigBuilder("testNode", solrHome)
      .setUseSchemaCache(Boolean.getBoolean("shareSchema"))
      .setCloudConfig(cloudConfig)
      .setUpdateShardHandlerConfig(updateShardHandlerConfig)
      .setMetricsConfig(metricsConfig)
      .build();
}
 
Example #13
Source File: TestHarness.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
/**
 * Create a TestHarness using a specific config
 * @param config the ConfigSolr to use
 */
public TestHarness(NodeConfig config, CoresLocator coresLocator) {
  container = new CoreContainer(config, coresLocator);
  container.load();
  updater = new UpdateRequestHandler();
  updater.init(null);
}
 
Example #14
Source File: SolrTestCaseJ4.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
public static CoreContainer createCoreContainer(String coreName, String dataDir, String solrConfig, String schema) {
  NodeConfig nodeConfig = TestHarness.buildTestNodeConfig(TEST_PATH());
  CoresLocator locator = new TestHarness.TestCoresLocator(coreName, dataDir, solrConfig, schema);
  CoreContainer cc = createCoreContainer(nodeConfig, locator);
  h.coreName = coreName;
  return cc;
}
 
Example #15
Source File: SolrMetricsIntegrationTest.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
@Before
public void beforeTest() throws Exception {
  Path home = Paths.get(TEST_HOME());
  // define these properties, they are used in solrconfig.xml
  System.setProperty("solr.test.sys.prop1", "propone");
  System.setProperty("solr.test.sys.prop2", "proptwo");
  String solrXml = FileUtils.readFileToString(Paths.get(home.toString(), "solr-metricreporter.xml").toFile(), "UTF-8");
  NodeConfig cfg = SolrXmlConfig.fromString(home, solrXml);
  cc = createCoreContainer(cfg, new TestHarness.TestCoresLocator
                           (DEFAULT_TEST_CORENAME, initAndGetDataDir().getAbsolutePath(),
                            "solrconfig.xml", "schema.xml"));
                           
  h.coreName = DEFAULT_TEST_CORENAME;
  jmxReporter = JmxUtil.findFirstMBeanServer() != null ? 1 : 0;
  metricManager = cc.getMetricManager();
  tag = h.getCore().getCoreMetricManager().getTag();
  // initially there are more reporters, because two of them are added via a matching collection name
  Map<String, SolrMetricReporter> reporters = metricManager.getReporters("solr.core." + DEFAULT_TEST_CORENAME);
  assertEquals(INITIAL_REPORTERS.length + jmxReporter, reporters.size());
  for (String r : INITIAL_REPORTERS) {
    assertTagged(reporters, r);
  }
  // test rename operation
  cc.rename(DEFAULT_TEST_CORENAME, CORE_NAME);
  h.coreName = CORE_NAME;
  cfg = cc.getConfig();
  PluginInfo[] plugins = cfg.getMetricsConfig().getMetricReporters();
  assertNotNull(plugins);
  assertEquals(10 + jmxReporter, plugins.length);
  reporters = metricManager.getReporters("solr.node");
  assertEquals(4 + jmxReporter, reporters.size());
  assertTrue("Reporter '" + REPORTER_NAMES[0] + "' missing in solr.node", reporters.containsKey(REPORTER_NAMES[0]));
  assertTrue("Reporter '" + UNIVERSAL + "' missing in solr.node", reporters.containsKey(UNIVERSAL));
  assertTrue("Reporter '" + MULTIGROUP + "' missing in solr.node", reporters.containsKey(MULTIGROUP));
  assertTrue("Reporter '" + MULTIREGISTRY + "' missing in solr.node", reporters.containsKey(MULTIREGISTRY));
  SolrMetricReporter reporter = reporters.get(REPORTER_NAMES[0]);
  assertTrue("Reporter " + reporter + " is not an instance of " + MockMetricReporter.class.getName(),
      reporter instanceof  MockMetricReporter);
  reporter = reporters.get(UNIVERSAL);
  assertTrue("Reporter " + reporter + " is not an instance of " + MockMetricReporter.class.getName(),
      reporter instanceof  MockMetricReporter);
}
 
Example #16
Source File: TestHarness.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
public TestHarness(NodeConfig nodeConfig) {
  this(nodeConfig, new CorePropertiesLocator(nodeConfig.getCoreRootDirectory()));
}
 
Example #17
Source File: MetricsConfigTest.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
private NodeConfig loadNodeConfig() throws Exception {
  InputStream is = MetricsConfigTest.class.getResourceAsStream("/solr/solr-metricsconfig.xml");
  return SolrXmlConfig.fromInputStream(TEST_PATH(), is, new Properties()); //TODO pass in props
}
 
Example #18
Source File: SolrSlf4jReporterTest.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
@Test
public void testReporter() throws Exception {
  ensureLoggingConfiguredAppropriately();
  Path home = Paths.get(TEST_HOME());
  // define these properties, they are used in solrconfig.xml
  System.setProperty("solr.test.sys.prop1", "propone");
  System.setProperty("solr.test.sys.prop2", "proptwo");

  String solrXml = FileUtils.readFileToString(Paths.get(home.toString(), "solr-slf4jreporter.xml").toFile(), "UTF-8");
  NodeConfig cfg = SolrXmlConfig.fromString(home, solrXml);
  CoreContainer cc = createCoreContainer(cfg, new TestHarness.TestCoresLocator
                                         (DEFAULT_TEST_CORENAME, initAndGetDataDir().getAbsolutePath(),
                                          "solrconfig.xml", "schema.xml"));
                                         
  h.coreName = DEFAULT_TEST_CORENAME;
  SolrMetricManager metricManager = cc.getMetricManager();
  Map<String, SolrMetricReporter> reporters = metricManager.getReporters("solr.node");
  assertTrue(reporters.toString(), reporters.size() >= 2);
  SolrMetricReporter reporter1 = reporters.get("test1");
  assertNotNull(reporter1);
  assertTrue(reporter1 instanceof SolrSlf4jReporter);
  SolrMetricReporter reporter2 = reporters.get("test2");
  assertNotNull(reporter2);
  assertTrue(reporter2 instanceof SolrSlf4jReporter);

  LogWatcherConfig watcherCfg = new LogWatcherConfig(true, null, null, 100);
  @SuppressWarnings({"rawtypes"})
  LogWatcher watcher = LogWatcher.newRegisteredLogWatcher(watcherCfg, null);
  watcher.setThreshold("INFO");

  watcher.reset();
  int cnt = 20;
  boolean active;
  do {
    Thread.sleep(1000);
    cnt--;
    active = ((SolrSlf4jReporter)reporter1).isActive() && ((SolrSlf4jReporter)reporter2).isActive();
  } while (!active && cnt > 0);
  if (!active) {
    fail("One or more reporters didn't become active in 20 seconds");
  }
  Thread.sleep(10000);

  SolrDocumentList history = watcher.getHistory(-1, null);
  // dot-separated names are treated like class names and collapsed
  // in regular log output, but here we get the full name
  if (history.stream().filter(d -> "solr.node".equals(d.getFirstValue("logger"))).count() == 0) {
    fail("No 'solr.node' logs in: " + history.toString());
  }
  if (history.stream().filter(d -> "foobar".equals(d.getFirstValue("logger"))).count() == 0) {
    fail("No 'foobar' logs in: " + history.toString());
  }
  if (history.stream().filter(d -> "x:collection1".equals(d.getFirstValue("core"))).count() == 0) {
    fail("No 'solr.core' or MDC context in logs: " + history.toString());
  }
}
 
Example #19
Source File: SolrTestCaseJ4.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
public static CoreContainer createCoreContainer(NodeConfig config, CoresLocator locator) {
  testSolrHome = config.getSolrHome();
  h = new TestHarness(config, locator);
  lrf = h.getRequestFactory("", 0, 20, CommonParams.VERSION, "2.2");
  return h.getCoreContainer();
}
 
Example #20
Source File: AbstractAlfrescoSolrIT.java    From SearchServices with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * @deprecated as testHarness is used
 */
@Deprecated
public static void createAlfrescoCore(String schema) throws ParserConfigurationException, IOException, SAXException
{
    Properties properties = new Properties();
    properties.put("solr.tests.maxBufferedDocs", "1000");
    properties.put("solr.tests.maxIndexingThreads", "10");
    properties.put("solr.tests.ramBufferSizeMB", "1024");
    properties.put("solr.tests.mergeScheduler", "org.apache.lucene.index.ConcurrentMergeScheduler");
    properties.put("alfresco.acl.tracker.cron", "0/10 * * * * ? *");
    properties.put("alfresco.content.tracker.cron", "0/10 * * * * ? *");
    properties.put("alfresco.metadata.tracker.cron", "0/10 * * * * ? *");
    properties.put("alfresco.cascade.tracker.cron", "0/10 * * * * ? *");
    properties.put("alfresco.commit.tracker.cron", "0/10 * * * * ? *");
    if("schema.xml".equalsIgnoreCase(schema))
    {
        String templateName = System.getProperty("templateName", "rerank");
        FileUtils.copyFile(
                Paths.get(String.format(templateConf, templateName) + schema).toFile(),
                Paths.get(testSolrConf + schema).toFile());
    }

    SolrResourceLoader resourceLoader = new SolrResourceLoader(Paths.get(testExecutionSolrHome), null, properties);
    TestCoresLocator locator = new TestCoresLocator(SolrTestCaseJ4.DEFAULT_TEST_CORENAME,
                                                    "data", 
                                                    "solrconfig.xml",
                                                    schema);
    
    NodeConfig nodeConfig = new NodeConfig.NodeConfigBuilder("name", resourceLoader)
            .setUseSchemaCache(false)
            .setCoreAdminHandlerClass(AlfrescoCoreAdminHandler.class.getName())
            .build();
    try
    {
        h = new TestHarness(nodeConfig, locator);
        h.coreName = SolrTestCaseJ4.DEFAULT_TEST_CORENAME;
        CORE_NOT_YET_CREATED = false;
    }
    catch(Exception e)
    {
        LOG.info("we hit an issue", e);
    }
    lrf = h.getRequestFactory
            ("standard",0,20, CommonParams.VERSION,"2.2");
}
 
Example #21
Source File: EmbeddedSolrServer.java    From lucene-solr with Apache License 2.0 2 votes vote down vote up
/**
 * Create an EmbeddedSolrServer using a NodeConfig
 *
 * @param nodeConfig      the configuration
 * @param defaultCoreName the core to route requests to by default (optional)
 */
public EmbeddedSolrServer(NodeConfig nodeConfig, String defaultCoreName) {
  this(load(new CoreContainer(nodeConfig)), defaultCoreName);
}