aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-26 13:11:19 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-26 13:11:19 +1300
commit3e56ea6a99e7da5d61c5956876c2d977268e4756 (patch)
treef70f61b1ec218e4491d36c10d5fbd52a67ba4862 /test/org/traccar/protocol
parentfbdd359d223579173b4e0076563df296f5492e3c (diff)
downloadtraccar-server-3e56ea6a99e7da5d61c5956876c2d977268e4756.tar.gz
traccar-server-3e56ea6a99e7da5d61c5956876c2d977268e4756.tar.bz2
traccar-server-3e56ea6a99e7da5d61c5956876c2d977268e4756.zip
Use standard Java hex conversion
Diffstat (limited to 'test/org/traccar/protocol')
-rw-r--r--test/org/traccar/protocol/CityeasyProtocolEncoderTest.java6
-rw-r--r--test/org/traccar/protocol/Gt06ProtocolEncoderTest.java6
-rw-r--r--test/org/traccar/protocol/KhdProtocolEncoderTest.java6
-rw-r--r--test/org/traccar/protocol/SkypatrolProtocolDecoderTest.java2
-rw-r--r--test/org/traccar/protocol/XexunFrameDecoderTest.java2
5 files changed, 14 insertions, 8 deletions
diff --git a/test/org/traccar/protocol/CityeasyProtocolEncoderTest.java b/test/org/traccar/protocol/CityeasyProtocolEncoderTest.java
index e2bfbb19a..19efb7af4 100644
--- a/test/org/traccar/protocol/CityeasyProtocolEncoderTest.java
+++ b/test/org/traccar/protocol/CityeasyProtocolEncoderTest.java
@@ -6,6 +6,8 @@ import org.junit.Test;
import org.traccar.helper.ChannelBufferTools;
import org.traccar.model.Command;
+import javax.xml.bind.DatatypeConverter;
+
public class CityeasyProtocolEncoderTest {
@Test
@@ -18,8 +20,8 @@ public class CityeasyProtocolEncoderTest {
command.setType(Command.TYPE_SET_TIMEZONE);
command.set(Command.KEY_TIMEZONE, 6 * 3600);
- Assert.assertEquals(encoder.encodeCommand(command), ChannelBuffers.wrappedBuffer(ChannelBufferTools.hexToBytes(
- "5353001100080001680000000B60820D0A")));
+ Assert.assertEquals(encoder.encodeCommand(command), ChannelBuffers.wrappedBuffer(
+ DatatypeConverter.parseHexBinary("5353001100080001680000000B60820D0A")));
}
diff --git a/test/org/traccar/protocol/Gt06ProtocolEncoderTest.java b/test/org/traccar/protocol/Gt06ProtocolEncoderTest.java
index 1041e65af..eff1942d1 100644
--- a/test/org/traccar/protocol/Gt06ProtocolEncoderTest.java
+++ b/test/org/traccar/protocol/Gt06ProtocolEncoderTest.java
@@ -6,6 +6,8 @@ import org.junit.Test;
import org.traccar.helper.ChannelBufferTools;
import org.traccar.model.Command;
+import javax.xml.bind.DatatypeConverter;
+
public class Gt06ProtocolEncoderTest {
@Test
@@ -17,8 +19,8 @@ public class Gt06ProtocolEncoderTest {
command.setDeviceId(1);
command.setType(Command.TYPE_ENGINE_STOP);
- Assert.assertEquals(encoder.encodeCommand(command), ChannelBuffers.wrappedBuffer(ChannelBufferTools.hexToBytes(
- "787812800c0000000052656c61792c312300009dee0d0a")));
+ Assert.assertEquals(encoder.encodeCommand(command), ChannelBuffers.wrappedBuffer(
+ DatatypeConverter.parseHexBinary("787812800c0000000052656c61792c312300009dee0d0a")));
}
diff --git a/test/org/traccar/protocol/KhdProtocolEncoderTest.java b/test/org/traccar/protocol/KhdProtocolEncoderTest.java
index 872997d7f..2a3fb524b 100644
--- a/test/org/traccar/protocol/KhdProtocolEncoderTest.java
+++ b/test/org/traccar/protocol/KhdProtocolEncoderTest.java
@@ -6,6 +6,8 @@ import org.junit.Test;
import org.traccar.helper.ChannelBufferTools;
import org.traccar.model.Command;
+import javax.xml.bind.DatatypeConverter;
+
public class KhdProtocolEncoderTest {
@Test
@@ -17,8 +19,8 @@ public class KhdProtocolEncoderTest {
command.setDeviceId(1);
command.setType(Command.TYPE_ENGINE_STOP);
- Assert.assertEquals(encoder.encodeCommand(command), ChannelBuffers.wrappedBuffer(ChannelBufferTools.hexToBytes(
- "2929390006000000003F0D")));
+ Assert.assertEquals(encoder.encodeCommand(command), ChannelBuffers.wrappedBuffer(
+ DatatypeConverter.parseHexBinary("2929390006000000003F0D")));
}
diff --git a/test/org/traccar/protocol/SkypatrolProtocolDecoderTest.java b/test/org/traccar/protocol/SkypatrolProtocolDecoderTest.java
index 9c7d79072..d3a9de340 100644
--- a/test/org/traccar/protocol/SkypatrolProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/SkypatrolProtocolDecoderTest.java
@@ -13,7 +13,7 @@ public class SkypatrolProtocolDecoderTest extends ProtocolDecoderTest {
SkypatrolProtocolDecoder decoder = new SkypatrolProtocolDecoder(new SkypatrolProtocol());
verifyPosition(decoder, binary(
- "0005021004FFFFFFFF0000000D313134373735383300CB000000000E11070C010184D032FB3841370000000016072B000017050032000000000000024E0C071116072C105900050000000000050000000000050000000003100260B7363B6306C11A00B73637F206BF19B73637F106B50EB73638B106BB0BB7363B6106B80AB73637F306B709000000000000000000C"));
+ "0005021004FFFFFFFF0000000D313134373735383300CB000000000E11070C010184D032FB3841370000000016072B000017050032000000000000024E0C071116072C105900050000000000050000000000050000000003100260B7363B6306C11A00B73637F206BF19B73637F106B50EB73638B106BB0BB7363B6106B80AB73637F306B709000000000000000000"));
//verifyPosition(decoder, binary(
// "000500030101383637383434303031373832333336420102000c0000fa07b5e101876c5b0e0a111606131c1b5e"));
diff --git a/test/org/traccar/protocol/XexunFrameDecoderTest.java b/test/org/traccar/protocol/XexunFrameDecoderTest.java
index e9a79ab45..532554225 100644
--- a/test/org/traccar/protocol/XexunFrameDecoderTest.java
+++ b/test/org/traccar/protocol/XexunFrameDecoderTest.java
@@ -13,7 +13,7 @@ public class XexunFrameDecoderTest extends ProtocolDecoderTest {
Assert.assertEquals(
binary("4750524d432c3230353933352e3030302c412c353134302e343335302c4e2c3530312e303638362c452c302e30302c302e30302c3132313031352c30302c303030302e302c412a37302c462c2c696d65693a3335393538373031343731383339322c"),
- decoder.decode(null, null, binary("313531303132313435392c2b33313635323435343932372c4750524d432c3230353933352e3030302c412c353134302e343335302c4e2c3530312e303638362c452c302e30302c302e30302c3132313031352c30302c303030302e302c412a37302c462c2c696d65693a3335393538373031343731383339322c313232497")));
+ decoder.decode(null, null, binary("313531303132313435392c2b33313635323435343932372c4750524d432c3230353933352e3030302c412c353134302e343335302c4e2c3530312e303638362c452c302e30302c302e30302c3132313031352c30302c303030302e302c412a37302c462c2c696d65693a3335393538373031343731383339322c31323249")));
Assert.assertEquals(
binary("4750524d432c3130333733312e3633362c412c343534352e353236362c4e2c30303434382e383235392c452c32312e31322c3237362e30312c3135303631352c2c2c412a35372c4c2c2c20696d65693a3031333934393030323032363637352c"),