aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2012-12-04 21:24:41 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2012-12-04 21:24:41 +1300
commit8d49ced822a1ae5c8b3f065178116e95a4f55c85 (patch)
treec5ab665fa17511ce808e34d2544ac6e1eb252061 /test/org/traccar
parent2b6d8cb12c6a307b4ee9a0af12101042ec78803c (diff)
downloadtrackermap-server-8d49ced822a1ae5c8b3f065178116e95a4f55c85.tar.gz
trackermap-server-8d49ced822a1ae5c8b3f065178116e95a4f55c85.tar.bz2
trackermap-server-8d49ced822a1ae5c8b3f065178116e95a4f55c85.zip
Added Navis protocol (fix #99)
Diffstat (limited to 'test/org/traccar')
-rw-r--r--test/org/traccar/protocol/NavisProtocolDecoderTest.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/org/traccar/protocol/NavisProtocolDecoderTest.java b/test/org/traccar/protocol/NavisProtocolDecoderTest.java
new file mode 100644
index 000000000..f880cde8b
--- /dev/null
+++ b/test/org/traccar/protocol/NavisProtocolDecoderTest.java
@@ -0,0 +1,24 @@
+package org.traccar.protocol;
+
+import java.nio.ByteOrder;
+import org.jboss.netty.buffer.ChannelBuffers;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertNotNull;
+import org.junit.Test;
+
+public class NavisProtocolDecoderTest {
+
+ @Test
+ public void testDecode() throws Exception {
+
+ NavisProtocolDecoder decoder = new NavisProtocolDecoder(new TestDataManager());
+
+ byte[] buf1 = {0x40,0x4E,0x54,0x43,0x01,0x00,0x00,0x00,0x7B,0x00,0x00,0x00,0x13,0x00,0x44,0x34,0x2A,0x3E,0x53,0x3A,0x38,0x36,0x31,0x37,0x38,0x35,0x30,0x30,0x35,0x32,0x30,0x35,0x30,0x37,0x39};
+ assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, buf1)));
+
+ byte[] buf2 = {0x40,0x4E,0x54,0x43,0x01,0x00,0x00,0x00,0x7B,0x00,0x00,0x00,0x5A,0x00,0x50,0x69,0x2A,0x3E,0x41,0x01,0x25,(byte)0xDB,0x0E,0x00,0x00,0x00,0x15,0x11,0x07,0x07,0x11,0x0A,0x0C,0x08,(byte)0x80,0x63,0x00,0x00,(byte)0xAA,0x39,(byte)0xA2,0x38,0x16,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x11,0x07,0x08,0x11,0x0A,0x0C,(byte)0xB3,(byte)0x89,(byte)0x79,0x3F,0x1A,(byte)0xEF,0x26,0x3F,0x00,0x00,0x00,0x00,0x12,0x00,0x34,(byte)0xF5,0x16,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xFA,(byte)0xFF,0x00,0x00,0x00,(byte)0xFA,(byte)0xFF,0x00,0x00,0x00,(byte)0xFA,(byte)0xFF,(byte)0x80,(byte)0x80,(byte)0x80,(byte)0x80};
+ assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, buf2)));
+
+ }
+
+}