diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-19 16:34:42 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-19 16:34:42 +1300 |
commit | 5123f06f22120b05cbef40f60c367c521c628d4e (patch) | |
tree | cad362125eb406d4a210698a09624bb530e23d8e /test | |
parent | 66f6f48f00f01600afb13395c8b8c1fe95254201 (diff) | |
download | trackermap-server-5123f06f22120b05cbef40f60c367c521c628d4e.tar.gz trackermap-server-5123f06f22120b05cbef40f60c367c521c628d4e.tar.bz2 trackermap-server-5123f06f22120b05cbef40f60c367c521c628d4e.zip |
Implement Neomatica ADM protocol
Diffstat (limited to 'test')
-rw-r--r-- | test/org/traccar/protocol/AdmProtocolDecoderTest.java | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/org/traccar/protocol/AdmProtocolDecoderTest.java b/test/org/traccar/protocol/AdmProtocolDecoderTest.java new file mode 100644 index 000000000..3720afbea --- /dev/null +++ b/test/org/traccar/protocol/AdmProtocolDecoderTest.java @@ -0,0 +1,39 @@ +package org.traccar.protocol; + +import org.jboss.netty.buffer.ChannelBuffers; +import org.junit.Test; +import org.traccar.helper.ChannelBufferTools; + +import java.nio.ByteOrder; + +import static org.junit.Assert.assertNull; +import static org.traccar.helper.DecoderVerifier.verify; + +public class AdmProtocolDecoderTest extends ProtocolDecoderTest { + + @Test + public void testDecode() throws Exception { + + AdmProtocolDecoder decoder = new AdmProtocolDecoder(new AdmProtocol()); + + assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString( + "010042033836313331313030323639343838320501000000000000000000000000000000000000000000000000000000000000000000000000000000000000000073")))); + + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString( + "01002680336510002062A34C423DCF8E42A50B1700005801140767E30F568F2534107D220000")))); + + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString( + "010022003300072020000000000000000044062A330000000000107F10565D4A8310")))); + + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString( + "0100268033641080207AA34C424CCF8E4239030800005B01140755E30F560000F00F70220000")))); + + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString( + "01002680336510002062A34C423DCF8E42A50B1700005801140767E30F568F2534107D220000")))); + + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString( + "01002200333508202000000000000000007F0D9F030000000000E39A1056E24A8210")))); + + } + +} |