You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Vijay Balakrishnan <bv...@gmail.com> on 2014/05/13 20:46:45 UTC

Independent/Selfcontained Solr Unit testing with JUnit

Hi,

Is there any way to run self-contained JUnit tests for say a Solr dependent
class where it doesn't depend on Solr being up and running at
localhost:8983 ? I have a collection etc. setup on the Solr server.

Is it possible to mockit with an EmbeddedSolr easily  with a @Before or
@BeforeClass annotation in JUnit4 ?

Any pointers to examples would be awesome(I am also trying to look in the
source).

 TIA,

Vijay

Re: Independent/Selfcontained Solr Unit testing with JUnit

Posted by Shawn Heisey <so...@elyograg.org>.
On 5/13/2014 12:46 PM, Vijay Balakrishnan wrote:
> Is there any way to run self-contained JUnit tests for say a Solr dependent
> class where it doesn't depend on Solr being up and running at
> localhost:8983 ? I have a collection etc. setup on the Solr server.
> 
> Is it possible to mockit with an EmbeddedSolr easily  with a @Before or
> @BeforeClass annotation in JUnit4 ?
> 
> Any pointers to examples would be awesome(I am also trying to look in the
> source).

An example of a Solr unit test that fires up Jetty (actually, more than
one instance of Jetty) before testing is located here in the source
download or checkout:

solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttpSolrServer.java

Thanks,
Shawn