From e5a8be1987aecf3735801165ee19c1bcdd4fcc05 Mon Sep 17 00:00:00 2001 From: Valerii Vyshniak Date: Wed, 22 Nov 2017 02:05:59 +0100 Subject: T580W: review comments fixes 3, re-implemented tk103 frame decoder --- test/org/traccar/BaseTest.java | 2 +- test/org/traccar/FilterHandlerTest.java | 2 +- .../traccar/protocol/Tk103ProtocolDecoderTest.java | 1 - .../traccar/protocol/Tk103ProtocolEncoderTest.java | 32 ++++------------------ 4 files changed, 8 insertions(+), 29 deletions(-) (limited to 'test/org') diff --git a/test/org/traccar/BaseTest.java b/test/org/traccar/BaseTest.java index 87ff3842c..4b9ee5451 100644 --- a/test/org/traccar/BaseTest.java +++ b/test/org/traccar/BaseTest.java @@ -40,7 +40,7 @@ public class BaseTest { @Override public boolean lookupAttributeBoolean( long deviceId, String attributeName, boolean defaultValue, boolean lookupConfig) { - return (deviceId == 2 && attributeName == "tk103.alternative" && lookupConfig) ? true : defaultValue; + return defaultValue; } @Override diff --git a/test/org/traccar/FilterHandlerTest.java b/test/org/traccar/FilterHandlerTest.java index e896aa450..7ebab3af5 100644 --- a/test/org/traccar/FilterHandlerTest.java +++ b/test/org/traccar/FilterHandlerTest.java @@ -48,7 +48,7 @@ public class FilterHandlerTest { @Override public boolean lookupAttributeBoolean( long deviceId, String attributeName, boolean defaultValue, boolean lookupConfig) { - return (deviceId == 2 && attributeName == "tk103.alternative" && lookupConfig) ? true : defaultValue; + return defaultValue; } @Override diff --git a/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java b/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java index 74edd10ab..0ceb3404e 100644 --- a/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java @@ -159,7 +159,6 @@ public class Tk103ProtocolDecoderTest extends ProtocolTest { verifyPosition(decoder, text( "(094050000111BP05000094050000111150808A3804.2418N04616.7468E000.0201447133.3501000011L0028019DT000)")); - //T580W verifyPosition(decoder, text( "(864555555555555,DW3B,131117,A,5544.02870N,01315.08194E,1.597,223707,291.65,-0.10,4)")); diff --git a/test/org/traccar/protocol/Tk103ProtocolEncoderTest.java b/test/org/traccar/protocol/Tk103ProtocolEncoderTest.java index f902268ce..0c16ccee6 100644 --- a/test/org/traccar/protocol/Tk103ProtocolEncoderTest.java +++ b/test/org/traccar/protocol/Tk103ProtocolEncoderTest.java @@ -31,10 +31,6 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest { Assert.assertEquals("(123456789012345AP00)", encoder.encodeCommand(command)); - command.setDeviceId(2); - - Assert.assertEquals("[begin]sms2,*getposl*,[end]", encoder.encodeCommand(command)); - } @Test @@ -49,10 +45,6 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest { Assert.assertEquals("(123456789012345AR00003C0000)", encoder.encodeCommand(command)); - command.setDeviceId(2); - - Assert.assertEquals("[begin]sms2,*routetrack*99*,[end]", encoder.encodeCommand(command)); - } @Test @@ -66,10 +58,6 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest { Assert.assertEquals("(123456789012345AR0000000000)", encoder.encodeCommand(command)); - command.setDeviceId(2); - - Assert.assertEquals("[begin]sms2,*routetrackoff*,[end]", encoder.encodeCommand(command)); - } @Test @@ -83,10 +71,6 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest { Assert.assertEquals("(123456789012345AP07)", encoder.encodeCommand(command)); - command.setDeviceId(2); - - Assert.assertEquals("[begin]sms2,*about*,[end]", encoder.encodeCommand(command)); - } @Test @@ -100,10 +84,6 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest { Assert.assertEquals("(123456789012345AT00)", encoder.encodeCommand(command)); - command.setDeviceId(2); - - Assert.assertEquals("[begin]sms2,88888888,[end]", encoder.encodeCommand(command)); - } @Test @@ -125,7 +105,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest { Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(); Command command = new Command(); - command.setDeviceId(2); + command.setDeviceId(1); command.setType(Command.TYPE_IDENTIFICATION); Assert.assertEquals("[begin]sms2,999999,[end]", encoder.encodeCommand(command)); @@ -138,7 +118,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest { Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(); Command command = new Command(); - command.setDeviceId(2); + command.setDeviceId(1); command.setType(Command.TYPE_ALARM_SOS); command.set(Command.KEY_ENABLE, true); @@ -152,7 +132,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest { Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(); Command command = new Command(); - command.setDeviceId(2); + command.setDeviceId(1); command.setType(Command.TYPE_ALARM_SOS); command.set(Command.KEY_ENABLE, false); @@ -166,7 +146,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest { Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(); Command command = new Command(); - command.setDeviceId(2); + command.setDeviceId(1); command.setType(Command.TYPE_CUSTOM); command.set(Command.KEY_DATA, "any text is ok"); @@ -180,7 +160,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest { Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(); Command command = new Command(); - command.setDeviceId(2); + command.setDeviceId(1); command.setType(Command.TYPE_SET_CONNECTION); command.set(Command.KEY_SERVER, "1.2.3.4"); command.set(Command.KEY_PORT, "5555"); @@ -195,7 +175,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest { Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(); Command command = new Command(); - command.setDeviceId(2); + command.setDeviceId(1); command.setType(Command.TYPE_SOS_NUMBER); command.set(Command.KEY_INDEX, "0"); command.set(Command.KEY_PHONE, "+55555555555"); -- cgit v1.2.3