diff options
author | Gabor Somogyi <Gabor_Somogyi@epam.com> | 2016-05-04 14:36:18 +0200 |
---|---|---|
committer | Gabor Somogyi <Gabor_Somogyi@epam.com> | 2016-05-04 14:39:03 +0200 |
commit | 516ef6a30eb59e1b9c3aa297e3595c5acf665530 (patch) | |
tree | 2bed5e621be4786816bbf3d6adabe41d2d43fbdb /test | |
parent | 5bf82eff1ecac7b23661cea14be26aa7a3e4d09a (diff) | |
parent | 59f466092c9c875c2bbcb70a2a402aad0edd7639 (diff) | |
download | trackermap-server-516ef6a30eb59e1b9c3aa297e3595c5acf665530.tar.gz trackermap-server-516ef6a30eb59e1b9c3aa297e3595c5acf665530.tar.bz2 trackermap-server-516ef6a30eb59e1b9c3aa297e3595c5acf665530.zip |
Merge branch 'master' into command_framework
Diffstat (limited to 'test')
-rw-r--r-- | test/org/traccar/ProtocolTest.java | 3 | ||||
-rw-r--r-- | test/org/traccar/helper/ChecksumTest.java | 3 | ||||
-rw-r--r-- | test/org/traccar/helper/StringFinderTest.java | 3 | ||||
-rw-r--r-- | test/org/traccar/protocol/AstraProtocolDecoderTest.java | 3 | ||||
-rw-r--r-- | test/org/traccar/protocol/Gt06ProtocolDecoderTest.java | 6 | ||||
-rw-r--r-- | test/org/traccar/protocol/Jt600ProtocolDecoderTest.java | 4 |
6 files changed, 17 insertions, 5 deletions
diff --git a/test/org/traccar/ProtocolTest.java b/test/org/traccar/ProtocolTest.java index 2f5f3962f..a8f3d13cf 100644 --- a/test/org/traccar/ProtocolTest.java +++ b/test/org/traccar/ProtocolTest.java @@ -15,6 +15,7 @@ import org.traccar.model.Position; import javax.xml.bind.DatatypeConverter; import java.nio.ByteOrder; import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -87,7 +88,7 @@ public class ProtocolTest { } protected ChannelBuffer buffer(String... data) { - return ChannelBuffers.copiedBuffer(concatenateStrings(data), Charset.defaultCharset()); + return ChannelBuffers.copiedBuffer(concatenateStrings(data), StandardCharsets.US_ASCII); } protected DefaultHttpRequest request(String url) { diff --git a/test/org/traccar/helper/ChecksumTest.java b/test/org/traccar/helper/ChecksumTest.java index a2e69eb5a..82bae7346 100644 --- a/test/org/traccar/helper/ChecksumTest.java +++ b/test/org/traccar/helper/ChecksumTest.java @@ -6,12 +6,13 @@ import org.junit.Assert; import org.junit.Test; import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; public class ChecksumTest { @Test public void testCrc16() { - ChannelBuffer buf = ChannelBuffers.copiedBuffer("123456789", Charset.defaultCharset()); + ChannelBuffer buf = ChannelBuffers.copiedBuffer("123456789", StandardCharsets.US_ASCII); Assert.assertEquals(0x906e, Checksum.crc16(Checksum.CRC16_X25, buf.toByteBuffer())); Assert.assertEquals(0x29b1, Checksum.crc16(Checksum.CRC16_CCITT_FALSE, buf.toByteBuffer())); diff --git a/test/org/traccar/helper/StringFinderTest.java b/test/org/traccar/helper/StringFinderTest.java index 71f9215db..1c8234db1 100644 --- a/test/org/traccar/helper/StringFinderTest.java +++ b/test/org/traccar/helper/StringFinderTest.java @@ -8,6 +8,7 @@ import org.junit.Assert; import org.junit.Test; import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; @@ -17,7 +18,7 @@ public class StringFinderTest { @Test public void testFind() { - ChannelBuffer buf = ChannelBuffers.copiedBuffer("hello world", Charset.defaultCharset()); + ChannelBuffer buf = ChannelBuffers.copiedBuffer("hello world", StandardCharsets.US_ASCII); Assert.assertEquals(-1, buf.indexOf(0, buf.writerIndex(), new StringFinder("bar"))); Assert.assertEquals(6, buf.indexOf(0, buf.writerIndex(), new StringFinder("world"))); diff --git a/test/org/traccar/protocol/AstraProtocolDecoderTest.java b/test/org/traccar/protocol/AstraProtocolDecoderTest.java index 93a939879..e8a9b12b5 100644 --- a/test/org/traccar/protocol/AstraProtocolDecoderTest.java +++ b/test/org/traccar/protocol/AstraProtocolDecoderTest.java @@ -11,6 +11,9 @@ public class AstraProtocolDecoderTest extends ProtocolTest { AstraProtocolDecoder decoder = new AstraProtocolDecoder(new AstraProtocol()); verifyPositions(decoder, binary( + "4b00320524c1da58769e6d0322617effe874024453065600a800000100080000643e0000000000000000000000069500e7bb")); + + verifyPositions(decoder, binary( "4b013c02213aec35c501ad031368b8ffcd1ad043e5c4500c79000100003101005c490c001c0009020200020015069600ae03136801ffcd1af143e5c452125e000100003101005c491200090011010000020015068500af0313629effcd1f4b43e5c45d1e46000100003101005c491e00080409040500040015068700b0031359d5ffcd35ad43e5c47b2a3b000001003101005c492a1b1a0d0b0f0b00080015068700b103134984ffcd4b1e43e5c4913354000100003101005c49340b0103090606000f0015067700b203132e1affcd5a5a43e5c4af3348000001003101005c4935070a08000a070017001505f700b30313192cffcd7af143e5c4cd3733000001003101005c4937091206050a0800200015058600b403130debffcda88743e5c4eb2c3e000001003101005c493707030601080600290015058600b377")); } diff --git a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java index d925ffec3..3bcd2ec3a 100644 --- a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java @@ -16,6 +16,12 @@ public class Gt06ProtocolDecoderTest extends ProtocolTest { verifyNothing(decoder, binary( "78780D01086471700328358100093F040D0A")); + verifyAttributes(decoder, binary( + "78782d152500000000437574206f666620746865206675656c20737570706c793a2053756363657373210002013b898a0d0a")); + + verifyAttributes(decoder, binary( + "787829152100000000526573746f7265206675656c20737570706c793a2053756363657373210002014077ce0d0a")); + verifyNothing(decoder, binary( "78780D01012345678901234500018CDD0D0A")); diff --git a/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java b/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java index 3969e8b2c..b95d8ddce 100644 --- a/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java @@ -32,10 +32,10 @@ public class Jt600ProtocolDecoderTest extends ProtocolTest { "(3120820029,W01,02553.3555,E,2438.0997,S,A,171012,053339,0,8,20,6,31,5,20,20)")); /*verifyPosition(decoder, text( ChannelBuffers.copiedBuffer( - "(3330104377,U01,010100,010228,F,00.000000,N,000.000000,E,0,0,0,0%,00001000000000,741,14,22,0,206)", Charset.defaultCharset()))); + "(3330104377,U01,010100,010228,F,00.000000,N,000.000000,E,0,0,0,0%,00001000000000,741,14,22,0,206)", StandardCharsets.US_ASCII))); verifyPosition(decoder, text( ChannelBuffers.copiedBuffer( - "(6221107674,2,U09,129,2,A,280513113036,E,02711.0500,S,1721.0876,A,030613171243,E,02756.7618,S,2300.0325,3491,538200,14400,1)", Charset.defaultCharset())));*/ + "(6221107674,2,U09,129,2,A,280513113036,E,02711.0500,S,1721.0876,A,030613171243,E,02756.7618,S,2300.0325,3491,538200,14400,1)",StandardCharsets.US_ASCII))));*/ } |