Use wiremock for network tests

Signed-off-by: Taylor Smock <taylor.smock@kaart.com>
pull/1/head
Taylor Smock 2019-10-14 16:56:01 -06:00
rodzic d48ef81aae
commit 34ccc3a7f0
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 625F6A74A3E4311A
18 zmienionych plików z 403 dodań i 10 usunięć

Wyświetl plik

@ -29,7 +29,7 @@ import org.openstreetmap.josm.tools.Logging;
import org.openstreetmap.josm.tools.Territories;
public class MapWithAIAvailability {
private static final String RAPID_RELEASES = "https://github.com/facebookmicrosites/Open-Mapping-At-Facebook/raw/master/data/rapid_realeases.geojson";
private static String rapidReleases = "https://github.com/facebookmicrosites/Open-Mapping-At-Facebook/raw/master/data/rapid_realeases.geojson";
private static MapWithAIAvailability instance = null;
private static final Map<String, Map<String, Boolean>> COUNTRIES = new HashMap<>();
private static final Map<String, String> POSSIBLE_DATA_POINTS = new TreeMap<>();
@ -42,8 +42,8 @@ public class MapWithAIAvailability {
}
private MapWithAIAvailability() {
try (CachedFile rapidReleases = new CachedFile(RAPID_RELEASES);
JsonParser parser = Json.createParser(rapidReleases.getContentReader())) {
try (CachedFile cachedRapidReleases = new CachedFile(rapidReleases);
JsonParser parser = Json.createParser(cachedRapidReleases.getContentReader())) {
if (parser.hasNext()) {
JsonParser.Event event = parser.next();
if (JsonParser.Event.START_OBJECT.equals(event)) {
@ -151,4 +151,11 @@ public class MapWithAIAvailability {
public static Map<String, String> getPossibleDataTypesAndMessages() {
return POSSIBLE_DATA_POINTS;
}
/**
* @param url The URL where the MapWithAI data releases are.
*/
public static void setReleaseUrl(String url) {
rapidReleases = url;
}
}

Wyświetl plik

@ -273,7 +273,7 @@ public final class MapWithAIDataUtils {
public static void setMapWithAIUrl(String url, boolean permanent) {
final MapWithAILayer layer = getLayer(false);
if (permanent) {
final List<String> urls = getMapWithAIURLs();
final List<String> urls = new ArrayList<>(getMapWithAIURLs());
if (!urls.contains(url)) {
urls.add(url);
setMapWithAIURLs(urls);

Wyświetl plik

@ -0,0 +1,25 @@
{
"id" : "982f4ad5-bf25-49aa-a616-f160e14eaed1",
"name" : "06_nodes",
"request" : {
"url" : "/0.6/nodes?nodes=6146500887",
"method" : "GET"
},
"response" : {
"status" : 200,
"body" : "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<osm version=\"0.6\" generator=\"CGImap 0.7.5 (3009 thorn-01.openstreetmap.org)\" copyright=\"OpenStreetMap and contributors\" attribution=\"http://www.openstreetmap.org/copyright\" license=\"http://opendatacommons.org/licenses/odbl/1-0/\">\n <node id=\"6146500887\" visible=\"true\" version=\"4\" changeset=\"66847511\" timestamp=\"2019-02-02T00:23:35Z\" user=\"vorpalblade\" uid=\"2078753\" lat=\"39.0674124\" lon=\"-108.5592645\">\n <tag k=\"couplings\" v=\"3\"/>\n <tag k=\"emergency\" v=\"fire_hydrant\"/>\n <tag k=\"fire_hydrant:awwa_class\" v=\"AA\"/>\n <tag k=\"fire_hydrant:position\" v=\"sidewalk\"/>\n <tag k=\"fire_hydrant:type\" v=\"pillar\"/>\n <tag k=\"manufacturer\" v=\"Clow Valve Company\"/>\n <tag k=\"model\" v=\"Iowa\"/>\n </node>\n</osm>\n",
"headers" : {
"Date" : "Mon, 14 Oct 2019 22:53:09 GMT",
"Server" : "Apache/2.4.29 (Ubuntu)",
"Strict-Transport-Security" : [ "max-age=31536000; includeSubDomains; preload", "max-age=31536000; includeSubDomains; preload" ],
"Expect-CT" : [ "max-age=0, report-uri=\"https://openstreetmap.report-uri.com/r/d/ct/reportOnly\"", "max-age=0, report-uri=\"https://openstreetmap.report-uri.com/r/d/ct/reportOnly\"" ],
"Cache-Control" : "private, max-age=0, must-revalidate",
"Content-Type" : "text/xml; charset=utf-8",
"Keep-Alive" : "timeout=5, max=99",
"Connection" : "Keep-Alive"
}
},
"uuid" : "982f4ad5-bf25-49aa-a616-f160e14eaed1",
"persistent" : true,
"insertionIndex" : 11
}

Wyświetl plik

@ -0,0 +1,25 @@
{
"id" : "fa0deb8f-2ce4-46b2-9f12-2100ccafa0a6",
"name" : "06_nodes",
"request" : {
"url" : "/0.6/nodes?nodes=6151680832",
"method" : "GET"
},
"response" : {
"status" : 200,
"body" : "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<osm version=\"0.6\" generator=\"CGImap 0.7.5 (32264 thorn-02.openstreetmap.org)\" copyright=\"OpenStreetMap and contributors\" attribution=\"http://www.openstreetmap.org/copyright\" license=\"http://opendatacommons.org/licenses/odbl/1-0/\">\n <node id=\"6151680832\" visible=\"true\" version=\"3\" changeset=\"66841675\" timestamp=\"2019-02-01T19:05:18Z\" user=\"vorpalblade\" uid=\"2078753\" lat=\"39.0673990\" lon=\"-108.5608433\">\n <tag k=\"bonnet:colour\" v=\"blue\"/>\n <tag k=\"cap:colour\" v=\"blue\"/>\n <tag k=\"colour\" v=\"yellow\"/>\n <tag k=\"couplings\" v=\"3\"/>\n <tag k=\"emergency\" v=\"fire_hydrant\"/>\n <tag k=\"fire_hydrant:type\" v=\"pillar\"/>\n <tag k=\"pillar:type\" v=\"dry_barrel\"/>\n <tag k=\"water_source\" v=\"main\"/>\n </node>\n</osm>\n",
"headers" : {
"Date" : "Mon, 14 Oct 2019 22:53:09 GMT",
"Server" : "Apache/2.4.29 (Ubuntu)",
"Strict-Transport-Security" : [ "max-age=31536000; includeSubDomains; preload", "max-age=31536000; includeSubDomains; preload" ],
"Expect-CT" : [ "max-age=0, report-uri=\"https://openstreetmap.report-uri.com/r/d/ct/reportOnly\"", "max-age=0, report-uri=\"https://openstreetmap.report-uri.com/r/d/ct/reportOnly\"" ],
"Cache-Control" : "private, max-age=0, must-revalidate",
"Content-Type" : "text/xml; charset=utf-8",
"Keep-Alive" : "timeout=5, max=98",
"Connection" : "Keep-Alive"
}
},
"uuid" : "fa0deb8f-2ce4-46b2-9f12-2100ccafa0a6",
"persistent" : true,
"insertionIndex" : 12
}

Wyświetl plik

@ -0,0 +1,38 @@
{
"id" : "194658eb-e7bb-4e22-b278-2d23246f3ff1",
"name" : "capabilities",
"request" : {
"url" : "/capabilities",
"method" : "GET"
},
"response" : {
"status" : 200,
"body" : "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<osm version=\"0.6\" generator=\"OpenStreetMap server\" copyright=\"OpenStreetMap and contributors\" attribution=\"http://www.openstreetmap.org/copyright\" license=\"http://opendatacommons.org/licenses/odbl/1-0/\">\n <api>\n <version minimum=\"0.6\" maximum=\"0.6\"/>\n <area maximum=\"0.25\"/>\n <note_area maximum=\"25\"/>\n <tracepoints per_page=\"5000\"/>\n <waynodes maximum=\"2000\"/>\n <changesets maximum_elements=\"10000\"/>\n <timeout seconds=\"300\"/>\n <status database=\"online\" api=\"online\" gpx=\"online\"/>\n </api>\n <policy>\n <imagery>\n <blacklist regex=\".*\\.google(apis)?\\..*/(vt|kh)[\\?/].*([xyz]=.*){3}.*\"/>\n <blacklist regex=\"http://xdworld\\.vworld\\.kr:8080/.*\"/>\n <blacklist regex=\".*\\.here\\.com[/:].*\"/>\n </imagery>\n </policy>\n</osm>\n",
"headers" : {
"Date" : "Mon, 14 Oct 2019 22:53:09 GMT",
"Server" : "Apache/2.4.29 (Ubuntu)",
"Cache-Control" : "max-age=0, private, must-revalidate",
"Vary" : "Origin,Accept-Encoding",
"X-Permitted-Cross-Domain-Policies" : "none",
"X-XSS-Protection" : "1; mode=block",
"X-Request-Id" : "XaT8VcQns38EL-zq1jCQEAAAAAA",
"X-Download-Options" : "noopen",
"X-Runtime" : "0.006498",
"X-Frame-Options" : "sameorigin",
"X-Content-Type-Options" : "nosniff",
"Content-Security-Policy" : "default-src 'self'; child-src 'self'; connect-src 'self' piwik.openstreetmap.org; font-src 'none'; form-action 'self'; frame-ancestors 'self'; frame-src 'self'; img-src 'self' data: www.gravatar.com *.wp.com *.tile.openstreetmap.org *.tile.thunderforest.com *.openstreetmap.fr piwik.openstreetmap.org https://openstreetmap-user-avatars.s3.dualstack.eu-west-1.amazonaws.com; manifest-src 'self'; media-src 'none'; object-src 'self'; script-src 'self' piwik.openstreetmap.org; style-src 'self'; worker-src 'none'",
"X-Powered-By" : "Phusion Passenger 6.0.4",
"Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload",
"Expect-CT" : "max-age=0, report-uri=\"https://openstreetmap.report-uri.com/r/d/ct/reportOnly\"",
"Upgrade" : "h2",
"ETag" : "W/\"0d683cbc36a97f94c7e1bcc861adc22a-gzip\"",
"Status" : "200 OK",
"Keep-Alive" : "timeout=5, max=100",
"Connection" : "Keep-Alive",
"Content-Type" : "application/xml; charset=utf-8"
}
},
"uuid" : "194658eb-e7bb-4e22-b278-2d23246f3ff1",
"persistent" : true,
"insertionIndex" : 10
}

Wyświetl plik

@ -0,0 +1,30 @@
{
"id" : "6a626be9-e423-4fd9-aa16-13b1262d8edb",
"name" : "ml_roads",
"request" : {
"url" : "/ml_roads?conflate_with_osm=true&theme=ml_road_vector&collaborator=josm&token=ASb3N5o9HbX8QWn8G_NtHIRQaYv3nuG2r7_f3vnGld3KhZNCxg57IsaQyssIaEw5rfRNsPpMwg4TsnrSJtIJms5m&hash=ASawRla3rBcwEjY4HIY&result_type=road_building_vector_xml&bbox=-108.4625,39.0621,-108.4594,39.0633",
"method" : "GET"
},
"response" : {
"status" : 200,
"body" : "<?xml version=\"1.0\"?>\n<osm attribution=\"http://www.openstreetmap.org/copyright\" copyright=\"OpenStreetMap and contributors\" generator=\"fb_conflation_service\" version=\"0.6\">\n <bounds maxlat=\"39.06329\" maxlon=\"-108.45941287902\" minlat=\"39.06211\" minlon=\"-108.46248712098\"/>\n <node action=\"modify\" id=\"-507451533360537\" lat=\"39.0627979\" lon=\"-108.4607428\" visible=\"true\">\n <tag k=\"conn\" v=\"w489117884,n1337868173,n2390205409\"/>\n </node>\n <node action=\"modify\" id=\"-447607076088874\" lat=\"39.0627937\" lon=\"-108.4614400\" visible=\"true\">\n <tag k=\"conn\" v=\"w489117884,n176212515,n1337868173\"/>\n </node>\n <node action=\"modify\" id=\"-512424752862157\" lat=\"39.0621071\" lon=\"-108.4614615\" visible=\"true\"/>\n <node action=\"modify\" id=\"-2661924864034455\" lat=\"39.0618533\" lon=\"-108.4614668\" visible=\"true\"/>\n <node action=\"modify\" id=\"-1359413207542142\" lat=\"39.0624692\" lon=\"-108.4607268\" visible=\"true\"/>\n <node action=\"modify\" id=\"-480100986137751\" lat=\"39.0624359\" lon=\"-108.4607428\" visible=\"true\"/>\n <node action=\"modify\" id=\"-516655755810722\" lat=\"39.0624525\" lon=\"-108.4599170\" visible=\"true\"/>\n <node action=\"modify\" id=\"-367646030587413\" lat=\"39.0621487\" lon=\"-108.4614400\" visible=\"true\"/>\n <node action=\"modify\" id=\"-1665763650222613\" lat=\"39.0621571\" lon=\"-108.4610432\" visible=\"true\"/>\n <node action=\"modify\" id=\"-2324123227677172\" lat=\"39.0618533\" lon=\"-108.4607536\" visible=\"true\"/>\n <way action=\"modify\" id=\"-487611782050068\" visible=\"true\">\n <nd ref=\"-2661924864034455\"/>\n <nd ref=\"-512424752862157\"/>\n <nd ref=\"-367646030587413\"/>\n <nd ref=\"-447607076088874\"/>\n <tag k=\"highway\" v=\"residential\"/>\n <tag k=\"source\" v=\"digitalglobe\"/>\n </way>\n <way action=\"modify\" id=\"-607051847951386979\" orig_id=\"-414732926053825\" visible=\"true\">\n <nd ref=\"-1359413207542142\"/>\n <nd ref=\"-480100986137751\"/>\n <nd ref=\"-2324123227677172\"/>\n <tag k=\"highway\" v=\"residential\"/>\n <tag k=\"source\" v=\"digitalglobe\"/>\n </way>\n <way action=\"modify\" id=\"-607051847951386978\" orig_id=\"-414732926053825\" visible=\"true\">\n <nd ref=\"-1359413207542142\"/>\n <nd ref=\"-507451533360537\"/>\n <tag k=\"highway\" v=\"residential\"/>\n <tag k=\"source\" v=\"digitalglobe\"/>\n </way>\n <way action=\"modify\" id=\"-2431015640267087\" visible=\"true\">\n <nd ref=\"-1359413207542142\"/>\n <nd ref=\"-516655755810722\"/>\n <tag k=\"highway\" v=\"residential\"/>\n <tag k=\"source\" v=\"digitalglobe\"/>\n </way>\n <way action=\"modify\" id=\"-580832622321925\" visible=\"true\">\n <nd ref=\"-367646030587413\"/>\n <nd ref=\"-1665763650222613\"/>\n <tag k=\"highway\" v=\"residential\"/>\n <tag k=\"source\" v=\"digitalglobe\"/>\n </way>\n <node id=\"-825422876905935714\" lat=\"39.062422\" lon=\"-108.461698\" source=\"microsoft\" visible=\"true\"/>\n <node id=\"-1870090824197945931\" lat=\"39.062422\" lon=\"-108.461835\" source=\"microsoft\" visible=\"true\"/>\n <node id=\"-2311326059727567166\" lat=\"39.062341\" lon=\"-108.461835\" source=\"microsoft\" visible=\"true\"/>\n <node id=\"-3237410471007433804\" lat=\"39.062341\" lon=\"-108.461698\" source=\"microsoft\" visible=\"true\"/>\n <way action=\"modify\" id=\"-3811549318070132106\" source=\"microsoft\" visible=\"true\">\n <nd ref=\"-825422876905935714\"/>\n <nd ref=\"-1870090824197945931\"/>\n <nd ref=\"-2311326059727567166\"/>\n <nd ref=\"-3237410471007433804\"/>\n <nd ref=\"-825422876905935714\"/>\n <tag k=\"building\" v=\"yes\"/>\n </way>\n <node id=\"-1612927083720338934\" lat=\"39.06218\" lon=\"-108.460179\" source=\"microsoft\" visible=\"true\"/>\n <node id=\"-297264572487637546\" lat=\"39.062184\" lon=\"-108.460581\" source=\"microsoft\" visible=\"true\"/>\n <node id=\"-2189477319764664972\" lat=\"39.061986\" lon=\"-108.460584\" source=\"microsoft\" visible=\"true\"/>\n <node id=\"-2965280592153399968\" lat=\"39.061982\" lon=\"-108.460182\" source=\"microsoft\" visible=\"true\"/>\n <way action=\"modify\" id=\"-2949770679498650644\" source=\"microsoft\" visible=\"true\">\n <nd ref=\"-1612927083720338934\"/>\n <nd ref=\"-297264572487637546\"/>\n <nd ref=\"-2189477319764664972\"/>\n <nd ref=\"-2965280592153399968\"/>\n <nd ref=\"-1612927083720338934\"/>\n <tag k=\"building\" v=\"yes\"/>\n </way>\n</osm>\n",
"headers" : {
"Content-Type" : "text/xml; charset=UTF-8",
"Strict-Transport-Security" : "max-age=15552000; preload",
"Vary" : "Accept-Encoding",
"X-Content-Type-Options" : "nosniff",
"X-Frame-Options" : "DENY",
"X-XSS-Protection" : "0",
"Access-Control-Allow-Origin" : "https://facebook.com",
"X-FB-Debug" : "63knydpqj3PUajqLTk1YJktu0kMZ6NyOvsXQJAV8vK7e9GABLqNRtRlBcO1Rml+2EUzQPMwb4MC8cwOa/fRClw==",
"Date" : "Mon, 14 Oct 2019 21:48:15 GMT",
"Connection" : "keep-alive"
}
},
"uuid" : "6a626be9-e423-4fd9-aa16-13b1262d8edb",
"persistent" : true,
"scenarioName" : "scenario-2-ml_roads",
"requiredScenarioState" : "Started",
"newScenarioState" : "scenario-2-ml_roads-2",
"insertionIndex" : 7
}

Wyświetl plik

@ -0,0 +1,27 @@
{
"id" : "75d62b89-cbe5-4125-bab5-7e9d66472ebb",
"name" : "ml_roads",
"request" : {
"url" : "/ml_roads?conflate_with_osm=true&theme=ml_road_vector&collaborator=josm&token=ASb3N5o9HbX8QWn8G_NtHIRQaYv3nuG2r7_f3vnGld3KhZNCxg57IsaQyssIaEw5rfRNsPpMwg4TsnrSJtIJms5m&hash=ASawRla3rBcwEjY4HIY&result_type=road_building_vector_xml&bbox=-0.001,-0.001,0.0,0.0",
"method" : "GET"
},
"response" : {
"status" : 200,
"body" : "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<osm generator=\"NS_ROADS_SERVICE\" version=\"0.6\">\n <bounds maxlat=\"-1.0E-5\" maxlon=\"-1.0000000000381E-5\" minlat=\"-0.00099\" minlon=\"-0.00098999999999962\"/>\n</osm>\n",
"headers" : {
"Content-Type" : "text/xml; charset=UTF-8",
"Strict-Transport-Security" : "max-age=15552000; preload",
"Vary" : "Accept-Encoding",
"X-Content-Type-Options" : "nosniff",
"X-Frame-Options" : "DENY",
"X-XSS-Protection" : "0",
"Access-Control-Allow-Origin" : "https://facebook.com",
"X-FB-Debug" : "oGEpJaHuX49aJ9sNRVyaFmxkz8lZP0Ohpjl3p1BFAHFxuFKst2xB9GCWjMpqj6tjK7WXmPo9DPzWb8L2LXWcTQ==",
"Date" : "Mon, 14 Oct 2019 21:48:11 GMT",
"Connection" : "keep-alive"
}
},
"uuid" : "75d62b89-cbe5-4125-bab5-7e9d66472ebb",
"persistent" : true,
"insertionIndex" : 6
}

Wyświetl plik

@ -0,0 +1,29 @@
{
"id" : "a4fdd7a5-d9b2-4d8a-a057-e52a8d5f1f86",
"name" : "ml_roads",
"request" : {
"url" : "/ml_roads?conflate_with_osm=true&theme=ml_road_vector&collaborator=josm&token=ASb3N5o9HbX8QWn8G_NtHIRQaYv3nuG2r7_f3vnGld3KhZNCxg57IsaQyssIaEw5rfRNsPpMwg4TsnrSJtIJms5m&hash=ASawRla3rBcwEjY4HIY&result_type=road_building_vector_xml&bbox=-108.4625,39.0621,-108.4594,39.0633",
"method" : "GET"
},
"response" : {
"status" : 200,
"body" : "<?xml version=\"1.0\"?>\n<osm attribution=\"http://www.openstreetmap.org/copyright\" copyright=\"OpenStreetMap and contributors\" generator=\"fb_conflation_service\" version=\"0.6\">\n <bounds maxlat=\"39.06329\" maxlon=\"-108.45941287902\" minlat=\"39.06211\" minlon=\"-108.46248712098\"/>\n <node action=\"modify\" id=\"-507451533360537\" lat=\"39.0627979\" lon=\"-108.4607428\" visible=\"true\">\n <tag k=\"conn\" v=\"w489117884,n1337868173,n2390205409\"/>\n </node>\n <node action=\"modify\" id=\"-447607076088874\" lat=\"39.0627937\" lon=\"-108.4614400\" visible=\"true\">\n <tag k=\"conn\" v=\"w489117884,n176212515,n1337868173\"/>\n </node>\n <node action=\"modify\" id=\"-512424752862157\" lat=\"39.0621071\" lon=\"-108.4614615\" visible=\"true\"/>\n <node action=\"modify\" id=\"-2661924864034455\" lat=\"39.0618533\" lon=\"-108.4614668\" visible=\"true\"/>\n <node action=\"modify\" id=\"-1359413207542142\" lat=\"39.0624692\" lon=\"-108.4607268\" visible=\"true\"/>\n <node action=\"modify\" id=\"-480100986137751\" lat=\"39.0624359\" lon=\"-108.4607428\" visible=\"true\"/>\n <node action=\"modify\" id=\"-516655755810722\" lat=\"39.0624525\" lon=\"-108.4599170\" visible=\"true\"/>\n <node action=\"modify\" id=\"-367646030587413\" lat=\"39.0621487\" lon=\"-108.4614400\" visible=\"true\"/>\n <node action=\"modify\" id=\"-1665763650222613\" lat=\"39.0621571\" lon=\"-108.4610432\" visible=\"true\"/>\n <node action=\"modify\" id=\"-2324123227677172\" lat=\"39.0618533\" lon=\"-108.4607536\" visible=\"true\"/>\n <way action=\"modify\" id=\"-487611782050068\" visible=\"true\">\n <nd ref=\"-2661924864034455\"/>\n <nd ref=\"-512424752862157\"/>\n <nd ref=\"-367646030587413\"/>\n <nd ref=\"-447607076088874\"/>\n <tag k=\"highway\" v=\"residential\"/>\n <tag k=\"source\" v=\"digitalglobe\"/>\n </way>\n <way action=\"modify\" id=\"-607051847951386978\" orig_id=\"-414732926053825\" visible=\"true\">\n <nd ref=\"-1359413207542142\"/>\n <nd ref=\"-480100986137751\"/>\n <nd ref=\"-2324123227677172\"/>\n <tag k=\"highway\" v=\"residential\"/>\n <tag k=\"source\" v=\"digitalglobe\"/>\n </way>\n <way action=\"modify\" id=\"-607051847951386979\" orig_id=\"-414732926053825\" visible=\"true\">\n <nd ref=\"-1359413207542142\"/>\n <nd ref=\"-507451533360537\"/>\n <tag k=\"highway\" v=\"residential\"/>\n <tag k=\"source\" v=\"digitalglobe\"/>\n </way>\n <way action=\"modify\" id=\"-2431015640267087\" visible=\"true\">\n <nd ref=\"-1359413207542142\"/>\n <nd ref=\"-516655755810722\"/>\n <tag k=\"highway\" v=\"residential\"/>\n <tag k=\"source\" v=\"digitalglobe\"/>\n </way>\n <way action=\"modify\" id=\"-580832622321925\" visible=\"true\">\n <nd ref=\"-367646030587413\"/>\n <nd ref=\"-1665763650222613\"/>\n <tag k=\"highway\" v=\"residential\"/>\n <tag k=\"source\" v=\"digitalglobe\"/>\n </way>\n <node id=\"-825422876905935714\" lat=\"39.062422\" lon=\"-108.461698\" source=\"microsoft\" visible=\"true\"/>\n <node id=\"-1870090824197945931\" lat=\"39.062422\" lon=\"-108.461835\" source=\"microsoft\" visible=\"true\"/>\n <node id=\"-2311326059727567166\" lat=\"39.062341\" lon=\"-108.461835\" source=\"microsoft\" visible=\"true\"/>\n <node id=\"-3237410471007433804\" lat=\"39.062341\" lon=\"-108.461698\" source=\"microsoft\" visible=\"true\"/>\n <way action=\"modify\" id=\"-3811549318070132106\" source=\"microsoft\" visible=\"true\">\n <nd ref=\"-825422876905935714\"/>\n <nd ref=\"-1870090824197945931\"/>\n <nd ref=\"-2311326059727567166\"/>\n <nd ref=\"-3237410471007433804\"/>\n <nd ref=\"-825422876905935714\"/>\n <tag k=\"building\" v=\"yes\"/>\n </way>\n <node id=\"-1612927083720338934\" lat=\"39.06218\" lon=\"-108.460179\" source=\"microsoft\" visible=\"true\"/>\n <node id=\"-297264572487637546\" lat=\"39.062184\" lon=\"-108.460581\" source=\"microsoft\" visible=\"true\"/>\n <node id=\"-2189477319764664972\" lat=\"39.061986\" lon=\"-108.460584\" source=\"microsoft\" visible=\"true\"/>\n <node id=\"-2965280592153399968\" lat=\"39.061982\" lon=\"-108.460182\" source=\"microsoft\" visible=\"true\"/>\n <way action=\"modify\" id=\"-2949770679498650644\" source=\"microsoft\" visible=\"true\">\n <nd ref=\"-1612927083720338934\"/>\n <nd ref=\"-297264572487637546\"/>\n <nd ref=\"-2189477319764664972\"/>\n <nd ref=\"-2965280592153399968\"/>\n <nd ref=\"-1612927083720338934\"/>\n <tag k=\"building\" v=\"yes\"/>\n </way>\n</osm>\n",
"headers" : {
"Content-Type" : "text/xml; charset=UTF-8",
"Strict-Transport-Security" : "max-age=15552000; preload",
"Vary" : "Accept-Encoding",
"X-Content-Type-Options" : "nosniff",
"X-Frame-Options" : "DENY",
"X-XSS-Protection" : "0",
"Access-Control-Allow-Origin" : "https://facebook.com",
"X-FB-Debug" : "SmwuV6my0klO6rrOzd5CLqqmHf/2sstTMpgbmIcKKlhVqNMf7zR1jevJ/WVwkXD5wzp/nhM7xNApsr9Ujd+Fww==",
"Date" : "Mon, 14 Oct 2019 21:48:18 GMT",
"Connection" : "keep-alive"
}
},
"uuid" : "a4fdd7a5-d9b2-4d8a-a057-e52a8d5f1f86",
"persistent" : true,
"scenarioName" : "scenario-2-ml_roads",
"requiredScenarioState" : "scenario-2-ml_roads-2",
"insertionIndex" : 8
}

Wyświetl plik

@ -0,0 +1,27 @@
{
"id" : "ae12b6fc-abf7-48e0-8e58-84bd81a6020e",
"name" : "ml_roads",
"request" : {
"url" : "/ml_roads?conflate_with_osm=true&theme=ml_road_vector&collaborator=josm&token=ASb3N5o9HbX8QWn8G_NtHIRQaYv3nuG2r7_f3vnGld3KhZNCxg57IsaQyssIaEw5rfRNsPpMwg4TsnrSJtIJms5m&hash=ASawRla3rBcwEjY4HIY&result_type=road_building_vector_xml&bbox=-108.5715723,39.0734162,-108.5707107,39.0738791&crop_bbox=-108.5711561,39.0735205,-108.5708568,39.0736682",
"method" : "GET"
},
"response" : {
"status" : 200,
"body" : "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<osm generator=\"NS_ROADS_SERVICE\" version=\"0.6\"><bounds maxlat=\"39.0738691\" maxlon=\"-108.57072358101\" minlat=\"39.0734262\" minlon=\"-108.57155941899\"/><node id=\"-2976339053870190188\" lon=\"-108.5708568\" lat=\"39.073597910501\" visible=\"true\"/><way id=\"-4444230471161502073\" orig_id=\"-1203473873173507\" visible=\"true\" action=\"modify\"><tag k=\"highway\" v=\"residential\"/><tag k=\"source\" v=\"digitalglobe\"/><nd ref=\"-710999622096597555\"/><nd ref=\"-373066400259132\"/><nd ref=\"-2976339053870190188\"/></way><node action=\"modify\" id=\"-710999622096597555\" lat=\"39.0736112\" lon=\"-108.5710852\" visible=\"true\"><tag k=\"dupe\" v=\"n6815623346\"/></node><node action=\"modify\" id=\"-373066400259132\" lat=\"39.0735933\" lon=\"-108.5709927\" visible=\"true\"/></osm>\n",
"headers" : {
"Content-Type" : "text/xml; charset=UTF-8",
"Strict-Transport-Security" : "max-age=15552000; preload",
"Vary" : "Accept-Encoding",
"X-Content-Type-Options" : "nosniff",
"X-Frame-Options" : "DENY",
"X-XSS-Protection" : "0",
"Access-Control-Allow-Origin" : "https://facebook.com",
"X-FB-Debug" : "njP75TEBeXP11/GnRT0KaUlhrpHlAcRMp3T9ToG+9+ZYpOybozFwS7e8F3b0HpDM7GUHtv59awjRp4fhvSM2vg==",
"Date" : "Mon, 14 Oct 2019 21:48:04 GMT",
"Connection" : "keep-alive"
}
},
"uuid" : "ae12b6fc-abf7-48e0-8e58-84bd81a6020e",
"persistent" : true,
"insertionIndex" : 4
}

Wyświetl plik

@ -0,0 +1,29 @@
{
"id" : "d36d0865-8422-40f7-8fdb-c683d1f05f0d",
"name" : "ml_roads",
"request" : {
"url" : "/ml_roads?conflate_with_osm=true&theme=ml_road_vector&collaborator=josm&token=ASb3N5o9HbX8QWn8G_NtHIRQaYv3nuG2r7_f3vnGld3KhZNCxg57IsaQyssIaEw5rfRNsPpMwg4TsnrSJtIJms5m&hash=ASawRla3rBcwEjY4HIY&result_type=road_building_vector_xml&bbox=-108.5715723,39.0734162,-108.5707107,39.0738791",
"method" : "GET"
},
"response" : {
"status" : 200,
"body" : "<?xml version=\"1.0\"?>\n<osm attribution=\"http://www.openstreetmap.org/copyright\" copyright=\"OpenStreetMap and contributors\" generator=\"fb_conflation_service\" version=\"0.6\">\n <bounds maxlat=\"39.0738691\" maxlon=\"-108.57072358101\" minlat=\"39.0734262\" minlon=\"-108.57155941899\"/>\n <node action=\"modify\" id=\"-2115501659910767206\" lat=\"39.0735990\" lon=\"-108.5707442\" visible=\"true\">\n <tag k=\"conn\" v=\"w626760817,n5917002841,n5917002155\"/>\n </node>\n <node action=\"modify\" id=\"-373066400259132\" lat=\"39.0735906\" lon=\"-108.5709913\" visible=\"true\">\n <tag k=\"conn\" v=\"w676695801,n5917002119,n5917002154\"/>\n </node>\n <node action=\"modify\" id=\"-1944810158953697\" lat=\"39.0735948\" lon=\"-108.5708516\" visible=\"true\">\n <tag k=\"conn\" v=\"w630961276,n176213658,n5907055576\"/>\n </node>\n <node action=\"modify\" id=\"-710999622096597555\" lat=\"39.0736112\" lon=\"-108.5710852\" visible=\"true\">\n <tag k=\"dupe\" v=\"n6815623346\"/>\n </node>\n <way action=\"modify\" id=\"-1203473873173507\" visible=\"true\">\n <nd ref=\"-710999622096597555\"/>\n <nd ref=\"-373066400259132\"/>\n <nd ref=\"-1944810158953697\"/>\n <nd ref=\"-2115501659910767206\"/>\n <tag k=\"highway\" v=\"residential\"/>\n <tag k=\"source\" v=\"digitalglobe\"/>\n </way>\n</osm>\n",
"headers" : {
"Content-Type" : "text/xml; charset=UTF-8",
"Strict-Transport-Security" : "max-age=15552000; preload",
"Vary" : "Accept-Encoding",
"X-Content-Type-Options" : "nosniff",
"X-Frame-Options" : "DENY",
"X-XSS-Protection" : "0",
"Access-Control-Allow-Origin" : "https://facebook.com",
"X-FB-Debug" : "aVFiJSWAL1DuwxZ3xy0r7kz2/Z8y9FsGpK/y34APwCHgc+MFqOzGysy4StVtW8Vs+hFglYo+CrVtGqequk0s/Q==",
"Date" : "Mon, 14 Oct 2019 21:48:02 GMT",
"Connection" : "keep-alive"
}
},
"uuid" : "d36d0865-8422-40f7-8fdb-c683d1f05f0d",
"persistent" : true,
"scenarioName" : "scenario-1-ml_roads",
"requiredScenarioState" : "scenario-1-ml_roads-2",
"insertionIndex" : 3
}

Wyświetl plik

@ -0,0 +1,27 @@
{
"id" : "ee32c13b-a85b-49d7-ac53-338b3c37ebdf",
"name" : "ml_roads",
"request" : {
"url" : "/ml_roads?conflate_with_osm=true&theme=ml_road_vector&collaborator=josm&token=ASb3N5o9HbX8QWn8G_NtHIRQaYv3nuG2r7_f3vnGld3KhZNCxg57IsaQyssIaEw5rfRNsPpMwg4TsnrSJtIJms5m&hash=ASawRla3rBcwEjY4HIY&result_type=road_building_vector_xml&bbox=0.0,0.0,0.001,0.001",
"method" : "GET"
},
"response" : {
"status" : 200,
"body" : "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<osm generator=\"NS_ROADS_SERVICE\" version=\"0.6\">\n <bounds maxlat=\"0.00099\" maxlon=\"0.00098999999999962\" minlat=\"1.0E-5\" minlon=\"1.0000000000381E-5\"/>\n</osm>\n",
"headers" : {
"Content-Type" : "text/xml; charset=UTF-8",
"Strict-Transport-Security" : "max-age=15552000; preload",
"Vary" : "Accept-Encoding",
"X-Content-Type-Options" : "nosniff",
"X-Frame-Options" : "DENY",
"X-XSS-Protection" : "0",
"Access-Control-Allow-Origin" : "https://facebook.com",
"X-FB-Debug" : "EslmENNZ6865gLeA/vlgj06w6NmF2zRhiK98druS1qBEWtE3juhoFcXnlUsryhz7dh7CuRIrkI6db6J2kCCGTw==",
"Date" : "Mon, 14 Oct 2019 21:48:11 GMT",
"Connection" : "keep-alive"
}
},
"uuid" : "ee32c13b-a85b-49d7-ac53-338b3c37ebdf",
"persistent" : true,
"insertionIndex" : 5
}

Wyświetl plik

@ -0,0 +1,30 @@
{
"id" : "f3356ac5-5d99-456b-8fb6-90dca6f7c766",
"name" : "ml_roads",
"request" : {
"url" : "/ml_roads?conflate_with_osm=true&theme=ml_road_vector&collaborator=josm&token=ASb3N5o9HbX8QWn8G_NtHIRQaYv3nuG2r7_f3vnGld3KhZNCxg57IsaQyssIaEw5rfRNsPpMwg4TsnrSJtIJms5m&hash=ASawRla3rBcwEjY4HIY&result_type=road_building_vector_xml&bbox=-108.5715723,39.0734162,-108.5707107,39.0738791",
"method" : "GET"
},
"response" : {
"status" : 200,
"body" : "<?xml version=\"1.0\"?>\n<osm attribution=\"http://www.openstreetmap.org/copyright\" copyright=\"OpenStreetMap and contributors\" generator=\"fb_conflation_service\" version=\"0.6\">\n <bounds maxlat=\"39.0738691\" maxlon=\"-108.57072358101\" minlat=\"39.0734262\" minlon=\"-108.57155941899\"/>\n <node action=\"modify\" id=\"-2115501659910767206\" lat=\"39.0735990\" lon=\"-108.5707442\" visible=\"true\">\n <tag k=\"conn\" v=\"w626760817,n5917002841,n5917002155\"/>\n </node>\n <node action=\"modify\" id=\"-373066400259132\" lat=\"39.0735906\" lon=\"-108.5709913\" visible=\"true\">\n <tag k=\"conn\" v=\"w676695801,n5917002119,n5917002154\"/>\n </node>\n <node action=\"modify\" id=\"-1944810158953697\" lat=\"39.0735948\" lon=\"-108.5708516\" visible=\"true\">\n <tag k=\"conn\" v=\"w630961276,n176213658,n5907055576\"/>\n </node>\n <node action=\"modify\" id=\"-710999622096597555\" lat=\"39.0736112\" lon=\"-108.5710852\" visible=\"true\">\n <tag k=\"dupe\" v=\"n6815623346\"/>\n </node>\n <way action=\"modify\" id=\"-1203473873173507\" visible=\"true\">\n <nd ref=\"-710999622096597555\"/>\n <nd ref=\"-373066400259132\"/>\n <nd ref=\"-1944810158953697\"/>\n <nd ref=\"-2115501659910767206\"/>\n <tag k=\"highway\" v=\"residential\"/>\n <tag k=\"source\" v=\"digitalglobe\"/>\n </way>\n</osm>\n",
"headers" : {
"Content-Type" : "text/xml; charset=UTF-8",
"Strict-Transport-Security" : "max-age=15552000; preload",
"Vary" : "Accept-Encoding",
"X-Content-Type-Options" : "nosniff",
"X-Frame-Options" : "DENY",
"X-XSS-Protection" : "0",
"Access-Control-Allow-Origin" : "https://facebook.com",
"X-FB-Debug" : "uSJWx0e/RUvkCnIK8Mx8XNzMqBvPzu5eJapcrhsCE8pMjClTkvvJ23R6qIxFXpzLAr7C8eeDl3nvTCsi5JlsVg==",
"Date" : "Mon, 14 Oct 2019 21:47:59 GMT",
"Connection" : "keep-alive"
}
},
"uuid" : "f3356ac5-5d99-456b-8fb6-90dca6f7c766",
"persistent" : true,
"scenarioName" : "scenario-1-ml_roads",
"requiredScenarioState" : "Started",
"newScenarioState" : "scenario-1-ml_roads-2",
"insertionIndex" : 2
}

Wyświetl plik

@ -1,6 +1,8 @@
// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.mapwithai.backend;
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
@ -10,6 +12,8 @@ import org.openstreetmap.josm.data.osm.BBox;
import org.openstreetmap.josm.testutils.JOSMTestRules;
import org.openstreetmap.josm.tools.Territories;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
public class MapWithAIAvailabilityTest {
@ -19,8 +23,13 @@ public class MapWithAIAvailabilityTest {
@SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
public JOSMTestRules test = new JOSMTestRules().preferences().main().projection();
@Rule
public WireMockRule wireMockRule = new WireMockRule(options().usingFilesUnderDirectory("test/resources/wiremock"));
@Before
public void setUp() {
MapWithAIAvailability.setReleaseUrl(wireMockRule.baseUrl()
+ "/facebookmicrosites/Open-Mapping-At-Facebook/master/data/rapid_realeases.geojson");
Territories.initialize();
instance = MapWithAIAvailability.getInstance();
}

Wyświetl plik

@ -1,6 +1,8 @@
// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.mapwithai.backend;
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@ -8,6 +10,7 @@ import java.util.List;
import java.util.TreeSet;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.openstreetmap.josm.TestUtils;
@ -25,6 +28,8 @@ import org.openstreetmap.josm.gui.MainApplication;
import org.openstreetmap.josm.gui.layer.GpxLayer;
import org.openstreetmap.josm.testutils.JOSMTestRules;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
public class MapWithAIDataUtilsTest {
@ -32,6 +37,16 @@ public class MapWithAIDataUtilsTest {
@SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
public JOSMTestRules test = new JOSMTestRules().preferences().main().projection();
@Rule
public WireMockRule wireMockRule = new WireMockRule(options().usingFilesUnderDirectory("test/resources/wiremock"));
@Before
public void setUp() {
String URL = MapWithAIDataUtils.getMapWithAIUrl().replace("https://www.facebook.com/maps",
wireMockRule.baseUrl());
MapWithAIDataUtils.setMapWithAIUrl(URL, true);
}
/**
* This gets data from MapWithAI. This test may fail if someone adds the data to
* OSM.
@ -124,11 +139,11 @@ public class MapWithAIDataUtilsTest {
@Test
public void testMapWithAIURLPreferences() {
final String fakeUrl = "https://fake.url";
Assert.assertEquals(MapWithAIDataUtils.DEFAULT_MAPWITHAI_API, MapWithAIDataUtils.getMapWithAIUrl());
Assert.assertNotEquals(fakeUrl, MapWithAIDataUtils.getMapWithAIUrl());
MapWithAIDataUtils.setMapWithAIUrl(fakeUrl, true);
Assert.assertEquals(fakeUrl, MapWithAIDataUtils.getMapWithAIUrl());
final List<String> urls = new ArrayList<>(MapWithAIDataUtils.getMapWithAIURLs());
Assert.assertEquals(2, urls.size());
Assert.assertEquals(3, urls.size());
MapWithAIDataUtils.setMapWithAIUrl(MapWithAIDataUtils.DEFAULT_MAPWITHAI_API, true);
Assert.assertEquals(MapWithAIDataUtils.DEFAULT_MAPWITHAI_API, MapWithAIDataUtils.getMapWithAIUrl());
MapWithAIDataUtils.setMapWithAIUrl(fakeUrl, true);

Wyświetl plik

@ -1,6 +1,7 @@
// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.mapwithai.backend;
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
import static org.openstreetmap.josm.tools.I18n.tr;
import java.awt.Component;
@ -22,6 +23,8 @@ import org.openstreetmap.josm.gui.layer.Layer;
import org.openstreetmap.josm.gui.layer.OsmDataLayer;
import org.openstreetmap.josm.testutils.JOSMTestRules;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
/**
@ -33,10 +36,17 @@ public class MapWithAILayerTest {
@SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
public JOSMTestRules test = new JOSMTestRules().preferences().main().projection();
@Rule
@SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
public WireMockRule wireMockRule = new WireMockRule(options().usingFilesUnderDirectory("test/resources/wiremock"));
MapWithAILayer layer;
@Before
public void setUp() {
String URL = MapWithAIDataUtils.getMapWithAIUrl().replace("https://www.facebook.com/maps",
wireMockRule.baseUrl());
MapWithAIDataUtils.setMapWithAIUrl(URL, true);
layer = new MapWithAILayer(new DataSet(), "test", null);
}

Wyświetl plik

@ -1,19 +1,21 @@
// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.mapwithai.backend;
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.openstreetmap.josm.data.osm.BBox;
import org.openstreetmap.josm.gui.MainApplication;
import org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler.RequestHandlerBadRequestException;
import org.openstreetmap.josm.plugins.mapwithai.backend.MapWithAIDataUtils;
import org.openstreetmap.josm.plugins.mapwithai.backend.MapWithAILayer;
import org.openstreetmap.josm.plugins.mapwithai.backend.MapWithAIRemoteControl;
import org.openstreetmap.josm.testutils.JOSMTestRules;
import org.openstreetmap.josm.tools.Utils;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
/**
@ -35,6 +37,16 @@ public class MapWithAIRemoteControlTest {
@SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
public JOSMTestRules test = new JOSMTestRules().main().projection();
@Rule
public WireMockRule wireMockRule = new WireMockRule(options().usingFilesUnderDirectory("test/resources/wiremock"));
@Before
public void setUp() {
String URL = MapWithAIDataUtils.getMapWithAIUrl().replace("https://www.facebook.com/maps",
wireMockRule.baseUrl());
MapWithAIDataUtils.setMapWithAIUrl(URL, true);
}
private static MapWithAIRemoteControl newHandler(String url) throws RequestHandlerBadRequestException {
final MapWithAIRemoteControl req = new MapWithAIRemoteControl();
if (url != null) {

Wyświetl plik

@ -1,11 +1,14 @@
// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.mapwithai.commands;
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.openstreetmap.josm.TestUtils;
@ -18,9 +21,11 @@ import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
import org.openstreetmap.josm.data.osm.Way;
import org.openstreetmap.josm.gui.MainApplication;
import org.openstreetmap.josm.gui.layer.OsmDataLayer;
import org.openstreetmap.josm.plugins.mapwithai.commands.CreateConnectionsCommand;
import org.openstreetmap.josm.spi.preferences.Config;
import org.openstreetmap.josm.testutils.JOSMTestRules;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
/**
@ -33,6 +38,14 @@ public class CreateConnectionsCommandTest {
@SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
public JOSMTestRules test = new JOSMTestRules().projection();
@Rule
public WireMockRule wireMockRule = new WireMockRule(options().usingFilesUnderDirectory("test/resources/wiremock"));
@Before
public void setUp() {
Config.getPref().put("osm-server.url", wireMockRule.baseUrl());
}
/**
* Test method for
* {@link CreateConnectionsCommand#createConnections(DataSet, Collection)}.