takezoe/solr-scala-client — pull request #10 by codingismy11to7 (2014-02-24 16:22:05+00:00)
Title: Refactor AsyncSolrClient to support testing

Hi, I've been testing out your library and definitely like it, I just wondered if you might roll this commit in so we don't have to maintain a branch (and hey, other people might find it useful).

Basically I have a lot of unit tests that start an EmbeddedSolrServer, load data, run tests, then shutdown. With AsyncSolrClient and AsyncQueryBuilder being concrete, I couldn't write unit tests using this library, so I factored out a trait and an abstract class that made it easy for me to plug in an EmbeddedSolrServer for query(), commit(), rollback(), and shutdown(), manually wrapped in futures. I've not started using solr-scala-client extensively yet, but so far it's passed all the tests I've written.

I also changed withTransaction() to not complete the returned future until after the commit() or rollback() has completed.

1. Bump SolrJ version from 4.2.0 to 4.5.1
2. Refactor AsyncSolrClient & AsyncQueryBuilder into a trait (IAsyncSolrClient) and an abstract class (AbstractAsyncQueryBuilder) which allows us to plug in an EmbeddedSolrServer for testing purposes
3. Modify [I]AsyncSolrClient.withTransaction to not complete the future until the commit() or rollback() has completed