diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2012-04-26 19:34:10 +0000 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2012-04-26 19:34:10 +0000 |
commit | 02c1fb78a8b1681325ec01f49ae6ff6603825243 (patch) | |
tree | a851415301ec88a03d492594ba47577f02dc0edd /test/org/traccar/protocol | |
parent | f0b1e58016632af5514d94b7439af77b9918b643 (diff) | |
download | trackermap-server-02c1fb78a8b1681325ec01f49ae6ff6603825243.tar.gz trackermap-server-02c1fb78a8b1681325ec01f49ae6ff6603825243.tar.bz2 trackermap-server-02c1fb78a8b1681325ec01f49ae6ff6603825243.zip |
Diffstat (limited to 'test/org/traccar/protocol')
11 files changed, 75 insertions, 236 deletions
diff --git a/test/org/traccar/protocol/avl08/Avl08ProtocolDecoderTest.java b/test/org/traccar/protocol/Avl08ProtocolDecoderTest.java index 281d780b3..8145412a5 100644 --- a/test/org/traccar/protocol/avl08/Avl08ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Avl08ProtocolDecoderTest.java @@ -1,40 +1,16 @@ -package org.traccar.protocol.avl08; +package org.traccar.protocol; -import java.util.List; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; import org.junit.Test; -import org.traccar.Device; -import org.traccar.Position; -import org.traccar.DataManager; -import static org.junit.Assert.*; public class Avl08ProtocolDecoderTest { - private class TestDataManager implements DataManager { - public List getDevices() { - return null; - } - - public Device getDeviceByImei(String imei) { - Device device = new Device(); - device.setId(new Long(1)); - device.setImei("10000000000000"); - return device; - } - - public void setPosition(Position position) { - } - } - @Test public void testDecode() throws Exception { - Avl08ProtocolDecoder decoder = new Avl08ProtocolDecoder(new Avl08ProtocolDecoderTest.TestDataManager(), 0); + Avl08ProtocolDecoder decoder = new Avl08ProtocolDecoder(new TestDataManager(), 0); - //$$(2 Bytes) + Len(2 Bytes) + IMEI(15 Bytes) + | + AlarmType(2 Bytes) + GPRMC + | + - //PDOP + | + HDOP + | + VDOP + | + Status(12 Bytes) + | + RTC(14 Bytes) + | + Voltage(8 Bytes) - //+ | + ADC(8 Bytes) + | + LACCI(8 Bytes) + | + Temperature(4 Bytes) | +Mile-meter+| +Serial(4 - //Bytes) + | +RFID(10Bytes)+|+ Checksum (4 Byte) + \r\n(2 Bytes) - assertNull(decoder.decode(null, null, "$$AE359772033395899|AA000000000000000000000000000000000000000000000000000000000000|00.0|00.0|00.0|000000000000|20090215000153|13601435|00000000|00000000|0000|0.0000|0007|2DAA")); @@ -58,6 +34,9 @@ public class Avl08ProtocolDecoderTest { assertNotNull(decoder.decode(null, null, "$$B3359772032399074|AA$GPRMC,234603.000,A,3648.2179,N,01008.0962,E,0.00,,030412,,,A*74|01.8|01.0|01.5|000000000000|20120403234603|14251914|00000000|0012D888|0000|0.0000|3674||940B")); + + assertNotNull(decoder.decode(null, null, + "$$B3359772032399074|AA$GPRMC,234603.000,A,3648.2179,N,01008.0962,E,0.00,,030412,,,A*74|01.8|01.0|01.5|000000000000|20120403234603|14251914|00000000|0012D888|0000|0.0000|3674|940B")); } } diff --git a/test/org/traccar/protocol/gl100/Gl100ProtocolDecoderTest.java b/test/org/traccar/protocol/Gl100ProtocolDecoderTest.java index 972e849e2..1e1a1c978 100644 --- a/test/org/traccar/protocol/gl100/Gl100ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Gl100ProtocolDecoderTest.java @@ -1,30 +1,10 @@ -package org.traccar.protocol.gl100; +package org.traccar.protocol; -import java.util.List; +import static org.junit.Assert.assertNotNull; import org.junit.Test; -import org.traccar.Device; -import org.traccar.Position; -import org.traccar.DataManager; -import static org.junit.Assert.*; public class Gl100ProtocolDecoderTest { - private class TestDataManager implements DataManager { - public List getDevices() { - return null; - } - - public Device getDeviceByImei(String imei) { - Device device = new Device(); - device.setId(new Long(1)); - device.setImei("10000000000000"); - return device; - } - - public void setPosition(Position position) { - } - } - @Test public void testDecode() throws Exception { @@ -53,7 +33,6 @@ public class Gl100ProtocolDecoderTest { //assertNotNull(decoder.decode(null, null, // "AT+GTHBD=HeartBeat,359231030000010,20090101000000,11F0,0102120204")); - } } diff --git a/test/org/traccar/protocol/gl200/Gl200ProtocolDecoderTest.java b/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java index 5f6707ab7..b14a0c141 100644 --- a/test/org/traccar/protocol/gl200/Gl200ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java @@ -1,30 +1,10 @@ -package org.traccar.protocol.gl200; +package org.traccar.protocol; -import java.util.List; +import static org.junit.Assert.assertNotNull; import org.junit.Test; -import org.traccar.Device; -import org.traccar.Position; -import org.traccar.DataManager; -import static org.junit.Assert.*; public class Gl200ProtocolDecoderTest { - private class TestDataManager implements DataManager { - public List getDevices() { - return null; - } - - public Device getDeviceByImei(String imei) { - Device device = new Device(); - device.setId(new Long(1)); - device.setImei("10000000000000"); - return device; - } - - public void setPosition(Position position) { - } - } - @Test public void testDecode() throws Exception { diff --git a/test/org/traccar/protocol/gps103/Gps103ProtocolDecoderTest.java b/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java index 79ba76586..c09b34bc7 100644 --- a/test/org/traccar/protocol/gps103/Gps103ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java @@ -1,30 +1,10 @@ -package org.traccar.protocol.gps103; +package org.traccar.protocol; -import java.util.List; +import static org.junit.Assert.assertNotNull; import org.junit.Test; -import org.traccar.Device; -import org.traccar.Position; -import org.traccar.DataManager; -import static org.junit.Assert.*; public class Gps103ProtocolDecoderTest { - private class TestDataManager implements DataManager { - public List getDevices() { - return null; - } - - public Device getDeviceByImei(String imei) { - Device device = new Device(); - device.setId(new Long(1)); - device.setImei("10000000000000"); - return device; - } - - public void setPosition(Position position) { - } - } - @Test public void testDecode() throws Exception { diff --git a/test/org/traccar/protocol/T55ProtocolDecoderTest.java b/test/org/traccar/protocol/T55ProtocolDecoderTest.java new file mode 100644 index 000000000..678549968 --- /dev/null +++ b/test/org/traccar/protocol/T55ProtocolDecoderTest.java @@ -0,0 +1,24 @@ +package org.traccar.protocol; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import org.junit.Test; + +public class T55ProtocolDecoderTest { + + @Test + public void testDecode() throws Exception { + + T55ProtocolDecoder decoder = new T55ProtocolDecoder(new TestDataManager(), 0); + + assertNull(decoder.decode(null, null, "$PGID,359853000144328*0F")); + + assertNotNull(decoder.decode(null, null, + "$GPRMC,094907.000,A,6000.5332,N,03020.5192,E,1.17,60.26,091111,,*33")); + + assertNotNull(decoder.decode(null, null, + "$GPRMC,115528.000,A,6000.5432,N,03020.4948,E,,,091111,,*06")); + + } + +} diff --git a/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java b/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java new file mode 100644 index 000000000..e294f6010 --- /dev/null +++ b/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java @@ -0,0 +1,18 @@ +package org.traccar.protocol; + +import static org.junit.Assert.assertNotNull; +import org.junit.Test; + +public class Tk103ProtocolDecoderTest { + + @Test + public void testDecode() throws Exception { + + Tk103ProtocolDecoder decoder = new Tk103ProtocolDecoder(new TestDataManager(), 0); + + assertNotNull(decoder.decode(null, null, + "(035988863964BP05000035988863964110524A4241.7977N02318.7561E000.0123536356.5100000000L000946BB")); + + } + +} diff --git a/test/org/traccar/protocol/Xexun2ProtocolDecoderTest.java b/test/org/traccar/protocol/Xexun2ProtocolDecoderTest.java new file mode 100644 index 000000000..845b5757d --- /dev/null +++ b/test/org/traccar/protocol/Xexun2ProtocolDecoderTest.java @@ -0,0 +1,18 @@ +package org.traccar.protocol; + +import static org.junit.Assert.assertNotNull; +import org.junit.Test; + +public class Xexun2ProtocolDecoderTest { + + @Test + public void testDecode() throws Exception { + + Xexun2ProtocolDecoder decoder = new Xexun2ProtocolDecoder(new TestDataManager(), 0); + + 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/xexun/XexunProtocolDecoderTest.java b/test/org/traccar/protocol/XexunProtocolDecoderTest.java index ec5370406..f85ce9bb3 100644 --- a/test/org/traccar/protocol/xexun/XexunProtocolDecoderTest.java +++ b/test/org/traccar/protocol/XexunProtocolDecoderTest.java @@ -1,30 +1,10 @@ -package org.traccar.protocol.xexun; +package org.traccar.protocol; -import java.util.List; +import static org.junit.Assert.assertNotNull; import org.junit.Test; -import org.traccar.Device; -import org.traccar.Position; -import org.traccar.DataManager; -import static org.junit.Assert.*; public class XexunProtocolDecoderTest { - private class TestDataManager implements DataManager { - public List getDevices() { - return null; - } - - public Device getDeviceByImei(String imei) { - Device device = new Device(); - device.setId(new Long(1)); - device.setImei("10000000000000"); - return device; - } - - public void setPosition(Position position) { - } - } - @Test public void testDecode() throws Exception { diff --git a/test/org/traccar/protocol/t55/T55ProtocolDecoderTest.java b/test/org/traccar/protocol/t55/T55ProtocolDecoderTest.java deleted file mode 100644 index 8ee9ce9e9..000000000 --- a/test/org/traccar/protocol/t55/T55ProtocolDecoderTest.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.traccar.protocol.t55; - -import java.util.List; -import org.junit.Test; -import org.traccar.Device; -import org.traccar.Position; -import org.traccar.DataManager; -import static org.junit.Assert.*; - -public class T55ProtocolDecoderTest { - - private class TestDataManager implements DataManager { - public List getDevices() { - return null; - } - - public Device getDeviceByImei(String imei) { - Device device = new Device(); - device.setId(new Long(1)); - device.setImei("10000000000000"); - return device; - } - - public void setPosition(Position position) { - } - } - - @Test - public void testDecode() throws Exception { - - T55ProtocolDecoder decoder = new T55ProtocolDecoder(new TestDataManager(), 0); - - assertNull(decoder.decode(null, null, "$PGID,359853000144328*0F")); - - assertNotNull(decoder.decode(null, null, - "$GPRMC,094907.000,A,6000.5332,N,03020.5192,E,1.17,60.26,091111,,*33")); - - assertNotNull(decoder.decode(null, null, - "$GPRMC,115528.000,A,6000.5432,N,03020.4948,E,,,091111,,*06")); - - } - -} diff --git a/test/org/traccar/protocol/tk103/Tk103ProtocolDecoderTest.java b/test/org/traccar/protocol/tk103/Tk103ProtocolDecoderTest.java deleted file mode 100644 index f1ef85b06..000000000 --- a/test/org/traccar/protocol/tk103/Tk103ProtocolDecoderTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.traccar.protocol.tk103; - -import java.util.List; -import org.junit.Test; -import org.traccar.Device; -import org.traccar.Position; -import org.traccar.DataManager; -import static org.junit.Assert.*; - -public class Tk103ProtocolDecoderTest { - - private class TestDataManager implements DataManager { - public List getDevices() { - return null; - } - - public Device getDeviceByImei(String imei) { - Device device = new Device(); - device.setId(new Long(1)); - device.setImei("10000000000000"); - return device; - } - - public void setPosition(Position position) { - } - } - - @Test - public void testDecode() throws Exception { - - Tk103ProtocolDecoder decoder = new Tk103ProtocolDecoder(new TestDataManager(), 0); - - assertNotNull(decoder.decode(null, null, - "(035988863964BP05000035988863964110524A4241.7977N02318.7561E000.0123536356.5100000000L000946BB")); - - } - -} diff --git a/test/org/traccar/protocol/xexun2/Xexun2ProtocolDecoderTest.java b/test/org/traccar/protocol/xexun2/Xexun2ProtocolDecoderTest.java deleted file mode 100644 index 790abc222..000000000 --- a/test/org/traccar/protocol/xexun2/Xexun2ProtocolDecoderTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.traccar.protocol.xexun2; - -import java.util.List; -import org.junit.Test; -import org.traccar.Device; -import org.traccar.Position; -import org.traccar.DataManager; -import static org.junit.Assert.*; - -public class Xexun2ProtocolDecoderTest { - - private class TestDataManager implements DataManager { - public List getDevices() { - return null; - } - - public Device getDeviceByImei(String imei) { - Device device = new Device(); - device.setId(new Long(1)); - device.setImei("10000000000000"); - return device; - } - - public void setPosition(Position position) { - } - } - - @Test - public void testDecode() throws Exception { - - Xexun2ProtocolDecoder decoder = new Xexun2ProtocolDecoder(new TestDataManager(), 0); - - 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")); - - } - -} |