4

For Solr 5 the developers have announced that the Solr server will soon be a standalone server as opposed to a webapp as it has been in the past.

My question is about how I would spin up a clean Solr instance for my integration tests, considering the fact that Solr is not a webapp anymore (actually, currently it still is, but this will likely change soon).

Having it as a webapp was quite convenient for integration tests. We could just use the cargo-maven plugin to deploy the war and copy over some configuration files. What would my options be for a standalone Solr server?

Malik Atalla
  • 193
  • 8

1 Answers1

3

I had the same problem: a project [1] which used Solr 4.x and a huge integration suite managed by Maven and Cargo. After migrating to Solr 5.3.1, I had to change my approach.

Actually it is very simple: Each (TestCase) class should extends

org.apache.solr.SolrJettyTestBase

The servlet engine is not automatically started, it's up to you. Instead, there's an @AfterClass method that (in case Jetty has been started) stop it at the end of the test methods.

You can find a working example here [2].


[1] https://github.com/agazzarini/SolRDF
[2] https://github.com/agazzarini/SolRDF/blob/master/solrdf/solrdf-integration-tests/src/test/java/org/gazzax/labs/solrdf/integration/IntegrationTestSupertypeLayer.java

Andrea
  • 2,714
  • 3
  • 27
  • 38