diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-01-27 12:23:35 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-01-27 12:23:35 +1300 |
commit | 75aa9f8ba896fe88f7842126081b367872a26c46 (patch) | |
tree | 26390c9a42fb2324b525083dab9c28df4e368298 /test/org/traccar/protocol | |
parent | 0a7bfdfbcec8dbb587882c63919456a3855930b4 (diff) | |
download | traccar-server-75aa9f8ba896fe88f7842126081b367872a26c46.tar.gz traccar-server-75aa9f8ba896fe88f7842126081b367872a26c46.tar.bz2 traccar-server-75aa9f8ba896fe88f7842126081b367872a26c46.zip |
Update binary test cases
Diffstat (limited to 'test/org/traccar/protocol')
16 files changed, 205 insertions, 202 deletions
diff --git a/test/org/traccar/protocol/Gt02ProtocolDecoderTest.java b/test/org/traccar/protocol/Gt02ProtocolDecoderTest.java index ccd6ba789..11fc4ff97 100644 --- a/test/org/traccar/protocol/Gt02ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Gt02ProtocolDecoderTest.java @@ -13,15 +13,15 @@ public class Gt02ProtocolDecoderTest { public void testDecode() throws Exception { Gt02ProtocolDecoder decoder = new Gt02ProtocolDecoder(new TestDataManager(), null, null); - - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[] {0x68,0x68,0x25,0x00,0x00,0x01,0x23,0x45,0x67,0x89,0x01,0x23,0x45,0x00,0x01,0x10,0x01,0x01,0x01,0x01,0x01,0x01,0x02,0x6B,0x3F,0x3E,0x02,0x6B,0x3F,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x0D,0x0A})))); - - assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[] {0x68,0x68,0x11,0x06,0x03,0x03,0x58,0x89,0x90,0x51,0x01,0x27,0x66,0x00,0x00,0x1a,0x04,0x02,0x29,0x2d,0x0d,0x0a})))); - - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[] {0x68,0x68,0x25,0x00,0xa4,0x03,0x58,0x89,0x90,0x51,0x01,0x27,0x66,0x00,0x01,0x10,0x0e,0x09,0x06,0x0a,0x1d,0x1b,0x00,0xad,0xe1,0xc9,0x0b,0x79,0xea,0x30,0x00,0x01,0x1b,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0d,0x0a})))); + + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "68682500000123456789012345000110010101010101026B3F3E026B3F3E000000000000000000010D0A")))); + + assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "6868110603035889905101276600001a0402292d0d0a")))); + + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "68682500a403588990510127660001100e09060a1d1b00ade1c90b79ea3000011b000000000000050d0a")))); } diff --git a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java index 1536644a0..c0af74538 100644 --- a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java @@ -14,48 +14,48 @@ public class Gt06ProtocolDecoderTest { Gt06ProtocolDecoder decoder = new Gt06ProtocolDecoder(new TestDataManager(), null, null); - assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[] {0x78,0x78,0x11,0x01,0x01,0x23,0x45,0x67,0x89,0x01,0x23,0x45,0x10,0x0B,0x32,0x01,0x00,0x01,0x71,0x93,0x0D,0x0A})))); + assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "787811010123456789012345100B3201000171930D0A")))); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[] {0x78,0x78,0x1F,0x12,0x0B,0x08,0x1D,0x11,0x2E,0x10,0xCC,0x02,0x7A,0xC7,0xEB,0x0C,0x46,0x58,0x49,0x00,0x14,0x8F,0x01,0xCC,0x00,0x28,0x7D,0x00,0x1F,0xB8,0x00,0x03,0x80,0x81,0x0D,0x0A})))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "78781F120B081D112E10CC027AC7EB0C46584900148F01CC00287D001FB8000380810D0A")))); - assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[] {0x78,0x78,0x0D,0x01,0x08,0x64,0x71,0x70,0x03,0x28,0x35,0x81,0x00,0x09,0x3F,0x04,0x0D,0x0A})))); + assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "78780D01086471700328358100093F040D0A")))); - assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[] {0x78,0x78,0x0D,0x01,0x01,0x23,0x45,0x67,0x89,0x01,0x23,0x45,0x00,0x01,0x8C,0xDD,0x0D,0x0A})))); + assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "78780D01012345678901234500018CDD0D0A")))); - assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[] {0x78,0x78,0x0d,0x01,0x03,0x53,0x41,0x90,0x36,0x06,0x60,0x61,0x00,0x03,0xc3,0xdf,0x0d,0x0a})))); + assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "78780d0103534190360660610003c3df0d0a")))); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[] {0x78,0x78,0x19,0x10,0x0B,0x03,0x1A,0x0B,0x1B,0x31,0xCC,0x02,0x7A,0xC7,0xFD,0x0C,0x46,0x57,0xBF,0x01,0x15,0x21,0x00,0x01,0x00,0x1C,0xC6,0x07,0x0D,0x0A})))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "787819100B031A0B1B31CC027AC7FD0C4657BF0115210001001CC6070D0A")))); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[] {0x78,0x78,0x21,0x12,0x0C,0x01,0x0C,0x0F,0x15,0x1F,0xCF,0x02,0x7A,0xC8,0x84,0x0C,0x46,0x57,0xEC,0x00,0x14,0x00,0x01,0xCC,0x00,0x28,0x7D,0x00,0x1F,0x72,0x00,0x01,0x00,0x0F,0x53,0xA0,0x0D,0x0A})))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "787821120C010C0F151FCF027AC8840C4657EC00140001CC00287D001F720001000F53A00D0A")))); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[] {0x78,0x78,0x25,0x16,0x0B,0x05,0x1B,0x09,0x35,0x23,0xCF,0x02,0x7A,0xC8,0x36,0x0C,0x46,0x57,0xB3,0x00,0x14,0x00,0x09,0x01,0xCC,0x00,0x26,0x6A,0x00,0x1E,0x17,0x40,0x05,0x04,0x00,0x02,0x00,0x08,0xD7,0xB1,0x0D,0x0A})))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "787825160B051B093523CF027AC8360C4657B30014000901CC00266A001E1740050400020008D7B10D0A")))); - assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[] {0x78,0x78,0x11,0x01,0x08,0x64,0x71,0x70,0x03,0x66,0x44,0x67,0x10,0x0f,0x19,0x0a,0x00,0x02,0xc6,0xd2,0x0d,0x0a})))); - - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[] {0x78,0x78,0x19,0x10,0x0e,0x01,0x09,0x03,0x23,0x0e,0xc8,0x03,0xae,0x32,0xa6,0x06,0x53,0xcd,0xed,0x00,0x18,0x00,0x00,0x02,0x00,0x72,0xfe,0xb7,0x0d,0x0a})))); + assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "787811010864717003664467100f190a0002c6d20d0a")))); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[] {0x78,0x78,0x47,0x1e,0x0e,0x03,0x11,0x0b,0x05,0x11,0xc5,0x01,0xc6,0x64,0xfd,0x07,0x4d,0xb7,0x3f,0x02,0x18,0xa6,0x02,0xe0,0x03,0x43,0x3a,0x00,0x2f,0xed,0x40,0x43,0x3a,0x00,0x56,0xe1,0x4e,0x43,0x3a,0x00,0x56,0x10,0x4e,0x43,0x3a,0x00,0x56,0xfd,0x53,0x43,0x3a,0x00,0x2e,0xed,0x55,0x43,0x3a,0x00,0x7e,0x4b,0x57,0x43,0x3a,0x00,0x2e,0xe2,0x5a,0xff,0x00,0x02,0x01,0x20,0xf6,0x72,0x0d,0x0a})))); - - assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[] {0x79,0x79,0x00,0x5b,0xfd,0x03,0x58,0x89,0x90,0x50,0x92,0x77,0x25,0x00,0x4c,0x00,0x20,0xbf,0x98,0x43,0x58,0xdf,0x60,0x3b,0x2e,0xa3,0xa3,0x39,0xe5,0x43,0x35,0x01,0x3a,0x5b,0x56,0x45,0x52,0x53,0x49,0x4f,0x4e,0x5d,0x47,0x54,0x30,0x36,0x44,0x5f,0x32,0x30,0x5f,0x36,0x30,0x44,0x4d,0x32,0x5f,0x42,0x32,0x35,0x45,0x5f,0x56,0x31,0x35,0x5f,0x57,0x4d,0x5b,0x42,0x55,0x49,0x4c,0x44,0x5d,0x32,0x30,0x31,0x33,0x2f,0x31,0x32,0x2f,0x32,0x38,0x20,0x31,0x35,0x3a,0x32,0x34,0x00,0x2a,0x3b,0x24,0x0d,0x0a,0x79,0x79,0x00,0x5b,0xfd,0x03,0x58,0x89,0x90,0x50,0x92,0x77,0x25,0x00,0x4c,0x00,0x20,0xbf,0x98,0x43,0x58,0xdf,0x60,0x3b,0x2e,0xa3,0xa3,0x39,0xe5,0x43,0x35,0x01,0x3a,0x5b,0x56,0x45,0x52,0x53,0x49,0x4f,0x4e,0x5d,0x47,0x54,0x30,0x36,0x44,0x5f,0x32,0x30,0x5f,0x36,0x30,0x44,0x4d,0x32,0x5f,0x42,0x32,0x35,0x45,0x5f,0x56,0x31,0x35,0x5f,0x57,0x4d,0x5b,0x42,0x55,0x49,0x4c,0x44,0x5d,0x32,0x30,0x31,0x33,0x2f,0x31,0x32,0x2f,0x32,0x38,0x20,0x31,0x35,0x3a,0x32,0x34,0x00,0x2d,0x4f,0x9b,0x0d,0x0a,0x79,0x79,0x00,0x5b,0xfd,0x03,0x58,0x89,0x90,0x50,0x92,0x77,0x25,0x00,0x4c,0x00,0x20,0xbf,0x98,0x43,0x58,0xdf,0x60,0x3b,0x2e,0xa3,0xa3,0x39,0xe5,0x43,0x35,0x01,0x3a,0x5b,0x56,0x45,0x52,0x53,0x49,0x4f,0x4e,0x5d,0x47,0x54,0x30,0x36,0x44,0x5f,0x32,0x30,0x5f,0x36,0x30,0x44,0x4d,0x32,0x5f,0x42,0x32,0x35,0x45,0x5f,0x56,0x31,0x35,0x5f,0x57,0x4d,0x5b,0x42,0x55,0x49,0x4c,0x44,0x5d,0x32,0x30,0x31,0x33,0x2f,0x31,0x32,0x2f,0x32,0x38,0x20,0x31,0x35,0x3a,0x32,0x34,0x00,0x30,0x84,0xff,0x0d,0x0a})))); - - assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[] {0x78,0x78,0x8b,0x81,0x83,0x00,0x00,0x00,0x00,0x53,0x45,0x45,0x46,0x4e,0x26,0x26,0x00,0x4f,0x04,0x22,0x00,0x45,0x04,0x26,0x26,0x26,0x2b,0x37,0x39,0x30,0x35,0x34,0x30,0x31,0x35,0x35,0x34,0x36,0x26,0x26,0x26,0x26,0x26,0x26,0x04,0x10,0x04,0x1b,0x04,0x15,0x04,0x1a,0x04,0x21,0x04,0x15,0x04,0x19,0x26,0x26,0x2b,0x37,0x39,0x30,0x36,0x34,0x33,0x33,0x30,0x31,0x31,0x35,0x26,0x26,0x04,0x10,0x04,0x3d,0x04,0x4f,0x26,0x26,0x2b,0x37,0x39,0x36,0x30,0x34,0x37,0x38,0x34,0x30,0x36,0x34,0x26,0x26,0x04,0x12,0x04,0x3e,0x04,0x32,0x04,0x30,0x26,0x26,0x2b,0x37,0x39,0x32,0x38,0x38,0x34,0x37,0x37,0x38,0x38,0x31,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x23,0x23,0x00,0x02,0x00,0x22,0x15,0x5d,0x0d,0x0a})))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "787819100e010903230ec803ae32a60653cded00180000020072feb70d0a")))); + + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "7878471e0e03110b0511c501c664fd074db73f0218a602e003433a002fed40433a0056e14e433a0056104e433a0056fd53433a002eed55433a007e4b57433a002ee25aff00020120f6720d0a")))); + + assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "7979005bfd0358899050927725004c0020bf984358df603b2ea3a339e54335013a5b56455253494f4e5d47543036445f32305f3630444d325f423235455f5631355f574d5b4255494c445d323031332f31322f32382031353a3234002a3b240d0a7979005bfd0358899050927725004c0020bf984358df603b2ea3a339e54335013a5b56455253494f4e5d47543036445f32305f3630444d325f423235455f5631355f574d5b4255494c445d323031332f31322f32382031353a3234002d4f9b0d0a7979005bfd0358899050927725004c0020bf984358df603b2ea3a339e54335013a5b56455253494f4e5d47543036445f32305f3630444d325f423235455f5631355f574d5b4255494c445d323031332f31322f32382031353a3234003084ff0d0a")))); + + assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "78788b818300000000534545464e2626004f04220045042626262b37393035343031353534362626262626260410041b0415041a04210415041926262b373930363433333031313526260410043d044f26262b373936303437383430363426260412043e0432043026262b373932383834373738383126262626262626262626262626262626232300020022155d0d0a")))); + + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "787822220e0914160f07c9021a362805090a7800d8b802d402c30e00a98a0105010213f4bb0d0a")))); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[] {0x78,0x78,0x22,0x22,0x0e,0x09,0x14,0x16,0x0f,0x07,0xc9,0x02,0x1a,0x36,0x28,0x05,0x09,0x0a,0x78,0x00,0xd8,0xb8,0x02,0xd4,0x02,0xc3,0x0e,0x00,0xa9,0x8a,0x01,0x05,0x01,0x02,0x13,0xf4,0xbb,0x0d,0x0a})))); - } } diff --git a/test/org/traccar/protocol/H02ProtocolDecoderTest.java b/test/org/traccar/protocol/H02ProtocolDecoderTest.java index 09b55d816..eed626380 100644 --- a/test/org/traccar/protocol/H02ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/H02ProtocolDecoderTest.java @@ -78,21 +78,21 @@ public class H02ProtocolDecoderTest { assertNull(decoder.decode(null, null, ChannelBuffers.copiedBuffer( "*HQ,8401016597,BASE,152609,0,0,0,0,211014,FFFFFFFF#", Charset.defaultCharset()))); - 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})))); - - 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})))); - - 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})))); - - 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})))); - - 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})))); - + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "2427051711092133391406135002584900014337822e000000ffffffffff0000")))); + + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "2427051711092134091406135002584900014337822e000000ffffffffff0000")))); + + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "2410307310010503162209022212874500113466574C014028fffffbffff0000")))); + + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "2441090013450831250401145047888000008554650e000000fffff9ffff001006000000000106020299109c01")))); + + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "24270517030820321418041423307879000463213792000056fffff9ffff0000")))); + } } diff --git a/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java b/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java index 93dd7d209..7cbab2836 100644 --- a/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java @@ -1,5 +1,6 @@ package org.traccar.protocol; +import org.traccar.helper.ChannelBufferTools; import org.traccar.helper.TestDataManager; import java.nio.charset.Charset; import org.jboss.netty.buffer.ChannelBuffers; @@ -13,29 +14,29 @@ public class Jt600ProtocolDecoderTest { Jt600ProtocolDecoder decoder = new Jt600ProtocolDecoder(new TestDataManager(), null, null); - byte[] buf1 = {0x24,0x31,0x10,0x21,0x60,0x01,0x11,0x00,0x1B,0x16,0x02,0x11,0x05,0x59,0x10,0x22,0x32,(byte)0x98,0x62,0x11,0x40,0x46,0x22,0x7B,0x05,(byte)0x98,0x09,0x50,(byte)0x80,0x01,0x23,0x27,(byte)0x95,0x14,0x35,0x16,0x1F}; - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf1))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "24311021600111001B16021105591022329862114046227B0598095080012327951435161F")))); - byte[] buf2 = {0x24,0x31,0x20,(byte)0x82,0x00,0x29,0x11,0x00,0x1B,0x17,0x10,0x12,0x05,0x28,0x31,0x24,0x38,0x10,0x12,0x02,0x55,0x33,0x64,0x25,0x00,0x19,0x07,0x19,0x00,0x03,(byte)0xFD,0x2B,(byte)0x91,0x04,0x4D,0x1F,(byte)0xA0}; - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf2))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "24312082002911001B171012052831243810120255336425001907190003FD2B91044D1FA0")))); - byte[] buf3 = {0x24,0x31,0x20,(byte)0x82,0x00,0x29,0x11,0x00,0x1B,0x17,0x10,0x12,0x05,0x33,0x05,0x24,0x38,0x09,(byte)0x97,0x02,0x55,0x33,0x58,0x45,0x00,0x04,0x06,0x1E,0x00,0x03,(byte)0xEE,0x00,0x00,0x00,0x00,0x0C,0x00}; - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf3))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "24312082002911001B1710120533052438099702553358450004061E0003EE000000000C00")))); - byte[] buf4 = {0x24,0x60,(byte)0x81,0x11,(byte)0x88,(byte)0x88,0x21,0x00,0x1B,0x09,0x06,0x09,0x08,0x04,0x53,0x22,0x56,0x40,0x25,0x11,0x32,0x42,0x32,(byte)0x9F,0x05,(byte)0x98,0x00,0x00,0x01,0x00,0x3F,0x00,0x00,0x00,0x2D,0x00,(byte)0xAB}; - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf4))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "24608111888821001B09060908045322564025113242329F0598000001003F0000002D00AB")))); - verify(decoder.decode(null, null, - ChannelBuffers.copiedBuffer("(3110312099,W01,11404.6204,E,2232.9961,N,A,040511,063736,4,7,100,4,17,1,1,company)", Charset.defaultCharset()))); + verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer( + "(3110312099,W01,11404.6204,E,2232.9961,N,A,040511,063736,4,7,100,4,17,1,1,company)", Charset.defaultCharset()))); - verify(decoder.decode(null, null, - ChannelBuffers.copiedBuffer("(3120820029,W01,02553.3555,E,2438.0997,S,A,171012,053339,0,8,20,6,31,5,20,20)", Charset.defaultCharset()))); + verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer( + "(3120820029,W01,02553.3555,E,2438.0997,S,A,171012,053339,0,8,20,6,31,5,20,20)", Charset.defaultCharset()))); - /*verify(decoder.decode(null, null, - ChannelBuffers.copiedBuffer("(3330104377,U01,010100,010228,F,00.000000,N,000.000000,E,0,0,0,0%,00001000000000,741,14,22,0,206)", Charset.defaultCharset())));*/ - - /*verify(decoder.decode(null, null, - ChannelBuffers.copiedBuffer("(6221107674,2,U09,129,2,A,280513113036,E,02711.0500,S,1721.0876,A,030613171243,E,02756.7618,S,2300.0325,3491,538200,14400,1)", Charset.defaultCharset())));*/ + /*verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer( + "(3330104377,U01,010100,010228,F,00.000000,N,000.000000,E,0,0,0,0%,00001000000000,741,14,22,0,206)", Charset.defaultCharset()))); + + verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer( + "(6221107674,2,U09,129,2,A,280513113036,E,02711.0500,S,1721.0876,A,030613171243,E,02756.7618,S,2300.0325,3491,538200,14400,1)", Charset.defaultCharset())));*/ } diff --git a/test/org/traccar/protocol/KhdProtocolDecoderTest.java b/test/org/traccar/protocol/KhdProtocolDecoderTest.java index 7d196df25..9593bf6d1 100644 --- a/test/org/traccar/protocol/KhdProtocolDecoderTest.java +++ b/test/org/traccar/protocol/KhdProtocolDecoderTest.java @@ -14,29 +14,29 @@ public class KhdProtocolDecoderTest { KhdProtocolDecoder decoder = new KhdProtocolDecoder(new TestDataManager(), null, null); - assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[] {0x29,0x29,0xb1,0x00,0x06,0x05,0x16,0x29,0x35,0xb8,0x0d})))); - - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[] {0x29,0x29,0x80,0x00,0x28,0x05,0x16,0x29,0x35,0x14,0x01,0x08,0x07,0x47,0x27,0x80,0x11,0x29,0x67,0x03,0x65,0x33,0x69,0x00,0x00,0x01,0x03,0xff,0xff,0x00,0x00,0x82,0xfc,0x00,0x00,0x00,0x1e,0x78,0x09,0x1b,0x00,0x00,0x00,0x36,0x0d})))); - - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[] {0x29,0x29,0x81,0x00,0x28,0x0A,0x9F,0x95,0x38,0x08,0x12,0x28,0x16,0x01,0x31,0x02,0x23,0x94,0x30,0x11,0x40,0x37,0x25,0x00,0x00,0x03,0x30,0xFF,0x00,0x00,0x00,0x7F,0xFC,0x0F,0x00,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x34,0x29,0x0D})))); - - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[] {0x29,0x29,0x80,0x00,0x28,0x0A,0x81,0x85,0x0A,0x12,0x03,0x10,0x09,0x57,0x50,0x00,0x52,0x81,0x37,0x00,0x61,0x19,0x08,0x00,0x00,0x02,0x32,0xF8,0x48,0xFF,0xBB,0xFF,0xFF,0x00,0x00,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0xED,0x0D})))); - - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[] {0x29,0x29,0x8E,0x00,0x28,0x0F,0x80,0x81,0x5A,0x12,0x12,0x18,0x20,0x31,0x16,0x02,0x23,0x18,0x46,0x11,0x40,0x22,0x70,0x00,0x72,0x02,0x62,0xFB,0x00,0x07,0x7C,0x7F,0xBF,0x56,0x00,0x00,0x1E,0x3C,0x32,0x00,0x00,0x00,0x00,0x85,0x0D})))); - - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[] {0x29,0x29,0x82,0x00,0x23,0x0A,0xA2,0xCC,0x39,0x12,0x05,0x03,0x05,0x05,0x22,0x02,0x85,0x94,0x79,0x03,0x10,0x95,0x50,0x00,0x80,0x02,0x07,0x84,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x75,0x0D})))); - - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[] {0x29,0x29,0x85,0x00,0x08,0x1D,0xD0,0x8C,0x22,0x12,0x03,0x12,0x17,0x40,0x26,0x02,0x65,0x45,0x71,0x03,0x12,0x54,0x17,0x00,0x00,0x00,0x00,0xF8,0x19,0xC8,0x39,0xFF,0xFF,0x1D,0x00,0x00,0x1E,0x00,0x50,0x00,0x00,0x00,0x3A,0xF9,0x0D})))); - - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[] {0x29,0x29,0x80,0x00,0x28,0x22,0x83,0x66,0x65,0x14,0x08,0x25,0x14,0x20,0x37,0x04,0x53,0x43,0x77,0x01,0x93,0x87,0x92,0x00,0x00,0x00,0x50,0xff,0xff,0x00,0x00,0x82,0xfc,0x00,0x00,0x04,0xb0,0x78,0x0b,0x17,0x00,0x00,0x00,0x2a,0x0d})))); + assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "2929b1000605162935b80d")))); + + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "292980002805162935140108074727801129670365336900000103ffff000082fc0000001e78091b000000360d")))); + + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "29298100280A9F9538081228160131022394301140372500000330FF0000007FFC0F00001E000000000034290D")))); + + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "29298000280A81850A120310095750005281370061190800000232F848FFBBFFFF0000001E000000000000ED0D")))); + + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "29298E00280F80815A121218203116022318461140227000720262FB00077C7FBF5600001E3C3200000000850D")))); + + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "29298200230AA2CC391205030505220285947903109550008002078400000002000000000000750D")))); + + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "29298500081DD08C22120312174026026545710312541700000000F819C839FFFF1D00001E00500000003AF90D")))); + + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "292980002822836665140825142037045343770193879200000050ffff000082fc000004b0780b170000002a0d")))); } diff --git a/test/org/traccar/protocol/M2mProtocolDecoderTest.java b/test/org/traccar/protocol/M2mProtocolDecoderTest.java index 2e481d47f..346cdbedb 100644 --- a/test/org/traccar/protocol/M2mProtocolDecoderTest.java +++ b/test/org/traccar/protocol/M2mProtocolDecoderTest.java @@ -14,11 +14,11 @@ public class M2mProtocolDecoderTest { M2mProtocolDecoder decoder = new M2mProtocolDecoder(new TestDataManager(), null, null); - 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)))); + assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "235A3C2A2624215C287D70212A21254C7C6421220B0B0B")))); - 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}; - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf2)))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "A6E12C2AAADA4628326B2059576E30202A2FE85D20200B")))); } diff --git a/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java b/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java index 73f1d9a93..9e91dd7fe 100644 --- a/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java +++ b/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java @@ -14,63 +14,63 @@ public class MeiligaoProtocolDecoderTest { MeiligaoProtocolDecoder decoder = new MeiligaoProtocolDecoder(new TestDataManager(), null, null); - assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[]{0x24,0x24,0x00,0x00,0x12,0x34,0x56,0xFF,0xFF,0xFF,0xFF,0x50,0x00,0x8B,0x9B,0x0D,0x0A})))); + assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "24240000123456FFFFFFFF50008B9B0D0A")))); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[]{0x24,0x24,0x00,0x6e,0x24,0x11,0x20,0x14,0x1f,0xff,0xff,0x99,0x55,0x30,0x39,0x33,0x39,0x31,0x30,0x2e,0x30,0x30,0x2c,0x41,0x2c,0x31,0x39,0x31,0x34,0x2e,0x37,0x37,0x37,0x36,0x35,0x2c,0x4e,0x2c,0x30,0x37,0x32,0x35,0x30,0x2e,0x36,0x38,0x30,0x37,0x32,0x2c,0x45,0x2c,0x30,0x2e,0x30,0x35,0x31,0x2c,0x2c,0x32,0x30,0x31,0x32,0x31,0x34,0x2c,0x2c,0x2c,0x44,0x2a,0x37,0x35,0x7c,0x30,0x2e,0x38,0x32,0x7c,0x32,0x2e,0x38,0x7c,0x30,0x30,0x30,0x30,0x7c,0x30,0x30,0x30,0x30,0x2c,0x30,0x30,0x30,0x30,0x7c,0x30,0x31,0x30,0x38,0x33,0x37,0x34,0x33,0x31,0x1d,0x17,0x0d,0x0a})))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "2424006e241120141fffff99553039333931302e30302c412c313931342e37373736352c4e2c30373235302e36383037322c452c302e3035312c2c3230313231342c2c2c442a37357c302e38327c322e387c303030307c303030302c303030307c3031303833373433311d170d0a")))); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[]{0x24,0x24,0x00,0x00,0x12,0x34,0x56,0xFF,0xFF,0xFF,0xFF,0x99,0x55,0x30,0x33,0x35,0x36,0x34,0x34,0x2E,0x30,0x30,0x30,0x2C,0x41,0x2C,0x32,0x32,0x33,0x32,0x2E,0x36,0x30,0x38,0x33,0x2C,0x4E,0x2C,0x31,0x31,0x34,0x30,0x34,0x2E,0x38,0x31,0x33,0x37,0x2C,0x45,0x2C,0x30,0x2E,0x30,0x30,0x2C,0x2C,0x30,0x31,0x30,0x38,0x30,0x39,0x2C,0x2C,0x2A,0x31,0x43,0x7C,0x31,0x31,0x2E,0x35,0x7C,0x31,0x39,0x34,0x7C,0x30,0x30,0x30,0x30,0x7C,0x30,0x30,0x30,0x30,0x2C,0x30,0x30,0x30,0x30,0x69,0x62,0x0D,0x0A})))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "24240000123456FFFFFFFF99553033353634342E3030302C412C323233322E363038332C4E2C31313430342E383133372C452C302E30302C2C3031303830392C2C2A31437C31312E357C3139347C303030307C303030302C3030303069620D0A")))); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[]{0x24,0x24,0x00,0x00,0x33,0x58,0x01,0x97,0x03,0x58,0x1F,0x99,0x55,0x31,0x33,0x34,0x33,0x35,0x31,0x2E,0x30,0x30,0x30,0x2C,0x41,0x2C,0x30,0x39,0x32,0x35,0x2E,0x35,0x30,0x32,0x35,0x2C,0x4E,0x2C,0x30,0x36,0x39,0x31,0x34,0x2E,0x38,0x31,0x30,0x37,0x2C,0x57,0x2C,0x30,0x2E,0x30,0x30,0x2C,0x32,0x33,0x2C,0x33,0x30,0x31,0x30,0x31,0x32,0x2C,0x2C,0x2A,0x32,0x43,0x7C,0x30,0x2E,0x38,0x7C,0x31,0x38,0x36,0x7C,0x32,0x30,0x30,0x30,0x7C,0x30,0x31,0x32,0x36,0x2C,0x30,0x30,0x46,0x46,0x7C,0x30,0x32,0x44,0x45,0x30,0x30,0x30,0x32,0x44,0x38,0x43,0x44,0x42,0x34,0x31,0x35,0x7C,0x30,0x36,0x7C,0x30,0x30,0x46,0x44,0x36,0x42,0x37,0x39,0x95,0x82,0x0D,0x0A})))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "242400003358019703581F99553133343335312E3030302C412C303932352E353032352C4E2C30363931342E383130372C572C302E30302C32332C3330313031322C2C2A32437C302E387C3138367C323030307C303132362C303046467C303244453030303244384344423431357C30367C303046443642373995820D0A")))); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[]{0x24,0x24,0x00,0x00,0x16,0x91,0x00,0x04,0x84,0x12,0x4F,0x99,0x55,0x31,0x34,0x30,0x36,0x30,0x33,0x2E,0x30,0x30,0x30,0x2C,0x41,0x2C,0x30,0x39,0x33,0x34,0x2E,0x32,0x35,0x35,0x34,0x2C,0x4E,0x2C,0x30,0x36,0x39,0x31,0x33,0x2E,0x30,0x39,0x36,0x36,0x2C,0x57,0x2C,0x30,0x2E,0x30,0x30,0x2C,0x2C,0x33,0x30,0x31,0x30,0x31,0x32,0x2C,0x2C,0x2A,0x30,0x32,0x7C,0x30,0x2E,0x38,0x7C,0x32,0x30,0x37,0x7C,0x30,0x30,0x30,0x30,0xFA,0x42,0x0D,0x0A})))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "242400001691000484124F99553134303630332E3030302C412C303933342E323535342C4E2C30363931332E303936362C572C302E30302C2C3330313031322C2C2A30327C302E387C3230377C30303030FA420D0A")))); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[]{0x24,0x24,0x00,0x00,0x45,0x12,0x42,0x20,0x30,0x6F,0xFF,0x99,0x99,0x14,0x31,0x35,0x35,0x34,0x32,0x32,0x2E,0x30,0x30,0x30,0x2C,0x56,0x2C,0x32,0x32,0x33,0x30,0x2E,0x37,0x36,0x32,0x33,0x2C,0x4E,0x2C,0x31,0x31,0x34,0x30,0x33,0x2E,0x34,0x32,0x31,0x38,0x2C,0x45,0x2C,0x30,0x2E,0x30,0x30,0x2C,0x30,0x2C,0x30,0x36,0x30,0x32,0x31,0x31,0x2C,0x2C,0x2A,0x31,0x41,0x7C,0x30,0x2E,0x30,0x7C,0x32,0x36,0x7C,0x30,0x30,0x30,0x30,0x7C,0x30,0x30,0x30,0x30,0x2C,0x30,0x30,0x30,0x30,0x7C,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x7C,0x36,0x33,0x7C,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0xBA,0xC1,0x0D,0x0A})))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "2424000045124220306FFF9999143135353432322E3030302C562C323233302E373632332C4E2C31313430332E343231382C452C302E30302C302C3036303231312C2C2A31417C302E307C32367C303030307C303030302C303030307C303030303030303030303030303030307C36337C3030303030303030BAC10D0A")))); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[]{0x24,0x24,0x00,0x00,0x86,0x21,0x70,0x01,0x42,0x45,0x8F,0x99,0x99,0x50,0x31,0x39,0x32,0x39,0x35,0x38,0x2E,0x30,0x30,0x30,0x2C,0x41,0x2C,0x33,0x36,0x32,0x37,0x2E,0x31,0x36,0x39,0x39,0x2C,0x4E,0x2C,0x30,0x31,0x30,0x34,0x33,0x2E,0x35,0x36,0x32,0x37,0x2C,0x45,0x2C,0x30,0x2E,0x30,0x30,0x2C,0x32,0x33,0x39,0x2C,0x30,0x39,0x31,0x32,0x31,0x32,0x2C,0x2C,0x2A,0x30,0x46,0x7C,0x31,0x2E,0x30,0x7C,0x37,0x7C,0x30,0x30,0x30,0x30,0x7C,0x30,0x31,0x41,0x39,0x2C,0x30,0x31,0x39,0x37,0x7C,0x30,0x32,0x35,0x44,0x30,0x30,0x30,0x32,0x30,0x30,0x35,0x41,0x38,0x36,0x39,0x46,0x7C,0x31,0x32,0x7C,0x30,0x30,0x30,0x33,0x33,0x42,0x42,0x33,0xE2,0x48,0x0D,0x0A})))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "242400008621700142458F9999503139323935382E3030302C412C333632372E313639392C4E2C30313034332E353632372C452C302E30302C3233392C3039313231322C2C2A30467C312E307C377C303030307C303141392C303139377C303235443030303230303541383639467C31327C3030303333424233E2480D0A")))); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[]{0x24,0x24,0x00,0x00,0x12,0x34,0x56,0x78,0x9F,0xFF,0xFF,0x99,0x55,0x30,0x32,0x30,0x36,0x30,0x30,0x2E,0x39,0x33,0x30,0x2C,0x41,0x2C,0x32,0x33,0x30,0x39,0x2E,0x32,0x30,0x35,0x31,0x2C,0x4E,0x2C,0x31,0x31,0x33,0x31,0x38,0x2E,0x38,0x34,0x34,0x39,0x2C,0x45,0x2C,0x30,0x2E,0x30,0x30,0x2C,0x30,0x2E,0x30,0x30,0x2C,0x30,0x39,0x30,0x37,0x31,0x30,0x2C,0x2C,0x2C,0x41,0x2A,0x36,0x41,0x7C,0x32,0x2E,0x36,0x7C,0x39,0x36,0x2E,0x37,0x7C,0x30,0x30,0x30,0x30,0x7C,0x30,0x30,0x30,0x30,0x2C,0x33,0x46,0x46,0x46,0x7C,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0xC4,0x52,0x0D,0x0A})))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "24240000123456789FFFFF99553032303630302E3933302C412C323330392E323035312C4E2C31313331382E383434392C452C302E30302C302E30302C3039303731302C2C2C412A36417C322E367C39362E377C303030307C303030302C334646467C303030303030303030C4520D0A")))); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[]{0x24,0x24,0x00,0x00,0x59,0x77,0x20,0x37,0x44,0x05,0x84,0x99,0x55,0x30,0x32,0x30,0x31,0x31,0x37,0x2E,0x30,0x30,0x30,0x2C,0x41,0x2C,0x34,0x31,0x31,0x37,0x2E,0x39,0x32,0x31,0x32,0x2C,0x4E,0x2C,0x30,0x38,0x31,0x33,0x30,0x2E,0x32,0x30,0x39,0x36,0x2C,0x57,0x2C,0x30,0x2E,0x30,0x30,0x2C,0x33,0x30,0x33,0x2E,0x38,0x35,0x2C,0x32,0x36,0x30,0x32,0x31,0x33,0x7C,0x31,0x2E,0x36,0x7C,0x30,0x30,0x7C,0x30,0x30,0x30,0x30,0x7C,0x30,0x30,0x30,0x30,0x2C,0x30,0x30,0x30,0x30,0x71,0xCD,0x0D,0x0A})))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "242400005977203744058499553032303131372E3030302C412C343131372E393231322C4E2C30383133302E323039362C572C302E30302C3330332E38352C3236303231337C312E367C30307C303030307C303030302C3030303071CD0D0A")))); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[]{0x24,0x24,0x00,0x00,0x35,0x11,0x11,0x11,0x11,0x11,0x11,0x99,0x55,0x31,0x33,0x34,0x37,0x34,0x33,0x2e,0x30,0x30,0x33,0x2c,0x41,0x2c,0x30,0x36,0x34,0x38,0x2e,0x39,0x38,0x36,0x36,0x2c,0x53,0x2c,0x31,0x30,0x37,0x30,0x37,0x2e,0x35,0x37,0x39,0x35,0x2c,0x45,0x2c,0x30,0x30,0x30,0x2e,0x30,0x2c,0x30,0x30,0x30,0x2e,0x30,0x2c,0x32,0x36,0x30,0x33,0x31,0x33,0xf3,0x15,0x0d,0x0a})))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "242400003511111111111199553133343734332e3030332c412c303634382e393836362c532c31303730372e353739352c452c3030302e302c3030302e302c323630333133f3150d0a")))); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[]{0x24,0x24,0x00,0x00,0x00,0x91,0x80,0x03,0x69,0x76,0x41,0x99,0x55,0x30,0x38,0x35,0x31,0x33,0x30,0x2e,0x30,0x30,0x30,0x2c,0x41,0x2c,0x33,0x30,0x35,0x33,0x2e,0x31,0x36,0x34,0x35,0x2c,0x4e,0x2c,0x30,0x37,0x35,0x35,0x35,0x2e,0x37,0x34,0x37,0x36,0x2c,0x45,0x2c,0x30,0x2e,0x30,0x30,0x2c,0x32,0x37,0x2c,0x31,0x36,0x30,0x34,0x31,0x33,0x2c,0x2c,0x2a,0x33,0x46,0x7c,0x30,0x2e,0x38,0x7c,0x32,0x34,0x35,0x7c,0x32,0x30,0x30,0x30,0x7c,0x30,0x33,0x46,0x37,0x2c,0x30,0x30,0x30,0x30,0x2c,0x30,0x30,0x30,0x30,0x2c,0x30,0x30,0x31,0x42,0x2c,0x30,0x30,0x30,0x30,0x2c,0x30,0x30,0x30,0x30,0x2c,0x30,0x30,0x30,0x30,0x2c,0x30,0x30,0x30,0x30,0x7c,0x30,0x31,0x39,0x34,0x30,0x30,0x30,0x32,0x30,0x31,0x43,0x43,0x36,0x32,0x37,0x43,0x7c,0x31,0x41,0x7c,0x30,0x31,0x31,0x36,0x30,0x38,0x34,0x39,0xe6,0xa7,0x0d,0x0a})))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "242400000091800369764199553038353133302e3030302c412c333035332e313634352c4e2c30373535352e373437362c452c302e30302c32372c3136303431332c2c2a33467c302e387c3234357c323030307c303346372c303030302c303030302c303031422c303030302c303030302c303030302c303030307c303139343030303230314343363237437c31417c3031313630383439e6a70d0a")))); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[]{0x24,0x24,0x00,0x00,0x26,0x01,0x61,0x00,0x90,0x1f,0xff,0x99,0x55,0x31,0x36,0x35,0x38,0x35,0x33,0x2c,0x41,0x2c,0x34,0x31,0x30,0x39,0x2e,0x36,0x30,0x32,0x31,0x32,0x2c,0x4e,0x2c,0x38,0x33,0x38,0x2e,0x35,0x39,0x31,0x31,0x39,0x2c,0x57,0x2c,0x33,0x2e,0x38,0x38,0x33,0x2c,0x31,0x32,0x2e,0x30,0x30,0x2c,0x30,0x34,0x30,0x37,0x31,0x33,0x2c,0x2c,0x2a,0x34,0x46,0x7c,0x32,0x2e,0x35,0x7c,0x31,0x31,0x30,0x7c,0x00,0x06,0x00,0x00,0x7c,0x00,0x00,0x01,0x0f,0x7c,0x30,0x32,0x42,0x30,0x2c,0x30,0x42,0x33,0x36,0x97,0x74,0x0d,0x0a})))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "2424000026016100901fff99553136353835332c412c343130392e36303231322c4e2c3833382e35393131392c572c332e3838332c31322e30302c3034303731332c2c2a34467c322e357c3131307c000600007c0000010f7c303242302c3042333697740d0a")))); - assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[]{0x24,0x24,0x00,0x00,0x67,0x62,0x20,0x10,0x05,0x35,0x62,0xaa,0x00,0x00,0x01,0x00,0x01,0xae,0x4f,0x00,0x00,0x00,0x07,0x80,0x00,0x00,0x00,0x30,0x39,0x35,0x31,0x35,0x36,0x2e,0x30,0x30,0x30,0x2c,0x41,0x2c,0x32,0x36,0x32,0x33,0x2e,0x38,0x39,0x36,0x36,0x2c,0x4e,0x2c,0x30,0x35,0x30,0x30,0x35,0x2e,0x30,0x36,0x38,0x30,0x2c,0x45,0x2c,0x32,0x34,0x2e,0x35,0x2c,0x32,0x34,0x31,0x2e,0x30,0x2c,0x32,0x32,0x31,0x30,0x31,0x33,0x59,0x9c,0x0d,0x0a})))); + assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "2424000067622010053562aa0000010001ae4f00000007800000003039353135362e3030302c412c323632332e383936362c4e2c30353030352e303638302c452c32342e352c3234312e302c323231303133599c0d0a")))); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[]{0x24,0x24,0x00,0x00,0x10,0x07,0xff,0xff,0xff,0xff,0xff,0x99,0x55,0x31,0x36,0x32,0x33,0x30,0x39,0x2e,0x30,0x35,0x34,0x2c,0x56,0x2c,0x30,0x39,0x33,0x31,0x2e,0x39,0x31,0x36,0x33,0x2c,0x4e,0x2c,0x30,0x36,0x39,0x31,0x31,0x2e,0x38,0x32,0x33,0x33,0x2c,0x57,0x2c,0x2c,0x2c,0x32,0x35,0x31,0x31,0x31,0x33,0x2c,0x2c,0x2c,0x4e,0x2a,0x36,0x43,0x7c,0x7c,0x31,0x35,0x38,0x7c,0x30,0x30,0x30,0x30,0x9c,0xc6,0x0d,0x0a})))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "242400001007ffffffffff99553136323330392e3035342c562c303933312e393136332c4e2c30363931312e383233332c572c2c2c3235313131332c2c2c4e2a36437c7c3135387c303030309cc60d0a")))); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[]{0x24,0x24,0x00,0x00,0x35,0x63,0x07,0x04,0x35,0x65,0x20,0x99,0x55,0x30,0x35,0x32,0x30,0x34,0x32,0x2e,0x30,0x30,0x30,0x2c,0x41,0x2c,0x34,0x34,0x35,0x38,0x2e,0x33,0x35,0x36,0x35,0x2c,0x4e,0x2c,0x30,0x34,0x31,0x30,0x34,0x2e,0x34,0x38,0x31,0x33,0x2c,0x45,0x2c,0x30,0x2e,0x30,0x30,0x2c,0x30,0x2e,0x30,0x30,0x2c,0x31,0x39,0x30,0x31,0x31,0x34,0x2c,0x2c,0x2a,0x39,0x43,0x7c,0x30,0x2e,0x37,0x30,0x30,0x30,0x30,0x30,0x7c,0x2d,0x38,0x35,0x39,0x31,0x31,0x37,0x33,0x37,0x36,0x7c,0x30,0x31,0x30,0x30,0x7c,0x30,0x7c,0x7c,0x7c,0x4f,0x2a,0x0d,0x0a})))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "242400003563070435652099553035323034322e3030302c412c343435382e333536352c4e2c30343130342e343831332c452c302e30302c302e30302c3139303131342c2c2a39437c302e3730303030307c2d3835393131373337367c303130307c307c7c7c4f2a0d0a")))); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[]{0x24,0x24,0x00,0x50,0x35,0x78,0x42,0x51,0xff,0xff,0xff,0x99,0x55,0x30,0x30,0x30,0x30,0x33,0x36,0x2e,0x39,0x38,0x31,0x2c,0x56,0x2c,0x30,0x39,0x33,0x31,0x2e,0x33,0x34,0x37,0x31,0x2c,0x4e,0x2c,0x30,0x36,0x39,0x31,0x31,0x2e,0x38,0x34,0x31,0x32,0x2c,0x57,0x2c,0x2c,0x2c,0x32,0x38,0x30,0x31,0x31,0x34,0x2c,0x2c,0x2c,0x4e,0x2a,0x36,0x35,0x7c,0x7c,0x31,0x36,0x38,0x7c,0x32,0x30,0x30,0x30,0x5e,0x42,0x0d,0x0a})))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "2424005035784251ffffff99553030303033362e3938312c562c303933312e333437312c4e2c30363931312e383431322c572c2c2c3238303131342c2c2c4e2a36357c7c3136387c323030305e420d0a")))); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[]{0x24,0x24,0x00,0x78,0x11,0x22,0x33,0x44,0xff,0xff,0xff,0x99,0x55,0x30,0x31,0x30,0x37,0x35,0x37,0x2e,0x30,0x30,0x30,0x2c,0x41,0x2c,0x32,0x39,0x35,0x39,0x2e,0x31,0x33,0x37,0x34,0x2c,0x4e,0x2c,0x30,0x39,0x35,0x34,0x30,0x2e,0x33,0x32,0x38,0x34,0x2c,0x57,0x2c,0x30,0x30,0x30,0x2e,0x30,0x2c,0x30,0x38,0x38,0x2e,0x37,0x2c,0x32,0x34,0x30,0x36,0x31,0x34,0x2c,0x2c,0x2c,0x41,0x2a,0x37,0x39,0x7c,0x31,0x2e,0x34,0x7c,0x33,0x35,0x2e,0x31,0x7c,0x30,0x30,0x30,0x30,0x7c,0x30,0x30,0x30,0x31,0x2c,0x30,0x30,0x30,0x30,0x7c,0x30,0x30,0x30,0x30,0x30,0x33,0x37,0x32,0x33,0x7c,0x30,0x30,0x30,0x30,0x30,0xe3,0x9f,0x0d,0x0a})))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "2424007811223344ffffff99553031303735372e3030302c412c323935392e313337342c4e2c30393534302e333238342c572c3030302e302c3038382e372c3234303631342c2c2c412a37397c312e347c33352e317c303030307c303030312c303030307c3030303030333732337c3030303030e39f0d0a")))); + + assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "24240011300600000046090002849a0d0a")))); + + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "2424007f3568960306760199553131303932342e3030302c412c343533342e323538352c4e2c30313933382e363531342c452c302e30302c2c3237303731342c2c2c412a37317c312e377c3130307c383030307c303737422c303030302c303030302c303030302c303030302c303030302c303030302c303030305dfc0d0a")))); - //assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - // new int[] {0x24,0x24,0x00,0x11,0x30,0x06,0x00,0x00,0x00,0x46,0x09,0x00,0x02,0x84,0x9a,0x0d,0x0a})))); - - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[]{0x24,0x24,0x00,0x7f,0x35,0x68,0x96,0x03,0x06,0x76,0x01,0x99,0x55,0x31,0x31,0x30,0x39,0x32,0x34,0x2e,0x30,0x30,0x30,0x2c,0x41,0x2c,0x34,0x35,0x33,0x34,0x2e,0x32,0x35,0x38,0x35,0x2c,0x4e,0x2c,0x30,0x31,0x39,0x33,0x38,0x2e,0x36,0x35,0x31,0x34,0x2c,0x45,0x2c,0x30,0x2e,0x30,0x30,0x2c,0x2c,0x32,0x37,0x30,0x37,0x31,0x34,0x2c,0x2c,0x2c,0x41,0x2a,0x37,0x31,0x7c,0x31,0x2e,0x37,0x7c,0x31,0x30,0x30,0x7c,0x38,0x30,0x30,0x30,0x7c,0x30,0x37,0x37,0x42,0x2c,0x30,0x30,0x30,0x30,0x2c,0x30,0x30,0x30,0x30,0x2c,0x30,0x30,0x30,0x30,0x2c,0x30,0x30,0x30,0x30,0x2c,0x30,0x30,0x30,0x30,0x2c,0x30,0x30,0x30,0x30,0x2c,0x30,0x30,0x30,0x30,0x5d,0xfc,0x0d,0x0a})))); - } } diff --git a/test/org/traccar/protocol/NavigilProtocolDecoderTest.java b/test/org/traccar/protocol/NavigilProtocolDecoderTest.java index 6b71d4d53..6f58f83d1 100644 --- a/test/org/traccar/protocol/NavigilProtocolDecoderTest.java +++ b/test/org/traccar/protocol/NavigilProtocolDecoderTest.java @@ -14,12 +14,12 @@ public class NavigilProtocolDecoderTest { public void testDecode() throws Exception { NavigilProtocolDecoder decoder = new NavigilProtocolDecoder(new TestDataManager(), null, null); - - assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertArray( - new int[] {0x01,0x00,0x43,0x00,0x04,0x00,0x20,0x00,0x00,0x00,0xf6,0x02,0x03,0x08,0x02,0x00,0xe7,0xcd,0x0f,0x51,0x0c,0x00,0x00,0x00,0x3b,0x00,0x00,0x00,0x00,0x00,0x00,0x00})))); - - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertArray( - new int[] {0x01,0x00,0xb3,0x00,0x0f,0x00,0x24,0x00,0x00,0x00,0xf4,0xa8,0x03,0x08,0x02,0x00,0xca,0x0c,0x11,0x51,0xef,0x88,0x85,0xf0,0xb8,0x2e,0x6d,0x13,0x04,0x00,0xc0,0x04,0x03,0x00,0x00,0x00})))); + + assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString( + "01004300040020000000f60203080200e7cd0f510c0000003b00000000000000")))); + + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString( + "0100b3000f0024000000f4a803080200ca0c1151ef8885f0b82e6d130400c00403000000")))); } diff --git a/test/org/traccar/protocol/NavisProtocolDecoderTest.java b/test/org/traccar/protocol/NavisProtocolDecoderTest.java index 716b13eaf..82dcc0ba1 100644 --- a/test/org/traccar/protocol/NavisProtocolDecoderTest.java +++ b/test/org/traccar/protocol/NavisProtocolDecoderTest.java @@ -1,5 +1,6 @@ package org.traccar.protocol; +import org.traccar.helper.ChannelBufferTools; import org.traccar.helper.TestDataManager; import java.nio.ByteOrder; import org.jboss.netty.buffer.ChannelBuffers; @@ -14,14 +15,14 @@ public class NavisProtocolDecoderTest { NavisProtocolDecoder decoder = new NavisProtocolDecoder(new TestDataManager(), null, null); - 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))); + assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString( + "404E5443010000007B000000130044342A3E533A383631373835303035323035303739")))); - 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}; - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, buf2))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString( + "404E5443010000007B0000005A0050692A3E410125DB0E00000015110707110A0C0880630000AA39A2381600020000000000000000000C110708110A0CB389793F1AEF263F00000000120034F516440000000000000000000000FAFF000000FAFF000000FAFF80808080")))); - byte[] buf3 = {0x40,0x4E,0x54,0x43,0x01,0x00,0x00,0x00,0x7B,0x00,0x00,0x00,0x13,0x00,0x47,0x37,0x2A,0x3E,0x53,0x3A,0x38,0x36,0x31,0x37,0x38,0x35,0x30,0x30,0x35,0x31,0x32,0x36,0x30,0x36,0x39}; - assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, buf3))); + assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString( + "404E5443010000007B000000130047372A3E533A383631373835303035313236303639")))); } diff --git a/test/org/traccar/protocol/NoranProtocolDecoderTest.java b/test/org/traccar/protocol/NoranProtocolDecoderTest.java index 4742cf730..1c80bb399 100644 --- a/test/org/traccar/protocol/NoranProtocolDecoderTest.java +++ b/test/org/traccar/protocol/NoranProtocolDecoderTest.java @@ -15,14 +15,14 @@ public class NoranProtocolDecoderTest { NoranProtocolDecoder decoder = new NoranProtocolDecoder(new TestDataManager(), null, null); - assertNull(decoder.decode(null, null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertArray( - new int[] {0x0f,0x00,0x00,0x00,0x4e,0x52,0x30,0x39,0x46,0x30,0x34,0x31,0x35,0x35,0x00})))); + assertNull(decoder.decode(null, null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString( + "0f0000004e52303946303431353500")))); - verify(decoder.decode(null, null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertArray( - new int[] {0x22,0x00,0x08,0x00,0x01,0x0c,0x00,0x8a,0x00,0x7e,0x9d,0xaa,0x42,0x31,0x7b,0xdd,0x41,0xa7,0xf3,0xe2,0x38,0x4e,0x52,0x30,0x39,0x46,0x30,0x34,0x31,0x35,0x35,0x00,0x00,0x00})))); + verify(decoder.decode(null, null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString( + "22000800010c008a007e9daa42317bdd41a7f3e2384e523039463034313535000000")))); - verify(decoder.decode(null, null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertArray( - new int[] {0x34,0x00,0x08,0x00,0x01,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x42,0x91,0x25,0x11,0x43,0x38,0x8d,0x17,0xc2,0x4e,0x52,0x30,0x39,0x42,0x31,0x31,0x30,0x39,0x30,0x00,0x00,0x31,0x34,0x2d,0x31,0x32,0x2d,0x32,0x35,0x20,0x30,0x30,0x3a,0x33,0x33,0x3a,0x30,0x37,0x00})))); + verify(decoder.decode(null, null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString( + "34000800010c0000000000001c4291251143388d17c24e523039423131303930000031342d31322d32352030303a33333a303700")))); } diff --git a/test/org/traccar/protocol/OrionProtocolDecoderTest.java b/test/org/traccar/protocol/OrionProtocolDecoderTest.java index dd7930c0f..d41ea5b91 100644 --- a/test/org/traccar/protocol/OrionProtocolDecoderTest.java +++ b/test/org/traccar/protocol/OrionProtocolDecoderTest.java @@ -15,20 +15,20 @@ public class OrionProtocolDecoderTest { OrionProtocolDecoder decoder = new OrionProtocolDecoder(new TestDataManager(), null, null); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertArray( - new int[] {0x50,0x57,0x00,0x01,0x37,0xbf,0x62,0x36,0x23,0x5a,0x03,0x31,0xb5,0xc6,0xe4,0x02,0xa3,0xb5,0xec,0xff,0x51,0x02,0x98,0x00,0x03,0x00,0x0e,0x0c,0x1d,0x17,0x29,0x36,0x08,0x0e,0x0c,0x1d,0x17,0x29,0x36,0xb0,0x3b,0x01,0x00,0x08,0x82,0x05,0x00,0x00,0x00,0x8e,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x8c,0x03,0x00,0x94,0x05,0x00,0x00,0x00,0x84,0x03,0x00,0x85,0x03,0x00,0x03,0x06,0x76,0x00,0x90,0x01,0x13,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0xa4,0xc8})))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString( + "5057000137bf6236235a0331b5c6e402a3b5ecff5102980003000e0c1d172936080e0c1d172936b03b01000882050000008e080000000000008c0300940500000084030085030003067600900113150000000000000000000000000000000000000004a4c8")))); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertArray( - new int[] {0x50,0x57,0x00,0x41,0x07,0x36,0x7C,0x24,0x2B,0x44,0x09,0x01,0xAD,0xE9,0x7D,0x01,0x63,0x14,0x3B,0x07,0xB0,0x03,0x00,0x00,0x00,0x00,0x0D,0x04,0x19,0x17,0x38,0x2D,0x00,0x0B,0x01,0x01,0x00,0x05,0x11,0x00,0x00,0x00,0x00,0x06,0x82,0x05,0x00,0x00,0x00,0x8E,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x8C,0x03,0x00,0x84,0x03,0x00,0x85,0x03,0x00,0x09,0x0A,0x00,0x00,0x00,0x00,0x48,0x01,0x00,0x00,0x00,0x8A,0xFC})))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString( + "5057004107367C242B440901ADE97D0163143B07B003000000000D041917382D000B0101000511000000000682050000008E080000000000008C0300840300850300090A0000000048010000008AFC")))); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertArray( - new int[] {0x50,0x57,0x00,0x41,0x07,0x36,0x7C,0x24,0x2C,0x44,0x09,0x01,0xAD,0xE9,0x7D,0x01,0x63,0x14,0x3B,0x07,0xB0,0x03,0x00,0x00,0x00,0x00,0x0D,0x04,0x19,0x17,0x38,0x2D,0x00,0x0B,0x01,0x01,0x00,0x05,0x13,0x00,0x00,0x00,0x00,0x06,0x82,0x05,0x00,0x00,0x00,0x8E,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x8C,0x03,0x00,0x84,0x03,0x00,0x85,0x03,0x00,0x09,0x0A,0x00,0x00,0x00,0x00,0x3B,0xFE,0xFF,0xFF,0x01,0xFA,0xE5})))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString( + "5057004107367C242C440901ADE97D0163143B07B003000000000D041917382D000B0101000513000000000682050000008E080000000000008C0300840300850300090A000000003BFEFFFF01FAE5")))); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertArray( - new int[] {0x50,0x57,0x00,0x41,0x07,0x36,0x7C,0x24,0x2D,0x44,0x09,0x01,0xAD,0xE9,0x7D,0x01,0x63,0x14,0x3B,0x07,0xB0,0x03,0x00,0x00,0x00,0x00,0x0D,0x04,0x19,0x17,0x38,0x2D,0x00,0x0B,0x01,0x01,0x00,0x05,0x14,0x00,0x00,0x00,0x00,0x06,0x82,0x05,0x00,0x00,0x00,0x8E,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x8C,0x03,0x00,0x84,0x03,0x00,0x85,0x03,0x00,0x09,0x0A,0x00,0x00,0x00,0x00,0xFD,0xFD,0xFF,0xFF,0x02,0x37,0x21})))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString( + "5057004107367C242D440901ADE97D0163143B07B003000000000D041917382D000B0101000514000000000682050000008E080000000000008C0300840300850300090A00000000FDFDFFFF023721")))); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertArray( - new int[] {0x50,0x57,0x00,0x41,0x2a,0xc8,0x62,0x36,0x35,0x40,0x09,0x11,0x4d,0x20,0xe4,0x02,0x21,0x0f,0x1f,0x00,0xd2,0x04,0x00,0x00,0x00,0x00,0x0e,0x06,0x11,0x0d,0x34,0x14,0x00,0x0b,0x01,0x01,0x00,0x12,0x28,0x00,0x00,0x00,0x00,0x06,0x82,0x05,0x00,0x00,0x00,0x8e,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x8c,0x03,0x00,0x84,0x03,0x00,0x85,0x03,0x00,0x03,0x06,0x7b,0x00,0x68,0x01,0x00,0x09,0x30})))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString( + "505700412ac86236354009114d20e402210f1f00d204000000000e06110d3414000b0101001228000000000682050000008e080000000000008c030084030085030003067b006801000930")))); } diff --git a/test/org/traccar/protocol/PiligrimProtocolDecoderTest.java b/test/org/traccar/protocol/PiligrimProtocolDecoderTest.java index 9fcab0dd5..62e19ad85 100644 --- a/test/org/traccar/protocol/PiligrimProtocolDecoderTest.java +++ b/test/org/traccar/protocol/PiligrimProtocolDecoderTest.java @@ -19,8 +19,8 @@ public class PiligrimProtocolDecoderTest { PiligrimProtocolDecoder decoder = new PiligrimProtocolDecoder(new TestDataManager(), null, null); HttpRequest msg1 = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, "/bingps?imei=868204005544720&csq=18&vout=00&vin=4050&dataid=00000000"); - int[] buf1 = {0xff,0xf2,0x20,0x0d,0x41,0x10,0x06,0x1a,0x32,0x35,0x4f,0x34,0x22,0x31,0x00,0x62,0x00,0x0a,0x00,0x05,0x17,0x3b,0x00,0x00,0xa1,0x01,0x00,0x03,0x00,0x00,0x5e,0x00,0xff,0xf2,0x20,0x0d,0x41,0x10,0x10,0x09,0x32,0x35,0x4f,0x2b,0x22,0x31,0x00,0x42,0x00,0x0b,0x00,0x0e,0x17,0x3b,0x00,0x00,0x9f,0x01,0x00,0x07,0x00,0x00,0x60,0x00}; - msg1.setContent(ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf1))); + msg1.setContent(ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "fff2200d4110061a32354f3422310062000a0005173b0000a101000300005e00fff2200d4110100932354f2b22310042000b000e173b00009f01000700006000"))); verify(decoder.decode(null, null, msg1)); } diff --git a/test/org/traccar/protocol/RitiProtocolDecoderTest.java b/test/org/traccar/protocol/RitiProtocolDecoderTest.java index e006689b5..b949e1376 100644 --- a/test/org/traccar/protocol/RitiProtocolDecoderTest.java +++ b/test/org/traccar/protocol/RitiProtocolDecoderTest.java @@ -14,9 +14,9 @@ public class RitiProtocolDecoderTest { public void testDecode() throws Exception { RitiProtocolDecoder decoder = new RitiProtocolDecoder(new TestDataManager(), null, null); - - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertArray( - new int[] {0x3b,0x28,0x64,0xa3,0x05,0x63,0x00,0x00,0x6d,0x40,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x24,0x47,0x50,0x52,0x4d,0x43,0x2c,0x32,0x31,0x31,0x37,0x34,0x33,0x2e,0x30,0x30,0x30,0x2c,0x41,0x2c,0x31,0x33,0x35,0x37,0x2e,0x33,0x36,0x37,0x35,0x2c,0x4e,0x2c,0x31,0x30,0x30,0x33,0x36,0x2e,0x36,0x39,0x39,0x32,0x2c,0x45,0x2c,0x30,0x2e,0x30,0x30,0x2c,0x2c,0x30,0x31,0x30,0x39,0x31,0x34,0x2c,0x2c,0x2c,0x41,0x2a,0x37,0x38,0x0d,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x04})))); + + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString( + "3b2864a3056300006d40000003000000000000000000000000244750524d432c3231313734332e3030302c412c313335372e333637352c4e2c31303033362e363939322c452c302e30302c2c3031303931342c2c2c412a37380d0a00000000000000000000000000000000040404")))); } diff --git a/test/org/traccar/protocol/RuptelaProtocolDecoderTest.java b/test/org/traccar/protocol/RuptelaProtocolDecoderTest.java index 978b281e2..84949b534 100644 --- a/test/org/traccar/protocol/RuptelaProtocolDecoderTest.java +++ b/test/org/traccar/protocol/RuptelaProtocolDecoderTest.java @@ -13,12 +13,12 @@ public class RuptelaProtocolDecoderTest { RuptelaProtocolDecoder decoder = new RuptelaProtocolDecoder(new TestDataManager(), null, null); - int[] buf1 = {0x00,0x79,0x00,0x00,0x0b,0x1a,0x2a,0x55,0x85,0xc3,0x01,0x00,0x02,0x4e,0x9c,0x03,0x69,0x00,0x00,0x0f,0x10,0x17,0x33,0x20,0x8f,0xf4,0x5e,0x07,0xb3,0x1b,0x57,0x0a,0x00,0x10,0x09,0x09,0x06,0x05,0x01,0x1b,0x1a,0x02,0x00,0x03,0x00,0x1c,0x01,0xad,0x01,0x02,0x1d,0x33,0x8e,0x16,0x00,0x00,0x02,0x96,0x00,0x00,0x60,0x1a,0x41,0x01,0x4b,0xc1,0x6d,0x00,0x4e,0x9c,0x03,0x84,0x00,0x00,0x0f,0x10,0x4f,0xdf,0x20,0x90,0x0d,0x20,0x07,0x51,0x03,0xb0,0x0a,0x00,0x13 ,0x08,0x09,0x06,0x05,0x01,0x1b,0x1a,0x02,0x00,0x03,0x00,0x1c,0x01,0xad,0x01,0x02,0x1d,0x33,0xb1,0x16,0x00,0x00,0x02,0x96,0x00,0x00,0x60,0x1a,0x41,0x01,0x4b,0xc1,0xea,0x00,0x28,0xf9}; - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf1)))); - - int[] buf2 = {0x00,0x92,0x00,0x00,0x0c,0x07,0xa6,0xba,0xcd,0x47,0x01,0x00,0x05,0x52,0xdb,0x5c,0xc2,0x00,0x00,0x18,0x7b,0x8b,0x25,0x1a,0xce,0x47,0x8e,0x08,0x7c,0x04,0x4c,0x0a,0x00,0x00,0x09,0x07,0x00,0x00,0x00,0x00,0x52,0xdb,0x5c,0xfe,0x00,0x00,0x18,0x7b,0x8a,0xb0,0x1a,0xce,0x47,0x19,0x08,0x79,0x04,0x4c,0x09,0x00,0x00,0x0b,0x07,0x00,0x00,0x00,0x00,0x52,0xdb,0x5d,0x3a,0x00,0x00,0x18,0x7b,0x8b,0x25,0x1a,0xce,0x47,0x4b,0x08,0x9d,0x04,0x4c,0x09,0x00,0x00,0x09,0x07,0x00,0x00,0x00,0x00,0x52,0xdb,0x5d,0x76,0x00,0x00,0x18,0x7b,0x8b,0x9a,0x1a,0xce,0x47,0x5c,0x08,0xcd,0x04,0x4c,0x08,0x00,0x00,0x09,0x07,0x00,0x00,0x00,0x00,0x52,0xdb,0x5d,0xb2,0x00,0x00,0x18,0x7b,0x8b,0x14,0x1a,0xce,0x46,0xe7,0x08,0xb3,0x04,0x4c,0x08,0x00,0x00,0x09,0x07,0x00,0x00,0x00,0x00,0x41,0xcb}; - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf2)))); - + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "007900000b1a2a5585c30100024e9c036900000f101733208ff45e07b31b570a001009090605011b1a020003001c01ad01021d338e16000002960000601a41014bc16d004e9c038400000f104fdf20900d20075103b00a001308090605011b1a020003001c01ad01021d33b116000002960000601a41014bc1ea0028f9")))); + + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "009200000c07a6bacd4701000552db5cc20000187b8b251ace478e087c044c0a000009070000000052db5cfe0000187b8ab01ace47190879044c0900000b070000000052db5d3a0000187b8b251ace474b089d044c09000009070000000052db5d760000187b8b9a1ace475c08cd044c08000009070000000052db5db20000187b8b141ace46e708b3044c08000009070000000041cb")))); + } } diff --git a/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java b/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java index 9c38bf4b7..32fa7df87 100644 --- a/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java +++ b/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java @@ -14,35 +14,35 @@ public class TeltonikaProtocolDecoderTest { TeltonikaProtocolDecoder decoder = new TeltonikaProtocolDecoder(new TestDataManager(), null, null); - assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[] {0x00,0x0F,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x30,0x31,0x32,0x33,0x34,0x35})))); + assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "000F313233343536373839303132333435")))); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[] {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xA7,0x08,0x04,0x00,0x00,0x01,0x13,0xfc,0x20,0x8d,0xff,0x00,0x0f,0x14,0xf6,0x50,0x20,0x9c,0xca,0x80,0x00,0x6f,0x00,0xd6,0x04,0x00,0x04,0x00,0x04,0x03,0x01,0x01,0x15,0x03,0x16,0x03,0x00,0x01,0x46,0x00,0x00,0x01,0x5d,0x00,0x00,0x00,0x01,0x13,0xfc,0x17,0x61,0x0b,0x00,0x0f,0x14,0xff,0xe0,0x20,0x9c,0xc5,0x80,0x00,0x6e,0x00,0xc0,0x05,0x00,0x01,0x00,0x04,0x03,0x01,0x01,0x15,0x03,0x16,0x01,0x00,0x01,0x46,0x00,0x00,0x01,0x5e,0x00,0x00,0x00,0x01,0x13,0xfc,0x28,0x49,0x45,0x00,0x0f,0x15,0x0f,0x00,0x20,0x9c,0xd2,0x00,0x00,0x95,0x01,0x08,0x04,0x00,0x00,0x00,0x04,0x03,0x01,0x01,0x15,0x00,0x16,0x03,0x00,0x01,0x46,0x00,0x00,0x01,0x5d,0x00,0x00,0x00,0x01,0x13,0xfc,0x26,0x7c,0x5b,0x00,0x0f,0x15,0x0a,0x50,0x20,0x9c,0xcc,0xc0,0x00,0x93,0x00,0x68,0x04,0x00,0x00,0x00,0x04,0x03,0x01,0x01,0x15,0x00,0x16,0x03,0x00,0x01,0x46,0x00,0x00,0x01,0x5b,0x00,0x04,0x00,0x00})))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "00000000000000A7080400000113fc208dff000f14f650209cca80006f00d60400040004030101150316030001460000015d0000000113fc17610b000f14ffe0209cc580006e00c00500010004030101150316010001460000015e0000000113fc284945000f150f00209cd200009501080400000004030101150016030001460000015d0000000113fc267c5b000f150a50209cccc0009300680400000004030101150016030001460000015b00040000")))); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[] {0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x47,0x08,0x06,0x00,0x00,0x01,0x3e,0x5a,0x60,0xa4,0xcb,0x00,0x3f,0xa7,0xb7,0x80,0xfc,0x42,0x45,0x18,0x00,0x42,0x00,0x00,0x0a,0x00,0x00,0x00,0x09,0x05,0x01,0x01,0x02,0x00,0xb3,0x00,0xb4,0x00,0xf0,0x00,0x03,0x42,0x68,0xa7,0x46,0x01,0x18,0x18,0x00,0x00,0x01,0xc7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x3e,0x5d,0xc8,0xba,0x28,0x00,0x3f,0xa7,0xc0,0x80,0xfc,0x42,0x46,0x04,0x00,0x01,0x00,0x00,0x05,0x00,0x00,0x00,0x09,0x05,0x01,0x01,0x02,0x00,0xb3,0x00,0xb4,0x00,0xf0,0x01,0x03,0x42,0x68,0xb4,0x46,0x00,0xef,0x18,0x00,0x00,0x01,0xc7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x3e,0x5d,0xc9,0x04,0x55,0x00,0x3f,0xa7,0xb6,0x40,0xfc,0x42,0x43,0x88,0x00,0x3a,0x00,0x00,0x07,0x00,0x00,0xf0,0x09,0x05,0x01,0x01,0x02,0x00,0xb3,0x00,0xb4,0x00,0xf0,0x00,0x03,0x42,0x68,0xdc,0x46,0x00,0xf7,0x18,0x00,0x00,0x01,0xc7,0x00,0x00,0x00,0x1d,0x00,0x00,0x00,0x01,0x3e,0x5d,0xc9,0xd3,0x68,0x00,0x3f,0xa7,0xb8,0x00,0xfc,0x42,0x44,0x30,0x00,0x49,0x00,0x00,0x04,0x00,0x00,0x00,0x09,0x05,0x01,0x01,0x02,0x00,0xb3,0x00,0xb4,0x00,0xf0,0x01,0x03,0x42,0x67,0xde,0x46,0x01,0x07,0x18,0x00,0x00,0x01,0xc7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x3e,0x5d,0xca,0x31,0x1d,0x00,0x3f,0xa7,0xb6,0x80,0xfc,0x42,0x43,0xcc,0x00,0x42,0x00,0x00,0x07,0x00,0x00,0xf0,0x09,0x05,0x01,0x01,0x02,0x00,0xb3,0x00,0xb4,0x00,0xf0,0x00,0x03,0x42,0x68,0x53,0x46,0x01,0x0b,0x18,0x00,0x00,0x01,0xc7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x3e,0x5d,0xcf,0xaf,0xe9,0x00,0x3f,0xa7,0xb6,0x00,0xfc,0x42,0x42,0xf0,0x00,0x3d,0x00,0x00,0x08,0x00,0x00,0x00,0x09,0x05,0x01,0x01,0x02,0x00,0xb3,0x00,0xb4,0x00,0xf0,0x00,0x03,0x42,0x68,0x52,0x46,0x01,0x19,0x18,0x00,0x00,0x01,0xc7,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x02,0x75})))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "000000000000014708060000013e5a60a4cb003fa7b780fc424518004200000a000000090501010200b300b400f000034268a746011818000001c700000000000000013e5dc8ba28003fa7c080fc4246040001000005000000090501010200b300b400f001034268b44600ef18000001c700000000000000013e5dc90455003fa7b640fc424388003a0000070000f0090501010200b300b400f000034268dc4600f718000001c70000001d000000013e5dc9d368003fa7b800fc4244300049000004000000090501010200b300b400f001034267de46010718000001c700000000000000013e5dca311d003fa7b680fc4243cc00420000070000f0090501010200b300b400f0000342685346010b18000001c700000000000000013e5dcfafe9003fa7b600fc4242f0003d000008000000090501010200b300b400f0000342685246011918000001c700000000000600000275")))); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[] {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2c,0x08,0x01,0x00,0x00,0x01,0x3e,0xff,0x8d,0x6f,0x98,0x00,0x17,0x32,0x95,0x00,0x21,0x11,0xf4,0x00,0x00,0x81,0x00,0xae,0x0b,0x00,0x00,0x00,0x04,0x01,0x01,0x00,0x03,0x09,0x00,0x16,0x43,0x29,0x80,0x42,0x2f,0x72,0x00,0x00,0x01,0x00,0x00,0x7a,0x5d})))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "000000000000002c08010000013eff8d6f9800173295002111f400008100ae0b0000000401010003090016432980422f7200000100007a5d")))); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[] {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc7,0x07,0x04,0x41,0xbf,0x9d,0xb0,0x0f,0xff,0x42,0x5a,0xdb,0xd7,0x41,0xca,0x6e,0x1e,0x00,0x9e,0x12,0x05,0x07,0x00,0x01,0x03,0x0b,0x16,0x00,0x00,0x60,0x1a,0x02,0x01,0x5e,0x02,0x00,0x03,0x14,0x00,0x66,0x15,0x00,0x0a,0x16,0x00,0x67,0x01,0x05,0x00,0x00,0x0c,0xe4,0x41,0xbf,0x9d,0x92,0x0f,0xff,0x42,0x5a,0xdb,0xb1,0x41,0xca,0x6f,0xc9,0x00,0xa2,0xb2,0x18,0x07,0x00,0x01,0x03,0x0b,0x16,0x00,0x00,0x60,0x1a,0x02,0x01,0x5e,0x02,0x00,0x03,0x14,0x00,0x66,0x15,0x00,0x0a,0x16,0x00,0x67,0x01,0x05,0x00,0x00,0x0c,0xc6,0x41,0xbf,0x9d,0x74,0x0f,0xff,0x42,0x5a,0xdb,0xee,0x41,0xca,0x73,0x92,0x00,0xb6,0xc9,0x1e,0x07,0x00,0x01,0x03,0x0b,0x1f,0x00,0x00,0x60,0x1a,0x02,0x01,0x5f,0x02,0x00,0x03,0x14,0x00,0x66,0x15,0x00,0x0a,0x16,0x00,0x66,0x01,0x05,0x00,0x00,0x0c,0xa8,0x41,0xbf,0x9c,0xfc,0x0f,0xff,0x42,0x5a,0xdb,0xa0,0x41,0xca,0x70,0xc1,0x00,0xb9,0x38,0x13,0x07,0x00,0x01,0x03,0x0b,0x1f,0x00,0x00,0x60,0x1a,0x02,0x01,0x5f,0x02,0x00,0x03,0x14,0x00,0x23,0x15,0x00,0x0a,0x16,0x00,0x25,0x01,0x05,0x00,0x00,0x0c,0x30,0x04,0x00,0x00,0x00})))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "00000000000000c7070441bf9db00fff425adbd741ca6e1e009e1205070001030b160000601a02015e02000314006615000a160067010500000ce441bf9d920fff425adbb141ca6fc900a2b218070001030b160000601a02015e02000314006615000a160067010500000cc641bf9d740fff425adbee41ca739200b6c91e070001030b1f0000601a02015f02000314006615000a160066010500000ca841bf9cfc0fff425adba041ca70c100b93813070001030b1f0000601a02015f02000314002315000a160025010500000c3004000000")))); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[] {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x31,0x07,0x02,0x4c,0x61,0x41,0x0b,0x01,0x3f,0x42,0x31,0xc2,0xc1,0x41,0xd0,0xbe,0xb9,0x00,0x3d,0x00,0x00,0x05,0x00,0x64,0x83,0xff,0x4c,0x61,0x40,0xeb,0x01,0x3f,0x42,0x31,0xc2,0xc1,0x41,0xd0,0xbe,0xb9,0x00,0x3d,0x00,0x00,0x05,0x00,0x64,0x83,0xff,0x02,0x00,0x00,0x41,0xdf})))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "000000000000003107024c61410b013f4231c2c141d0beb9003d000005006483ff4c6140eb013f4231c2c141d0beb9003d000005006483ff02000041df")))); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[] {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2b,0x08,0x01,0x00,0x00,0x01,0x40,0xd4,0xe3,0xec,0x6e,0x00,0x0c,0xc6,0x61,0xd0,0x16,0x74,0xa5,0xe0,0xff,0xfc,0x00,0x00,0x09,0x00,0x00,0x00,0x04,0x02,0x01,0x00,0xf0,0x00,0x02,0x42,0x32,0x23,0x18,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x7a,0x04})))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "000000000000002b080100000140d4e3ec6e000cc661d01674a5e0fffc00000900000004020100f0000242322318000000000100007a04")))); - assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[] {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2d,0x0c,0x01,0x06,0x00,0x00,0x00,0x25,0x23,0x46,0x4d,0x32,0x3d,0x32,0x36,0x32,0x30,0x33,0x32,0x37,0x36,0x31,0x37,0x32,0x31,0x33,0x39,0x36,0x2c,0x32,0x36,0x32,0x30,0x33,0x2c,0x30,0x37,0x2e,0x30,0x32,0x2e,0x30,0x35,0x0d,0x0a,0x01,0x00,0x00,0x9a,0x2e})))); + assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "000000000000002d0c01060000002523464d323d3236323033323736313732313339362c32363230332c30372e30322e30350d0a0100009a2e")))); - assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[] {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,0x0c,0x02,0x06,0x00,0x00,0x00,0x02,0x0d,0x0a,0x02,0x00,0x00,0x6f,0x4e})))); + assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "000000000000000a0c0206000000020d0a0200006f4e")))); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( - new int[] {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa6,0x08,0x01,0x00,0x00,0x01,0x3f,0x14,0xa1,0xd1,0xce,0x00,0x0f,0x0e,0xb7,0x90,0x20,0x9a,0x77,0x80,0x00,0xab,0x01,0x0c,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x33,0x90})))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "00000000000000a608010000013f14a1d1ce000f0eb790209a778000ab010c0500000000000000000100003390")))); } diff --git a/test/org/traccar/protocol/Xt7ProtocolDecoderTest.java b/test/org/traccar/protocol/Xt7ProtocolDecoderTest.java index 1207743ed..e786cd4da 100644 --- a/test/org/traccar/protocol/Xt7ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Xt7ProtocolDecoderTest.java @@ -1,5 +1,7 @@ package org.traccar.protocol; +import org.jboss.netty.buffer.ChannelBuffers; +import org.traccar.helper.ChannelBufferTools; import org.traccar.helper.TestDataManager; import org.jboss.netty.buffer.ChannelBufferFactory; import org.jboss.netty.buffer.HeapChannelBufferFactory; @@ -12,10 +14,9 @@ public class Xt7ProtocolDecoderTest { public void testDecode() throws Exception { Xt7ProtocolDecoder decoder = new Xt7ProtocolDecoder(new TestDataManager(), null, null); - ChannelBufferFactory factory = new HeapChannelBufferFactory(); - byte[] buf1 = {0x53,0x54,0x58,0x32,0x30,0x31,0x30,0x31,0x30,0x31,0x38,0x30,0x31,0x20,0x20,0x20,0x20,0x20,0x20,0x02,0x6A,0x24,0x47,0x50,0x52,0x4D,0x43,0x2C,0x31,0x30,0x31,0x30,0x35,0x33,0x2E,0x30,0x30,0x30,0x2C,0x41,0x2C,0x32,0x32,0x33,0x32,0x2E,0x37,0x36,0x30,0x37,0x2C,0x4E,0x2C,0x31,0x31,0x34,0x30,0x34,0x2E,0x37,0x36,0x36,0x39,0x2C,0x45,0x2C,0x30,0x2E,0x30,0x30,0x2C,0x2C,0x32,0x33,0x31,0x31,0x31,0x30,0x2C,0x2C,0x2C,0x41,0x2A,0x37,0x46,0x2C,0x34,0x36,0x30,0x2C,0x30,0x30,0x2C,0x32,0x37,0x39,0x35,0x2C,0x30,0x45,0x36,0x41,0x2C,0x31,0x34,0x2C,0x39,0x34,0x2C,0x31,0x30,0x30,0x30,0x2C,0x30,0x30,0x30,0x30,0x2C,0x39,0x31,0x2C,0x54,0x69,0x6D,0x65,0x72,0x3B,0x31,0x44,0x0D,0x0A}; - verify(decoder.decode(null, null, factory.getBuffer(buf1, 0, buf1.length))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "53545832303130313031383031202020202020026A244750524D432C3130313035332E3030302C412C323233322E373630372C4E2C31313430342E373636392C452C302E30302C2C3233313131302C2C2C412A37462C3436302C30302C323739352C304536412C31342C39342C313030302C303030302C39312C54696D65723B31440D0A")))); } |