test: cleanup static test resources

This commit is contained in:
Martijn van Groningen 2016-01-26 21:15:30 +01:00
parent 82ae74071e
commit 2b2552c301
1 changed files with 9 additions and 0 deletions

View File

@ -23,6 +23,7 @@ import com.maxmind.geoip2.DatabaseReader;
import org.elasticsearch.ingest.core.AbstractProcessorFactory;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.test.StreamsUtils;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import java.io.ByteArrayInputStream;
@ -55,6 +56,14 @@ public class GeoIpProcessorFactoryTests extends ESTestCase {
databaseReaders = IngestGeoIpPlugin.loadDatabaseReaders(geoIpConfigDir);
}
@AfterClass
public static void closeDatabaseReaders() throws IOException {
for (DatabaseReader reader : databaseReaders.values()) {
reader.close();
}
databaseReaders = null;
}
public void testBuildDefaults() throws Exception {
GeoIpProcessor.Factory factory = new GeoIpProcessor.Factory(databaseReaders);