aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2013-08-19 23:25:40 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2013-08-19 23:25:40 +1200
commitf03fbcc96e804c232a873d63eaf55060685ad3da (patch)
tree2ac84a74564611d4f321a7c81b550c7b0eaa6645 /test/org/traccar
parent6ec4bb34e99a56b2786b149d73f243246fb979d9 (diff)
downloadtrackermap-server-f03fbcc96e804c232a873d63eaf55060685ad3da.tar.gz
trackermap-server-f03fbcc96e804c232a873d63eaf55060685ad3da.tar.bz2
trackermap-server-f03fbcc96e804c232a873d63eaf55060685ad3da.zip
Add M2M mini protocol
Diffstat (limited to 'test/org/traccar')
-rw-r--r--test/org/traccar/protocol/M2mProtocolDecoderTest.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/org/traccar/protocol/M2mProtocolDecoderTest.java b/test/org/traccar/protocol/M2mProtocolDecoderTest.java
new file mode 100644
index 000000000..3ea2131c9
--- /dev/null
+++ b/test/org/traccar/protocol/M2mProtocolDecoderTest.java
@@ -0,0 +1,25 @@
+package org.traccar.protocol;
+
+import org.jboss.netty.buffer.ChannelBuffers;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import org.junit.Test;
+import org.traccar.helper.ChannelBufferTools;
+
+public class M2mProtocolDecoderTest {
+
+ @Test
+ public void testDecode() throws Exception {
+
+ M2mProtocolDecoder decoder = new M2mProtocolDecoder(null);
+ decoder.setDataManager(new TestDataManager());
+
+ int[] buf1 = {0x23,0x5A,0x3C,0x2A,0x26,0x24,0x21,0x5C,0x28,0x7D,0x70,0x21,0x2A,0x21,0x25,0x4C,0x7C,0x64,0x21,0x22,0x0B,0x0B,0x0B};
+ assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf1))));
+
+ int[] buf2 = {0xA6,0xE1,0x2C,0x2A,0xAA,0xDA,0x46,0x28,0x32,0x6B,0x20,0x59,0x57,0x6E,0x30,0x20,0x2A,0x2F,0xE8,0x5D,0x20,0x20,0x0B};
+ assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf2))));
+
+ }
+
+}