aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org/traccar/ProtocolTest.java
diff options
context:
space:
mode:
authorcasswarry0 <casswarry0@gmail.com>2023-01-17 17:14:53 -0700
committercasswarry0 <casswarry0@gmail.com>2023-01-17 17:14:53 -0700
commit7338b8730949ed027b3f8b31d7dca20687ebbb8b (patch)
treec2d171e6121818ab511460a786f69aab97a2a628 /src/test/java/org/traccar/ProtocolTest.java
parentcdecd3fa4427a382c0b09f8ad9d69ec14388960a (diff)
parent85501f9cf4918d5eee345f83aed7a31eecb26b8d (diff)
downloadtrackermap-server-7338b8730949ed027b3f8b31d7dca20687ebbb8b.tar.gz
trackermap-server-7338b8730949ed027b3f8b31d7dca20687ebbb8b.tar.bz2
trackermap-server-7338b8730949ed027b3f8b31d7dca20687ebbb8b.zip
Merge branch 'master' into develop
Diffstat (limited to 'src/test/java/org/traccar/ProtocolTest.java')
-rw-r--r--src/test/java/org/traccar/ProtocolTest.java27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/test/java/org/traccar/ProtocolTest.java b/src/test/java/org/traccar/ProtocolTest.java
index c40a15dcc..5e37f44b9 100644
--- a/src/test/java/org/traccar/ProtocolTest.java
+++ b/src/test/java/org/traccar/ProtocolTest.java
@@ -4,14 +4,17 @@ import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufUtil;
import io.netty.buffer.Unpooled;
import io.netty.handler.codec.http.DefaultFullHttpRequest;
+import io.netty.handler.codec.http.DefaultFullHttpResponse;
import io.netty.handler.codec.http.DefaultHttpHeaders;
import io.netty.handler.codec.http.HttpHeaders;
import io.netty.handler.codec.http.HttpMethod;
+import io.netty.handler.codec.http.HttpResponseStatus;
import io.netty.handler.codec.http.HttpVersion;
import org.traccar.helper.DataConverter;
import org.traccar.model.CellTower;
import org.traccar.model.Command;
import org.traccar.model.Position;
+import org.traccar.model.WifiAccessPoint;
import java.nio.charset.StandardCharsets;
import java.text.DateFormat;
@@ -89,6 +92,10 @@ public class ProtocolTest extends BaseTest {
return new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, method, url, Unpooled.buffer(), headers, new DefaultHttpHeaders());
}
+ protected DefaultFullHttpResponse response(ByteBuf data) {
+ return new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK, data);
+ }
+
protected void verifyNotNull(BaseProtocolDecoder decoder, Object object) throws Exception {
assertNotNull(decoder.decode(null, null, object));
}
@@ -304,12 +311,20 @@ public class ProtocolTest extends BaseTest {
assertTrue(attributes.get(Position.KEY_RESULT) instanceof String);
}
- if (position.getNetwork() != null && position.getNetwork().getCellTowers() != null) {
- for (CellTower cellTower : position.getNetwork().getCellTowers()) {
- checkInteger(cellTower.getMobileCountryCode(), 0, 999);
- checkInteger(cellTower.getMobileNetworkCode(), 0, 999);
- checkInteger(cellTower.getLocationAreaCode(), 1, 65535);
- checkInteger(cellTower.getCellId(), 0, 268435455);
+ if (position.getNetwork() != null) {
+ if (position.getNetwork().getCellTowers() != null) {
+ for (CellTower cellTower : position.getNetwork().getCellTowers()) {
+ checkInteger(cellTower.getMobileCountryCode(), 0, 999);
+ checkInteger(cellTower.getMobileNetworkCode(), 0, 999);
+ checkInteger(cellTower.getLocationAreaCode(), 1, 65535);
+ checkInteger(cellTower.getCellId(), 0, 268435455);
+ }
+ }
+
+ if (position.getNetwork().getWifiAccessPoints() != null) {
+ for (WifiAccessPoint wifiAccessPoint : position.getNetwork().getWifiAccessPoints()) {
+ assertTrue(wifiAccessPoint.getMacAddress().matches("((\\p{XDigit}{2}):){5}(\\p{XDigit}{2})"));
+ }
}
}