aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar/protocol
diff options
context:
space:
mode:
authorEvgeny S Maksimov <me@vragam.net>2019-01-31 01:33:51 +0300
committerEvgeny S Maksimov <me@vragam.net>2019-01-31 01:33:51 +0300
commit26dc25f0de3c4908425490bcf9e4f854d6598559 (patch)
treed9ff272de979a3999fb0dce79020938fe09b2306 /test/org/traccar/protocol
parenta652d928263b473648f43d4f64c06549792eb653 (diff)
downloadtrackermap-server-26dc25f0de3c4908425490bcf9e4f854d6598559.tar.gz
trackermap-server-26dc25f0de3c4908425490bcf9e4f854d6598559.tar.bz2
trackermap-server-26dc25f0de3c4908425490bcf9e4f854d6598559.zip
Added tests for frame decoder
Diffstat (limited to 'test/org/traccar/protocol')
-rw-r--r--test/org/traccar/protocol/NavisFrameDecoderTest.java39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/org/traccar/protocol/NavisFrameDecoderTest.java b/test/org/traccar/protocol/NavisFrameDecoderTest.java
new file mode 100644
index 000000000..069f03d1b
--- /dev/null
+++ b/test/org/traccar/protocol/NavisFrameDecoderTest.java
@@ -0,0 +1,39 @@
+package org.traccar.protocol;
+
+import org.traccar.ProtocolTest;
+
+import org.junit.Test;
+
+public class NavisFrameDecoderTest extends ProtocolTest {
+
+ @Test
+ public void testDecode() throws Exception {
+
+ NavisProtocolDecoder protocolDecoder = new NavisProtocolDecoder(null);
+ NavisFrameDecoder frameDecoder = new NavisFrameDecoder(protocolDecoder);
+
+ // Handshake
+ verifyNull(protocolDecoder, binary(
+ "404E5443010000007B000000130044342A3E533A383631373835303035323035303739"));
+
+ // NTCB F5.2 - Single
+ verifyFrame(binary(
+ "404e5443010000000000000059009adb2a3e54250000000000ff1500040b0a1008291838001200760ee600000000000000000000000f1500040b0a10ac20703fb1aec23f00000000320149668f430000000000000000000000000000000000000000000000f3808080"),
+ frameDecoder.decode(null, null, binary("404e5443010000000000000059009adb2a3e54250000000000ff1500040b0a1008291838001200760ee600000000000000000000000f1500040b0a10ac20703fb1aec23f00000000320149668f430000000000000000000000000000000000000000000000f3808080")));
+
+ // FLEX 1.0 - Negotiation
+ verifyNull(protocolDecoder, binary(
+ "404e544301000000aaecf6021300c8712a3e464c4558b00a0a45ffff300a08080f8388"));
+
+ // FLEX 1.0 - Single
+ verifyFrame(binary(
+ "7e54040000000400000030129957405c000b00632f9857405ccace03021e129101a103000000000000c4005ba3fe3b00000000120046100000000000001aff7f000080bfffff80000080bfffffffff9f"),
+ frameDecoder.decode(null, null, binary("7e54040000000400000030129957405c000b00632f9857405ccace03021e129101a103000000000000c4005ba3fe3b00000000120046100000000000001aff7f000080bfffff80000080bfffffffff9f")));
+
+ // FLEX 1.0 - Array (1 message)
+ verifyFrame(binary(
+ "7e4101080000000917c057405c002b001833c057405cbbce030225129101a00300007c6102408900400c1b3cfce3b23a12004710e000000000001bff7f000080bfffff80000080bfffffffffb2"),
+ frameDecoder.decode(null, null, binary("7e4101080000000917c057405c002b001833c057405cbbce030225129101a00300007c6102408900400c1b3cfce3b23a12004710e000000000001bff7f000080bfffff80000080bfffffffffb2")));
+ }
+
+}