Writing unit tests for Solr plugin using JUnit4, including creating collections
Asked Answered
S

2

8

I wrote a plugin for Solr which contains new stream expressions. Now, I'm trying to understand what is the best way to write them unit tests: Unit tests which need to include creation of collections in Solr, so I will be able to check if my new stream expressions return me the right data they suppose.

I saw over the web that there is a class called "SolrTestCaseJ4", but I didn't find how to use it for creating new collections in Solr and add them data and so on...

Can you please recommend me which class may I use for that purpose or any other way to test my new classes?

BTW, we are using Solr 7.1 in cloud mode and JUnit4.

Thanks in advance.

Schroder answered 21/12, 2017 at 16:39 Comment(0)
S
5

Eventually I found a better class, which simplifies everything and implements more functionality than MiniSolrCloudCluster (actually it contains MiniSolrCloudCluster inside it as a member).

This class called SolrCloudTestCase, and as you can see here, even Solr's source code uses it in their own unit tests.

Schroder answered 31/12, 2017 at 15:4 Comment(0)
S
5

Eventually I found a better class, which simplifies everything and implements more functionality than MiniSolrCloudCluster (actually it contains MiniSolrCloudCluster inside it as a member).

This class called SolrCloudTestCase, and as you can see here, even Solr's source code uses it in their own unit tests.

Schroder answered 31/12, 2017 at 15:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.