aboutsummaryrefslogtreecommitdiff
path: root/test/org
diff options
context:
space:
mode:
Diffstat (limited to 'test/org')
-rw-r--r--test/org/traccar/FilterHandlerTest.java10
-rw-r--r--test/org/traccar/ProtocolTest.java4
-rw-r--r--test/org/traccar/geocoder/GeocoderTest.java2
-rw-r--r--test/org/traccar/protocol/CellocatorProtocolDecoderTest.java6
-rw-r--r--test/org/traccar/protocol/CellocatorProtocolEncoderTest.java26
-rw-r--r--test/org/traccar/protocol/Gl200ProtocolDecoderTest.java9
-rw-r--r--test/org/traccar/protocol/H02FrameDecoderTest.java4
-rw-r--r--test/org/traccar/protocol/KhdProtocolDecoderTest.java3
-rw-r--r--test/org/traccar/protocol/MiniFinderProtocolDecoderTest.java2
-rw-r--r--test/org/traccar/protocol/PricolProtocolDecoderTest.java3
-rw-r--r--test/org/traccar/protocol/TaipProtocolDecoderTest.java6
-rw-r--r--test/org/traccar/protocol/Tk103ProtocolDecoderTest.java3
-rw-r--r--test/org/traccar/protocol/TmgProtocolDecoderTest.java8
13 files changed, 75 insertions, 11 deletions
diff --git a/test/org/traccar/FilterHandlerTest.java b/test/org/traccar/FilterHandlerTest.java
index 11b4163a1..452592048 100644
--- a/test/org/traccar/FilterHandlerTest.java
+++ b/test/org/traccar/FilterHandlerTest.java
@@ -1,14 +1,14 @@
package org.traccar;
-import java.util.Date;
import org.junit.After;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
import org.junit.Before;
import org.junit.Test;
-import org.traccar.database.IdentityManager;
import org.traccar.model.Position;
-import org.traccar.model.Device;
+
+import java.util.Date;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
public class FilterHandlerTest extends BaseTest {
diff --git a/test/org/traccar/ProtocolTest.java b/test/org/traccar/ProtocolTest.java
index 955e0b788..f4072ad24 100644
--- a/test/org/traccar/ProtocolTest.java
+++ b/test/org/traccar/ProtocolTest.java
@@ -6,10 +6,8 @@ import org.jboss.netty.handler.codec.http.DefaultHttpRequest;
import org.jboss.netty.handler.codec.http.HttpMethod;
import org.jboss.netty.handler.codec.http.HttpVersion;
import org.junit.Assert;
-import org.traccar.database.IdentityManager;
import org.traccar.model.CellTower;
import org.traccar.model.Command;
-import org.traccar.model.Device;
import org.traccar.model.Position;
import javax.xml.bind.DatatypeConverter;
@@ -147,7 +145,7 @@ public class ProtocolTest extends BaseTest {
} else {
Assert.assertNotNull(position.getFixTime());
- Assert.assertTrue("year > 2000", position.getFixTime().after(new Date(946684800000L)));
+ Assert.assertTrue("year > 1999", position.getFixTime().after(new Date(915148800000L)));
Assert.assertTrue("time < +25 hours",
position.getFixTime().getTime() < System.currentTimeMillis() + 25 * 3600000);
diff --git a/test/org/traccar/geocoder/GeocoderTest.java b/test/org/traccar/geocoder/GeocoderTest.java
index a5aecc8cf..6f4fc1710 100644
--- a/test/org/traccar/geocoder/GeocoderTest.java
+++ b/test/org/traccar/geocoder/GeocoderTest.java
@@ -94,7 +94,7 @@ public class GeocoderTest {
}
public void testGeocodeFarm() throws InterruptedException {
- Geocoder geocoder = new GeocodeFarmGeocoder(null, 0);
+ Geocoder geocoder = new GeocodeFarmGeocoder(null, null, 0);
geocoder.getAddress(new AddressFormat(), 34.116302, -118.051519, new Geocoder.ReverseGeocoderCallback() {
@Override
diff --git a/test/org/traccar/protocol/CellocatorProtocolDecoderTest.java b/test/org/traccar/protocol/CellocatorProtocolDecoderTest.java
index fe03bc3d5..cdda0fca7 100644
--- a/test/org/traccar/protocol/CellocatorProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/CellocatorProtocolDecoderTest.java
@@ -13,6 +13,12 @@ public class CellocatorProtocolDecoderTest extends ProtocolTest {
CellocatorProtocolDecoder decoder = new CellocatorProtocolDecoder(new CellocatorProtocol());
verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "4D434750008AD01500080103011804000000460020000000005E750000000000000000000000C34300040204DA4DA30367195703E803000000000000000001030F0802E10778"));
+
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "4D434750008AD01500080102011804000000360060000000005E750000000000000000000000C24300040204DA4DA30367195703E80300000000000000003B020F0802E107DF"));
+
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
"4D4347500006000000081A02021204000000210062300000006B00E100000000000000000000E5A100040206614EA303181A57034E1200000000000000001525071403D60749"));
verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
diff --git a/test/org/traccar/protocol/CellocatorProtocolEncoderTest.java b/test/org/traccar/protocol/CellocatorProtocolEncoderTest.java
new file mode 100644
index 000000000..89850fb5f
--- /dev/null
+++ b/test/org/traccar/protocol/CellocatorProtocolEncoderTest.java
@@ -0,0 +1,26 @@
+package org.traccar.protocol;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+import org.traccar.model.Command;
+
+public class CellocatorProtocolEncoderTest extends ProtocolTest {
+
+ @Ignore
+ @Test
+ public void testEncode() throws Exception {
+
+ CellocatorProtocolEncoder encoder = new CellocatorProtocolEncoder();
+
+ Command command = new Command();
+ command.setDeviceId(1);
+ command.setType(Command.TYPE_OUTPUT_CONTROL);
+ command.set(Command.KEY_INDEX, 0);
+ command.set(Command.KEY_DATA, "1");
+
+ verifyCommand(encoder, command, binary("4D434750000000000000000000000303101000000000000026"));
+
+ }
+
+}
diff --git a/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java b/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java
index a4b8985f1..e2ac176f0 100644
--- a/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java
@@ -10,6 +10,15 @@ public class Gl200ProtocolDecoderTest extends ProtocolTest {
Gl200ProtocolDecoder decoder = new Gl200ProtocolDecoder(new Gl200Protocol());
+ verifyNothing(decoder, text(
+ "+RESP:GTGSM,400201,862365030034940,STR,0234,0030,0870,2469,19,,0234,0030,0870,35ee,18,,0234,0030,0870,16ac,12,,0234,0030,0870,16b2,11,,0234,0030,0870,360f,6,,0234,0030,0870,165d,6,,0234,0030,0870,35ef,17,,20170215220049,008D$"));
+
+ verifyPosition(decoder, text(
+ "+RESP:GTSTR,400201,862365030034940,GL500,0,0,2,21.1,86,0,1.6,0,5.8,0.622831,51.582688,20170215090422,0234,0030,0870,35EF,,,,20170215220049,008C$"));
+
+ verifyPositions(decoder, text(
+ "+RESP:GTFRI,2C0402,867162020000816,,0,0,1,2,0.3,337,245.7,-82.373387,34.634011,20170215003054,,,,,,63,20170215003241,3EAB$"));
+
verifyNotNull(decoder, text(
"+RESP:GTWIF,210102,354524044608058,,4,c413e200ff14,-39,,,,c413e2010e55,-39,,,,c8d3ff04a837,-43,,,,42490f997c6d,-57,,,,,,,,100,20170201020055,0001$"));
diff --git a/test/org/traccar/protocol/H02FrameDecoderTest.java b/test/org/traccar/protocol/H02FrameDecoderTest.java
index 1505e25ac..3ced35d53 100644
--- a/test/org/traccar/protocol/H02FrameDecoderTest.java
+++ b/test/org/traccar/protocol/H02FrameDecoderTest.java
@@ -12,6 +12,10 @@ public class H02FrameDecoderTest extends ProtocolTest {
H02FrameDecoder decoder = new H02FrameDecoder(0);
Assert.assertEquals(
+ binary("2a48512c3335353438383032303131333931312c56312c3031323934352c412c353233312e37393238332c4e2c30313332342e31303731382c452c302e30352c302c3137303231372c464646464646464623"),
+ decoder.decode(null, null, binary("2a48512c3335353438383032303131333931312c56312c3031323934352c412c353233312e37393238332c4e2c30313332342e31303731382c452c302e30352c302c3137303231372c4646464646464646230d0a")));
+
+ Assert.assertEquals(
binary("2441060116601245431311165035313006004318210e000000fffffbffff0024"),
decoder.decode(null, null, binary("2441060116601245431311165035313006004318210e000000fffffbffff0024")));
diff --git a/test/org/traccar/protocol/KhdProtocolDecoderTest.java b/test/org/traccar/protocol/KhdProtocolDecoderTest.java
index c58600bed..e85695be8 100644
--- a/test/org/traccar/protocol/KhdProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/KhdProtocolDecoderTest.java
@@ -14,6 +14,9 @@ public class KhdProtocolDecoderTest extends ProtocolTest {
"2929b1000605162935b80d"));
verifyPosition(decoder, binary(
+ "2929a3002e1780c663170216203353003060811013839500000114f8000000ffff5000000a00000000000000060102003db70d"));
+
+ verifyPosition(decoder, binary(
"292980002805162935140108074727801129670365336900000103ffff000082fc0000001e78091b000000360d"));
verifyPosition(decoder, binary(
diff --git a/test/org/traccar/protocol/MiniFinderProtocolDecoderTest.java b/test/org/traccar/protocol/MiniFinderProtocolDecoderTest.java
index ccefee049..57201670f 100644
--- a/test/org/traccar/protocol/MiniFinderProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/MiniFinderProtocolDecoderTest.java
@@ -20,7 +20,7 @@ public class MiniFinderProtocolDecoderTest extends ProtocolTest {
"!1,860719027585011"));
verifyPosition(decoder, text(
- "!D,28/11/16,00:04:09,42.926067,-85.747589,124,236,140001,179.8,60,11,16,0;"));
+ "!D,28/11/16,00:04:09,42.926067,-85.747589,124,236,140001,179.8,60,11,16,0"));
verifyPosition(decoder, text(
"!C,30/1/16,1:1:6,31.259157,30.020910,0,0,100001,25.32,100,0.03,0.01,0"));
diff --git a/test/org/traccar/protocol/PricolProtocolDecoderTest.java b/test/org/traccar/protocol/PricolProtocolDecoderTest.java
index 3826d56c4..0c792a8ec 100644
--- a/test/org/traccar/protocol/PricolProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/PricolProtocolDecoderTest.java
@@ -10,6 +10,9 @@ public class PricolProtocolDecoderTest extends ProtocolTest {
PricolProtocolDecoder decoder = new PricolProtocolDecoder(new PricolProtocol());
+ verifyPosition(decoder, binary(
+ "3c5052493030303350020000011402110b222b0455152e4e001de819ca450000000000000003820249000000000000000000000000000000000000000040003e"));
+
verifyNotNull(decoder, binary(
"3c544553303030324b02000000000000000000000000000000000000000000000000000000037c01f4000000000000000000000000000000000000000000003e"));
diff --git a/test/org/traccar/protocol/TaipProtocolDecoderTest.java b/test/org/traccar/protocol/TaipProtocolDecoderTest.java
index 871ec84b3..74956f51c 100644
--- a/test/org/traccar/protocol/TaipProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/TaipProtocolDecoderTest.java
@@ -11,6 +11,12 @@ public class TaipProtocolDecoderTest extends ProtocolTest {
TaipProtocolDecoder decoder = new TaipProtocolDecoder(new TaipProtocol(), false);
verifyPosition(decoder, text(
+ ">RCQ09000000000000-3460365-058381460000007F0000000000000115000FFFF1099;#0000;ID=555224;*05<"));
+
+ verifyPosition(decoder, text(
+ ">RBR00130217040848-3462200-05846708000175FF0022900003B3C13010800001118410+24061A;ID=555224;*07<"));
+
+ verifyPosition(decoder, text(
">REV451891352379+0307152+1016143700000012;SV=8;BL=4416;VO=8055;ID=356612026322000<"));
verifyPosition(decoder, text(
diff --git a/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java b/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java
index 3f4e12940..e6ca3f218 100644
--- a/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java
@@ -11,6 +11,9 @@ public class Tk103ProtocolDecoderTest extends ProtocolTest {
Tk103ProtocolDecoder decoder = new Tk103ProtocolDecoder(new Tk103Protocol());
verifyPosition(decoder, text(
+ "(087073803649BR00170221A6142.0334N02712.2197E000.3203149000.00,00000000L00000000)"));
+
+ verifyPosition(decoder, text(
"(864768010869060,DW30,050117,A,5135.82713N,00001.17918E,0.089,154745,000.0,43.40,12)"));
verifyNotNull(decoder, text(
diff --git a/test/org/traccar/protocol/TmgProtocolDecoderTest.java b/test/org/traccar/protocol/TmgProtocolDecoderTest.java
index cbfe82abc..2fac25dab 100644
--- a/test/org/traccar/protocol/TmgProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/TmgProtocolDecoderTest.java
@@ -11,6 +11,12 @@ public class TmgProtocolDecoderTest extends ProtocolTest {
TmgProtocolDecoder decoder = new TmgProtocolDecoder(new TmgProtocol());
verifyPosition(decoder, text(
+ "$nor,L,868325023006341,14022017,103947,1,2836.6542,N,07706.2504,E,0.0,0.0,0.0,0.0,0,22,VODAFONE - DELH,15,49B7,1,2.57,13.2,00000010,00000000,0111,00.0,00.0,0.0,SW10.12,NA,#"));
+
+ verifyPosition(decoder, text(
+ "$rid,L,868325023006341,14022017,103706,1,2836.6542,N,07706.2504,E,0.0,0.0,0.0,0.0,0,22,VODAFONE - DELH,15,49B7,1,2.57,13.2,00000011,00000000,0111,00.0,00.0,0.0,SW10.12,0004909463,#"));
+
+ verifyPosition(decoder, text(
"$ion,H,868324023777431,27012017,101057,4,2830.2952,N,07705.2532,E,0.0,202.38,225.9,1.22,8,20,N.A,0,N.A,1,4.09,00.0,00000111,00000000,1101,00.0-00.0,00.0-0.0,4.42,01.02,#"));
verifyPosition(decoder, text(
@@ -32,7 +38,7 @@ public class TmgProtocolDecoderTest extends ProtocolTest {
"$nor,L,868324023777431,17012017,001523,4,2830.2939,N,07705.2527,E,0.0,50.96,236.5,1.05,11,21,IDEA CELLULAR L,18,DCDE,0,4.09,12.8,00000111,00000000,1111,00.0-00.0,00.0-0.0,3.59,01.02,#"));
verifyPosition(decoder, text(
- "$nor,L,869309999985699,24062015,094459,4,2826.1956,N,07659.7690,E,67.5,2.5,167,0.82,15,22,airtel,31,4441,1,4.1,12.7,00000011,00000011,1111,0.0,0.0, 21.3,SW00.01,#"));
+ "$nor,L,869309999985699,24062015,094459,4,2826.1956,N,07659.7690,E,67.5,2.5,167,0.82,15,22,airtel,31,4441,1,4.1,12.7,00000011,00000011,1111,0.0,0.0,21.3,SW00.01,#"));
}