aboutsummaryrefslogtreecommitdiff
path: root/test/org
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-12-09 02:54:27 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2016-12-09 02:54:27 +1300
commit7638564f34b182b3f9a4e650d3f180f04fe8ae28 (patch)
tree87d8e33c17b63df36f0aa662ddadd918d2e2fe45 /test/org
parent627069db35c2ef3a433847a546aa7a2c0e0f4d3b (diff)
downloadtraccar-server-7638564f34b182b3f9a4e650d3f180f04fe8ae28.tar.gz
traccar-server-7638564f34b182b3f9a4e650d3f180f04fe8ae28.tar.bz2
traccar-server-7638564f34b182b3f9a4e650d3f180f04fe8ae28.zip
Workaround for Granit coordinates (fix #2664)
Diffstat (limited to 'test/org')
-rw-r--r--test/org/traccar/ProtocolTest.java4
-rw-r--r--test/org/traccar/protocol/GranitProtocolDecoderTest.java18
2 files changed, 19 insertions, 3 deletions
diff --git a/test/org/traccar/ProtocolTest.java b/test/org/traccar/ProtocolTest.java
index 756393288..93f3150c7 100644
--- a/test/org/traccar/ProtocolTest.java
+++ b/test/org/traccar/ProtocolTest.java
@@ -135,7 +135,9 @@ public class ProtocolTest extends BaseTest {
if (expected != null) {
if (expected.getFixTime() != null) {
- Assert.assertEquals("time", expected.getFixTime(), position.getFixTime());
+ DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
+ dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
+ Assert.assertEquals("time", dateFormat.format(expected.getFixTime()), dateFormat.format(position.getFixTime()));
}
Assert.assertEquals("valid", expected.getValid(), position.getValid());
Assert.assertEquals("latitude", expected.getLatitude(), position.getLatitude(), 0.00001);
diff --git a/test/org/traccar/protocol/GranitProtocolDecoderTest.java b/test/org/traccar/protocol/GranitProtocolDecoderTest.java
index 1fea1d98c..6e85b5cfc 100644
--- a/test/org/traccar/protocol/GranitProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/GranitProtocolDecoderTest.java
@@ -13,6 +13,20 @@ public class GranitProtocolDecoderTest extends ProtocolTest {
GranitProtocolDecoder decoder = new GranitProtocolDecoder(new GranitProtocol());
verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "2b444441547e8400c500040130050c43495808002839aee3150200000000640000000000000008002839aee3150200000000640000000000000008002839aee3150200000000640000000000000008002839aee3150200000000640000000000000008002839aee3150200000000640000000000000008002839aee3150200000000640000000000000014002a37420d0a"));
+
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "2b525243427e1a00c5008443495808002839aee315020000000064000000000000002a37410d0a"),
+ position("2016-12-08 11:27:00.000", false, 57.00888, 40.97143));
+
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "2b525243427e1a00c500ec904858b842283997e30002000000005e000000000d00002a32390d0a"),
+ position("2016-12-07 22:45:00.000", true, 57.00853, 40.97105));
+
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "2b525243427e1a00c500009148580800283997e30002000000005f000000000000002a33410d0a"));
+
+ verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
"2b444441547e84003b6d0401b10e9217445800b051398f35d34a313b000072000000010b000080b051398f35d34a313b000072000000010b0000f0b051390f33314c303b900371000000010b0000f0b05139cd31e54c2f3cd0016f000000010b0000f0b051396831204d303d950071000000010b0000f0b051397530aa4d323c610171000000010b00000a002a30420d0a"));
verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
@@ -24,11 +38,11 @@ public class GranitProtocolDecoderTest extends ProtocolTest {
verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
"2b444441547e84003e290401d41680747c57f8a03c38987f50e6005300006c000000001c0000f8b03c38987f50e6005300006c000000001c0000fefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefe14002a4346"));
- //+IDNT: Navigator.04x Firmware version 0712GLN *21
+ // +IDNT: Navigator.04x Firmware version 0712GLN *21
verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN,
"2b49444e543a204e6176696761746f722e30347820204669726d776172652076657273696f6e202030373132474c4e202a3231"));
- //ERROR WRONG CHECKSUM_1
+ // ERROR WRONG CHECKSUM_1
verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN,
"4552524f522057524f4e4720434845434b53554d5f31"));