mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-19 07:53:08 +00:00
[DS-4409] Don't use live GeoLite database for testing -- there might not be one.
This commit is contained in:
@@ -10,9 +10,7 @@ package org.dspace.statistics;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import com.maxmind.geoip2.DatabaseReader;
|
import com.maxmind.geoip2.DatabaseReader;
|
||||||
import org.dspace.services.ConfigurationService;
|
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
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.
|
||||||
@@ -21,9 +19,6 @@ public class MockSolrLoggerServiceImpl
|
|||||||
extends SolrLoggerServiceImpl
|
extends SolrLoggerServiceImpl
|
||||||
implements InitializingBean {
|
implements InitializingBean {
|
||||||
|
|
||||||
@Autowired(required = true)
|
|
||||||
private ConfigurationService configurationService;
|
|
||||||
|
|
||||||
public MockSolrLoggerServiceImpl() {
|
public MockSolrLoggerServiceImpl() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,9 +29,8 @@ public class MockSolrLoggerServiceImpl
|
|||||||
|
|
||||||
new FakeDatabaseReader(); // Activate fake
|
new FakeDatabaseReader(); // Activate fake
|
||||||
new FakeDatabaseReader.Builder(); // Activate fake
|
new FakeDatabaseReader.Builder(); // Activate fake
|
||||||
String locationDbPath = configurationService.getProperty("usage-statistics.dbfile");
|
File locationDb = File.createTempFile("GeoIP", ".db");
|
||||||
File locationDb = new File(locationDbPath);
|
locationDb.deleteOnExit();
|
||||||
locationDb.createNewFile();
|
|
||||||
locationService = new DatabaseReader.Builder(locationDb).build();
|
locationService = new DatabaseReader.Builder(locationDb).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user