aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-10-20 20:59:39 +1300
committerGitHub <noreply@github.com>2016-10-20 20:59:39 +1300
commit1b903a5fb7d54201b81805ae549a8ece31300366 (patch)
tree8cdff4b3bf3a4ac2cb0582b4c7eb72773b6fd8a2
parent4f7356cc1c6962f46ca522246d5b63dc06a2d268 (diff)
parentd997b79ec28ae8f2d8778ee388c342dbf40bc40e (diff)
downloadtrackermap-server-1b903a5fb7d54201b81805ae549a8ece31300366.tar.gz
trackermap-server-1b903a5fb7d54201b81805ae549a8ece31300366.tar.bz2
trackermap-server-1b903a5fb7d54201b81805ae549a8ece31300366.zip
Merge pull request #2461 from renaudallard/master
Log device uniqueId in filters logging
-rw-r--r--src/org/traccar/FilterHandler.java11
-rw-r--r--test/org/traccar/BaseTest.java (renamed from test/org/traccar/EventHandlerTest.java)2
-rw-r--r--test/org/traccar/FilterHandlerTest.java6
-rw-r--r--test/org/traccar/ProtocolTest.java36
-rw-r--r--test/org/traccar/events/AlertEventHandlerTest.java4
-rw-r--r--test/org/traccar/events/CommandResultEventHandlerTest.java4
-rw-r--r--test/org/traccar/events/IgnitionEventHandlerTest.java4
-rw-r--r--test/org/traccar/events/MotionEventHandlerTest.java4
8 files changed, 24 insertions, 47 deletions
diff --git a/src/org/traccar/FilterHandler.java b/src/org/traccar/FilterHandler.java
index 83d79a3c0..f9904ccaf 100644
--- a/src/org/traccar/FilterHandler.java
+++ b/src/org/traccar/FilterHandler.java
@@ -175,7 +175,16 @@ public class FilterHandler extends BaseDataHandler {
}
if (filterType.length() > 0 && !filterLimit(position)) {
- Log.info("Position filtered by " + filterType.toString() + "filters from " + position.getDeviceId());
+
+ StringBuilder message = new StringBuilder();
+ message.append("Position filtered by ");
+ message.append(filterType.toString());
+ message.append("filters from device: ");
+ message.append(Context.getIdentityManager().getDeviceById(position.getDeviceId()).getUniqueId());
+ message.append(" with id: ");
+ message.append(position.getDeviceId());
+
+ Log.info(message.toString());
return true;
}
diff --git a/test/org/traccar/EventHandlerTest.java b/test/org/traccar/BaseTest.java
index 423a5084f..0d74f50e5 100644
--- a/test/org/traccar/EventHandlerTest.java
+++ b/test/org/traccar/BaseTest.java
@@ -4,7 +4,7 @@ import org.traccar.database.IdentityManager;
import org.traccar.model.Device;
import org.traccar.model.Position;
-public class EventHandlerTest {
+public class BaseTest {
static {
Context.init(new IdentityManager() {
diff --git a/test/org/traccar/FilterHandlerTest.java b/test/org/traccar/FilterHandlerTest.java
index bb7e69dc0..ea06a490d 100644
--- a/test/org/traccar/FilterHandlerTest.java
+++ b/test/org/traccar/FilterHandlerTest.java
@@ -6,9 +6,11 @@ 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 {
+public class FilterHandlerTest extends BaseTest {
private FilterHandler filtingHandler;
private FilterHandler passingHandler;
@@ -32,7 +34,7 @@ public class FilterHandlerTest {
filtingHandler = null;
passingHandler = null;
}
-
+
private Position createPosition(
long deviceId,
Date time,
diff --git a/test/org/traccar/ProtocolTest.java b/test/org/traccar/ProtocolTest.java
index c6c957679..8211e9d6d 100644
--- a/test/org/traccar/ProtocolTest.java
+++ b/test/org/traccar/ProtocolTest.java
@@ -22,41 +22,7 @@ import java.util.List;
import java.util.Map;
import java.util.TimeZone;
-public class ProtocolTest {
-
- 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;
- }
-
- });
- }
+public class ProtocolTest extends BaseTest {
protected Position position(String time, boolean valid, double lat, double lon) throws ParseException {
diff --git a/test/org/traccar/events/AlertEventHandlerTest.java b/test/org/traccar/events/AlertEventHandlerTest.java
index c6d5e07d9..77128f066 100644
--- a/test/org/traccar/events/AlertEventHandlerTest.java
+++ b/test/org/traccar/events/AlertEventHandlerTest.java
@@ -6,11 +6,11 @@ import static org.junit.Assert.assertNotNull;
import java.util.Collection;
import org.junit.Test;
-import org.traccar.EventHandlerTest;
+import org.traccar.BaseTest;
import org.traccar.model.Event;
import org.traccar.model.Position;
-public class AlertEventHandlerTest extends EventHandlerTest {
+public class AlertEventHandlerTest extends BaseTest {
@Test
public void testAlertEventHandler() throws Exception {
diff --git a/test/org/traccar/events/CommandResultEventHandlerTest.java b/test/org/traccar/events/CommandResultEventHandlerTest.java
index b09898b4a..f028e86ee 100644
--- a/test/org/traccar/events/CommandResultEventHandlerTest.java
+++ b/test/org/traccar/events/CommandResultEventHandlerTest.java
@@ -6,11 +6,11 @@ import static org.junit.Assert.assertNotNull;
import java.util.Collection;
import org.junit.Test;
-import org.traccar.EventHandlerTest;
+import org.traccar.BaseTest;
import org.traccar.model.Event;
import org.traccar.model.Position;
-public class CommandResultEventHandlerTest extends EventHandlerTest {
+public class CommandResultEventHandlerTest extends BaseTest {
@Test
public void testCommandResultEventHandler() throws Exception {
diff --git a/test/org/traccar/events/IgnitionEventHandlerTest.java b/test/org/traccar/events/IgnitionEventHandlerTest.java
index 96df6e1ed..ad329d139 100644
--- a/test/org/traccar/events/IgnitionEventHandlerTest.java
+++ b/test/org/traccar/events/IgnitionEventHandlerTest.java
@@ -6,11 +6,11 @@ import static org.junit.Assert.assertNotNull;
import java.util.Collection;
import org.junit.Test;
-import org.traccar.EventHandlerTest;
+import org.traccar.BaseTest;
import org.traccar.model.Event;
import org.traccar.model.Position;
-public class IgnitionEventHandlerTest extends EventHandlerTest{
+public class IgnitionEventHandlerTest extends BaseTest {
@Test
public void testIgnitionEventHandler() throws Exception {
diff --git a/test/org/traccar/events/MotionEventHandlerTest.java b/test/org/traccar/events/MotionEventHandlerTest.java
index 34b2c481d..622680d91 100644
--- a/test/org/traccar/events/MotionEventHandlerTest.java
+++ b/test/org/traccar/events/MotionEventHandlerTest.java
@@ -6,11 +6,11 @@ import static org.junit.Assert.assertNotNull;
import java.util.Collection;
import org.junit.Test;
-import org.traccar.EventHandlerTest;
+import org.traccar.BaseTest;
import org.traccar.model.Event;
import org.traccar.model.Position;
-public class MotionEventHandlerTest extends EventHandlerTest {
+public class MotionEventHandlerTest extends BaseTest {
@Test
public void testMotionEventHandler() throws Exception {