aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org/traccar/geocoder/GeocoderTest.java
diff options
context:
space:
mode:
authorcasswarry0 <casswarry0@gmail.com>2023-01-17 17:14:53 -0700
committercasswarry0 <casswarry0@gmail.com>2023-01-17 17:14:53 -0700
commit7338b8730949ed027b3f8b31d7dca20687ebbb8b (patch)
treec2d171e6121818ab511460a786f69aab97a2a628 /src/test/java/org/traccar/geocoder/GeocoderTest.java
parentcdecd3fa4427a382c0b09f8ad9d69ec14388960a (diff)
parent85501f9cf4918d5eee345f83aed7a31eecb26b8d (diff)
downloadtrackermap-server-7338b8730949ed027b3f8b31d7dca20687ebbb8b.tar.gz
trackermap-server-7338b8730949ed027b3f8b31d7dca20687ebbb8b.tar.bz2
trackermap-server-7338b8730949ed027b3f8b31d7dca20687ebbb8b.zip
Merge branch 'master' into develop
Diffstat (limited to 'src/test/java/org/traccar/geocoder/GeocoderTest.java')
-rw-r--r--src/test/java/org/traccar/geocoder/GeocoderTest.java40
1 files changed, 26 insertions, 14 deletions
diff --git a/src/test/java/org/traccar/geocoder/GeocoderTest.java b/src/test/java/org/traccar/geocoder/GeocoderTest.java
index 380980d2b..ff33b1f1c 100644
--- a/src/test/java/org/traccar/geocoder/GeocoderTest.java
+++ b/src/test/java/org/traccar/geocoder/GeocoderTest.java
@@ -1,10 +1,12 @@
package org.traccar.geocoder;
-import java.util.Locale;
-
import org.junit.Ignore;
import org.junit.Test;
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import java.util.Locale;
+
import static org.junit.Assert.assertEquals;
public class GeocoderTest {
@@ -13,10 +15,12 @@ public class GeocoderTest {
Locale.setDefault(Locale.US);
}
+ private final Client client = ClientBuilder.newClient();
+
@Ignore
@Test
public void testGoogle() {
- Geocoder geocoder = new GoogleGeocoder(null, null, 0, new AddressFormat());
+ Geocoder geocoder = new GoogleGeocoder(client, null, null, 0, new AddressFormat());
String address = geocoder.getAddress(31.776797, 35.211489, null);
assertEquals("1 Ibn Shaprut St, Jerusalem, Jerusalem District, IL", address);
}
@@ -24,7 +28,7 @@ public class GeocoderTest {
@Ignore
@Test
public void testNominatim() {
- Geocoder geocoder = new NominatimGeocoder(null, null, null, 0, new AddressFormat());
+ Geocoder geocoder = new NominatimGeocoder(client, null, null, null, 0, new AddressFormat());
String address = geocoder.getAddress(40.7337807, -73.9974401, null);
assertEquals("35 West 9th Street, NYC, New York, US", address);
}
@@ -32,7 +36,7 @@ public class GeocoderTest {
@Ignore
@Test
public void testGisgraphy() {
- Geocoder geocoder = new GisgraphyGeocoder(null, 0, new AddressFormat());
+ Geocoder geocoder = new GisgraphyGeocoder(client, null, 0, new AddressFormat());
String address = geocoder.getAddress(48.8530000, 2.3400000, null);
assertEquals("Rue du Jardinet, Paris, Île-de-France, FR", address);
}
@@ -41,7 +45,7 @@ public class GeocoderTest {
@Test
public void testOpenCage() {
Geocoder geocoder = new OpenCageGeocoder(
- "http://api.opencagedata.com/geocode/v1", "SECRET", 0, new AddressFormat());
+ client, "http://api.opencagedata.com/geocode/v1", "SECRET", null, 0, new AddressFormat());
String address = geocoder.getAddress(34.116302, -118.051519, null);
assertEquals("Charleston Road, California, US", address);
}
@@ -49,7 +53,7 @@ public class GeocoderTest {
@Ignore
@Test
public void testGeocodeFarm() {
- Geocoder geocoder = new GeocodeFarmGeocoder(null, null, 0, new AddressFormat());
+ Geocoder geocoder = new GeocodeFarmGeocoder(client, null, null, 0, new AddressFormat());
String address = geocoder.getAddress(34.116302, -118.051519, null);
assertEquals("Estrella Avenue, Arcadia, California, United States", address);
}
@@ -57,7 +61,7 @@ public class GeocoderTest {
@Ignore
@Test
public void testGeocodeXyz() {
- Geocoder geocoder = new GeocodeXyzGeocoder(null, 0, new AddressFormat());
+ Geocoder geocoder = new GeocodeXyzGeocoder(client, null, 0, new AddressFormat());
String address = geocoder.getAddress(34.116302, -118.051519, null);
assertEquals("605 ESTRELLA AVE, ARCADIA, California United States of America, US", address);
}
@@ -65,7 +69,7 @@ public class GeocoderTest {
@Ignore
@Test
public void testBan() {
- Geocoder geocoder = new BanGeocoder(0, new AddressFormat("%f [%d], %c"));
+ Geocoder geocoder = new BanGeocoder(client, 0, new AddressFormat("%f [%d], %c"));
String address = geocoder.getAddress(48.8575, 2.2944, null);
assertEquals("8 Avenue Gustave Eiffel 75007 Paris [75, Paris, Île-de-France], FR", address);
}
@@ -73,7 +77,7 @@ public class GeocoderTest {
@Ignore
@Test
public void testHere() {
- Geocoder geocoder = new HereGeocoder(null, "", "", null, 0, new AddressFormat());
+ Geocoder geocoder = new HereGeocoder(client, null, "", "", null, 0, new AddressFormat());
String address = geocoder.getAddress(48.8575, 2.2944, null);
assertEquals("6 Avenue Gustave Eiffel, Paris, Île-de-France, FRA", address);
}
@@ -81,7 +85,7 @@ public class GeocoderTest {
@Ignore
@Test
public void testMapmyIndia() {
- Geocoder geocoder = new MapmyIndiaGeocoder("", "", 0, new AddressFormat("%f"));
+ Geocoder geocoder = new MapmyIndiaGeocoder(client, "", "", 0, new AddressFormat("%f"));
String address = geocoder.getAddress(28.6129602407977, 77.2294557094574, null);
assertEquals("New Delhi, Delhi. 1 m from India Gate pin-110001 (India)", address);
}
@@ -89,7 +93,7 @@ public class GeocoderTest {
@Ignore
@Test
public void testPositionStack() {
- Geocoder geocoder = new PositionStackGeocoder("", 0, new AddressFormat("%f"));
+ Geocoder geocoder = new PositionStackGeocoder(client, "", 0, new AddressFormat("%f"));
String address = geocoder.getAddress(28.6129602407977, 77.2294557094574, null);
assertEquals("India Gate, New Delhi, India", address);
}
@@ -97,7 +101,7 @@ public class GeocoderTest {
@Ignore
@Test
public void testMapbox() {
- Geocoder geocoder = new MapboxGeocoder("", 0, new AddressFormat("%f"));
+ Geocoder geocoder = new MapboxGeocoder(client, "", 0, new AddressFormat("%f"));
String address = geocoder.getAddress(40.733, -73.989, null);
assertEquals("120 East 13th Street, New York, New York 10003, United States", address);
}
@@ -105,9 +109,17 @@ public class GeocoderTest {
@Ignore
@Test
public void testMapTiler() {
- Geocoder geocoder = new MapTilerGeocoder("mnbnwLErpdspq13f0kC6", 0, new AddressFormat());
+ Geocoder geocoder = new MapTilerGeocoder(client, "", 0, new AddressFormat());
String address = geocoder.getAddress(40.733, -73.989, null);
assertEquals("East 13th Street, New York City, New York, United States", address);
}
+ @Ignore
+ @Test
+ public void testGeoapify() {
+ Geocoder geocoder = new GeoapifyGeocoder(client, "", null, 0, new AddressFormat());
+ String address = geocoder.getAddress(40.733, -73.989, null);
+ assertEquals("114 East 13th Street, New York, New York, US", address);
+ }
+
}