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 | |
parent | f0b1e58016632af5514d94b7439af77b9918b643 (diff) | |
download | trackermap-server-02c1fb78a8b1681325ec01f49ae6ff6603825243.tar.gz trackermap-server-02c1fb78a8b1681325ec01f49ae6ff6603825243.tar.bz2 trackermap-server-02c1fb78a8b1681325ec01f49ae6ff6603825243.zip |
-rw-r--r-- | src/org/traccar/Server.java | 18 | ||||
-rw-r--r-- | src/org/traccar/protocol/Avl08ProtocolDecoder.java (renamed from src/org/traccar/protocol/avl08/Avl08ProtocolDecoder.java) | 7 | ||||
-rw-r--r-- | src/org/traccar/protocol/Gl100ProtocolDecoder.java (renamed from src/org/traccar/protocol/gl100/Gl100ProtocolDecoder.java) | 2 | ||||
-rw-r--r-- | src/org/traccar/protocol/Gl200ProtocolDecoder.java (renamed from src/org/traccar/protocol/gl200/Gl200ProtocolDecoder.java) | 2 | ||||
-rw-r--r-- | src/org/traccar/protocol/Gps103ProtocolDecoder.java (renamed from src/org/traccar/protocol/gps103/Gps103ProtocolDecoder.java) | 2 | ||||
-rw-r--r-- | src/org/traccar/protocol/T55ProtocolDecoder.java (renamed from src/org/traccar/protocol/t55/T55ProtocolDecoder.java) | 2 | ||||
-rw-r--r-- | src/org/traccar/protocol/Tk103ProtocolDecoder.java (renamed from src/org/traccar/protocol/tk103/Tk103ProtocolDecoder.java) | 4 | ||||
-rw-r--r-- | src/org/traccar/protocol/Xexun2ProtocolDecoder.java (renamed from src/org/traccar/protocol/xexun2/Xexun2ProtocolDecoder.java) | 2 | ||||
-rw-r--r-- | src/org/traccar/protocol/XexunFrameDecoder.java (renamed from src/org/traccar/protocol/xexun/XexunFrameDecoder.java) | 2 | ||||
-rw-r--r-- | src/org/traccar/protocol/XexunProtocolDecoder.java (renamed from src/org/traccar/protocol/xexun/XexunProtocolDecoder.java) | 2 | ||||
-rw-r--r-- | test/org/traccar/protocol/Avl08ProtocolDecoderTest.java (renamed from test/org/traccar/protocol/avl08/Avl08ProtocolDecoderTest.java) | 35 | ||||
-rw-r--r-- | test/org/traccar/protocol/Gl100ProtocolDecoderTest.java (renamed from test/org/traccar/protocol/gl100/Gl100ProtocolDecoderTest.java) | 25 | ||||
-rw-r--r-- | test/org/traccar/protocol/Gl200ProtocolDecoderTest.java (renamed from test/org/traccar/protocol/gl200/Gl200ProtocolDecoderTest.java) | 24 | ||||
-rw-r--r-- | test/org/traccar/protocol/Gps103ProtocolDecoderTest.java (renamed from test/org/traccar/protocol/gps103/Gps103ProtocolDecoderTest.java) | 24 | ||||
-rw-r--r-- | test/org/traccar/protocol/T55ProtocolDecoderTest.java | 24 | ||||
-rw-r--r-- | test/org/traccar/protocol/Tk103ProtocolDecoderTest.java | 18 | ||||
-rw-r--r-- | test/org/traccar/protocol/Xexun2ProtocolDecoderTest.java | 18 | ||||
-rw-r--r-- | test/org/traccar/protocol/XexunProtocolDecoderTest.java (renamed from test/org/traccar/protocol/xexun/XexunProtocolDecoderTest.java) | 24 | ||||
-rw-r--r-- | test/org/traccar/protocol/t55/T55ProtocolDecoderTest.java | 43 | ||||
-rw-r--r-- | test/org/traccar/protocol/tk103/Tk103ProtocolDecoderTest.java | 38 | ||||
-rw-r--r-- | test/org/traccar/protocol/xexun2/Xexun2ProtocolDecoderTest.java | 38 |
21 files changed, 96 insertions, 258 deletions
diff --git a/src/org/traccar/Server.java b/src/org/traccar/Server.java index a84f8f337..b5e7acdea 100644 --- a/src/org/traccar/Server.java +++ b/src/org/traccar/Server.java @@ -39,12 +39,12 @@ import org.jboss.netty.handler.codec.string.StringEncoder; import org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder; import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.handler.logging.LoggingHandler; -import org.traccar.protocol.xexun.XexunFrameDecoder; -import org.traccar.protocol.xexun.XexunProtocolDecoder; -import org.traccar.protocol.gps103.Gps103ProtocolDecoder; -import org.traccar.protocol.tk103.Tk103ProtocolDecoder; -import org.traccar.protocol.gl200.Gl200ProtocolDecoder; -import org.traccar.protocol.t55.T55ProtocolDecoder; +import org.traccar.protocol.XexunFrameDecoder; +import org.traccar.protocol.XexunProtocolDecoder; +import org.traccar.protocol.Gps103ProtocolDecoder; +import org.traccar.protocol.Tk103ProtocolDecoder; +import org.traccar.protocol.Gl200ProtocolDecoder; +import org.traccar.protocol.T55ProtocolDecoder; import org.jboss.netty.channel.ChannelHandlerContext; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.channel.ChannelPipelineFactory; @@ -52,9 +52,9 @@ import org.jboss.netty.channel.ChannelStateEvent; import org.jboss.netty.channel.Channels; import org.jboss.netty.channel.SimpleChannelHandler; import org.traccar.helper.AdvancedConnection; -import org.traccar.protocol.gl100.Gl100ProtocolDecoder; -import org.traccar.protocol.xexun2.Xexun2ProtocolDecoder; -import org.traccar.protocol.avl08.Avl08ProtocolDecoder; +import org.traccar.protocol.Gl100ProtocolDecoder; +import org.traccar.protocol.Xexun2ProtocolDecoder; +import org.traccar.protocol.Avl08ProtocolDecoder; /** * Server diff --git a/src/org/traccar/protocol/avl08/Avl08ProtocolDecoder.java b/src/org/traccar/protocol/Avl08ProtocolDecoder.java index 4fb33f5ba..7f564af37 100644 --- a/src/org/traccar/protocol/avl08/Avl08ProtocolDecoder.java +++ b/src/org/traccar/protocol/Avl08ProtocolDecoder.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.traccar.protocol.avl08; +package org.traccar.protocol; import java.util.Calendar; import java.util.GregorianCalendar; @@ -65,8 +65,9 @@ public class Avl08ProtocolDecoder extends GenericProtocolDecoder { "(.\\d{3})\\|" + // Temperature "(\\d+.\\d{4})\\|" + // Mileage "(\\d{4})\\|" + // Serial - "(.{10})?\\|" + // RFID - ".+"); + "(.{10})?\\|?" + // RFID + ".+"); // TODO: Use non-capturing group + /** * Decode message */ diff --git a/src/org/traccar/protocol/gl100/Gl100ProtocolDecoder.java b/src/org/traccar/protocol/Gl100ProtocolDecoder.java index e4c0de38a..4ec41f8c1 100644 --- a/src/org/traccar/protocol/gl100/Gl100ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gl100ProtocolDecoder.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.traccar.protocol.gl100; +package org.traccar.protocol; import java.util.Calendar; import java.util.GregorianCalendar; diff --git a/src/org/traccar/protocol/gl200/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java index 4c1149347..a43562eb9 100644 --- a/src/org/traccar/protocol/gl200/Gl200ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.traccar.protocol.gl200; +package org.traccar.protocol; import java.util.Calendar; import java.util.GregorianCalendar; diff --git a/src/org/traccar/protocol/gps103/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java index f50dfad2a..e9c889af7 100644 --- a/src/org/traccar/protocol/gps103/Gps103ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.traccar.protocol.gps103; +package org.traccar.protocol; import java.util.Calendar; import java.util.GregorianCalendar; diff --git a/src/org/traccar/protocol/t55/T55ProtocolDecoder.java b/src/org/traccar/protocol/T55ProtocolDecoder.java index 5b1558c00..d1ffc7a4d 100644 --- a/src/org/traccar/protocol/t55/T55ProtocolDecoder.java +++ b/src/org/traccar/protocol/T55ProtocolDecoder.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.traccar.protocol.t55; +package org.traccar.protocol; import java.util.Calendar; import java.util.GregorianCalendar; diff --git a/src/org/traccar/protocol/tk103/Tk103ProtocolDecoder.java b/src/org/traccar/protocol/Tk103ProtocolDecoder.java index db3280d91..3eab4a386 100644 --- a/src/org/traccar/protocol/tk103/Tk103ProtocolDecoder.java +++ b/src/org/traccar/protocol/Tk103ProtocolDecoder.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.traccar.protocol.tk103; +package org.traccar.protocol; import java.util.Calendar; import java.util.GregorianCalendar; @@ -67,8 +67,6 @@ public class Tk103ProtocolDecoder extends GenericProtocolDecoder { String sentence = (String) msg; - // TODO: Send response (?) - // Parse message Matcher parser = pattern.matcher(sentence); if (!parser.matches()) { diff --git a/src/org/traccar/protocol/xexun2/Xexun2ProtocolDecoder.java b/src/org/traccar/protocol/Xexun2ProtocolDecoder.java index 62ec432ee..ce530785e 100644 --- a/src/org/traccar/protocol/xexun2/Xexun2ProtocolDecoder.java +++ b/src/org/traccar/protocol/Xexun2ProtocolDecoder.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.traccar.protocol.xexun2; +package org.traccar.protocol; import java.util.Calendar; import java.util.GregorianCalendar; diff --git a/src/org/traccar/protocol/xexun/XexunFrameDecoder.java b/src/org/traccar/protocol/XexunFrameDecoder.java index 6fd32a4c5..86f409b3e 100644 --- a/src/org/traccar/protocol/xexun/XexunFrameDecoder.java +++ b/src/org/traccar/protocol/XexunFrameDecoder.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.traccar.protocol.xexun; +package org.traccar.protocol; import org.jboss.netty.handler.codec.frame.FrameDecoder; import org.jboss.netty.channel.Channel; diff --git a/src/org/traccar/protocol/xexun/XexunProtocolDecoder.java b/src/org/traccar/protocol/XexunProtocolDecoder.java index 46b88f8a3..398b9a257 100644 --- a/src/org/traccar/protocol/xexun/XexunProtocolDecoder.java +++ b/src/org/traccar/protocol/XexunProtocolDecoder.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.traccar.protocol.xexun; +package org.traccar.protocol; import java.util.Calendar; import java.util.GregorianCalendar; 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")); - - } - -} |