aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2012-12-07 21:35:11 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2012-12-07 21:35:11 +1300
commit617c2fd4ae57517ec1a40c7b340c45e1ff54f01b (patch)
tree486385bbe42d7c5499748cbfc015dfa4e167397e
parent9cfee9cc32c5074dba6e8bd888db196bcbb91b87 (diff)
downloadtrackermap-server-617c2fd4ae57517ec1a40c7b340c45e1ff54f01b.tar.gz
trackermap-server-617c2fd4ae57517ec1a40c7b340c45e1ff54f01b.tar.bz2
trackermap-server-617c2fd4ae57517ec1a40c7b340c45e1ff54f01b.zip
Some more tests
-rwxr-xr-xhex.sh1
-rw-r--r--test/org/traccar/protocol/MeitrackProtocolDecoderTest.java3
-rw-r--r--test/org/traccar/protocol/NavisProtocolDecoderTest.java5
3 files changed, 8 insertions, 1 deletions
diff --git a/hex.sh b/hex.sh
new file mode 100755
index 000000000..a061ac18c
--- /dev/null
+++ b/hex.sh
@@ -0,0 +1 @@
+echo 2424613133382C3031323839363030303437353439382C4141412C33352C2D362E3133383330362C3130362E3931303635352C3132313230353130333430392C412C332C31312C302C302C312C33362C343138322C33343834372C3531307C31307C303038317C344634462C303030302C303030427C303030437C303030417C303846367C303030302C2C2A44350D0A | perl -ne 's/([0-9a-f]{2})/print chr hex $1/gie' | nc -v localhost 5020
diff --git a/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java b/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java
index 7261443d5..2ba89fae0 100644
--- a/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java
@@ -15,6 +15,9 @@ public class MeitrackProtocolDecoderTest {
assertNotNull(decoder.decode(null, null,
"$$d138,012896000475498,AAA,35,-6.138255,106.910545,121205074819,A,7,18,0,0,0,49,3800,24965,510|10|0081|4F4F,0000,000D|0010|0012|0963|0000,,*BF"));
+
+ assertNotNull(decoder.decode(null, null,
+ "$$j138,012896000475498,AAA,35,-6.138306,106.910655,121205103708,A,3,11,0,0,1,36,4182,35025,510|10|0081|4F4F,0000,000A|000C|000A|0915|0000,,*BF"));
}
diff --git a/test/org/traccar/protocol/NavisProtocolDecoderTest.java b/test/org/traccar/protocol/NavisProtocolDecoderTest.java
index f880cde8b..cf9a47992 100644
--- a/test/org/traccar/protocol/NavisProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/NavisProtocolDecoderTest.java
@@ -2,8 +2,8 @@ package org.traccar.protocol;
import java.nio.ByteOrder;
import org.jboss.netty.buffer.ChannelBuffers;
-import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import org.junit.Test;
public class NavisProtocolDecoderTest {
@@ -19,6 +19,9 @@ public class NavisProtocolDecoderTest {
byte[] buf2 = {0x40,0x4E,0x54,0x43,0x01,0x00,0x00,0x00,0x7B,0x00,0x00,0x00,0x5A,0x00,0x50,0x69,0x2A,0x3E,0x41,0x01,0x25,(byte)0xDB,0x0E,0x00,0x00,0x00,0x15,0x11,0x07,0x07,0x11,0x0A,0x0C,0x08,(byte)0x80,0x63,0x00,0x00,(byte)0xAA,0x39,(byte)0xA2,0x38,0x16,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x11,0x07,0x08,0x11,0x0A,0x0C,(byte)0xB3,(byte)0x89,(byte)0x79,0x3F,0x1A,(byte)0xEF,0x26,0x3F,0x00,0x00,0x00,0x00,0x12,0x00,0x34,(byte)0xF5,0x16,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xFA,(byte)0xFF,0x00,0x00,0x00,(byte)0xFA,(byte)0xFF,0x00,0x00,0x00,(byte)0xFA,(byte)0xFF,(byte)0x80,(byte)0x80,(byte)0x80,(byte)0x80};
assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, buf2)));
+ byte[] buf3 = {0x40,0x4E,0x54,0x43,0x01,0x00,0x00,0x00,0x7B,0x00,0x00,0x00,0x13,0x00,0x47,0x37,0x2A,0x3E,0x53,0x3A,0x38,0x36,0x31,0x37,0x38,0x35,0x30,0x30,0x35,0x31,0x32,0x36,0x30,0x36,0x39};
+ assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, buf3)));
+
}
}