[DS-3832] Recast test support classes.

This commit is contained in:
Mark H. Wood
2018-03-27 21:14:49 -04:00
parent 074337f167
commit 6b9cfec8c6
4 changed files with 101 additions and 13 deletions

View File

@@ -15,18 +15,29 @@ import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
/**
* Mock service that uses an embedded SOLR server for the statistics core
* Mock service that uses an embedded SOLR server for the statistics core.
*/
public class MockSolrLoggerServiceImpl extends SolrLoggerServiceImpl implements InitializingBean {
public class MockSolrLoggerServiceImpl
extends SolrLoggerServiceImpl
implements InitializingBean {
@Autowired(required = true)
private ConfigurationService configurationService;
public MockSolrLoggerServiceImpl() {
}
@Override
public void afterPropertiesSet() throws Exception {
//We don't use SOLR in the tests of this module
solr = null;
locationService = new DatabaseReader.Builder(new File(".")).build();
new FakeDatabaseReader(); // Activate fake
new FakeDatabaseReader.Builder(); // Activate fake
String locationDbPath = configurationService.getProperty("usage-statistics.dbfile");
File locationDb = new File(locationDbPath);
locationDb.createNewFile();
locationService = new DatabaseReader.Builder(locationDb).build();
useProxies = configurationService.getBooleanProperty("useProxies");
}