diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-11-15 18:13:16 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-11-15 18:13:16 +1300 |
commit | 98aeb9261b37dc174c37236292cb2d726937c3d5 (patch) | |
tree | d95d6ca6d60e29b3d5389d55bed22009c0b8752c | |
parent | 12ac6af766b92b4d5cfd53957955e1bed4dcc151 (diff) | |
download | trackermap-server-98aeb9261b37dc174c37236292cb2d726937c3d5.tar.gz trackermap-server-98aeb9261b37dc174c37236292cb2d726937c3d5.tar.bz2 trackermap-server-98aeb9261b37dc174c37236292cb2d726937c3d5.zip |
Make LBS tests even stricter
-rw-r--r-- | src/org/traccar/protocol/TeltonikaProtocolDecoder.java | 2 | ||||
-rw-r--r-- | test/org/traccar/ProtocolDecoderTest.java | 9 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java index 3592cae79..2217b5ce4 100644 --- a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java +++ b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java @@ -114,7 +114,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder { } if (BitUtil.check(locationMask, 5)) { - position.set("area", buf.readUnsignedShort()); + position.set(Event.KEY_LAC, buf.readUnsignedShort()); position.set(Event.KEY_CID, buf.readUnsignedShort()); } diff --git a/test/org/traccar/ProtocolDecoderTest.java b/test/org/traccar/ProtocolDecoderTest.java index ef98b3467..8f7ed628b 100644 --- a/test/org/traccar/ProtocolDecoderTest.java +++ b/test/org/traccar/ProtocolDecoderTest.java @@ -187,11 +187,16 @@ public class ProtocolDecoderTest { Assert.assertFalse("no attributes", attributes.isEmpty()); } + if (attributes.containsKey(Event.KEY_LAC) || attributes.containsKey(Event.KEY_CID)) { + checkInteger(attributes.get(Event.KEY_LAC), 1, 65535); + checkInteger(attributes.get(Event.KEY_CID), 1, 268435455); + } + if (attributes.containsKey(Event.KEY_MCC) || attributes.containsKey(Event.KEY_MNC)) { checkInteger(attributes.get(Event.KEY_MCC), 100, 999); checkInteger(attributes.get(Event.KEY_MNC), 0, 999); - checkInteger(attributes.get(Event.KEY_LAC), 1, 65535); - checkInteger(attributes.get(Event.KEY_CID), 1, 268435455); + Assert.assertTrue("value missing", attributes.containsKey(Event.KEY_LAC)); + Assert.assertTrue("value missing", attributes.containsKey(Event.KEY_CID)); } } |