aboutsummaryrefslogtreecommitdiff
path: root/test/org
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2019-03-09 15:01:08 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2019-03-09 15:01:08 -0800
commite3668177e4cb989b596ed7b2eef71eb348860736 (patch)
tree7c5a0f131471ce8a3b5206a42fb44bb310d6ccf5 /test/org
parent2af6e4cc6255f59acaa17e6763063b775d7ba1ea (diff)
downloadtraccar-server-e3668177e4cb989b596ed7b2eef71eb348860736.tar.gz
traccar-server-e3668177e4cb989b596ed7b2eef71eb348860736.tar.bz2
traccar-server-e3668177e4cb989b596ed7b2eef71eb348860736.zip
Refactor motion event handler
Diffstat (limited to 'test/org')
-rw-r--r--test/org/traccar/handler/events/MotionEventHandlerTest.java6
-rw-r--r--test/org/traccar/reports/ReportUtilsTest.java40
2 files changed, 30 insertions, 16 deletions
diff --git a/test/org/traccar/handler/events/MotionEventHandlerTest.java b/test/org/traccar/handler/events/MotionEventHandlerTest.java
index 8e643c476..f57c16635 100644
--- a/test/org/traccar/handler/events/MotionEventHandlerTest.java
+++ b/test/org/traccar/handler/events/MotionEventHandlerTest.java
@@ -31,7 +31,7 @@ public class MotionEventHandlerTest extends BaseTest {
@Test
public void testMotionWithPosition() throws Exception {
MotionEventHandler motionEventHandler = new MotionEventHandler(
- new TripsConfig(500, 300 * 1000, 300 * 1000, 0, false, false, 0.01));
+ null, null, new TripsConfig(500, 300 * 1000, 300 * 1000, 0, false, false, 0.01));
Position position = new Position();
position.setTime(date("2017-01-01 00:00:00"));
@@ -72,7 +72,7 @@ public class MotionEventHandlerTest extends BaseTest {
@Test
public void testMotionWithStatus() throws Exception {
MotionEventHandler motionEventHandler = new MotionEventHandler(
- new TripsConfig(500, 300 * 1000, 300 * 1000, 0, false, false, 0.01));
+ null, null, new TripsConfig(500, 300 * 1000, 300 * 1000, 0, false, false, 0.01));
Position position = new Position();
position.setTime(new Date(System.currentTimeMillis() - 360000));
@@ -93,7 +93,7 @@ public class MotionEventHandlerTest extends BaseTest {
@Test
public void testStopWithPositionIgnition() throws Exception {
MotionEventHandler motionEventHandler = new MotionEventHandler(
- new TripsConfig(500, 300 * 1000, 300 * 1000, 0, true, false, 0.01));
+ null, null, new TripsConfig(500, 300 * 1000, 300 * 1000, 0, true, false, 0.01));
Position position = new Position();
position.setTime(date("2017-01-01 00:00:00"));
diff --git a/test/org/traccar/reports/ReportUtilsTest.java b/test/org/traccar/reports/ReportUtilsTest.java
index a8ff653c9..01b9c276f 100644
--- a/test/org/traccar/reports/ReportUtilsTest.java
+++ b/test/org/traccar/reports/ReportUtilsTest.java
@@ -17,6 +17,7 @@ import java.util.TimeZone;
import org.junit.Test;
import org.traccar.BaseTest;
+import org.traccar.TestIdentityManager;
import org.traccar.model.Position;
import org.traccar.reports.model.StopReport;
import org.traccar.reports.model.TripReport;
@@ -79,7 +80,8 @@ public class ReportUtilsTest extends BaseTest {
TripsConfig tripsConfig = new TripsConfig(500, 300000, 180000, 900000, false, false, 0.01);
- Collection<TripReport> trips = ReportUtils.detectTripsAndStops(data, tripsConfig, false, TripReport.class);
+ Collection<TripReport> trips = ReportUtils.detectTripsAndStops(
+ new TestIdentityManager(), null, data, tripsConfig, false, TripReport.class);
assertNotNull(trips);
assertFalse(trips.isEmpty());
@@ -93,7 +95,8 @@ public class ReportUtilsTest extends BaseTest {
assertEquals(10, itemTrip.getMaxSpeed(), 0.01);
assertEquals(3000, itemTrip.getDistance(), 0.01);
- Collection<StopReport> stops = ReportUtils.detectTripsAndStops(data, tripsConfig, false, StopReport.class);
+ Collection<StopReport> stops = ReportUtils.detectTripsAndStops(
+ new TestIdentityManager(), null, data, tripsConfig, false, StopReport.class);
assertNotNull(stops);
assertFalse(stops.isEmpty());
@@ -131,7 +134,8 @@ public class ReportUtilsTest extends BaseTest {
TripsConfig tripsConfig = new TripsConfig(500, 300000, 180000, 900000, true, false, 0.01);
- Collection<TripReport> trips = ReportUtils.detectTripsAndStops(data, tripsConfig, false, TripReport.class);
+ Collection<TripReport> trips = ReportUtils.detectTripsAndStops(
+ new TestIdentityManager(), null, data, tripsConfig, false, TripReport.class);
assertNotNull(trips);
assertFalse(trips.isEmpty());
@@ -145,7 +149,8 @@ public class ReportUtilsTest extends BaseTest {
assertEquals(10, itemTrip.getMaxSpeed(), 0.01);
assertEquals(3000, itemTrip.getDistance(), 0.01);
- trips = ReportUtils.detectTripsAndStops(data, tripsConfig, false, TripReport.class);
+ trips = ReportUtils.detectTripsAndStops(
+ new TestIdentityManager(), null, data, tripsConfig, false, TripReport.class);
assertNotNull(trips);
assertFalse(trips.isEmpty());
@@ -159,7 +164,8 @@ public class ReportUtilsTest extends BaseTest {
assertEquals(10, itemTrip.getMaxSpeed(), 0.01);
assertEquals(3000, itemTrip.getDistance(), 0.01);
- Collection<StopReport> stops = ReportUtils.detectTripsAndStops(data, tripsConfig, false, StopReport.class);
+ Collection<StopReport> stops = ReportUtils.detectTripsAndStops(
+ new TestIdentityManager(), null, data, tripsConfig, false, StopReport.class);
assertNotNull(stops);
assertFalse(stops.isEmpty());
@@ -199,7 +205,8 @@ public class ReportUtilsTest extends BaseTest {
TripsConfig tripsConfig = new TripsConfig(500, 300000, 180000, 900000, false, false, 0.01);
- Collection<TripReport> trips = ReportUtils.detectTripsAndStops(data, tripsConfig, false, TripReport.class);
+ Collection<TripReport> trips = ReportUtils.detectTripsAndStops(
+ new TestIdentityManager(), null, data, tripsConfig, false, TripReport.class);
assertNotNull(trips);
assertFalse(trips.isEmpty());
@@ -213,7 +220,8 @@ public class ReportUtilsTest extends BaseTest {
assertEquals(10, itemTrip.getMaxSpeed(), 0.01);
assertEquals(7000, itemTrip.getDistance(), 0.01);
- Collection<StopReport> stops = ReportUtils.detectTripsAndStops(data, tripsConfig, false, StopReport.class);
+ Collection<StopReport> stops = ReportUtils.detectTripsAndStops(
+ new TestIdentityManager(), null, data, tripsConfig, false, StopReport.class);
assertNotNull(stops);
assertFalse(stops.isEmpty());
@@ -247,7 +255,8 @@ public class ReportUtilsTest extends BaseTest {
TripsConfig tripsConfig = new TripsConfig(500, 300000, 200000, 900000, false, false, 0.01);
- Collection<StopReport> result = ReportUtils.detectTripsAndStops(data, tripsConfig, false, StopReport.class);
+ Collection<StopReport> result = ReportUtils.detectTripsAndStops(
+ new TestIdentityManager(), null, data, tripsConfig, false, StopReport.class);
assertNotNull(result);
assertFalse(result.isEmpty());
@@ -273,7 +282,8 @@ public class ReportUtilsTest extends BaseTest {
TripsConfig tripsConfig = new TripsConfig(500, 300000, 200000, 900000, false, false, 0.01);
- Collection<StopReport> result = ReportUtils.detectTripsAndStops(data, tripsConfig, false, StopReport.class);
+ Collection<StopReport> result = ReportUtils.detectTripsAndStops(
+ new TestIdentityManager(), null, data, tripsConfig, false, StopReport.class);
assertNotNull(result);
assertFalse(result.isEmpty());
@@ -299,7 +309,8 @@ public class ReportUtilsTest extends BaseTest {
TripsConfig tripsConfig = new TripsConfig(500, 300000, 200000, 900000, false, false, 0.01);
- Collection<StopReport> result = ReportUtils.detectTripsAndStops(data, tripsConfig, false, StopReport.class);
+ Collection<StopReport> result = ReportUtils.detectTripsAndStops(
+ new TestIdentityManager(), null, data, tripsConfig, false, StopReport.class);
assertNotNull(result);
assertFalse(result.isEmpty());
@@ -325,7 +336,8 @@ public class ReportUtilsTest extends BaseTest {
TripsConfig tripsConfig = new TripsConfig(500, 300000, 200000, 900000, false, false, 0.01);
- Collection<StopReport> result = ReportUtils.detectTripsAndStops(data, tripsConfig, false, StopReport.class);
+ Collection<StopReport> result = ReportUtils.detectTripsAndStops(
+ new TestIdentityManager(), null, data, tripsConfig, false, StopReport.class);
assertNotNull(result);
assertTrue(result.isEmpty());
@@ -347,7 +359,8 @@ public class ReportUtilsTest extends BaseTest {
TripsConfig tripsConfig = new TripsConfig(500, 200000, 200000, 900000, false, false, 0.01);
- Collection<TripReport> trips = ReportUtils.detectTripsAndStops(data, tripsConfig, false, TripReport.class);
+ Collection<TripReport> trips = ReportUtils.detectTripsAndStops(
+ new TestIdentityManager(), null, data, tripsConfig, false, TripReport.class);
assertNotNull(trips);
assertFalse(trips.isEmpty());
@@ -361,7 +374,8 @@ public class ReportUtilsTest extends BaseTest {
assertEquals(7, itemTrip.getMaxSpeed(), 0.01);
assertEquals(600, itemTrip.getDistance(), 0.01);
- Collection<StopReport> stops = ReportUtils.detectTripsAndStops(data, tripsConfig, false, StopReport.class);
+ Collection<StopReport> stops = ReportUtils.detectTripsAndStops(
+ new TestIdentityManager(), null, data, tripsConfig, false, StopReport.class);
assertNotNull(stops);
assertFalse(stops.isEmpty());