From b368eda2a2673fceb304efd4a64f36ca7e5b7b9e Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 8 Jul 2017 15:37:30 +1200 Subject: Add more integration tests --- .../traccar/protocol/CarcellProtocolDecoder.java | 5 ++-- .../traccar/protocol/RaveonProtocolDecoder.java | 6 ++-- tools/test-integration.py | 34 ++++++++++++++++++++-- 3 files changed, 37 insertions(+), 8 deletions(-) diff --git a/src/org/traccar/protocol/CarcellProtocolDecoder.java b/src/org/traccar/protocol/CarcellProtocolDecoder.java index fedc65168..fc5710f09 100644 --- a/src/org/traccar/protocol/CarcellProtocolDecoder.java +++ b/src/org/traccar/protocol/CarcellProtocolDecoder.java @@ -47,7 +47,7 @@ public class CarcellProtocolDecoder extends BaseProtocolDecoder { .number("(d+),") // speed .number("(d+),") // course .groupBegin() - .number("([-+]ddd)([-+]ddd)([-+]ddd),") // x,y,z + .number("([-+]ddd)([-+]ddd)([-+]ddd),") // x,y,z .or() .number("(d+),") // accel .groupEnd() @@ -55,7 +55,7 @@ public class CarcellProtocolDecoder extends BaseProtocolDecoder { .number("(d+),") // csq .number("(d),") // jamming .number("(d+),") // hdop - .expression("([CG]),?") // clock type + .expression("([CG]),?") // clock type .number("(dd)(dd)(dd),") // date (ddmmyy) .number("(dd)(dd)(dd),") // time (hhmmss) .number("(d),") // block @@ -81,7 +81,6 @@ public class CarcellProtocolDecoder extends BaseProtocolDecoder { Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { Parser parser = new Parser(PATTERN, (String) msg); - if (!parser.matches()) { return null; } diff --git a/src/org/traccar/protocol/RaveonProtocolDecoder.java b/src/org/traccar/protocol/RaveonProtocolDecoder.java index 75027246e..cbe6026a2 100644 --- a/src/org/traccar/protocol/RaveonProtocolDecoder.java +++ b/src/org/traccar/protocol/RaveonProtocolDecoder.java @@ -63,13 +63,13 @@ public class RaveonProtocolDecoder extends BaseProtocolDecoder { return null; } - Position position = new Position(); - position.setProtocol(getProtocolName()); - DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, parser.next()); if (deviceSession == null) { return null; } + + Position position = new Position(); + position.setProtocol(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); position.setLatitude(parser.nextCoordinate(Parser.CoordinateFormat.HEM_DEG_MIN)); diff --git a/tools/test-integration.py b/tools/test-integration.py index c3885095f..d91ec8806 100755 --- a/tools/test-integration.py +++ b/tools/test-integration.py @@ -60,7 +60,35 @@ messages = { 'mtx' : '#MTX,123456789012345,20101226,195550,41.6296399,002.3611174,000,035,000000.00,X,X,1111,000,0,0\r\n', 'aquila' : '$$SRINI_1MS,123456,1,12.963515,77.533844,150925161628,A,27,0,8,0,68,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,*43\r\n', 'flextrack' : '-1,LOGON,123456,8945000000\r-2,UNITSTAT,20060101,123442,1080424008,N0.00.0000,E0.00.0000,0,0,0,4129,-61,2,23866,0,999,A214,63,2EE2,3471676\r', - 'watch' : '[SG*123456*0087*UD,220414,134652,A,22.571707,N,113.8613968,E,0.1,0.0,100,7,60,90,1000,50,0000,4,1,460,0,9360,4082,131,9360,4092,148,9360,4091,143,9360,4153,141]' + 'watch' : '[3G*1234567890*00FD*UD,160617,120759,V,18.917990,S,47.5450083,E,0.00,0.0,0.0,0,87,1,0,0,00000011,7,255,646,2,81,11552,140,81,10281,127,81,10602,127,81,11553,126,81,10284,121,81,11122,119,81,10662,119,2,NETGEAR20,44:94:fc:43:5b:78,-47,TP-LINK_7650,98:de:d0:46:76:50,-88,46.5]', + 'upro' : '*AI2001234567890,BA&A2003064913201201845107561627121016&B0100000000&C05>8=961&F0333&K023101002154A7#', + 'auro' : 'M0030T0000816398975I123456789012345E00001W*****110620150441000068DA#RD01DA240000000000+100408391+013756125100620152140102362238320034400\r\n', + 'disha' : '$A#A#123456789012345#A#053523#010216#2232.7733#N#08821.1940#E#002.75#038.1#09#00.8#1800#0#000#0000#9999#11.7#285.7#0001*\r\n', + 'arnavi' : '$AV,V3,123456,12487,2277,203,65534,0,0,193,65535,65535,65535,65535,1,13,200741,5950.6773N,03029.1043E,300.0,360.0,121012,65535,65535,65535,SF*6E\r\n', + 'kenji' : '>C123456,M005004,O0000,I0002,D124057,A,S3137.2783,W05830.2978,T000.0,H254.3,Y240116,G06*17\r\n', + 'fox' : '', + 'gnx' : '$GNX_DIO,123456789012345,110,1,155627,121214,151244,121214,1,08.878321,N,076.643154,E,0,0,0,0,0,0,GNX01001,B1*\n\r', + 'arknav' : '123456789012345,05*850,000,L001,A,2459.3640,N,12125.2958,E,000.0,224.8,00.8,07:47:26 09-09-05,9.00,D3,0,C4,1,,,,\r', + 'supermate' : '2:123456789012345:1:*,00000000,XT,A,10031b,140b28,80ad4c72,81ba2d2c,06ab,238c,020204010000,12,0,0000,0003e6#', + 'appello' : 'FOLLOWIT,123456789012345,160211221959,-12.112660,-77.045258,1,0,6,116,F,716,17,4E85,050C,29,,4.22,,39,999/00/00,,,,,,46206,\r\n', + 'idpl' : '*ID1,123456789012345,210314,162752,A,1831.4412,N,07351.0983,E,0.04,213.84,9,25,A,1,4.20,0,1,01,1,0,0,A01,L,EA01#\r\n', + 'hunterpro' : '>1234<$GPRMC,170559.000,A,0328.3045,N,07630.0735,W,0.73,266.16,200816,,,A77, s000078015180",0MD\r', + 'raveon' : '$PRAVE,1234,0001,3308.9051,-11713.1164,195348,1,10,168,31,13.3,3,-83,0,0,,1003.4*66\r\n', + 'cradlepoint' : '123456789012,162658,4337.174385,N,11612.338373,W,0.0,,Verizon,,-71,-44,-11,,\r\n', + 'arknavx8' : '123456789012345,241111;1R,110509053244,A,2457.9141N,12126.3321E,220.0,315,10.0,00000000;', + 'autograde' : '(000000007322123456789012345170415A1001.1971N07618.1375E0.000145312128.59?A0024B0024C0000D0000E0000K0000L0000M0000N0000O0000)', + 'cguard' : 'IDRO:123456789012345\r\nNV:170409 031456:56.808553:60.595476:0:NAN:0\r\n', + 'fifotrack' : '$$105,123456789012345,AB,A00,,161007085534,A,54.738791,25.271918,0,350,151,0,17929,0000,0,,246|1|65|96DB,936|0*0B\r\n', + 'extremtrac' : '$GPRMC,123456789012345,050859.000,A,1404.8573,N,08710.9967,W,0.00,0,080117,0,,00C8,00218,99,,,,,,0.00\r\n', + 'trakmate' : '^TMSRT|123456789012345|12.59675|77.56789|123456|030414|1.03|1.01|#', + 'maestro' : '@123456789012345,601,UPV-02,0,13.4,10,0,0,16/11/04,17:21:14,0.352793,32.647927,0,0,0,0,99,0.000,0!\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', + 'gt30' : '$$005D1234567890 9955102834.000,A,3802.8629,N,02349.7163,E,0.00,,060117,,*13|1.3|26225BD\r\n', + 'tmg' : '$nor,L,123456789012345,24062015,094459,4,2826.1956,N,07659.7690,E,67.5,2.5,167,0.82,15,22,airtel,31,4441,1,4.1,12.7,00000011,00000011,1111,0.0,0.0,21.3,SW00.01,#\r\n', + 'pretrace' : '(123456789012345U1110A1701201500102238.1700N11401.9324E000264000000000009001790000000,&P11A4,F1050^47)', + 'siwi' : '$SIWI,1234,1320,A,0,,1,1,0,0,876578,43,10,A,19.0123456,72.65347,45,0,055929,071107,22,5,1,0,3700,1210,0,2500,1230,321,0,1.1,4.0,1!\r\n', + 'starlink' : '$SLU123456,06,622,170329035057,01,170329035057,+3158.0018,+03446.6968,004.9,007,000099,1,1,0,0,0,0,0,0,,,14.176,03.826,,1,1,1,4*B0\r\n', + 'alematics' : '$T,50,592,123456789012345,20170515062915,20170515062915,25.035005,121.561555,0,31,89,3.7,5,1,0,0.000,12.752,1629,38,12752,4203,6\r\n', + 'vtfms' : '(123456789012345,00I76,00,000,,,,,A,133755,210617,10.57354,077.24912,SW,000,00598,00000,K,0017368,1,12.7,,,0.000,,,0,0,0,0,1,1,0,,)074' } baseUrl = 'http://localhost:8082' @@ -135,7 +163,9 @@ remove_devices(cookie) devices = { '123456789012345' : add_device(cookie, '123456789012345'), '123456789012' : add_device(cookie, '123456789012'), - '123456' : add_device(cookie, '123456') + '1234567890' : add_device(cookie, '1234567890'), + '123456' : add_device(cookie, '123456'), + '1234' : add_device(cookie, '1234') } -- cgit v1.2.3