From e7a545ee8b6d03ab085896ac162da7ae12e5557d Mon Sep 17 00:00:00 2001 From: Renaud Allard Date: Wed, 19 Oct 2016 15:10:07 +0200 Subject: Log device uniqueId in filters logging This combined with another commit to traccar-web makes it easier to see which device has been filtered. --- test/org/traccar/FilterHandlerTest.java | 38 ++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/org/traccar/FilterHandlerTest.java b/test/org/traccar/FilterHandlerTest.java index bb7e69dc0..9c2ce416e 100644 --- a/test/org/traccar/FilterHandlerTest.java +++ b/test/org/traccar/FilterHandlerTest.java @@ -6,10 +6,46 @@ 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; public class FilterHandlerTest { + static { + Context.init(new IdentityManager() { + + private Device createDevice() { + Device device = new Device(); + device.setId(1); + device.setName("test"); + device.setUniqueId("123456789012345"); + return device; + } + + @Override + public Device getDeviceById(long id) { + return createDevice(); + } + + @Override + public Device getDeviceByUniqueId(String uniqueId) { + return createDevice(); + } + + @Override + public Position getLastPosition(long deviceId) { + return null; + } + + @Override + public boolean isLatestPosition(Position position) { + return true; + } + + }); + } + private FilterHandler filtingHandler; private FilterHandler passingHandler; @@ -32,7 +68,7 @@ public class FilterHandlerTest { filtingHandler = null; passingHandler = null; } - + private Position createPosition( long deviceId, Date time, -- cgit v1.2.3