From 142734931830f117b0e86dfa5f6dddec5416d878 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 31 Aug 2015 16:36:04 +1200 Subject: Implement KHD protocol commands --- .../protocol/Gps103ProtocolEncoderTest.java | 2 +- .../traccar/protocol/Gt06ProtocolEncoderTest.java | 2 +- .../traccar/protocol/KhdProtocolEncoderTest.java | 25 ++++++++++++++++++++++ .../traccar/protocol/TotemProtocolEncoderTest.java | 2 +- 4 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 test/org/traccar/protocol/KhdProtocolEncoderTest.java (limited to 'test/org') diff --git a/test/org/traccar/protocol/Gps103ProtocolEncoderTest.java b/test/org/traccar/protocol/Gps103ProtocolEncoderTest.java index bf8c06232..019c92523 100644 --- a/test/org/traccar/protocol/Gps103ProtocolEncoderTest.java +++ b/test/org/traccar/protocol/Gps103ProtocolEncoderTest.java @@ -7,7 +7,7 @@ import org.traccar.model.Command; public class Gps103ProtocolEncoderTest { @Test - public void testDecode() throws Exception { + public void testEncode() throws Exception { Gps103ProtocolEncoder encoder = new Gps103ProtocolEncoder(); diff --git a/test/org/traccar/protocol/Gt06ProtocolEncoderTest.java b/test/org/traccar/protocol/Gt06ProtocolEncoderTest.java index a24045584..0a79bfca7 100644 --- a/test/org/traccar/protocol/Gt06ProtocolEncoderTest.java +++ b/test/org/traccar/protocol/Gt06ProtocolEncoderTest.java @@ -9,7 +9,7 @@ import org.traccar.model.Command; public class Gt06ProtocolEncoderTest { @Test - public void testDecode() throws Exception { + public void testEncode() throws Exception { Gt06ProtocolEncoder encoder = new Gt06ProtocolEncoder(); diff --git a/test/org/traccar/protocol/KhdProtocolEncoderTest.java b/test/org/traccar/protocol/KhdProtocolEncoderTest.java new file mode 100644 index 000000000..ec620aa60 --- /dev/null +++ b/test/org/traccar/protocol/KhdProtocolEncoderTest.java @@ -0,0 +1,25 @@ +package org.traccar.protocol; + +import org.jboss.netty.buffer.ChannelBuffers; +import org.junit.Assert; +import org.junit.Test; +import org.traccar.helper.ChannelBufferTools; +import org.traccar.model.Command; + +public class KhdProtocolEncoderTest { + + @Test + public void testEncode() throws Exception { + + KhdProtocolEncoder encoder = new KhdProtocolEncoder(); + + Command command = new Command(); + command.setDeviceId(1); + command.setType(Command.TYPE_ENGINE_STOP); + + Assert.assertEquals(encoder.encodeCommand(command), ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "2929390006000000003F0D"))); + + } + +} diff --git a/test/org/traccar/protocol/TotemProtocolEncoderTest.java b/test/org/traccar/protocol/TotemProtocolEncoderTest.java index 840165070..e228ca5a5 100644 --- a/test/org/traccar/protocol/TotemProtocolEncoderTest.java +++ b/test/org/traccar/protocol/TotemProtocolEncoderTest.java @@ -21,7 +21,7 @@ import org.traccar.model.Command; public class TotemProtocolEncoderTest { @Test - public void testDecode() throws Exception { + public void testEncode() throws Exception { TotemProtocolEncoder encoder = new TotemProtocolEncoder(); -- cgit v1.2.3