[DS-4409] Don't use live GeoLite database for testing -- there might not be one.

This commit is contained in:
Mark H. Wood
2020-01-07 16:23:17 -05:00
parent e018386175
commit 692bbd9449

View File

@@ -10,9 +10,7 @@ package org.dspace.statistics;
import java.io.File;
import com.maxmind.geoip2.DatabaseReader;
import org.dspace.services.ConfigurationService;
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.
@@ -21,9 +19,6 @@ public class MockSolrLoggerServiceImpl
extends SolrLoggerServiceImpl
implements InitializingBean {
@Autowired(required = true)
private ConfigurationService configurationService;
public MockSolrLoggerServiceImpl() {
}
@@ -34,9 +29,8 @@ public class MockSolrLoggerServiceImpl
new FakeDatabaseReader(); // Activate fake
new FakeDatabaseReader.Builder(); // Activate fake
String locationDbPath = configurationService.getProperty("usage-statistics.dbfile");
File locationDb = new File(locationDbPath);
locationDb.createNewFile();
File locationDb = File.createTempFile("GeoIP", ".db");
locationDb.deleteOnExit();
locationService = new DatabaseReader.Builder(locationDb).build();
}