diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2013-01-15 00:19:39 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2013-01-15 00:19:39 +1300 |
commit | b5bd3e35f563825c9d40eaa04c02bc6397029219 (patch) | |
tree | 05684875856d3908fdec3c582ecbf2153a5bdfb8 /test/org/traccar/protocol | |
parent | 38fbc3e872717a1179abd00a48b600b489f9fead (diff) | |
download | traccar-server-b5bd3e35f563825c9d40eaa04c02bc6397029219.tar.gz traccar-server-b5bd3e35f563825c9d40eaa04c02bc6397029219.tar.bz2 traccar-server-b5bd3e35f563825c9d40eaa04c02bc6397029219.zip |
Pass ServerManager to every protocol decoder
Diffstat (limited to 'test/org/traccar/protocol')
22 files changed, 86 insertions, 65 deletions
diff --git a/test/org/traccar/protocol/Avl08ProtocolDecoderTest.java b/test/org/traccar/protocol/Avl08ProtocolDecoderTest.java index 5e0004444..19a54b6e3 100644 --- a/test/org/traccar/protocol/Avl08ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Avl08ProtocolDecoderTest.java @@ -8,8 +8,9 @@ public class Avl08ProtocolDecoderTest { @Test public void testDecode() throws Exception { - - Avl08ProtocolDecoder decoder = new Avl08ProtocolDecoder(new TestDataManager()); + + Avl08ProtocolDecoder decoder = new Avl08ProtocolDecoder(null); + decoder.setDataManager(new TestDataManager()); assertNull(decoder.decode(null, null, "$$AE359772033395899|AA000000000000000000000000000000000000000000000000000000000000|00.0|00.0|00.0|000000000000|20090215000153|13601435|00000000|00000000|0000|0.0000|0007|2DAA")); @@ -25,7 +26,7 @@ public class Avl08ProtocolDecoderTest { assertNotNull(decoder.decode(null, null, "$$B3359772032399074|09$GPRMC,094905.000,A,3648.2229,N,01008.0976,E,0.00,,221211,,,A*71|02.1|01.3|01.7|000000000000|20111222094905|03210533|00000000|00000000|0000|0.0000|0002||FA58")); - + assertNotNull(decoder.decode(null, null, "$$B3359772032399074|AA$GPRMC,093911.000,A,3648.2146,N,01008.0977,E,0.00,,140312,,,A*7E|02.1|01.1|01.8|000000000000|20120314093910|04100057|00000000|0012D887|0000|0.0000|1128||C50E")); diff --git a/test/org/traccar/protocol/EnforaProtocolDecoderTest.java b/test/org/traccar/protocol/EnforaProtocolDecoderTest.java index bf7f22290..a0a2e1b6f 100644 --- a/test/org/traccar/protocol/EnforaProtocolDecoderTest.java +++ b/test/org/traccar/protocol/EnforaProtocolDecoderTest.java @@ -11,7 +11,8 @@ public class EnforaProtocolDecoderTest { @Test public void testDecode() throws Exception { - EnforaProtocolDecoder decoder = new EnforaProtocolDecoder(new TestDataManager()); + EnforaProtocolDecoder decoder = new EnforaProtocolDecoder(null); + decoder.setDataManager(new TestDataManager()); ChannelBufferFactory factory = new HeapChannelBufferFactory(); byte[] buf1 = {0x00,0x0A,0x08,0x00,0x20,0x20,0x20,0x20,0x20,0x30,0x31,0x31,0x30,0x37,0x30,0x30,0x30,0x30,0x35,0x37,0x30,0x32,0x36,0x37}; diff --git a/test/org/traccar/protocol/Ev603ProtocolDecoderTest.java b/test/org/traccar/protocol/Ev603ProtocolDecoderTest.java index c25c06798..c4ecc5c7b 100644 --- a/test/org/traccar/protocol/Ev603ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Ev603ProtocolDecoderTest.java @@ -8,9 +8,10 @@ public class Ev603ProtocolDecoderTest { @Test public void testDecode() throws Exception { - - Ev603ProtocolDecoder decoder = new Ev603ProtocolDecoder(new TestDataManager()); - + + Ev603ProtocolDecoder decoder = new Ev603ProtocolDecoder(null); + decoder.setDataManager(new TestDataManager()); + assertNull(decoder.decode(null, null, "!5,17,V")); assertNotNull(decoder.decode(null, null, diff --git a/test/org/traccar/protocol/Gl100ProtocolDecoderTest.java b/test/org/traccar/protocol/Gl100ProtocolDecoderTest.java index e066d9af8..b705e446e 100644 --- a/test/org/traccar/protocol/Gl100ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Gl100ProtocolDecoderTest.java @@ -7,9 +7,10 @@ public class Gl100ProtocolDecoderTest { @Test public void testDecode() throws Exception { - - Gl100ProtocolDecoder decoder = new Gl100ProtocolDecoder(new TestDataManager()); - + + Gl100ProtocolDecoder decoder = new Gl100ProtocolDecoder(null); + decoder.setDataManager(new TestDataManager()); + assertNotNull(decoder.decode(null, null, "+RESP:GTSOS,359231030000010,0,0,0,1,4.3,92,70.0,1,121.354335,31.222073,20090101000000,0460,0000,18d8,6141,00,11F0,0102120204")); diff --git a/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java b/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java index 3be9bdc35..460d0dfec 100644 --- a/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java @@ -8,7 +8,8 @@ public class Gl200ProtocolDecoderTest { @Test public void testDecode() throws Exception { - Gl200ProtocolDecoder decoder = new Gl200ProtocolDecoder(new TestDataManager()); + Gl200ProtocolDecoder decoder = new Gl200ProtocolDecoder(null); + decoder.setDataManager(new TestDataManager()); assertNotNull(decoder.decode(null, null, "+RESP:GTFRI,020102,000035988863964,,0,0,1,1,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,00,,20090214093254,11F0")); diff --git a/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java b/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java index 0433e2e34..823b4fca2 100644 --- a/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java @@ -9,7 +9,8 @@ public class Gps103ProtocolDecoderTest { @Test public void testDecode() throws Exception { - Gps103ProtocolDecoder decoder = new Gps103ProtocolDecoder(new TestDataManager()); + Gps103ProtocolDecoder decoder = new Gps103ProtocolDecoder(null); + decoder.setDataManager(new TestDataManager()); // Log on request //assertNull(decoder.decode(null, null, "##,imei:359586015829802,A")); diff --git a/test/org/traccar/protocol/Gt02ProtocolDecoderTest.java b/test/org/traccar/protocol/Gt02ProtocolDecoderTest.java index 585a2cea3..19d7f3812 100644 --- a/test/org/traccar/protocol/Gt02ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Gt02ProtocolDecoderTest.java @@ -8,9 +8,10 @@ public class Gt02ProtocolDecoderTest { @Test public void testDecode() throws Exception { - - Gt02ProtocolDecoder decoder = new Gt02ProtocolDecoder(new TestDataManager()); - + + Gt02ProtocolDecoder decoder = new Gt02ProtocolDecoder(null); + decoder.setDataManager(new TestDataManager()); + byte[] buf1 = {0x68,0x68,0x25,0x00,0x00,0x01,0x23,0x45,0x67,(byte)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}; assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf1))); diff --git a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java index ae4416435..c738cd79d 100644 --- a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java @@ -10,7 +10,8 @@ public class Gt06ProtocolDecoderTest { @Test public void testDecode() throws Exception { - Gt06ProtocolDecoder decoder = new Gt06ProtocolDecoder(new TestDataManager()); + Gt06ProtocolDecoder decoder = new Gt06ProtocolDecoder(null); + decoder.setDataManager(new TestDataManager()); byte[] buf1 = {0x78,0x78,0x0d,0x01,0x03,0x53,0x41,(byte)0x90,0x36,0x06,0x60,0x61,0x00,0x03,(byte)0xc3,(byte)0xdf,0x0d,0x0a}; assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf1))); diff --git a/test/org/traccar/protocol/H02ProtocolDecoderTest.java b/test/org/traccar/protocol/H02ProtocolDecoderTest.java index cd200705b..235ef279e 100644 --- a/test/org/traccar/protocol/H02ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/H02ProtocolDecoderTest.java @@ -8,9 +8,10 @@ public class H02ProtocolDecoderTest { @Test public void testDecode() throws Exception { - - H02ProtocolDecoder decoder = new H02ProtocolDecoder(new TestDataManager()); - + + H02ProtocolDecoder decoder = new H02ProtocolDecoder(null); + decoder.setDataManager(new TestDataManager()); + assertNotNull(decoder.decode(null, null, "*HQ,123456789012345,V1,155850,A,5214.5346,N,2117.4683,E,0.00,270.90,131012,ffffffff,000000,000000,000000,000000")); diff --git a/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java b/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java index 3e214832e..0419c024c 100644 --- a/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java @@ -9,18 +9,19 @@ public class Jt600ProtocolDecoderTest { @Test public void testDecode() throws Exception { - - Jt600ProtocolDecoder decoder = new Jt600ProtocolDecoder(new TestDataManager()); - + + Jt600ProtocolDecoder decoder = new Jt600ProtocolDecoder(null); + decoder.setDataManager(new TestDataManager()); + 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}; assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf1))); - + 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}; assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf2))); 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}; assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf2))); - + assertNotNull(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()))); diff --git a/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java b/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java index 11ca13aef..94950fc9c 100644 --- a/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java +++ b/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java @@ -11,27 +11,28 @@ public class MeiligaoProtocolDecoderTest { @Test public void testDecode() throws Exception { - MeiligaoProtocolDecoder decoder = new MeiligaoProtocolDecoder(new TestDataManager()); + MeiligaoProtocolDecoder decoder = new MeiligaoProtocolDecoder(null); + decoder.setDataManager(new TestDataManager()); ChannelBufferFactory factory = new HeapChannelBufferFactory(); - + byte[] buf1 = {0x12,0x34,0x56,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,0x50,0x00,(byte)0x8B,(byte)0x9B,0x0D,0x0A}; assertNull(decoder.decode(null, null, factory.getBuffer(buf1, 0, buf1.length))); byte[] buf2 = {0x12,0x34,0x56,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)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}; assertNotNull(decoder.decode(null, null, factory.getBuffer(buf2, 0, buf2.length))); - + byte[] buf3 = {0x33,0x58,0x01,(byte)0x97,0x03,0x58,0x1F,(byte)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,(byte)0x95,(byte)0x82,0x0D,0x0A}; assertNotNull(decoder.decode(null, null, factory.getBuffer(buf3, 0, buf3.length))); byte[] buf4 = {0x16,(byte)0x91,0x00,0x04,(byte)0x84,0x12,0x4F,(byte)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,(byte)0xFA,0x42,0x0D,0x0A}; assertNotNull(decoder.decode(null, null, factory.getBuffer(buf4, 0, buf4.length))); - + byte[] buf5 = {0x45,0x12,0x42,0x20,0x30,0x6F,(byte)0xFF,(byte)0x99,(byte)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,(byte)0xBA,(byte)0xC1,0x0D,0x0A}; assertNotNull(decoder.decode(null, null, factory.getBuffer(buf5, 0, buf5.length))); - + byte[] buf6 = {(byte)0x86,0x21,0x70,0x01,0x42,0x45,(byte)0x8F,(byte)0x99,(byte)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,(byte)0xE2,0x48,0x0D,0x0A}; assertNotNull(decoder.decode(null, null, factory.getBuffer(buf6, 0, buf6.length))); - + byte[] buf7 = {0x12,0x34,0x56,0x78,(byte)0x9F,(byte)0xFF,(byte)0xFF,(byte)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,(byte)0xC4,0x52,0x0D,0x0A}; assertNotNull(decoder.decode(null, null, factory.getBuffer(buf7, 0, buf7.length))); diff --git a/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java b/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java index c67fc2e31..e2f30b752 100644 --- a/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java +++ b/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java @@ -8,7 +8,8 @@ public class MeitrackProtocolDecoderTest { @Test public void testDecode() throws Exception { - MeitrackProtocolDecoder decoder = new MeitrackProtocolDecoder(new TestDataManager()); + MeitrackProtocolDecoder decoder = new MeitrackProtocolDecoder(null); + decoder.setDataManager(new TestDataManager()); assertNotNull(decoder.decode(null, null, "$$]138,012896000475498,AAA,35,-6.138255,106.910545,121205074600,A,5,18,0,0,0,49,3800,24826,510|10|0081|4F4F,0000,0011|0012|0010|0963|0000,,*94")); @@ -18,13 +19,13 @@ public class MeitrackProtocolDecoderTest { assertNotNull(decoder.decode(null, null, "$$j138,012896000475498,AAA,35,-6.138306,106.910655,121205103708,A,3,11,0,0,1,36,4182,35025,510|10|0081|4F4F,0000,000A|000C|000A|0915|0000,,*BF")); - + assertNotNull(decoder.decode(null, null, "$$m139,012896005334567,AAA,35,-33.866423,151.190060,121208020649,A,7,27,0,32,4,13,6150,49517,505|2|0B67|5A6C,0000,0000|0000|0000|0977|0000,,*F1")); - + assertNotNull(decoder.decode(null, null, "$$A141,012896005334567,AAA,35,-33.866543,151.190148,121209081758,A,6,27,0,16,1,48,65551,152784,505|2|0B5F|D9D3,0000,0000|0000|0000|0A39|0000,,*5B")); - + } } diff --git a/test/org/traccar/protocol/NavisProtocolDecoderTest.java b/test/org/traccar/protocol/NavisProtocolDecoderTest.java index cf9a47992..2d568765a 100644 --- a/test/org/traccar/protocol/NavisProtocolDecoderTest.java +++ b/test/org/traccar/protocol/NavisProtocolDecoderTest.java @@ -10,18 +10,19 @@ public class NavisProtocolDecoderTest { @Test public void testDecode() throws Exception { - - NavisProtocolDecoder decoder = new NavisProtocolDecoder(new TestDataManager()); - + + NavisProtocolDecoder decoder = new NavisProtocolDecoder(null); + decoder.setDataManager(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))); - + 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))); - + } } diff --git a/test/org/traccar/protocol/Pt502ProtocolDecoderTest.java b/test/org/traccar/protocol/Pt502ProtocolDecoderTest.java index f8c4c43d2..c8a33037c 100644 --- a/test/org/traccar/protocol/Pt502ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Pt502ProtocolDecoderTest.java @@ -7,21 +7,22 @@ public class Pt502ProtocolDecoderTest { @Test public void testDecode() throws Exception { - - Pt502ProtocolDecoder decoder = new Pt502ProtocolDecoder(new TestDataManager()); + + Pt502ProtocolDecoder decoder = new Pt502ProtocolDecoder(null); + decoder.setDataManager(new TestDataManager()); assertNotNull(decoder.decode(null, null, "$POS,6094,205523.000,A,1013.6223,N,06728.4248,W,0.0,99.3,011112,,,A/00000,00000/0/23895000//")); assertNotNull(decoder.decode(null, null, "$POS,6120,233326.000,V,0935.1201,N,06914.6933,W,0.00,,151112,,,A/00000,00000/0/0/")); - + assertNotNull(decoder.decode(null, null, "$POS,6002,233257.000,A,0931.0430,N,06912.8707,W,0.05,146.98,141112,,,A/00010,00000/0/5360872")); - + assertNotNull(decoder.decode(null, null, "$POS,6095,233344.000,V,0933.0451,N,06912.3360,W,,,151112,,,N/00000,00000/0/1677600/")); - + /*assertNotNull(decoder.decode(null, null, "$PHO0,6091,233606.000,A,0902.9855,N,06944.3654,W,0.0,43.8,141112,,,A/00010,00000/0/224000//"));*/ diff --git a/test/org/traccar/protocol/ST210ProtocolDecoderTest.java b/test/org/traccar/protocol/ST210ProtocolDecoderTest.java index 7956c3dd4..d84993b95 100644 --- a/test/org/traccar/protocol/ST210ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/ST210ProtocolDecoderTest.java @@ -10,8 +10,8 @@ public class ST210ProtocolDecoderTest { @Test public void testDecode() throws Exception { - ST210ProtocolDecoder decoder = new ST210ProtocolDecoder( - new TestDataManager()); + ST210ProtocolDecoder decoder = new ST210ProtocolDecoder(null); + decoder.setDataManager(new TestDataManager()); //Status assertNotNull(decoder @@ -48,7 +48,7 @@ public class ST210ProtocolDecoderTest { assertNotNull(decoder .decode(null, null, - "SA200ALT;317652;042;20120829;14:25:58;16d41;-15.618770;-056.083242;000.029;000.00;0;0;2404240;0.00;000000;10")); + "SA200ALT;317652;042;20120829;14:25:58;16d41;-15.618770;-056.083242;000.029;000.00;0;0;2404240;0.00;000000;10")); } } diff --git a/test/org/traccar/protocol/SkypatrolProtocolDecoderTest.java b/test/org/traccar/protocol/SkypatrolProtocolDecoderTest.java index 3024094d4..e3b1a0dc1 100644 --- a/test/org/traccar/protocol/SkypatrolProtocolDecoderTest.java +++ b/test/org/traccar/protocol/SkypatrolProtocolDecoderTest.java @@ -6,13 +6,14 @@ import static org.junit.Assert.assertNotNull; import org.junit.Test; public class SkypatrolProtocolDecoderTest { - + @Test public void testDecode() throws Exception { - - SkypatrolProtocolDecoder decoder = new SkypatrolProtocolDecoder(new TestDataManager()); + + SkypatrolProtocolDecoder decoder = new SkypatrolProtocolDecoder(null); + decoder.setDataManager(new TestDataManager()); ChannelBufferFactory factory = new HeapChannelBufferFactory(); - + byte[] buf1 = {0x00,0x05,0x02,0x10,0x04,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,0x00,0x00,0x00,0x0D,0x31,0x31,0x34,0x37,0x37,0x35,0x38,0x33,0x00,(byte)0xCB,0x00,0x00,0x00,0x00,0x0E,0x11,0x07,0x0C,0x01,0x01,(byte)0x84,(byte)0xD0,0x32,(byte)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,(byte)0xB7,0x36,0x3B,0x63,0x06,(byte)0xC1,0x1A,0x00,(byte)0xB7,0x36,0x37,(byte)0xF2,0x06,(byte)0xBF,0x19,(byte)0xB7,0x36,0x37,(byte)0xF1,0x06,(byte)0xB5,0x0E,(byte)0xB7,0x36,0x38,(byte)0xB1,0x06,(byte)0xBB,0x0B,(byte)0xB7,0x36,0x3B,0x61,0x06,(byte)0xB8,0x0A,(byte)0xB7,0x36,0x37,(byte)0xF3,0x06,(byte)0xB7,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C}; assertNotNull(decoder.decode(null, null, factory.getBuffer(buf1, 0, buf1.length))); diff --git a/test/org/traccar/protocol/T55ProtocolDecoderTest.java b/test/org/traccar/protocol/T55ProtocolDecoderTest.java index 5d9ae4e3a..6d639ee8c 100644 --- a/test/org/traccar/protocol/T55ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/T55ProtocolDecoderTest.java @@ -8,9 +8,10 @@ public class T55ProtocolDecoderTest { @Test public void testDecode() throws Exception { - - T55ProtocolDecoder decoder = new T55ProtocolDecoder(new TestDataManager()); - + + T55ProtocolDecoder decoder = new T55ProtocolDecoder(null); + decoder.setDataManager(new TestDataManager()); + assertNull(decoder.decode(null, null, "$PGID,359853000144328*0F")); assertNotNull(decoder.decode(null, null, diff --git a/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java b/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java index d7e9b2444..b7e4ab849 100644 --- a/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java @@ -9,7 +9,8 @@ public class Tk103ProtocolDecoderTest { @Test public void testDecode() throws Exception { - Tk103ProtocolDecoder decoder = new Tk103ProtocolDecoder(new TestDataManager()); + Tk103ProtocolDecoder decoder = new Tk103ProtocolDecoder(null); + decoder.setDataManager(new TestDataManager()); assertNull(decoder.decode(null, null, "(090411121854BP0000001234567890HSO")); diff --git a/test/org/traccar/protocol/Tr20ProtocolDecoderTest.java b/test/org/traccar/protocol/Tr20ProtocolDecoderTest.java index aa978655b..ecb814708 100644 --- a/test/org/traccar/protocol/Tr20ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Tr20ProtocolDecoderTest.java @@ -8,9 +8,10 @@ public class Tr20ProtocolDecoderTest { @Test public void testDecode() throws Exception { - - Tr20ProtocolDecoder decoder = new Tr20ProtocolDecoder(new TestDataManager()); - + + Tr20ProtocolDecoder decoder = new Tr20ProtocolDecoder(null); + decoder.setDataManager(new TestDataManager()); + assertNull(decoder.decode(null, null, "%%TRACKPRO01,1")); assertNotNull(decoder.decode(null, null, diff --git a/test/org/traccar/protocol/V680ProtocolDecoderTest.java b/test/org/traccar/protocol/V680ProtocolDecoderTest.java index 15b25b9d9..e185ab9fd 100644 --- a/test/org/traccar/protocol/V680ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/V680ProtocolDecoderTest.java @@ -7,9 +7,10 @@ public class V680ProtocolDecoderTest { @Test public void testDecode() throws Exception { - - V680ProtocolDecoder decoder = new V680ProtocolDecoder(new TestDataManager()); - + + V680ProtocolDecoder decoder = new V680ProtocolDecoder(null); + decoder.setDataManager(new TestDataManager()); + assertNotNull(decoder.decode(null, null, "#356823033219838#1000#0#1478#AUT#1#66830FFB#03855.6628,E,4716.6821,N,001.41,259#130812#143905")); diff --git a/test/org/traccar/protocol/Xexun2ProtocolDecoderTest.java b/test/org/traccar/protocol/Xexun2ProtocolDecoderTest.java index 8d585337a..9a4b6e28d 100644 --- a/test/org/traccar/protocol/Xexun2ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Xexun2ProtocolDecoderTest.java @@ -8,7 +8,8 @@ public class Xexun2ProtocolDecoderTest { @Test public void testDecode() throws Exception { - Xexun2ProtocolDecoder decoder = new Xexun2ProtocolDecoder(new TestDataManager()); + Xexun2ProtocolDecoder decoder = new Xexun2ProtocolDecoder(null); + decoder.setDataManager(new TestDataManager()); assertNotNull(decoder.decode(null, null, "111111120009,+436763737552,GPRMC,120009.590,A,4639.6774,N,01418.5737,E,0.00,0.00,111111,,,A*68,F,, imei:359853000144328,04,481.2,F:4.15V,0,139,2689,232,03,2725,0576")); diff --git a/test/org/traccar/protocol/XexunProtocolDecoderTest.java b/test/org/traccar/protocol/XexunProtocolDecoderTest.java index 832f4ee63..fa32ed966 100644 --- a/test/org/traccar/protocol/XexunProtocolDecoderTest.java +++ b/test/org/traccar/protocol/XexunProtocolDecoderTest.java @@ -7,8 +7,9 @@ public class XexunProtocolDecoderTest { @Test public void testDecode() throws Exception { - - XexunProtocolDecoder decoder = new XexunProtocolDecoder(new TestDataManager()); + + XexunProtocolDecoder decoder = new XexunProtocolDecoder(null); + decoder.setDataManager(new TestDataManager()); assertNotNull(decoder.decode(null, null, "GPRMC,150120.000,A,3346.4463,S,15057.3083,E,0.0,117.4,010911,,,A*76,F,imei:351525010943661,")); @@ -21,7 +22,7 @@ public class XexunProtocolDecoderTest { assertNotNull(decoder.decode(null, null, "GPRMC,080303.000,A,5546.7313,N,03738.6005,E,0.56,160.13,100311,,,A*6A,L,imei:354778030461167,")); - + assertNotNull(decoder.decode(null, null, "GPRMC,014623.000,A,4710.8260,N,1948.1220,E,0.11,105.40,111212,00,0000.0,A*49,F,,imei:357713002048962,")); |