aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2014-10-22 16:37:13 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2014-10-22 16:37:13 +1300
commit435ae8233c3cca5da88c4ba774b90aff780e9b88 (patch)
treec35e5102a5ab3ee1e8c10120bd8f69bfa762102c /test/org/traccar/protocol
parent5490a0351abc9d6e741baf129300beb2d50051fd (diff)
downloadtrackermap-server-435ae8233c3cca5da88c4ba774b90aff780e9b88.tar.gz
trackermap-server-435ae8233c3cca5da88c4ba774b90aff780e9b88.tar.bz2
trackermap-server-435ae8233c3cca5da88c4ba774b90aff780e9b88.zip
Add unit tests
Diffstat (limited to 'test/org/traccar/protocol')
-rw-r--r--test/org/traccar/protocol/H02ProtocolDecoderTest.java23
-rw-r--r--test/org/traccar/protocol/SkypatrolProtocolDecoderTest.java3
2 files changed, 16 insertions, 10 deletions
diff --git a/test/org/traccar/protocol/H02ProtocolDecoderTest.java b/test/org/traccar/protocol/H02ProtocolDecoderTest.java
index d1800f3f3..09b55d816 100644
--- a/test/org/traccar/protocol/H02ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/H02ProtocolDecoderTest.java
@@ -74,21 +74,24 @@ public class H02ProtocolDecoderTest {
verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer(
"*HQ,356823035368767,V1,083618,A,0955.6392,N,07809.0796,E,0.00,0,070414,FFFBFFFF,194,3b5, 71,c9a9#", Charset.defaultCharset())));
+
+ assertNull(decoder.decode(null, null, ChannelBuffers.copiedBuffer(
+ "*HQ,8401016597,BASE,152609,0,0,0,0,211014,FFFFFFFF#", Charset.defaultCharset())));
- int[] buf1 = {0x24,0x27,0x05,0x17,0x11,0x09,0x21,0x33,0x39,0x14,0x06,0x13,0x50,0x02,0x58,0x49,0x00,0x01,0x43,0x37,0x82,0x2e,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0x00,0x00};
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf1))));
+ verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(
+ new int[]{0x24,0x27,0x05,0x17,0x11,0x09,0x21,0x33,0x39,0x14,0x06,0x13,0x50,0x02,0x58,0x49,0x00,0x01,0x43,0x37,0x82,0x2e,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0x00,0x00}))));
- int[] buf2 = {0x24,0x27,0x05,0x17,0x11,0x09,0x21,0x34,0x09,0x14,0x06,0x13,0x50,0x02,0x58,0x49,0x00,0x01,0x43,0x37,0x82,0x2e,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0x00,0x00};
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf2))));
+ verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(
+ new int[]{0x24,0x27,0x05,0x17,0x11,0x09,0x21,0x34,0x09,0x14,0x06,0x13,0x50,0x02,0x58,0x49,0x00,0x01,0x43,0x37,0x82,0x2e,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0x00,0x00}))));
- int[] buf3 = {0x24,0x10,0x30,0x73,0x10,0x01,0x05,0x03,0x16,0x22,0x09,0x02,0x22,0x12,0x87,0x45,0x00,0x11,0x34,0x66,0x57,0x4C,0x01,0x40,0x28,0xff,0xff,0xfb,0xff,0xff,0x00,0x00};
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf3))));
+ verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(
+ new int[]{0x24,0x10,0x30,0x73,0x10,0x01,0x05,0x03,0x16,0x22,0x09,0x02,0x22,0x12,0x87,0x45,0x00,0x11,0x34,0x66,0x57,0x4C,0x01,0x40,0x28,0xff,0xff,0xfb,0xff,0xff,0x00,0x00}))));
- int[] buf4 = {0x24,0x41,0x09,0x00,0x13,0x45,0x08,0x31,0x25,0x04,0x01,0x14,0x50,0x47,0x88,0x80,0x00,0x00,0x85,0x54,0x65,0x0e,0x00,0x00,0x00,0xff,0xff,0xf9,0xff,0xff,0x00,0x10,0x06,0x00,0x00,0x00,0x00,0x01,0x06,0x02,0x02,0x99,0x10,0x9c,0x01};
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf4))));
+ verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(
+ new int[]{0x24,0x41,0x09,0x00,0x13,0x45,0x08,0x31,0x25,0x04,0x01,0x14,0x50,0x47,0x88,0x80,0x00,0x00,0x85,0x54,0x65,0x0e,0x00,0x00,0x00,0xff,0xff,0xf9,0xff,0xff,0x00,0x10,0x06,0x00,0x00,0x00,0x00,0x01,0x06,0x02,0x02,0x99,0x10,0x9c,0x01}))));
- int[] buf5 = {0x24,0x27,0x05,0x17,0x03,0x08,0x20,0x32,0x14,0x18,0x04,0x14,0x23,0x30,0x78,0x79,0x00,0x04,0x63,0x21,0x37,0x92,0x00,0x00,0x56,0xff,0xff,0xf9,0xff,0xff,0x00,0x00};
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf5))));
+ verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(
+ new int[]{0x24,0x27,0x05,0x17,0x03,0x08,0x20,0x32,0x14,0x18,0x04,0x14,0x23,0x30,0x78,0x79,0x00,0x04,0x63,0x21,0x37,0x92,0x00,0x00,0x56,0xff,0xff,0xf9,0xff,0xff,0x00,0x00}))));
}
diff --git a/test/org/traccar/protocol/SkypatrolProtocolDecoderTest.java b/test/org/traccar/protocol/SkypatrolProtocolDecoderTest.java
index b47624a25..758167384 100644
--- a/test/org/traccar/protocol/SkypatrolProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/SkypatrolProtocolDecoderTest.java
@@ -15,6 +15,9 @@ public class SkypatrolProtocolDecoderTest {
verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(
new int[]{0x00,0x05,0x02,0x10,0x04,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x0D,0x31,0x31,0x34,0x37,0x37,0x35,0x38,0x33,0x00,0xCB,0x00,0x00,0x00,0x00,0x0E,0x11,0x07,0x0C,0x01,0x01,0x84,0xD0,0x32,0xFB,0x38,0x41,0x37,0x00,0x00,0x00,0x00,0x16,0x07,0x2B,0x00,0x00,0x17,0x05,0x00,0x32,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x4E,0x0C,0x07,0x11,0x16,0x07,0x2C,0x10,0x59,0x00,0x05,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x00,0x03,0x10,0x02,0x60,0xB7,0x36,0x3B,0x63,0x06,0xC1,0x1A,0x00,0xB7,0x36,0x37,0xF2,0x06,0xBF,0x19,0xB7,0x36,0x37,0xF1,0x06,0xB5,0x0E,0xB7,0x36,0x38,0xB1,0x06,0xBB,0x0B,0xB7,0x36,0x3B,0x61,0x06,0xB8,0x0A,0xB7,0x36,0x37,0xF3,0x06,0xB7,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C}))));
+
+ //verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(
+ // new int[]{0x00,0x05,0x00,0x03,0x01,0x01,0x38,0x36,0x37,0x38,0x34,0x34,0x30,0x30,0x31,0x37,0x38,0x32,0x33,0x33,0x36,0x42,0x01,0x02,0x00,0x0c,0x00,0x00,0xfa,0x07,0xb5,0xe1,0x01,0x87,0x6c,0x5b,0x0e,0x0a,0x11,0x16,0x06,0x13,0x1c,0x1b,0x5e}))));
//Enfora TT8750
//verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(