我正在为我的 solr-indexer 应用程序编写一些测试。 遵循测试最佳实践,我想编写独立的代码,只需加载 schema.xml
和 solrconfig.xml
并为索引搜索测试创建临时数据树。
由于应用程序大部分是用java编写的,我正在处理SolrJ库,但我遇到了问题(好吧,我迷失在 corecontainers-coredescriptor-coreconfig-solrcore 的宇宙中......)
任何人都可以在这里放置一些代码来创建一个嵌入式服务器来加载配置并写入参数传递的数据目录?
I'm coding some tests for my solr-indexer application. Following testing best practices, I want to write code self-dependant, just loading the schema.xml
and solrconfig.xml
and creating a temporary data tree for the indexing-searching tests.
As the application is most written in java, I'm dealing with SolrJ library, but I'm getting problems (well, I'm lost in the universe of corecontainers-coredescriptor-coreconfig-solrcore ...)
Anyone can place here some code to create an Embedded Server that loads the config and also writes to a parameter-pased data-dir?
发布评论
评论(3)
您可以从 SolrExampleTests 扩展了 SolrExampleTestBase 扩展了 AbstractSolrTestCase 。
还有这个 样本测试。
另请查看 此 和 此线程。
You can start with the SolrExampleTests which extends SolrExampleTestBase which extends AbstractSolrTestCase .
Also this SampleTest.
Also take a look at this and this threads.
这是一个简单测试用例的示例。 solr 是包含 solr 配置文件的目录:
有关详细信息,请参阅此博文:Solr 集成测试
This is an example for a simple test case. solr is the directory that contains your solr configuration files:
See this blogpost for more info:Solr Integration Tests
首先,您需要设置包含 solr.xml 的 Solr 主目录和包含 solrconfig.xml、schema.xml 等的 conf 文件夹。
之后,您可以为 Solrj 使用这个简单且基本的代码。
我希望这有帮助。
First you need to set your Solr Home Directory which contains solr.xml and conf folder containing solrconfig.xml, schema.xml etc.
After that you can use this simple and basic code for Solrj.
I hope this helps.