diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2014-03-19 23:12:50 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2014-03-19 23:12:50 +1300 |
commit | 57a7b6beaade9a51690d0cc89149eca0dea8294a (patch) | |
tree | 341d468c1c0ec30fc6206cc382f67f2cf6a185c9 /test/org/traccar | |
parent | 289609b483d0b6188f8536f692363eb91e38288c (diff) | |
download | traccar-server-57a7b6beaade9a51690d0cc89149eca0dea8294a.tar.gz traccar-server-57a7b6beaade9a51690d0cc89149eca0dea8294a.tar.bz2 traccar-server-57a7b6beaade9a51690d0cc89149eca0dea8294a.zip |
Fix Noran decoder (fix #610)
Diffstat (limited to 'test/org/traccar')
-rw-r--r-- | test/org/traccar/protocol/NoranProtocolDecoderTest.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/test/org/traccar/protocol/NoranProtocolDecoderTest.java b/test/org/traccar/protocol/NoranProtocolDecoderTest.java index d8f228cac..8d6025b47 100644 --- a/test/org/traccar/protocol/NoranProtocolDecoderTest.java +++ b/test/org/traccar/protocol/NoranProtocolDecoderTest.java @@ -1,7 +1,9 @@ package org.traccar.protocol; +import java.nio.ByteOrder; import org.traccar.helper.TestDataManager; import org.jboss.netty.buffer.ChannelBuffers; +import static org.junit.Assert.assertNull; import static org.traccar.helper.DecoderVerifier.verify; import org.junit.Test; import org.traccar.helper.ChannelBufferTools; @@ -14,8 +16,11 @@ public class NoranProtocolDecoderTest { NoranProtocolDecoder decoder = new NoranProtocolDecoder(null); decoder.setDataManager(new TestDataManager()); - //int[] buf1 = {0x00}; - //verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf1)))); + int[] buf1 = {0x0f,0x00,0x00,0x00,0x4e,0x52,0x30,0x39,0x46,0x30,0x34,0x31,0x35,0x35,0x00}; + assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertArray(buf1)))); + + int[] buf2 = {0x22,0x00,0x08,0x00,0x01,0x0c,0x00,0x8a,0x00,0x7e,0x9d,0xaa,0x42,0x31,0x7b,0xdd,0x41,0xa7,0xf3,0xe2,0x38,0x4e,0x52,0x30,0x39,0x46,0x30,0x34,0x31,0x35,0x35,0x00,0x00,0x00}; + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertArray(buf2)))); } |