diff options
-rw-r--r-- | src/org/traccar/Context.java | 5 | ||||
-rw-r--r-- | src/org/traccar/geocode/MapQuestReverseGeocoder.java | 13 | ||||
-rw-r--r-- | web/tests/010_sanity.t.js | 13 | ||||
-rw-r--r-- | web/tests/index.html | 17 | ||||
-rw-r--r-- | web/tests/index.js | 14 |
5 files changed, 51 insertions, 11 deletions
diff --git a/src/org/traccar/Context.java b/src/org/traccar/Context.java index 7f1d175e0..fb85de0a4 100644 --- a/src/org/traccar/Context.java +++ b/src/org/traccar/Context.java @@ -22,6 +22,7 @@ import org.traccar.database.IdentityManager; import org.traccar.database.PermissionsManager; import org.traccar.geocode.GisgraphyReverseGeocoder; import org.traccar.geocode.GoogleReverseGeocoder; +import org.traccar.geocode.MapQuestReverseGeocoder; import org.traccar.geocode.NominatimReverseGeocoder; import org.traccar.geocode.ReverseGeocoder; import org.traccar.geocode.MapQuestReverseGeocoder; @@ -113,7 +114,7 @@ public class Context { String url = config.getString("geocoder.url"); String key = config.getString("geocoder.key"); - int cacheSize = config.getInteger("geocoder.cacheSize"); + int cacheSize = config.getInteger("geocoder.cacheSize"); switch (type) { case "google": reverseGeocoder = new GoogleReverseGeocoder(cacheSize); @@ -124,6 +125,8 @@ public class Context { case "gisgraphy": reverseGeocoder = new GisgraphyReverseGeocoder(url, cacheSize); break; + case "mapquest": + reverseGeocoder = new MapQuestReverseGeocoder(url, key, cacheSize); case "mapquest": reverseGeocoder = new MapQuestReverseGeocoder(url, key, cacheSize); break; diff --git a/src/org/traccar/geocode/MapQuestReverseGeocoder.java b/src/org/traccar/geocode/MapQuestReverseGeocoder.java index 45df18658..e1ed18918 100644 --- a/src/org/traccar/geocode/MapQuestReverseGeocoder.java +++ b/src/org/traccar/geocode/MapQuestReverseGeocoder.java @@ -15,24 +15,17 @@ */ package org.traccar.geocode; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import javax.json.Json; import javax.json.JsonArray; import javax.json.JsonObject; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; - -import org.traccar.helper.Log; -import org.w3c.dom.Document; public class MapQuestReverseGeocoder extends JsonReverseGeocoder { + public MapQuestReverseGeocoder() { this("http://www.mapquestapi.com/geocoding/v1/reverse", "ABCDE", 0); } + public MapQuestReverseGeocoder(String url, String key, int cacheSize) { - super(url + "?key=" + key + "&location=%f,%f", cacheSize); + super(url + "?key=" + key + "&location=%f,%f", cacheSize); } @Override diff --git a/web/tests/010_sanity.t.js b/web/tests/010_sanity.t.js new file mode 100644 index 000000000..9d5636493 --- /dev/null +++ b/web/tests/010_sanity.t.js @@ -0,0 +1,13 @@ +// also supports: startTest(function(t) { +StartTest(function(t) { + t.diag("Sanity"); + + t.ok(Ext, 'ExtJS is here'); + t.ok(Ext.Window, '.. indeed'); + + + t.ok(Your.Project, 'My project is here'); + t.ok(Your.Project.Util, '.. indeed'); + + t.done(); // Optional, marks the correct exit point from the test +}) diff --git a/web/tests/index.html b/web/tests/index.html new file mode 100644 index 000000000..334e13893 --- /dev/null +++ b/web/tests/index.html @@ -0,0 +1,17 @@ +<!DOCTYPE html> +<html> +<head> +<!-- Siesta UI must use ExtJS 5.1.0 (you can specify any other ExtJS version in your "preload" config) --> +<link rel="stylesheet" type="text/css" href="//cdn.sencha.com/ext/gpl/5.1.0/packages/ext-theme-crisp/build/resources/ext-theme-crisp-all.css" /> +<link rel="stylesheet" type="text/css" href="//cdn.traccar.org/siesta/siesta-3.1.0-lite/resources/css/siesta-all.css"> + +<!-- Siesta UI must use ExtJS 5.1.0 (you can specify any other ExtJS version in your "preload" config) --> +<script type="text/javascript" src="//cdn.sencha.com/ext/gpl/5.1.0/build/ext-all.js"></script> +<script type="text/javascript" src="//cdn.traccar.org/siesta/siesta-3.1.0-lite/siesta-all.js"></script> + +<script type="text/javascript" src="index.js"></script> +</head> + +<body> +</body> +</html> diff --git a/web/tests/index.js b/web/tests/index.js new file mode 100644 index 000000000..a3708d7f1 --- /dev/null +++ b/web/tests/index.js @@ -0,0 +1,14 @@ +var Harness = Siesta.Harness.Browser.ExtJS; + +Harness.configure({ + title : 'Awesome Test Suite', + + preload : [ + '//cdnjs.cloudflare.com/ajax/libs/extjs/6.0.0/ext-all.js', + '../app.min.js' + ] +}); + +Harness.start( + '010_sanity.t.js' +); |