aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-06-05 23:16:21 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2018-06-05 23:16:21 +1200
commit9c99076dc2416c4e0725007af0e5f2f2f444c05c (patch)
tree55068f2ab5dbe99fcd60acc01c1bb05fc365aa43 /test
parentb8f4fc8888aaad7fe384c1dc2b80f44c1683bb03 (diff)
downloadtrackermap-server-9c99076dc2416c4e0725007af0e5f2f2f444c05c.tar.gz
trackermap-server-9c99076dc2416c4e0725007af0e5f2f2f444c05c.tar.bz2
trackermap-server-9c99076dc2416c4e0725007af0e5f2f2f444c05c.zip
Migrate more protocols
Diffstat (limited to 'test')
-rw-r--r--test/org/traccar/helper/StringFinderTest.java26
-rw-r--r--test/org/traccar/protocol/AdmProtocolDecoderTest.java14
-rw-r--r--test/org/traccar/protocol/At2000FrameDecoderTest.java16
-rw-r--r--test/org/traccar/protocol/At2000ProtocolDecoderTest.java20
-rw-r--r--test/org/traccar/protocol/AtrackFrameDecoderTest.java10
5 files changed, 27 insertions, 59 deletions
diff --git a/test/org/traccar/helper/StringFinderTest.java b/test/org/traccar/helper/StringFinderTest.java
deleted file mode 100644
index b8ac6d761..000000000
--- a/test/org/traccar/helper/StringFinderTest.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.traccar.helper;
-
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.Unpooled;
-import org.junit.Test;
-
-import java.nio.charset.StandardCharsets;
-
-import static org.junit.Assert.assertEquals;
-
-public class StringFinderTest {
-
- @Test
- public void testFind() {
-
- ByteBuf buf = Unpooled.copiedBuffer("hello world", StandardCharsets.US_ASCII);
-
- // TODO update test
- /*assertEquals(-1, buf.indexOf(0, buf.writerIndex(), new StringFinder("bar")));
- assertEquals(6, buf.indexOf(0, buf.writerIndex(), new StringFinder("world")));
- assertEquals(-1, buf.indexOf(0, buf.writerIndex(), new StringFinder("worlds")));
- assertEquals(0, buf.indexOf(0, buf.writerIndex(), new StringFinder("hell")));*/
-
- }
-
-}
diff --git a/test/org/traccar/protocol/AdmProtocolDecoderTest.java b/test/org/traccar/protocol/AdmProtocolDecoderTest.java
index 9a7f91d26..92775991b 100644
--- a/test/org/traccar/protocol/AdmProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/AdmProtocolDecoderTest.java
@@ -12,25 +12,25 @@ public class AdmProtocolDecoderTest extends ProtocolTest {
AdmProtocolDecoder decoder = new AdmProtocolDecoder(new AdmProtocol());
- verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ verifyNull(decoder, binary(
"010042033836313331313030323639343838320501000000000000000000000000000000000000000000000000000000000000000000000000000000000000000073"));
- verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ verifyPosition(decoder, binary(
"01002680336510002062A34C423DCF8E42A50B1700005801140767E30F568F2534107D220000"));
- verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ verifyPosition(decoder, binary(
"010022003300072020000000000000000044062A330000000000107F10565D4A8310"));
- verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ verifyPosition(decoder, binary(
"0100268033641080207AA34C424CCF8E4239030800005B01140755E30F560000F00F70220000"));
- verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ verifyPosition(decoder, binary(
"01002680336510002062A34C423DCF8E42A50B1700005801140767E30F568F2534107D220000"));
- verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ verifyPosition(decoder, binary(
"01002200333508202000000000000000007F0D9F030000000000E39A1056E24A8210"));
- verifyNotNull(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ verifyNotNull(decoder, binary(
"01008449443d3120536f66743d30783531204750533d313036382054696d653d30383a35393a32302031302e30392e31372056616c3d30204c61743d36312e36373738204c6f6e3d35302e3832343520563d3020536174436e743d342b3720537461743d30783030313020496e5f616c61726d3d30783030000000000000000000000000"));
}
diff --git a/test/org/traccar/protocol/At2000FrameDecoderTest.java b/test/org/traccar/protocol/At2000FrameDecoderTest.java
index 5613f832e..c5829d588 100644
--- a/test/org/traccar/protocol/At2000FrameDecoderTest.java
+++ b/test/org/traccar/protocol/At2000FrameDecoderTest.java
@@ -3,10 +3,6 @@ package org.traccar.protocol;
import org.junit.Test;
import org.traccar.ProtocolTest;
-import java.nio.ByteOrder;
-
-import static org.junit.Assert.assertEquals;
-
public class At2000FrameDecoderTest extends ProtocolTest {
@Test
@@ -14,13 +10,13 @@ public class At2000FrameDecoderTest extends ProtocolTest {
At2000FrameDecoder decoder = new At2000FrameDecoder();
- assertEquals(
- binary(ByteOrder.LITTLE_ENDIAN, "01012f00000000000000000000000000003335363137333036343430373439320fad981997ae8e031fe10c0ea7641903ca32c0331df467233d2a9cd886fbeef8"),
- decoder.decode(null, null, binary(ByteOrder.LITTLE_ENDIAN, "01012f00000000000000000000000000003335363137333036343430373439320fad981997ae8e031fe10c0ea7641903ca32c0331df467233d2a9cd886fbeef8")));
+ verifyFrame(
+ binary("01012f00000000000000000000000000003335363137333036343430373439320fad981997ae8e031fe10c0ea7641903ca32c0331df467233d2a9cd886fbeef8"),
+ decoder.decode(null, null, binary("01012f00000000000000000000000000003335363137333036343430373439320fad981997ae8e031fe10c0ea7641903ca32c0331df467233d2a9cd886fbeef8")));
- assertEquals(
- binary(ByteOrder.LITTLE_ENDIAN, "893f0000000000000000000000000000e048b1a31deba3f5dbe8877f574877e6ed4d022b6611a10d80dfc4c0c11fa8aacf4a9de61528327e2b66843dd9c5d3a7cc9ee1d9c71a34bb482145d88b4fda3e"),
- decoder.decode(null, null, binary(ByteOrder.LITTLE_ENDIAN, "893f0000000000000000000000000000e048b1a31deba3f5dbe8877f574877e6ed4d022b6611a10d80dfc4c0c11fa8aacf4a9de61528327e2b66843dd9c5d3a7cc9ee1d9c71a34bb482145d88b4fda3e")));
+ verifyFrame(
+ binary("893f0000000000000000000000000000e048b1a31deba3f5dbe8877f574877e6ed4d022b6611a10d80dfc4c0c11fa8aacf4a9de61528327e2b66843dd9c5d3a7cc9ee1d9c71a34bb482145d88b4fda3e"),
+ decoder.decode(null, null, binary("893f0000000000000000000000000000e048b1a31deba3f5dbe8877f574877e6ed4d022b6611a10d80dfc4c0c11fa8aacf4a9de61528327e2b66843dd9c5d3a7cc9ee1d9c71a34bb482145d88b4fda3e")));
}
diff --git a/test/org/traccar/protocol/At2000ProtocolDecoderTest.java b/test/org/traccar/protocol/At2000ProtocolDecoderTest.java
index 532baa764..ad0165065 100644
--- a/test/org/traccar/protocol/At2000ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/At2000ProtocolDecoderTest.java
@@ -18,42 +18,42 @@ public class At2000ProtocolDecoderTest extends ProtocolTest {
decoder = new At2000ProtocolDecoder(new At2000Protocol());
- verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ verifyNull(decoder, binary(
"01012f00000000000000000000000000003335373435343037313632373539388b57ec3a6ec7e3310a1ceb0a70fd751b8f2e7be6df1d6dcd80129f66fff0ea1c"));
- verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ verifyNull(decoder, binary(
"89000000000000000000000000000000"));
decoder = new At2000ProtocolDecoder(new At2000Protocol());
- verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ verifyNull(decoder, binary(
"01012f0000000000000000000000000000333537343534303731363036313936ddf189075add9a32d97b54073025963e65849a3a59940d05fd8db655fc84bc6d"));
- verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ verifyPositions(decoder, binary(
"893b01000000000000000000000000003b40bcdab6387d829146701d8cb53daaa87b84d24b40cb24fd86da5d3f5f02b0f6f603c43c5a513418a0b2bdcaba603dbe737687cfe9082c57668eb6789d2b029a35aeac6a609558b96de5d7ad37917c902efc878ca9aff474f9d5d2417191285b8d5749bd3ffa86cc99096ce24c1f6ac350ae9adf3d5c788f80b4e3d3dc2dbb8abc1414ea1b52fdb55b2bb8af223ec528245f99d451b715e5774c5397db645d9ae441e645f8dae70230b728e81f51240868712d6f426fd694dbad8026fcf487c268939f04593ad86391cc829b1a1bdac8804ff7507544a69dc0b1b3927d7344e8a5b26fa56825283b3e476330b36d15011e1647ebd9f2ef71844ed32c0dc050457bfbd79160e6d1d8cda00a0927c8957631770e98eb20735aa46b0b18502baf4c45d2623ee51a4320cf3018010e7bbf8bc0dd79eb28e88b727ea67e980b8a91"));
decoder = new At2000ProtocolDecoder(new At2000Protocol());
- verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ verifyNull(decoder, binary(
"01012f000000000000000000000000000033353734353430373136303631393637f5441a9862260117858237fe3160388490f0df7d46c09112ee087235a92101"));
- verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ verifyPositions(decoder, binary(
"89043203000000000000000000000000d01ff1df1b56ba9185bb741ddc253f3cee093b1f8193100cd95777b5288a6f29d1b343a952f882ce8825679f7e27ad88ed7898bff92f716acadfc3c17fa8c1a6b9d0934e8f042433a183776c06c1acd73efb4b9f19030debb4dceb161fb3e6630757d25c3e995b7cf5f446318dcc1677eb215d1af49f11cd7300598bcdc40cc25466ed2391d836c782e44bc04a332e902b2b34f5597a542af4ca670cdfc18d87ce2a225c3e6f2f32359d4914c6df09aa5ee306c229260d4a56da53f93398bc8a6e77095305ee214cf605de20d3876a993fb810486f75bcd514c12442bf4dc3fbe7963b20d5100b5ecff1c1aef4c4b3736a04e245d50f538327db21d55270b279db5ac5a9658876bae3d9b5026b8975bb2bf4d100b8492760d66ae31f27bf9c525c2d794860eabca9c788b91152dbce79f336daaf6a7a9547bf1dd8e3334c891f4548fd6d112ebf45125c2a8abd3a786ebbcfdd03101b524bbf465f14a9a424305ce7de56ffca85b4657fc8c03e4349c0ca6be64d1cf595ee91f8173678ef2267dae54dd00028450c48d9b74c925af0f245d409d8773238dce5832747587f53a12155869c1d464eb0630f94cf8dceb76aa39995411d4ce7743b1501692425afec498535526067e79f568b7f71ee47d8b4929118d57b13d56cdbfd26582d579dee"));
decoder = new At2000ProtocolDecoder(new At2000Protocol());
- verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ verifyNull(decoder, binary(
"01012f0000000000000000000000000000333537343534303731363035353033dd529a1eb5df9f3b6d320b38250e03306692957e8c2127d8e381a717f639b4c9"));
- verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ verifyPositions(decoder, binary(
"89898701000000000000000000000000ae99e38f13d44f536769eb4930a6826dfebe5b98a6048941e89b17c9cdcb276be4af7c0d188d07c90d6e94aa9efcb465fe7aeaff4d85caf837483b4e9b32fbbacfbc4e175eebf57a27f552a64fc3419565d2dfbea668511a08d5a526342fad0e93b20c4449ad8defab4a9ac68cf7dad86971eb2cd96810d9d6a9c56e07fd90e4c28cfc53a069b63efe37a0523a69b607a2dc011ba17b177c5332c04be1faeeabed24539b3b790fa8a8610ab3633e0140ed79690fcae9dea43c7daad780d95a511d8f4875e621bcfe7516a03b80eb3c473ffd4bc1eda298dfa7d994a2cfeaa5d24c190d52d72fd90975a2e6f9ed3b95017133952262f91787c46839738a80c333dc53ee4d8afe75315d801efe17bc7309f30cfce64906bf70e6844c835781cbb64b49e9315ca3c2cd39d00a03cc7178a4ebc5df230dcdfd44ec588791d488f96bb6ff4007a753f552bda4d1766632aa3ec5eb38feb23ed6efb8f382a7f22b70adc9cb533c09bf749190c36d63b572c1acfc3a59138d51273835ab13c4689df01e3d2c2dd1829e00aac5c56b5d51e60d6731833f82c7464d88df663ca28a20eedeecb60f3704ae78281838caa116184e414db459768321bbfa1e83ad59fe168eb81f3b41cfe0e39c8aa78cbbe5825620bf053a1cb62e04d4cdf17ca2dc9305d47c"));
decoder = new At2000ProtocolDecoder(new At2000Protocol());
- verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ verifyNull(decoder, binary(
"01012f00000000000000000000000000003335363137333036343430373439320fad981997ae8e031fe10c0ea7641903ca32c0331df467233d2a9cd886fbeef8"));
- verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ verifyPositions(decoder, binary(
"893f0000000000000000000000000000e048b1a31deba3f5dbe8877f574877e6ed4d022b6611a10d80dfc4c0c11fa8aacf4a9de61528327e2b66843dd9c5d3a7cc9ee1d9c71a34bb482145d88b4fda3e"));
}
diff --git a/test/org/traccar/protocol/AtrackFrameDecoderTest.java b/test/org/traccar/protocol/AtrackFrameDecoderTest.java
index 52ac18026..df775021a 100644
--- a/test/org/traccar/protocol/AtrackFrameDecoderTest.java
+++ b/test/org/traccar/protocol/AtrackFrameDecoderTest.java
@@ -3,8 +3,6 @@ package org.traccar.protocol;
import org.junit.Test;
import org.traccar.ProtocolTest;
-import static org.junit.Assert.assertEquals;
-
public class AtrackFrameDecoderTest extends ProtocolTest {
@Test
@@ -12,19 +10,19 @@ public class AtrackFrameDecoderTest extends ProtocolTest {
AtrackFrameDecoder decoder = new AtrackFrameDecoder();
- assertEquals(
+ verifyFrame(
binary("40502c373542332c3132302c37393737392c3335383930313034383039313535342c32303138303431323134323531342c32303138303431323134323531342c32303138303431333030303635352c31363432333338392c34383137383730302c3130382c322c362e352c392c302c302c302c302c302c323030302c323030302c1a0d0a"),
decoder.decode(null, null, binary("40502c373542332c3132302c37393737392c3335383930313034383039313535342c32303138303431323134323531342c32303138303431323134323531342c32303138303431333030303635352c31363432333338392c34383137383730302c3130382c322c362e352c392c302c302c302c302c302c323030302c323030302c1a0d0a")));
- assertEquals(
+ verifyFrame(
binary("244F4B0D0A"),
decoder.decode(null, null, binary("244F4B0D0A")));
- assertEquals(
+ verifyFrame(
binary("fe0200014104d8f196820001"),
decoder.decode(null, null, binary("fe0200014104d8f196820001")));
- assertEquals(
+ verifyFrame(
binary("40501e58003301e000014104d8f19682525ecd5d525ee344525ee35effc88815026ab4d70000020000104403de01000b0000000007d007d000"),
decoder.decode(null, null, binary("40501e58003301e000014104d8f19682525ecd5d525ee344525ee35effc88815026ab4d70000020000104403de01000b0000000007d007d000")));