aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-06-14 20:47:21 +1200
committerGitHub <noreply@github.com>2017-06-14 20:47:21 +1200
commite4262bd41306970130b30b529bd0913e911efda1 (patch)
tree33c3ba94df5123c3a033f12ce6b4981009623a56 /test
parentb84d627b57181907c73d2c4ebb46ed011be8cfab (diff)
parent21a4dbd3150d49d15f48dfcdc38ad2d9e2f37a85 (diff)
downloadtrackermap-server-e4262bd41306970130b30b529bd0913e911efda1.tar.gz
trackermap-server-e4262bd41306970130b30b529bd0913e911efda1.tar.bz2
trackermap-server-e4262bd41306970130b30b529bd0913e911efda1.zip
Merge pull request #3242 from jpmens/owntracks
New protocol decoder for OwnTracks
Diffstat (limited to 'test')
-rw-r--r--test/org/traccar/protocol/OwnTracksProtocolDecoderTest.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/org/traccar/protocol/OwnTracksProtocolDecoderTest.java b/test/org/traccar/protocol/OwnTracksProtocolDecoderTest.java
new file mode 100644
index 000000000..1eb188421
--- /dev/null
+++ b/test/org/traccar/protocol/OwnTracksProtocolDecoderTest.java
@@ -0,0 +1,22 @@
+package org.traccar.protocol;
+
+import org.jboss.netty.handler.codec.http.HttpMethod;
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+
+public class OwnTracksProtocolDecoderTest extends ProtocolTest {
+
+ @Test
+ public void testDecode() throws Exception {
+
+ OwnTracksProtocolDecoder decoder = new OwnTracksProtocolDecoder(new OwnTracksProtocol());
+
+ verifyPosition(decoder, request(HttpMethod.POST, "/",
+ buffer(text("{\"lon\":2.29513,\"lat\":48.85833,\"tst\":1497349316,\"_type\":\"location\",\"tid\":\"JJ\"}"))));
+
+ verifyPosition(decoder, request(HttpMethod.POST, "/",
+ buffer(text("{\"cog\":271,\"lon\":2.29513,\"acc\":5,\"vel\":61,\"vac\":21,\"lat\":48.85833,\"tst\":1497349316,\"alt\":167,\"_type\":\"location\",\"tid\":\"JJ\",\"t\":\"u\",\"batt\":67}"))));
+
+ }
+
+}