From b19f1a505f7088ff48f467b32b5f1c207aa3be01 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Wed, 12 Jul 2017 14:22:03 +0500 Subject: - Handle rfid attributes and populate driverUniqueId - Add Driver Name to Trip report --- test/org/traccar/ProtocolTest.java | 4 ++++ test/org/traccar/processing/PopulateDriverTest.java | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 test/org/traccar/processing/PopulateDriverTest.java (limited to 'test') 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)); + } +} -- cgit v1.2.3