简体   繁体   English

Solr虚拟或测试环境

[英]Solr virtual or test environment

Does Solr have support for setting up a virtual environment for testing? Solr是否支持设置虚拟环境进行测试? I'm writing some test cases of a SolrJ client, using an EmbeddedSolrServer . 我正在使用EmbeddedSolrServer编写一些SolrJ客户端的测试用例。

Right now I'm looking at having my JUnit test case generate a temporary Solr home that can be passed to the CoreContainer used by EmbeddedSolrServer . 现在,我看有我的JUnit测试用例生成一个临时Solr的主可以传递到所使用的CoreContainer EmbeddedSolrServer Is there any easier way? 有没有更简单的方法?

Yes, take a look on class - http://lucene.apache.org/solr/4_7_0/solr-test-framework/org/apache/solr/SolrTestCaseJ4.html 是的,请看一下课堂-http://lucene.apache.org/solr/4_7_0/solr-test-framework/org/apache/solr/SolrTestCaseJ4.html

All you need is to extend this class, and in test method you could access Solr, send queries, assert response, etc. 您所需要做的就是扩展此类,在测试方法中,您可以访问Solr,发送查询,声明响应等。

Just an example of this kind of test from Solr repo - https://github.com/apache/lucene-solr/blob/c3ef419e4fb720866e88e0020b182de3e25a4fbb/solr/core/src/test/org/apache/solr/search/TestFieldSortValues.java 只是Solr回购中这种测试的一个示例-https: //github.com/apache/lucene-solr/blob/c3ef419e4fb720866e88e0020b182de3e25a4fbb/solr/core/src/test/org/apache/solr/search/TestFieldSortValues.java

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM