aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org/traccar/protocol
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/org/traccar/protocol')
-rw-r--r--src/test/java/org/traccar/protocol/OutsafeProtocolDecoderTest.java19
-rw-r--r--src/test/java/org/traccar/protocol/Tk103ProtocolEncoderTest.java38
-rw-r--r--src/test/java/org/traccar/protocol/TopinProtocolDecoderTest.java24
3 files changed, 62 insertions, 19 deletions
diff --git a/src/test/java/org/traccar/protocol/OutsafeProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/OutsafeProtocolDecoderTest.java
new file mode 100644
index 000000000..82bc7dec7
--- /dev/null
+++ b/src/test/java/org/traccar/protocol/OutsafeProtocolDecoderTest.java
@@ -0,0 +1,19 @@
+package org.traccar.protocol;
+
+import io.netty.handler.codec.http.HttpMethod;
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+
+public class OutsafeProtocolDecoderTest extends ProtocolTest {
+
+ @Test
+ public void testDecode() throws Exception {
+
+ OutsafeProtocolDecoder decoder = new OutsafeProtocolDecoder(null);
+
+ verifyPosition(decoder, request(HttpMethod.POST, "/",
+ buffer("{\"device\":\"1e09d88a-fe8e-4dee-90b9-6297088ff3de\",\"owner\":\"\",\"data\":{\"cmd\":\"GEO\",\"ms1\":82,\"ms2\":80,\"ms3\":5266,\"ms4\":-68,\"observation\":\"$NMEA 323455\",\"content\":null},\"time\":null,\"origin\":\"TCP\",\"latitude\":19.334734,\"longitude\":-99.307236,\"altitude\":2000,\"heading\":0,\"rssi\":123}")));
+
+ }
+
+}
diff --git a/src/test/java/org/traccar/protocol/Tk103ProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/Tk103ProtocolEncoderTest.java
index d1dad8c92..82e0e0d88 100644
--- a/src/test/java/org/traccar/protocol/Tk103ProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/Tk103ProtocolEncoderTest.java
@@ -23,7 +23,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEncodeEngineStop() throws Exception {
+ public void testEncodeEngineStop() {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
@@ -36,7 +36,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEncodePositionSingle() throws Exception {
+ public void testEncodePositionSingle() {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
@@ -49,7 +49,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEncodePositionPeriodic() throws Exception {
+ public void testEncodePositionPeriodic() {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
@@ -63,7 +63,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEncodePositionStop() throws Exception {
+ public void testEncodePositionStop() {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
@@ -76,7 +76,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEncodeGetVersion() throws Exception {
+ public void testEncodeGetVersion() {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
@@ -89,7 +89,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEncodeRebootDevice() throws Exception {
+ public void testEncodeRebootDevice() {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
@@ -102,7 +102,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEncodeSetOdometer() throws Exception {
+ public void testEncodeSetOdometer() {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
@@ -115,7 +115,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEncodePositionSingleAlternative() throws Exception {
+ public void testEncodePositionSingleAlternative() {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
@@ -128,7 +128,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEncodePositionPeriodicAlternative() throws Exception {
+ public void testEncodePositionPeriodicAlternative() {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
@@ -141,7 +141,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEncodePositionStopAlternative() throws Exception {
+ public void testEncodePositionStopAlternative() {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
@@ -154,7 +154,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEncodeGetVersionAlternative() throws Exception {
+ public void testEncodeGetVersionAlternative() {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
@@ -167,7 +167,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEncodeRebootDeviceAlternative() throws Exception {
+ public void testEncodeRebootDeviceAlternative() {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
@@ -180,7 +180,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEncodeIdentificationAlternative() throws Exception {
+ public void testEncodeIdentificationAlternative() {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
@@ -193,7 +193,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEncodeSosOnAlternative() throws Exception {
+ public void testEncodeSosOnAlternative() {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
@@ -207,7 +207,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEncodeSosOffAlternative() throws Exception {
+ public void testEncodeSosOffAlternative() {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
@@ -221,7 +221,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEncodeCustom() throws Exception {
+ public void testEncodeCustom() {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
@@ -235,7 +235,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEncodeCustomAlternative() throws Exception {
+ public void testEncodeCustomAlternative() {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
@@ -249,7 +249,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEncodeSetConnectionAlternative() throws Exception {
+ public void testEncodeSetConnectionAlternative() {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
@@ -264,7 +264,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEncodeSosNumberAlternative() throws Exception {
+ public void testEncodeSosNumberAlternative() {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
diff --git a/src/test/java/org/traccar/protocol/TopinProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/TopinProtocolDecoderTest.java
new file mode 100644
index 000000000..2fb734462
--- /dev/null
+++ b/src/test/java/org/traccar/protocol/TopinProtocolDecoderTest.java
@@ -0,0 +1,24 @@
+package org.traccar.protocol;
+
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+
+public class TopinProtocolDecoderTest extends ProtocolTest {
+
+ @Test
+ public void testDecode() throws Exception {
+
+ TopinProtocolDecoder decoder = new TopinProtocolDecoder(null);
+
+ verifyNull(decoder, binary(
+ "78780d0103593390754169634d0d0a"));
+
+ verifyPosition(decoder, binary(
+ "787812100a03170f32179c026b3f3e0c22ad651f34600d0a"));
+
+ verifyAttributes(decoder, binary(
+ "78780713514d0819640d0a"));
+
+ }
+
+}