-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c88711b
commit cad67e1
Showing
5 changed files
with
134 additions
and
5 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
...ocoder/src/main/java/org/apache/camel/quarkus/component/geocoder/it/FakeNominatimApi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.apache.camel.quarkus.component.geocoder.it; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.nio.charset.StandardCharsets; | ||
|
||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.Produces; | ||
|
||
import org.apache.commons.io.IOUtils; | ||
|
||
/** | ||
* Stubs nominatim API responses in absence of WireMock support: | ||
* | ||
* https://github.com/apache/camel-quarkus/issues/2033 | ||
*/ | ||
@Path("/fake/nominatim/api") | ||
public class FakeNominatimApi { | ||
|
||
@GET | ||
@Path("/reverse") | ||
@Produces("application/json") | ||
public String reverse() throws IOException { | ||
InputStream resource = FakeNominatimApi.class.getResourceAsStream("/nominatimReverse.json"); | ||
return IOUtils.toString(resource, StandardCharsets.UTF_8); | ||
} | ||
|
||
@GET | ||
@Path("/search") | ||
@Produces("application/json") | ||
public String search() throws IOException { | ||
InputStream resource = FakeNominatimApi.class.getResourceAsStream("/nominatimSearch.json"); | ||
return IOUtils.toString(resource, StandardCharsets.UTF_8); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
integration-tests/geocoder/src/main/resources/nominatimReverse.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"place_id": 169146043, | ||
"licence": "Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright", | ||
"osm_type": "way", | ||
"osm_id": 279767995, | ||
"lat": "40.714128099999996", | ||
"lon": "-73.96131110000002", | ||
"place_rank": 30, | ||
"category": "building", | ||
"type": "yes", | ||
"importance": 0, | ||
"addresstype": "building", | ||
"name": null, | ||
"display_name": "281, Bedford Avenue, Brooklyn, Kings County, New York, 11211, United States", | ||
"address": { | ||
"house_number": "281", | ||
"road": "Bedford Avenue", | ||
"suburb": "Brooklyn", | ||
"city_district": "Kings County", | ||
"city": "New York", | ||
"state": "New York", | ||
"postcode": "11211", | ||
"country": "United States", | ||
"country_code": "us" | ||
}, | ||
"boundingbox": [ | ||
"40.714064", | ||
"40.7141922", | ||
"-73.9614164", | ||
"-73.9612058" | ||
] | ||
} |
32 changes: 32 additions & 0 deletions
32
integration-tests/geocoder/src/main/resources/nominatimSearch.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
[ | ||
{ | ||
"place_id": 107106886, | ||
"licence": "Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright", | ||
"osm_type": "way", | ||
"osm_id": 26663743, | ||
"boundingbox": [ | ||
"37.3695898", | ||
"37.3724355", | ||
"-6.0562787", | ||
"-6.0555991" | ||
], | ||
"lat": "37.3709153", | ||
"lon": "-6.0559655", | ||
"display_name": "Calle Marie Curie, Urbanización Valdovina, Residencial Andana, Tomares, Sevilla, Andalucía, 41940, España", | ||
"place_rank": 26, | ||
"category": "highway", | ||
"type": "residential", | ||
"importance": 0.6, | ||
"address": { | ||
"road": "Calle Marie Curie", | ||
"neighbourhood": "Urbanización Valdovina", | ||
"hamlet": "Residencial Andana", | ||
"town": "Tomares", | ||
"state_district": "Sevilla", | ||
"state": "Andalucía", | ||
"postcode": "41940", | ||
"country": "España", | ||
"country_code": "es" | ||
} | ||
} | ||
] |