aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar/location/LocationProviderTest.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-12-20 17:22:21 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2016-12-20 17:22:21 +1300
commit0a8d47bec2a232aad6353d34a101eb82c9d4f7ae (patch)
tree2bad0ed0875b4e2ef751ffc6a7d25591cd6ae3fd /test/org/traccar/location/LocationProviderTest.java
parentc5594e16882ac3ec9215c47047e857566f8166b8 (diff)
downloadtrackermap-server-0a8d47bec2a232aad6353d34a101eb82c9d4f7ae.tar.gz
trackermap-server-0a8d47bec2a232aad6353d34a101eb82c9d4f7ae.tar.bz2
trackermap-server-0a8d47bec2a232aad6353d34a101eb82c9d4f7ae.zip
Improved network location providers
Diffstat (limited to 'test/org/traccar/location/LocationProviderTest.java')
-rw-r--r--test/org/traccar/location/LocationProviderTest.java27
1 files changed, 16 insertions, 11 deletions
diff --git a/test/org/traccar/location/LocationProviderTest.java b/test/org/traccar/location/LocationProviderTest.java
index 910f9e9ea..9c6000121 100644
--- a/test/org/traccar/location/LocationProviderTest.java
+++ b/test/org/traccar/location/LocationProviderTest.java
@@ -2,34 +2,33 @@ package org.traccar.location;
import org.junit.Assert;
import org.junit.Test;
+import org.traccar.BaseTest;
+import org.traccar.model.CellTower;
+import org.traccar.model.Network;
import org.traccar.model.Position;
import java.util.HashMap;
import java.util.Map;
-public class LocationProviderTest {
+public class LocationProviderTest extends BaseTest {
private boolean enable = false;
@Test
public void test() {
if (enable) {
- testOpenCellId();
+ testMozilla();
}
}
- public void testOpenCellId() {
- OpenCellIdLocationProvider locationProvider = new OpenCellIdLocationProvider("fake");
+ public void testMozilla() {
+ MozillaLocationProvider locationProvider = new MozillaLocationProvider();
- Map<String, Object> attributes = new HashMap<>();
- attributes.put(Position.KEY_MCC, 260);
- attributes.put(Position.KEY_MNC, 2);
- attributes.put(Position.KEY_LAC, 10250);
- attributes.put(Position.KEY_CID, 26511);
+ Network network = new Network(CellTower.from(260, 2, 10250, 26511));
- locationProvider.getLocation(attributes, new LocationProvider.LocationProviderCallback() {
+ locationProvider.getLocation(network, new LocationProvider.LocationProviderCallback() {
@Override
- public void onSuccess(double latitude, double longitude) {
+ public void onSuccess(double latitude, double longitude, double accuracy) {
Assert.assertEquals(60.07254, latitude, 0.00001);
Assert.assertEquals(30.30996, longitude, 0.00001);
}
@@ -39,6 +38,12 @@ public class LocationProviderTest {
Assert.fail();
}
});
+
+ try {
+ Thread.sleep(10000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
}
}