diff options
Diffstat (limited to 'test/org/traccar/protocol')
4 files changed, 76 insertions, 5 deletions
diff --git a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java index c9ef29791..b6493e85b 100644 --- a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java @@ -17,6 +17,30 @@ public class Gt06ProtocolDecoderTest extends ProtocolTest { "78780D01086471700328358100093F040D0A")); verifyAttributes(decoder, binary( + "78780B23C00122040001000818720D0A")); + + verifyNotNull(decoder, binary( + "787880a2110b161010140136040000591200000000009d7c01020000591200000000009d7c01020000591200000000009d7c01020000591200000000009d7c01020000591200000000009d7c01020000591200000000009d7c01020000591200000000009d7c0102ff033c1e04ddc28aa6001801eb4039c90000000000000014db84730d0a")); + + verifyNotNull(decoder, binary( + "78782ba701cc000000919100000000090617032b3836313832323038343735363200000000000000000100049fb60d0a")); + + verifyNotNull(decoder, binary( + "787819a501cc0000009191000000000906170304050400010005f44d0d0a")); + + verifyNotNull(decoder, binary( + "78782ca3110b10081336f000000000000000000004003901cc0000009191000000000906170304050400010003e0940d0a")); + + verifyNotNull(decoder, binary( + "7878A3A2110B0603201501CC010000254E000000000615F804000000254E000000000615F804000000254E000000000615F804000000254E000000000615F804000000254E000000000615F804000000254E000000000615F804000000254E000000000615F80400FF08F483CD4DF4C0D750BD5F8BC5CECFB0D59DAFB459CDA8574E8424C6CC50BD5F6C7E1CC9B0D59D8AA718C90087363040E0C83496727B4DE4C7002919670D0A")); + + verifyNotNull(decoder, binary( + "78786CA1110B0413093801CC01000025FC000000000618C10201000025FC000000000618C10201000025FC000000000618C10201000025FC000000000618C10201000025FC000000000618C10201000025FC000000000618C10201000025FC000000000618C10201FF0002000541D70D0A")); + + verifyPosition(decoder, binary( + "787822220F0C1D023305C9027AC8180C46586000140001CC00287D001F71000001000820860D0A")); + + verifyAttributes(decoder, binary( "797900262100000000020043006f006d006d0061006e00640020006500720072006f0072002100236e850d0a")); verifyNotNull(decoder, binary( @@ -206,6 +230,12 @@ public class Gt06ProtocolDecoderTest extends ProtocolTest { verifyNull(decoder, binary( "787801080d0a")); + verifyNull(decoder, binary( + "78782E2A0F0C1D071139CA027AC8000C4658000014D83132353230313335333231373730373900000000000001002A6ECE0D0A")); + + verifyNull(decoder, binary( + "7878058A000688290D0A")); + } } diff --git a/test/org/traccar/protocol/Jt600FrameDecoderTest.java b/test/org/traccar/protocol/Jt600FrameDecoderTest.java index afa53ba13..15e6ec18c 100644 --- a/test/org/traccar/protocol/Jt600FrameDecoderTest.java +++ b/test/org/traccar/protocol/Jt600FrameDecoderTest.java @@ -11,23 +11,27 @@ public class Jt600FrameDecoderTest extends ProtocolTest { Jt600FrameDecoder decoder = new Jt600FrameDecoder(); - Assert.assertEquals( + verifyFrame( + binary("24315011626912001b21111718095900000000000000000e0000005c000000000000000000"), + decoder.decode(null, null, binary("24315011626912001b21111718095900000000000000000e0000005c00000000000000000024315011626912001b22111708130400000000000000000e0000005a00000000000000000024315011626912001b22111708140400000000000000000e0000005a000000723e18a61b01"))); + + verifyFrame( binary("2475604055531611002311111600311326144436028210791d016c0000001f070000000020c03c4f6d07d80ccf"), decoder.decode(null, null, binary("2475604055531611002311111600311326144436028210791d016c0000001f070000000020c03c4f6d07d80ccf"))); - Assert.assertEquals( + verifyFrame( binary("2475605035891613002328091601152806086750106533350c00000000000a000000000000e1ff4f97007f1607"), decoder.decode(null, null, binary("2475605035891613002328091601152806086750106533350c00000000000a000000000000e1ff4f97007f1607"))); - Assert.assertEquals( + verifyFrame( binary("28333132303832303032392C5730312C30323535332E333535352C452C323433382E303939372C532C412C3137313031322C3035333333392C302C382C32302C362C33312C352C32302C323029"), decoder.decode(null, null, binary("28333132303832303032392C5730312C30323535332E333535352C452C323433382E303939372C532C412C3137313031322C3035333333392C302C382C32302C362C33312C352C32302C323029"))); - Assert.assertEquals( + verifyFrame( binary("24312082002911001B171012053405243809970255335555000406140003EE2B91044D1F02"), decoder.decode(null, null, binary("24312082002911001B171012053405243809970255335555000406140003EE2B91044D1F02"))); - Assert.assertEquals( + verifyFrame( binary("28373536303430353535332c404a5429"), decoder.decode(null, null, binary("28373536303430353535332c404a5429"))); diff --git a/test/org/traccar/protocol/SigfoxProtocolDecoderTest.java b/test/org/traccar/protocol/SigfoxProtocolDecoderTest.java new file mode 100644 index 000000000..86ae225ee --- /dev/null +++ b/test/org/traccar/protocol/SigfoxProtocolDecoderTest.java @@ -0,0 +1,19 @@ +package org.traccar.protocol; + +import org.jboss.netty.handler.codec.http.HttpMethod; +import org.junit.Test; +import org.traccar.ProtocolTest; + +public class SigfoxProtocolDecoderTest extends ProtocolTest { + + @Test + public void testDecode() throws Exception { + + SigfoxProtocolDecoder decoder = new SigfoxProtocolDecoder(new SigfoxProtocol()); + + verifyPosition(decoder, request(HttpMethod.POST, "/", + buffer("%7B++%22device%22%3A%222BF839%22%2C++%22time%22%3A1510605882%2C++%22duplicate%22%3Afalse%2C++%22snr%22%3A45.61%2C++%22station%22%3A%2235A9%22%2C++%22data%22%3A%2200bd6475e907398e562d01b9%22%2C++%22avgSnr%22%3A45.16%2C++%22lat%22%3A-38.0%2C++%22lng%22%3A145.0%2C++%22rssi%22%3A-98.00%2C++%22seqNumber%22%3A228+%7D="))); + + } + +} diff --git a/test/org/traccar/protocol/StarcomProtocolDecoderTest.java b/test/org/traccar/protocol/StarcomProtocolDecoderTest.java new file mode 100644 index 000000000..08369eccf --- /dev/null +++ b/test/org/traccar/protocol/StarcomProtocolDecoderTest.java @@ -0,0 +1,18 @@ +package org.traccar.protocol; + +import org.junit.Test; +import org.traccar.ProtocolTest; + +public class StarcomProtocolDecoderTest extends ProtocolTest { + + @Test + public void testDecode() throws Exception { + + StarcomProtocolDecoder decoder = new StarcomProtocolDecoder(new StarcomProtocol()); + + verifyPosition(decoder, text( + "|unit=836673,unittype=5,address=186.227.158.251,kind=1,pending=1,mileage=23.808,odometer=1300,logic_state=1,reason=1,eventid=52,response=1,longitude=-46.50328,latitude=-23.54878,altitude=786,gps_valid=1,gps_connected=1,satellites=7,velocity=1,heading=0,emergency=0,driver=0,ignition=1,door=1,arm=0,disarm=0,extra1=0,extra2=0,extra3=0,siren=0,lock=0,immobilizer=1,unlock=0,fuel=0,rpm=0,modemsignal=0,main_voltage=12.06,backup_voltage=-1.00,analog1=0.00,analog2=0.00,analog3=0.00,datetime_utc=2017/11/16 03:18:59,datetime_actual=2017/11/16 03:18:59,network=TCPIP.1|\r\n")); + + } + +} |