aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar/protocol/Tk103ProtocolEncoderTest.java
diff options
context:
space:
mode:
authorChristoph Krey <c@ckrey.de>2018-04-16 10:45:11 +0200
committerGitHub <noreply@github.com>2018-04-16 10:45:11 +0200
commit3a602dd133b533cc69d5986d64a00fb3ed670f75 (patch)
tree97ff753db310a49ae7e53240b1db07fb8475679e /test/org/traccar/protocol/Tk103ProtocolEncoderTest.java
parent232de5f0daef98f31b28d177d991fdbfa191f195 (diff)
parent6d4b8df25c7e942b9ad594db9444fe15bcb16be9 (diff)
downloadtrackermap-server-3a602dd133b533cc69d5986d64a00fb3ed670f75.tar.gz
trackermap-server-3a602dd133b533cc69d5986d64a00fb3ed670f75.tar.bz2
trackermap-server-3a602dd133b533cc69d5986d64a00fb3ed670f75.zip
Merge pull request #4 from traccar/master
upgrade to current master
Diffstat (limited to 'test/org/traccar/protocol/Tk103ProtocolEncoderTest.java')
-rw-r--r--test/org/traccar/protocol/Tk103ProtocolEncoderTest.java55
1 files changed, 34 insertions, 21 deletions
diff --git a/test/org/traccar/protocol/Tk103ProtocolEncoderTest.java b/test/org/traccar/protocol/Tk103ProtocolEncoderTest.java
index 7e04dcb81..25968a0fe 100644
--- a/test/org/traccar/protocol/Tk103ProtocolEncoderTest.java
+++ b/test/org/traccar/protocol/Tk103ProtocolEncoderTest.java
@@ -1,15 +1,28 @@
package org.traccar.protocol;
-import org.junit.Assert;
import org.junit.Test;
import org.traccar.ProtocolTest;
-import org.traccar.TestIdentityManager;
import org.traccar.model.Command;
-import org.traccar.model.Device;
+
+import static org.junit.Assert.assertEquals;
public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
+ public void testEncodeOutputControl() {
+
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder();
+
+ Command command = new Command();
+ command.setDeviceId(1);
+ command.setType(Command.TYPE_OUTPUT_CONTROL);
+ command.set(Command.KEY_DATA, "1");
+
+ assertEquals("(123456789012345AV001)", encoder.encodeCommand(command));
+
+ }
+
+ @Test
public void testEncodeEngineStop() throws Exception {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder();
@@ -18,7 +31,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
command.setDeviceId(1);
command.setType(Command.TYPE_ENGINE_STOP);
- Assert.assertEquals("(123456789012345AV010)", encoder.encodeCommand(command));
+ assertEquals("(123456789012345AV010)", encoder.encodeCommand(command));
}
@@ -31,7 +44,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
command.setDeviceId(1);
command.setType(Command.TYPE_POSITION_SINGLE);
- Assert.assertEquals("(123456789012345AP00)", encoder.encodeCommand(command));
+ assertEquals("(123456789012345AP00)", encoder.encodeCommand(command));
}
@@ -45,7 +58,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
command.setType(Command.TYPE_POSITION_PERIODIC);
command.set(Command.KEY_FREQUENCY, 60);
- Assert.assertEquals("(123456789012345AR00003C0000)", encoder.encodeCommand(command));
+ assertEquals("(123456789012345AR00003C0000)", encoder.encodeCommand(command));
}
@@ -58,7 +71,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
command.setDeviceId(1);
command.setType(Command.TYPE_POSITION_STOP);
- Assert.assertEquals("(123456789012345AR0000000000)", encoder.encodeCommand(command));
+ assertEquals("(123456789012345AR0000000000)", encoder.encodeCommand(command));
}
@@ -71,7 +84,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
command.setDeviceId(1);
command.setType(Command.TYPE_GET_VERSION);
- Assert.assertEquals("(123456789012345AP07)", encoder.encodeCommand(command));
+ assertEquals("(123456789012345AP07)", encoder.encodeCommand(command));
}
@@ -84,7 +97,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
command.setDeviceId(1);
command.setType(Command.TYPE_REBOOT_DEVICE);
- Assert.assertEquals("(123456789012345AT00)", encoder.encodeCommand(command));
+ assertEquals("(123456789012345AT00)", encoder.encodeCommand(command));
}
@@ -97,7 +110,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
command.setDeviceId(1);
command.setType(Command.TYPE_SET_ODOMETER);
- Assert.assertEquals("(123456789012345AX01)", encoder.encodeCommand(command));
+ assertEquals("(123456789012345AX01)", encoder.encodeCommand(command));
}
@@ -110,7 +123,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
command.setDeviceId(1);
command.setType(Command.TYPE_POSITION_SINGLE);
- Assert.assertEquals("[begin]sms2,*getposl*,[end]", encoder.encodeCommand(command));
+ assertEquals("[begin]sms2,*getposl*,[end]", encoder.encodeCommand(command));
}
@@ -123,7 +136,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
command.setDeviceId(1);
command.setType(Command.TYPE_POSITION_PERIODIC);
- Assert.assertEquals("[begin]sms2,*routetrack*99*,[end]", encoder.encodeCommand(command));
+ assertEquals("[begin]sms2,*routetrack*99*,[end]", encoder.encodeCommand(command));
}
@@ -136,7 +149,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
command.setDeviceId(1);
command.setType(Command.TYPE_POSITION_STOP);
- Assert.assertEquals("[begin]sms2,*routetrackoff*,[end]", encoder.encodeCommand(command));
+ assertEquals("[begin]sms2,*routetrackoff*,[end]", encoder.encodeCommand(command));
}
@@ -149,7 +162,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
command.setDeviceId(1);
command.setType(Command.TYPE_GET_VERSION);
- Assert.assertEquals("[begin]sms2,*about*,[end]", encoder.encodeCommand(command));
+ assertEquals("[begin]sms2,*about*,[end]", encoder.encodeCommand(command));
}
@@ -162,7 +175,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
command.setDeviceId(1);
command.setType(Command.TYPE_REBOOT_DEVICE);
- Assert.assertEquals("[begin]sms2,88888888,[end]", encoder.encodeCommand(command));
+ assertEquals("[begin]sms2,88888888,[end]", encoder.encodeCommand(command));
}
@@ -175,7 +188,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
command.setDeviceId(1);
command.setType(Command.TYPE_IDENTIFICATION);
- Assert.assertEquals("[begin]sms2,999999,[end]", encoder.encodeCommand(command));
+ assertEquals("[begin]sms2,999999,[end]", encoder.encodeCommand(command));
}
@@ -189,7 +202,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
command.setType(Command.TYPE_ALARM_SOS);
command.set(Command.KEY_ENABLE, true);
- Assert.assertEquals("[begin]sms2,*soson*,[end]", encoder.encodeCommand(command));
+ assertEquals("[begin]sms2,*soson*,[end]", encoder.encodeCommand(command));
}
@@ -203,7 +216,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
command.setType(Command.TYPE_ALARM_SOS);
command.set(Command.KEY_ENABLE, false);
- Assert.assertEquals("[begin]sms2,*sosoff*,[end]", encoder.encodeCommand(command));
+ assertEquals("[begin]sms2,*sosoff*,[end]", encoder.encodeCommand(command));
}
@@ -217,7 +230,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
command.setType(Command.TYPE_CUSTOM);
command.set(Command.KEY_DATA, "any text is ok");
- Assert.assertEquals("[begin]sms2,any text is ok,[end]", encoder.encodeCommand(command));
+ assertEquals("[begin]sms2,any text is ok,[end]", encoder.encodeCommand(command));
}
@@ -232,7 +245,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
command.set(Command.KEY_SERVER, "1.2.3.4");
command.set(Command.KEY_PORT, "5555");
- Assert.assertEquals("[begin]sms2,*setip*1*2*3*4*5555*,[end]", encoder.encodeCommand(command));
+ assertEquals("[begin]sms2,*setip*1*2*3*4*5555*,[end]", encoder.encodeCommand(command));
}
@@ -248,7 +261,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
command.set(Command.KEY_PHONE, "+55555555555");
command.set(Command.KEY_DEVICE_PASSWORD, "232323");
- Assert.assertEquals("[begin]sms2,*master*232323*+55555555555*,[end]", encoder.encodeCommand(command));
+ assertEquals("[begin]sms2,*master*232323*+55555555555*,[end]", encoder.encodeCommand(command));
}