aboutsummaryrefslogtreecommitdiff
path: root/test/org
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-07-12 14:22:03 +0500
committerAbyss777 <abyss@fox5.ru>2017-07-12 15:20:07 +0500
commitb19f1a505f7088ff48f467b32b5f1c207aa3be01 (patch)
tree663ef14ec15af04e5d9062c2185cd020fb5b9e42 /test/org
parent4f3830d844dd0542e9e7b09e7a6c17ffbb796264 (diff)
downloadtrackermap-server-b19f1a505f7088ff48f467b32b5f1c207aa3be01.tar.gz
trackermap-server-b19f1a505f7088ff48f467b32b5f1c207aa3be01.tar.bz2
trackermap-server-b19f1a505f7088ff48f467b32b5f1c207aa3be01.zip
- Handle rfid attributes and populate driverUniqueId
- Add Driver Name to Trip report
Diffstat (limited to 'test/org')
-rw-r--r--test/org/traccar/ProtocolTest.java4
-rw-r--r--test/org/traccar/processing/PopulateDriverTest.java21
2 files changed, 25 insertions, 0 deletions
diff --git a/test/org/traccar/ProtocolTest.java b/test/org/traccar/ProtocolTest.java
index 3b801c6eb..dc4f70981 100644
--- a/test/org/traccar/ProtocolTest.java
+++ b/test/org/traccar/ProtocolTest.java
@@ -245,6 +245,10 @@ public class ProtocolTest extends BaseTest {
Assert.assertTrue(attributes.get(Position.KEY_ARCHIVE) instanceof Boolean);
}
+ if (attributes.containsKey(Position.KEY_RFID)) {
+ Assert.assertTrue(attributes.get(Position.KEY_RFID) instanceof String);
+ }
+
if (position.getNetwork() != null && position.getNetwork().getCellTowers() != null) {
for (CellTower cellTower : position.getNetwork().getCellTowers()) {
checkInteger(cellTower.getMobileCountryCode(), 0, 999);
diff --git a/test/org/traccar/processing/PopulateDriverTest.java b/test/org/traccar/processing/PopulateDriverTest.java
new file mode 100644
index 000000000..7c6ee9f06
--- /dev/null
+++ b/test/org/traccar/processing/PopulateDriverTest.java
@@ -0,0 +1,21 @@
+package org.traccar.processing;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.traccar.model.Position;
+
+public class PopulateDriverTest {
+
+ @Test
+ public void testPopulateDriver() {
+ Position position = new Position();
+ PopulateDriverHandler populateDriverHandler = new PopulateDriverHandler();
+ Assert.assertNull(populateDriverHandler.handlePosition(position).getString(Position.KEY_DRIVER_UNIQUE_ID));
+ position.set(Position.KEY_DRIVER_UNIQUE_ID, "123");
+ Assert.assertEquals("123",
+ populateDriverHandler.handlePosition(position).getString(Position.KEY_DRIVER_UNIQUE_ID));
+ position.set(Position.KEY_RFID, "321");
+ Assert.assertEquals("321",
+ populateDriverHandler.handlePosition(position).getString(Position.KEY_DRIVER_UNIQUE_ID));
+ }
+}