|
@@ -52,17 +52,14 @@ public class GeoIpProcessorTests extends ESTestCase {
|
|
|
assertThat(ingestDocument.getSourceAndMetadata().get("source_field"), equalTo("8.8.8.8"));
|
|
|
@SuppressWarnings("unchecked")
|
|
|
Map<String, Object> geoData = (Map<String, Object>) ingestDocument.getSourceAndMetadata().get("target_field");
|
|
|
- assertThat(geoData.size(), equalTo(8));
|
|
|
+ assertThat(geoData.size(), equalTo(5));
|
|
|
assertThat(geoData.get("ip"), equalTo("8.8.8.8"));
|
|
|
assertThat(geoData.get("country_iso_code"), equalTo("US"));
|
|
|
assertThat(geoData.get("country_name"), equalTo("United States"));
|
|
|
assertThat(geoData.get("continent_name"), equalTo("North America"));
|
|
|
- assertThat(geoData.get("region_name"), equalTo("California"));
|
|
|
- assertThat(geoData.get("city_name"), equalTo("Mountain View"));
|
|
|
- assertThat(geoData.get("timezone"), equalTo("America/Los_Angeles"));
|
|
|
Map<String, Object> location = new HashMap<>();
|
|
|
- location.put("lat", 37.386d);
|
|
|
- location.put("lon", -122.0838d);
|
|
|
+ location.put("lat", 37.751d);
|
|
|
+ location.put("lon", -97.822d);
|
|
|
assertThat(geoData.get("location"), equalTo(location));
|
|
|
}
|
|
|
|
|
@@ -142,15 +139,15 @@ public class GeoIpProcessorTests extends ESTestCase {
|
|
|
new DatabaseReader.Builder(database).build(), "target_field", EnumSet.allOf(GeoIpProcessor.Property.class), false);
|
|
|
|
|
|
Map<String, Object> document = new HashMap<>();
|
|
|
- document.put("source_field", "93.114.45.13");
|
|
|
+ document.put("source_field", "80.231.5.0");
|
|
|
IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), document);
|
|
|
processor.execute(ingestDocument);
|
|
|
|
|
|
- assertThat(ingestDocument.getSourceAndMetadata().get("source_field"), equalTo("93.114.45.13"));
|
|
|
+ assertThat(ingestDocument.getSourceAndMetadata().get("source_field"), equalTo("80.231.5.0"));
|
|
|
@SuppressWarnings("unchecked")
|
|
|
Map<String, Object> geoData = (Map<String, Object>) ingestDocument.getSourceAndMetadata().get("target_field");
|
|
|
assertThat(geoData.size(), equalTo(1));
|
|
|
- assertThat(geoData.get("ip"), equalTo("93.114.45.13"));
|
|
|
+ assertThat(geoData.get("ip"), equalTo("80.231.5.0"));
|
|
|
}
|
|
|
|
|
|
public void testCountry() throws Exception {
|
|
@@ -179,15 +176,15 @@ public class GeoIpProcessorTests extends ESTestCase {
|
|
|
new DatabaseReader.Builder(database).build(), "target_field", EnumSet.allOf(GeoIpProcessor.Property.class), false);
|
|
|
|
|
|
Map<String, Object> document = new HashMap<>();
|
|
|
- document.put("source_field", "93.114.45.13");
|
|
|
+ document.put("source_field", "80.231.5.0");
|
|
|
IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), document);
|
|
|
processor.execute(ingestDocument);
|
|
|
|
|
|
- assertThat(ingestDocument.getSourceAndMetadata().get("source_field"), equalTo("93.114.45.13"));
|
|
|
+ assertThat(ingestDocument.getSourceAndMetadata().get("source_field"), equalTo("80.231.5.0"));
|
|
|
@SuppressWarnings("unchecked")
|
|
|
Map<String, Object> geoData = (Map<String, Object>) ingestDocument.getSourceAndMetadata().get("target_field");
|
|
|
assertThat(geoData.size(), equalTo(1));
|
|
|
- assertThat(geoData.get("ip"), equalTo("93.114.45.13"));
|
|
|
+ assertThat(geoData.get("ip"), equalTo("80.231.5.0"));
|
|
|
}
|
|
|
|
|
|
public void testAddressIsNotInTheDatabase() throws Exception {
|