diff options
Diffstat (limited to 'test/net/sourceforge')
5 files changed, 34 insertions, 106 deletions
diff --git a/test/net/sourceforge/opentracking/protocol/gl200/Gl200ProtocolDecoderTest.java b/test/net/sourceforge/opentracking/protocol/gl200/Gl200ProtocolDecoderTest.java index 09d7b0b35..53f1eebf8 100644 --- a/test/net/sourceforge/opentracking/protocol/gl200/Gl200ProtocolDecoderTest.java +++ b/test/net/sourceforge/opentracking/protocol/gl200/Gl200ProtocolDecoderTest.java @@ -30,28 +30,12 @@ public class Gl200ProtocolDecoderTest { @Test public void testDecode() throws Exception { - - String testMsg1 = "+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"; - + Gl200ProtocolDecoder decoder = new Gl200ProtocolDecoder(new TestDataManager(), 0); - Position position = (Position) decoder.decode(null, null, testMsg1); - - //Date time = new GregorianCalendar(2003, 1, 1, 1, 2, 3).getTime(); - //assertEquals(time, position.getTime()); - - assertEquals(true, position.getValid()); - - Double latitude = 1.0 + 2.0003 / 60.0; - assertEquals(latitude, position.getLatitude()); - - Double longitude = 1.0 + 2.0003 / 60.0; - assertEquals(longitude, position.getLongitude()); - - Double speed = 1.02; - assertEquals(speed, position.getSpeed()); + + 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")); - Long deviceId = new Long(1); - assertEquals(deviceId, position.getDeviceId()); } } diff --git a/test/net/sourceforge/opentracking/protocol/gps103/Gps103ProtocolDecoderTest.java b/test/net/sourceforge/opentracking/protocol/gps103/Gps103ProtocolDecoderTest.java index 0e99a8637..18fde11a7 100644 --- a/test/net/sourceforge/opentracking/protocol/gps103/Gps103ProtocolDecoderTest.java +++ b/test/net/sourceforge/opentracking/protocol/gps103/Gps103ProtocolDecoderTest.java @@ -30,42 +30,23 @@ public class Gps103ProtocolDecoderTest { @Test public void testDecode() throws Exception { - - Calendar time = new GregorianCalendar(TimeZone.getTimeZone("UTC")); - time.set(Calendar.HOUR, 0); - time.set(Calendar.MINUTE, 1); - time.set(Calendar.SECOND, 2); - time.set(Calendar.MILLISECOND, 3); - String x = time.getTime().toString(); - - String testMsg1 = "##,imei:10000000000000,A"; - // NEW MESSAGE: imei:359587017470280,tracker,0000000000,03184511405,L,; - - String testMsg2 = //"imei:10000000000000,help me,1004171910,,F,010203.000,A,0102.0003,N,00102.0003,E,1.02,"; - //"imei:353451040164707,tracker,1105182344,+36304665439,F,214418.000,A,4804.2222,N,01916.7593,E,0.37,"; - //"imei:353451042861763,tracker,1106132241,, F,144114.000,A,2301.9052,S,04909.3676,W,0.13,"; - "imei:359587010124900,tracker,0809231929,13554900601,F,112909.397,A,2234.4669,N,11354.3287,E,0.11,321.53,;"; - + Gps103ProtocolDecoder decoder = new Gps103ProtocolDecoder(new TestDataManager(), 0); - //assertNull(decoder.decode(null, null, testMsg1)); - Position position = (Position) decoder.decode(null, null, testMsg2); - - //Date time = new GregorianCalendar(2003, 1, 1, 1, 2, 3).getTime(); - //assertEquals(time, position.getTime()); + + // assertNull(decoder.decode(null, null, "##,imei:10000000000000,A")); - assertEquals(true, position.getValid()); + assertNotNull(decoder.decode(null, null, + "imei:10000000000000,help me,1004171910,,F,010203.000,A,0102.0003,N,00102.0003,E,1.02,")); - Double latitude = 1.0 + 2.0003 / 60.0; - assertEquals(latitude, position.getLatitude()); + assertNotNull(decoder.decode(null, null, + "imei:353451040164707,tracker,1105182344,+36304665439,F,214418.000,A,4804.2222,N,01916.7593,E,0.37,")); - Double longitude = 1.0 + 2.0003 / 60.0; - assertEquals(longitude, position.getLongitude()); + assertNotNull(decoder.decode(null, null, + "imei:353451042861763,tracker,1106132241,,F,144114.000,A,2301.9052,S,04909.3676,W,0.13,")); - Double speed = 1.02; - assertEquals(speed, position.getSpeed()); + assertNotNull(decoder.decode(null, null, + "imei:359587010124900,tracker,0809231929,13554900601,F,112909.397,A,2234.4669,N,11354.3287,E,0.11,321.53,;")); - Long deviceId = new Long(1); - assertEquals(deviceId, position.getDeviceId()); } } diff --git a/test/net/sourceforge/opentracking/protocol/t55/T55ProtocolDecoderTest.java b/test/net/sourceforge/opentracking/protocol/t55/T55ProtocolDecoderTest.java index b63f91524..009c94c5c 100644 --- a/test/net/sourceforge/opentracking/protocol/t55/T55ProtocolDecoderTest.java +++ b/test/net/sourceforge/opentracking/protocol/t55/T55ProtocolDecoderTest.java @@ -29,36 +29,17 @@ public class T55ProtocolDecoderTest { @Test public void testDecode() throws Exception { - - String test1 = "$PGID,359853000144328*0F"; - String test2 = "$GPRMC,094907.000,A,6000.5332,N,03020.5192,E,1.17,60.26,091111,,*33"; - //$GPRMC,115528.000,A,6000.5432,N,03020.4948,E,,,091111,,*06 - T55ProtocolDecoder decoder = new T55ProtocolDecoder(new TestDataManager(), 0); - decoder.decode(null, null, test1); - - Position position = (Position) decoder.decode(null, null, test2); - - Date time = new GregorianCalendar(2003, 1, 1, 1, 2, 3).getTime(); - assertEquals(time, position.getTime()); - - assertEquals(true, position.getValid()); - - Double latitude = 1.0 + 2.0003 / 60.0; - assertEquals(latitude, position.getLatitude()); + + assertNull(decoder.decode(null, null, "$PGID,359853000144328*0F")); - Double longitude = 1.0 + 2.0003 / 60.0; - assertEquals(longitude, position.getLongitude()); + assertNotNull(decoder.decode(null, null, + "$GPRMC,094907.000,A,6000.5332,N,03020.5192,E,1.17,60.26,091111,,*33")); - Double speed = 1.02; - assertEquals(speed, position.getSpeed()); + assertNotNull(decoder.decode(null, null, + "$GPRMC,115528.000,A,6000.5432,N,03020.4948,E,,,091111,,*06")); - Double course = 1.02; - assertEquals(course, position.getCourse()); - - Long deviceId = new Long(1); - assertEquals(deviceId, position.getDeviceId()); } } diff --git a/test/net/sourceforge/opentracking/protocol/tk103/Tk103ProtocolDecoderTest.java b/test/net/sourceforge/opentracking/protocol/tk103/Tk103ProtocolDecoderTest.java index e318fe5fb..ba4a97e14 100644 --- a/test/net/sourceforge/opentracking/protocol/tk103/Tk103ProtocolDecoderTest.java +++ b/test/net/sourceforge/opentracking/protocol/tk103/Tk103ProtocolDecoderTest.java @@ -30,12 +30,12 @@ public class Tk103ProtocolDecoderTest { @Test public void testDecode() throws Exception { - - String testMsg1 = "(035988863964BP05000035988863964110524A4241.7977N02318.7561E000.0123536356.5100000000L000946BB"; + Tk103ProtocolDecoder decoder = new Tk103ProtocolDecoder(new TestDataManager(), 0); - Position position = (Position) decoder.decode(null, null, testMsg1); + + assertNotNull(decoder.decode(null, null, + "(035988863964BP05000035988863964110524A4241.7977N02318.7561E000.0123536356.5100000000L000946BB")); - assertEquals(true, position.getValid()); } } diff --git a/test/net/sourceforge/opentracking/protocol/xexun/XexunProtocolDecoderTest.java b/test/net/sourceforge/opentracking/protocol/xexun/XexunProtocolDecoderTest.java index 1f7ad8845..ba374a3ed 100644 --- a/test/net/sourceforge/opentracking/protocol/xexun/XexunProtocolDecoderTest.java +++ b/test/net/sourceforge/opentracking/protocol/xexun/XexunProtocolDecoderTest.java @@ -29,39 +29,21 @@ public class XexunProtocolDecoderTest { @Test public void testDecode() throws Exception { - - String testMsg = - "GPRMC,150120.000,A,3346.4463,S,15057.3083,E,0.0,117.4,010911,,,A*76,F," + - "imei:351525010943661,"; - //"GPRMC,010203.000,A,0102.0003,N,00102.0003,E,1.02,1.02,010203,,,A*00,F,, " + - //"imei:10000000000000,"; - //"GPRMC,233842.000,A,5001.3060,N,01429.3243,E,0.00,,210211,,,A*74,F," + - //"imei:354776030495631,"; - //1103100803,+79629503178, - //"GPRMC,080303.000,A,5546.7313,N,03738.6005,E,0.56,160.13,100311,,,A*6A,L,imei:354778030461167,"; - + XexunProtocolDecoder decoder = new XexunProtocolDecoder(new TestDataManager(), 0); - Position position = (Position) decoder.decode(null, null, testMsg); - Date time = new GregorianCalendar(2003, 1, 1, 1, 2, 3).getTime(); - assertEquals(time, position.getTime()); + 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,")); - assertEquals(true, position.getValid()); + 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,")); - Double latitude = 1.0 + 2.0003 / 60.0; - assertEquals(latitude, position.getLatitude()); + assertNotNull(decoder.decode(null, null, + "GPRMC,233842.000,A,5001.3060,N,01429.3243,E,0.00,,210211,,,A*74,F,imei:354776030495631,")); - Double longitude = 1.0 + 2.0003 / 60.0; - assertEquals(longitude, position.getLongitude()); + 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,")); - Double speed = 1.02; - assertEquals(speed, position.getSpeed()); - - Double course = 1.02; - assertEquals(course, position.getCourse()); - - Long deviceId = new Long(1); - assertEquals(deviceId, position.getDeviceId()); } } |