From 12659dd920eb1ebf72c377f5075902539d7c4fc3 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 11 Jan 2014 11:00:22 +1300 Subject: Update skypatrol unit test --- test/org/traccar/protocol/SkypatrolProtocolDecoderTest.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/test/org/traccar/protocol/SkypatrolProtocolDecoderTest.java b/test/org/traccar/protocol/SkypatrolProtocolDecoderTest.java index d1b87ea6d..427c092a9 100644 --- a/test/org/traccar/protocol/SkypatrolProtocolDecoderTest.java +++ b/test/org/traccar/protocol/SkypatrolProtocolDecoderTest.java @@ -1,10 +1,10 @@ package org.traccar.protocol; import org.traccar.helper.TestDataManager; -import org.jboss.netty.buffer.ChannelBufferFactory; -import org.jboss.netty.buffer.HeapChannelBufferFactory; +import org.jboss.netty.buffer.ChannelBuffers; import static org.traccar.helper.DecoderVerifier.verify; import org.junit.Test; +import org.traccar.helper.ChannelBufferTools; public class SkypatrolProtocolDecoderTest { @@ -13,10 +13,13 @@ public class SkypatrolProtocolDecoderTest { SkypatrolProtocolDecoder decoder = new SkypatrolProtocolDecoder(null); decoder.setDataManager(new TestDataManager()); - ChannelBufferFactory factory = new HeapChannelBufferFactory(); - byte[] buf1 = {0x00,0x05,0x02,0x10,0x04,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,0x00,0x00,0x00,0x0D,0x31,0x31,0x34,0x37,0x37,0x35,0x38,0x33,0x00,(byte)0xCB,0x00,0x00,0x00,0x00,0x0E,0x11,0x07,0x0C,0x01,0x01,(byte)0x84,(byte)0xD0,0x32,(byte)0xFB,0x38,0x41,0x37,0x00,0x00,0x00,0x00,0x16,0x07,0x2B,0x00,0x00,0x17,0x05,0x00,0x32,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x4E,0x0C,0x07,0x11,0x16,0x07,0x2C,0x10,0x59,0x00,0x05,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x00,0x03,0x10,0x02,0x60,(byte)0xB7,0x36,0x3B,0x63,0x06,(byte)0xC1,0x1A,0x00,(byte)0xB7,0x36,0x37,(byte)0xF2,0x06,(byte)0xBF,0x19,(byte)0xB7,0x36,0x37,(byte)0xF1,0x06,(byte)0xB5,0x0E,(byte)0xB7,0x36,0x38,(byte)0xB1,0x06,(byte)0xBB,0x0B,(byte)0xB7,0x36,0x3B,0x61,0x06,(byte)0xB8,0x0A,(byte)0xB7,0x36,0x37,(byte)0xF3,0x06,(byte)0xB7,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C}; - verify(decoder.decode(null, null, factory.getBuffer(buf1, 0, buf1.length))); + int[] buf1 = {0x00,0x05,0x02,0x10,0x04,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x0D,0x31,0x31,0x34,0x37,0x37,0x35,0x38,0x33,0x00,0xCB,0x00,0x00,0x00,0x00,0x0E,0x11,0x07,0x0C,0x01,0x01,0x84,0xD0,0x32,0xFB,0x38,0x41,0x37,0x00,0x00,0x00,0x00,0x16,0x07,0x2B,0x00,0x00,0x17,0x05,0x00,0x32,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x4E,0x0C,0x07,0x11,0x16,0x07,0x2C,0x10,0x59,0x00,0x05,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x00,0x03,0x10,0x02,0x60,0xB7,0x36,0x3B,0x63,0x06,0xC1,0x1A,0x00,0xB7,0x36,0x37,0xF2,0x06,0xBF,0x19,0xB7,0x36,0x37,0xF1,0x06,0xB5,0x0E,0xB7,0x36,0x38,0xB1,0x06,0xBB,0x0B,0xB7,0x36,0x3B,0x61,0x06,0xB8,0x0A,0xB7,0x36,0x37,0xF3,0x06,0xB7,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C}; + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf1)))); + + //Enfora TT8750 + //int[] buf2 = {0x00,0x05,0x02,0x00,0x00,0x00,0xf1,0x14,0x30,0x35,0x30,0x30,0x31,0x39,0x30,0x31,0xd1,0xdf,0x00,0x2f,0x00,0x00,0x0d,0x01,0x87,0x12,0x01,0x15,0xe5,0x56,0xff,0x76,0x2a,0xa9,0x00,0x00,0x00,0x00,0x00,0xaa,0xe4,0x00,0x05,0xd2,0x00,0x0e,0xe1,0xbc,0x0e,0x01,0x0a,0x04,0x25,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x04,0x00,0x00,0x02,0x23,0x3c,0x09,0x6c,0x00,0xee,0x2a,0x00,0x23,0x3c,0x00,0x85,0x00,0xf0,0x22,0x23,0x3c,0x0b,0x05,0x00,0xf2,0x1d,0x23,0x3c,0x00,0x00,0x00,0xfb,0x23,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + //verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf2)))); } -- cgit v1.2.3