diff options
Diffstat (limited to 'test')
3 files changed, 28 insertions, 0 deletions
diff --git a/test/org/traccar/protocol/AquilaProtocolDecoderTest.java b/test/org/traccar/protocol/AquilaProtocolDecoderTest.java index a2ef966c2..8844dafd2 100644 --- a/test/org/traccar/protocol/AquilaProtocolDecoderTest.java +++ b/test/org/traccar/protocol/AquilaProtocolDecoderTest.java @@ -11,6 +11,9 @@ public class AquilaProtocolDecoderTest extends ProtocolTest { AquilaProtocolDecoder decoder = new AquilaProtocolDecoder(new AquilaProtocol()); verifyPosition(decoder, text( + "$$CLIENT_1ZF,170215089,1,18.462809,73.824188,170613182744,A,19,0,0,256,4,4.860000,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,259,3731,*37")); + + verifyPosition(decoder, text( "$$CLIENT_1ZF,170222318,101,22.846016,75.949104,170321103506,A,0,0,244991,0,10,0.860000,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,12483,294,*3D")); verifyNull(decoder, text( diff --git a/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java b/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java index 345a89ad9..ee48ebb27 100644 --- a/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java @@ -10,6 +10,9 @@ public class Gps103ProtocolDecoderTest extends ProtocolTest { Gps103ProtocolDecoder decoder = new Gps103ProtocolDecoder(new Gps103Protocol()); + verifyNull(decoder, text( + "imei:868683027825532,OBD,170613203014,,,,0,0,0.00%,0,0.00%,0,0.00,,,,;")); + verifyAttributes(decoder, text( "imei:862106025092216,OBD,170612165656,196043,,145803.9,,000,0.0%,+,0.0%,00000,12.6,,,,;")); diff --git a/test/org/traccar/protocol/OwnTracksProtocolDecoderTest.java b/test/org/traccar/protocol/OwnTracksProtocolDecoderTest.java new file mode 100644 index 000000000..75d9af041 --- /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("{\"lon\":2.29513,\"lat\":48.85833,\"tst\":1497349316,\"_type\":\"location\",\"tid\":\"JJ\"}"))); + + verifyPosition(decoder, request(HttpMethod.POST, "/", + buffer("{\"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}"))); + + } + +} |