From 87392d9fbb0289b5486496b6e6b97db1ea84e2b7 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Mon, 4 Sep 2017 18:01:43 +0500 Subject: Accept timezone id instead of offset in commands --- test/org/traccar/protocol/CityeasyProtocolEncoderTest.java | 4 ++-- test/org/traccar/protocol/Jt600ProtocolEncoderTest.java | 2 +- test/org/traccar/protocol/MeiligaoProtocolEncoderTest.java | 4 ++-- test/org/traccar/protocol/MiniFinderProtocolEncoderTest.java | 6 +++--- test/org/traccar/protocol/Pt502ProtocolEncoderTest.java | 2 +- test/org/traccar/protocol/WatchProtocolEncoderTest.java | 8 ++++---- 6 files changed, 13 insertions(+), 13 deletions(-) (limited to 'test/org') diff --git a/test/org/traccar/protocol/CityeasyProtocolEncoderTest.java b/test/org/traccar/protocol/CityeasyProtocolEncoderTest.java index 96b3c2b74..7c03b7d5b 100644 --- a/test/org/traccar/protocol/CityeasyProtocolEncoderTest.java +++ b/test/org/traccar/protocol/CityeasyProtocolEncoderTest.java @@ -10,11 +10,11 @@ public class CityeasyProtocolEncoderTest extends ProtocolTest { public void testEncode() throws Exception { CityeasyProtocolEncoder encoder = new CityeasyProtocolEncoder(); - + Command command = new Command(); command.setDeviceId(1); command.setType(Command.TYPE_SET_TIMEZONE); - command.set(Command.KEY_TIMEZONE, 6 * 3600); + command.set(Command.KEY_TIMEZONE, "GMT+6"); verifyCommand(encoder, command, binary("5353001100080001680000000B60820D0A")); diff --git a/test/org/traccar/protocol/Jt600ProtocolEncoderTest.java b/test/org/traccar/protocol/Jt600ProtocolEncoderTest.java index 80802dc35..100d7492a 100644 --- a/test/org/traccar/protocol/Jt600ProtocolEncoderTest.java +++ b/test/org/traccar/protocol/Jt600ProtocolEncoderTest.java @@ -25,7 +25,7 @@ public class Jt600ProtocolEncoderTest extends ProtocolTest { @Test public void testSetTimezone() throws Exception { command.setType(Command.TYPE_SET_TIMEZONE); - command.set(Command.KEY_TIMEZONE, 240 * 60); + command.set(Command.KEY_TIMEZONE, "GMT+4"); assertEquals("(S09,1,240)", encoder.encodeCommand(command)); } diff --git a/test/org/traccar/protocol/MeiligaoProtocolEncoderTest.java b/test/org/traccar/protocol/MeiligaoProtocolEncoderTest.java index f9d77f8a6..ee4a869f9 100644 --- a/test/org/traccar/protocol/MeiligaoProtocolEncoderTest.java +++ b/test/org/traccar/protocol/MeiligaoProtocolEncoderTest.java @@ -10,7 +10,7 @@ public class MeiligaoProtocolEncoderTest extends ProtocolTest { public void testEncode() throws Exception { MeiligaoProtocolEncoder encoder = new MeiligaoProtocolEncoder(); - + Command command = new Command(); command.setDeviceId(1); command.setType(Command.TYPE_POSITION_SINGLE); @@ -23,7 +23,7 @@ public class MeiligaoProtocolEncoderTest extends ProtocolTest { verifyCommand(encoder, command, binary("40400013123456789012344102000a2f4f0d0a")); command.setType(Command.TYPE_SET_TIMEZONE); - command.set(Command.KEY_TIMEZONE, 480 * 60); + command.set(Command.KEY_TIMEZONE, "GMT+8"); verifyCommand(encoder, command, binary("4040001412345678901234413234383030ad0d0a")); diff --git a/test/org/traccar/protocol/MiniFinderProtocolEncoderTest.java b/test/org/traccar/protocol/MiniFinderProtocolEncoderTest.java index 99b250ebc..360ea0008 100644 --- a/test/org/traccar/protocol/MiniFinderProtocolEncoderTest.java +++ b/test/org/traccar/protocol/MiniFinderProtocolEncoderTest.java @@ -11,12 +11,12 @@ public class MiniFinderProtocolEncoderTest extends ProtocolTest { public void testEncode() throws Exception { MiniFinderProtocolEncoder encoder = new MiniFinderProtocolEncoder(); - + Command command = new Command(); command.setDeviceId(1); command.setType(Command.TYPE_SET_TIMEZONE); - command.set(Command.KEY_TIMEZONE, 3600); - + command.set(Command.KEY_TIMEZONE, "GMT+1"); + Assert.assertEquals("123456L+01", encoder.encodeCommand(command)); command = new Command(); diff --git a/test/org/traccar/protocol/Pt502ProtocolEncoderTest.java b/test/org/traccar/protocol/Pt502ProtocolEncoderTest.java index ab6446010..62406d3f2 100644 --- a/test/org/traccar/protocol/Pt502ProtocolEncoderTest.java +++ b/test/org/traccar/protocol/Pt502ProtocolEncoderTest.java @@ -30,7 +30,7 @@ public class Pt502ProtocolEncoderTest extends ProtocolTest { Command command = new Command(); command.setDeviceId(1); command.setType(Command.TYPE_SET_TIMEZONE); - command.set(Command.KEY_TIMEZONE, 8); + command.set(Command.KEY_TIMEZONE, "GMT+8"); Assert.assertEquals("#TMZ8\r\n", encoder.encodeCommand(command)); diff --git a/test/org/traccar/protocol/WatchProtocolEncoderTest.java b/test/org/traccar/protocol/WatchProtocolEncoderTest.java index 7184d278e..cffe373cf 100644 --- a/test/org/traccar/protocol/WatchProtocolEncoderTest.java +++ b/test/org/traccar/protocol/WatchProtocolEncoderTest.java @@ -41,16 +41,16 @@ public class WatchProtocolEncoderTest extends ProtocolTest { command = new Command(); command.setDeviceId(1); command.setType(Command.TYPE_SET_TIMEZONE); - command.set(Command.KEY_TIMEZONE, 60 * 60); + command.set(Command.KEY_TIMEZONE, "Europe/Amsterdam"); Assert.assertEquals("[CS*123456789012345*0006*LZ,,+1]", encoder.encodeCommand(command)); - command.set(Command.KEY_TIMEZONE, 90 * 60); + command.set(Command.KEY_TIMEZONE, "GMT+01:30"); Assert.assertEquals("[CS*123456789012345*0008*LZ,,+1.5]", encoder.encodeCommand(command)); - command.set(Command.KEY_TIMEZONE, -60 * 60); + command.set(Command.KEY_TIMEZONE, "Atlantic/Azores"); Assert.assertEquals("[CS*123456789012345*0006*LZ,,-1]", encoder.encodeCommand(command)); - command.set(Command.KEY_TIMEZONE, -11 * 60 * 60 - 30 * 60); + command.set(Command.KEY_TIMEZONE, "GMT-11:30"); Assert.assertEquals("[CS*123456789012345*0009*LZ,,-11.5]", encoder.encodeCommand(command)); } -- cgit v1.2.3