aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2011-11-11 13:46:52 +0000
committerAnton Tananaev <anton.tananaev@gmail.com>2011-11-11 13:46:52 +0000
commite7c57a86e55868e3563e023a6dc70e7848c55d20 (patch)
tree61cb0d82671cb68c18bc34be32467548de8b36cf /test/org/traccar/protocol
parenta88479f670fea8f6c7f5fdf13c7dffa67772d854 (diff)
downloadtrackermap-server-e7c57a86e55868e3563e023a6dc70e7848c55d20.tar.gz
trackermap-server-e7c57a86e55868e3563e023a6dc70e7848c55d20.tar.bz2
trackermap-server-e7c57a86e55868e3563e023a6dc70e7848c55d20.zip
Diffstat (limited to 'test/org/traccar/protocol')
-rw-r--r--test/org/traccar/protocol/gl200/Gl200ProtocolDecoderTest.java41
-rw-r--r--test/org/traccar/protocol/gps103/Gps103ProtocolDecoderTest.java52
-rw-r--r--test/org/traccar/protocol/t55/T55ProtocolDecoderTest.java45
-rw-r--r--test/org/traccar/protocol/tk103/Tk103ProtocolDecoderTest.java41
-rw-r--r--test/org/traccar/protocol/xexun/XexunProtocolDecoderTest.java49
5 files changed, 228 insertions, 0 deletions
diff --git a/test/org/traccar/protocol/gl200/Gl200ProtocolDecoderTest.java b/test/org/traccar/protocol/gl200/Gl200ProtocolDecoderTest.java
new file mode 100644
index 000000000..e2f4188bc
--- /dev/null
+++ b/test/org/traccar/protocol/gl200/Gl200ProtocolDecoderTest.java
@@ -0,0 +1,41 @@
+package org.traccar.protocol.gl200;
+
+import java.util.Calendar;
+import java.util.TimeZone;
+import java.util.GregorianCalendar;
+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 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 {
+
+ Gl200ProtocolDecoder decoder = new Gl200ProtocolDecoder(new TestDataManager(), 0);
+
+ 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/gps103/Gps103ProtocolDecoderTest.java b/test/org/traccar/protocol/gps103/Gps103ProtocolDecoderTest.java
new file mode 100644
index 000000000..8cdebcb88
--- /dev/null
+++ b/test/org/traccar/protocol/gps103/Gps103ProtocolDecoderTest.java
@@ -0,0 +1,52 @@
+package org.traccar.protocol.gps103;
+
+import java.util.Calendar;
+import java.util.TimeZone;
+import java.util.GregorianCalendar;
+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 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 {
+
+ Gps103ProtocolDecoder decoder = new Gps103ProtocolDecoder(new TestDataManager(), 0);
+
+ // assertNull(decoder.decode(null, null, "##,imei:10000000000000,A"));
+
+ assertNotNull(decoder.decode(null, null,
+ "imei:10000000000000,help me,1004171910,,F,010203.000,A,0102.0003,N,00102.0003,E,1.02,"));
+
+ assertNotNull(decoder.decode(null, null,
+ "imei:353451040164707,tracker,1105182344,+36304665439,F,214418.000,A,4804.2222,N,01916.7593,E,0.37,"));
+
+ assertNotNull(decoder.decode(null, null,
+ "imei:353451042861763,tracker,1106132241,,F,144114.000,A,2301.9052,S,04909.3676,W,0.13,"));
+
+ assertNotNull(decoder.decode(null, null,
+ "imei:359587010124900,tracker,0809231929,13554900601,F,112909.397,A,2234.4669,N,11354.3287,E,0.11,321.53,;"));
+
+ }
+
+}
diff --git a/test/org/traccar/protocol/t55/T55ProtocolDecoderTest.java b/test/org/traccar/protocol/t55/T55ProtocolDecoderTest.java
new file mode 100644
index 000000000..e806d49de
--- /dev/null
+++ b/test/org/traccar/protocol/t55/T55ProtocolDecoderTest.java
@@ -0,0 +1,45 @@
+package org.traccar.protocol.t55;
+
+import java.util.Date;
+import java.util.GregorianCalendar;
+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
new file mode 100644
index 000000000..68ea941fd
--- /dev/null
+++ b/test/org/traccar/protocol/tk103/Tk103ProtocolDecoderTest.java
@@ -0,0 +1,41 @@
+package org.traccar.protocol.tk103;
+
+import java.util.Calendar;
+import java.util.TimeZone;
+import java.util.GregorianCalendar;
+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/xexun/XexunProtocolDecoderTest.java b/test/org/traccar/protocol/xexun/XexunProtocolDecoderTest.java
new file mode 100644
index 000000000..76c299cd2
--- /dev/null
+++ b/test/org/traccar/protocol/xexun/XexunProtocolDecoderTest.java
@@ -0,0 +1,49 @@
+package org.traccar.protocol.xexun;
+
+import java.util.Date;
+import java.util.GregorianCalendar;
+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 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 {
+
+ XexunProtocolDecoder decoder = new XexunProtocolDecoder(new TestDataManager(), 0);
+
+ 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,"));
+
+ assertNotNull(decoder.decode(null, null,
+ "GPRMC,010203.000,A,0102.0003,N,00102.0003,E,1.02,1.02,010203,,,A*00,F,,imei:10000000000000,"));
+
+ assertNotNull(decoder.decode(null, null,
+ "GPRMC,233842.000,A,5001.3060,N,01429.3243,E,0.00,,210211,,,A*74,F,imei:354776030495631,"));
+
+ 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,"));
+
+ }
+
+}