Cleanup: renamed SensorData* to Aggregator*.

This commit is contained in:
Dennis Guse
2023-11-15 18:41:13 +01:00
parent d47fa27e02
commit ce21fe3569
18 changed files with 81 additions and 80 deletions
@@ -59,10 +59,11 @@ import de.dennisguse.opentracks.data.models.TrackPoint;
import de.dennisguse.opentracks.io.file.TrackFileFormat;
import de.dennisguse.opentracks.io.file.exporter.TrackExporter;
import de.dennisguse.opentracks.sensors.AltitudeSumManager;
import de.dennisguse.opentracks.sensors.sensorData.SensorDataCyclingCadence;
import de.dennisguse.opentracks.sensors.sensorData.SensorDataCyclingDistanceSpeed;
import de.dennisguse.opentracks.sensors.sensorData.SensorDataCyclingPower;
import de.dennisguse.opentracks.sensors.sensorData.SensorDataHeartRate;
import de.dennisguse.opentracks.sensors.sensorData.Aggregator;
import de.dennisguse.opentracks.sensors.sensorData.AggregatorCyclingCadence;
import de.dennisguse.opentracks.sensors.sensorData.AggregatorCyclingDistanceSpeed;
import de.dennisguse.opentracks.sensors.sensorData.AggregatorCyclingPower;
import de.dennisguse.opentracks.sensors.sensorData.AggregatorHeartRate;
import de.dennisguse.opentracks.sensors.sensorData.SensorDataSet;
import de.dennisguse.opentracks.services.TrackRecordingService;
import de.dennisguse.opentracks.services.handlers.TrackPointCreator;
@@ -71,7 +72,7 @@ import de.dennisguse.opentracks.stats.TrackStatistics;
/**
* Export a track to {@link TrackFileFormat} and verify that the import is identical.
* <p>
* Note: those tests are affected by {@link de.dennisguse.opentracks.sensors.sensorData.SensorData}.isRecent().
* Note: those tests are affected by {@link Aggregator}.isRecent().
* If the test device is too slow (like in a CI) these are likely to fail as the sensor data will be omitted from actual.
*/
@RunWith(AndroidJUnit4.class)
@@ -549,22 +550,22 @@ public class ExportImportTest {
SensorDataSet sensorDataSet = new SensorDataSet();
sensorDataSet.cyclingPower = Mockito.mock(SensorDataCyclingPower.class);
sensorDataSet.cyclingPower = Mockito.mock(AggregatorCyclingPower.class);
Mockito.when( sensorDataSet.cyclingPower.hasValue()).thenReturn(true);
Mockito.when(sensorDataSet.cyclingPower.getValue()).thenReturn(Power.of(power));
sensorDataSet.heartRate = Mockito.mock(SensorDataHeartRate.class);
sensorDataSet.heartRate = Mockito.mock(AggregatorHeartRate.class);
Mockito.when(sensorDataSet.heartRate.getValue()).thenReturn(HeartRate.of(heartRate));
SensorDataCyclingCadence cyclingCadence = Mockito.mock(SensorDataCyclingCadence.class);
AggregatorCyclingCadence cyclingCadence = Mockito.mock(AggregatorCyclingCadence.class);
Mockito.when(cyclingCadence.hasValue()).thenReturn(true);
Mockito.when(cyclingCadence.getValue()).thenReturn(Cadence.of(cadence));
sensorDataSet.cyclingCadence = cyclingCadence;
if (distance != null && speed != null) {
SensorDataCyclingDistanceSpeed distanceSpeed = Mockito.mock(SensorDataCyclingDistanceSpeed.class);
AggregatorCyclingDistanceSpeed distanceSpeed = Mockito.mock(AggregatorCyclingDistanceSpeed.class);
Mockito.when(distanceSpeed.hasValue()).thenReturn(true);
Mockito.when(distanceSpeed.getValue()).thenReturn(new SensorDataCyclingDistanceSpeed.Data(null, distance, Speed.of(speed)));
Mockito.when(distanceSpeed.getValue()).thenReturn(new AggregatorCyclingDistanceSpeed.Data(null, distance, Speed.of(speed)));
sensorDataSet.cyclingDistanceSpeed = distanceSpeed;
}
@@ -20,7 +20,7 @@ public class SensorDataCyclingTest {
@Test
public void compute_cadence_1() {
SensorDataCyclingCadence current = new SensorDataCyclingCadence("", "");
AggregatorCyclingCadence current = new AggregatorCyclingCadence("", "");
// when
current.add(new Raw<>(new BluetoothHandlerCyclingCadence.CrankData(1, 1024)));
@@ -32,7 +32,7 @@ public class SensorDataCyclingTest {
@Test
public void compute_cadence_2() {
SensorDataCyclingCadence current = new SensorDataCyclingCadence("", "");
AggregatorCyclingCadence current = new AggregatorCyclingCadence("", "");
// when
current.add(new Raw<>(new BluetoothHandlerCyclingCadence.CrankData(1, 6184)));
@@ -44,7 +44,7 @@ public class SensorDataCyclingTest {
@Test
public void compute_cadence_sameCount() {
SensorDataCyclingCadence current = new SensorDataCyclingCadence("", "");
AggregatorCyclingCadence current = new AggregatorCyclingCadence("", "");
// when
current.add(new Raw<>(new BluetoothHandlerCyclingCadence.CrankData(1, 1024)));
@@ -57,7 +57,7 @@ public class SensorDataCyclingTest {
@Test
public void compute_cadence_sameTime() {
SensorDataCyclingCadence current = new SensorDataCyclingCadence("", "");
AggregatorCyclingCadence current = new AggregatorCyclingCadence("", "");
// when
current.add(new Raw<>(new BluetoothHandlerCyclingCadence.CrankData(1, 1024)));
@@ -69,7 +69,7 @@ public class SensorDataCyclingTest {
@Test
public void compute_cadence_rollOverTime() {
SensorDataCyclingCadence current = new SensorDataCyclingCadence("", "");
AggregatorCyclingCadence current = new AggregatorCyclingCadence("", "");
// when
current.add(new Raw<>(new BluetoothHandlerCyclingCadence.CrankData(1, UintUtils.UINT16_MAX - 1024)));
@@ -82,7 +82,7 @@ public class SensorDataCyclingTest {
@Test
@Deprecated
public void compute_cadence_rollOverCount() {
SensorDataCyclingCadence current = new SensorDataCyclingCadence("", "");
AggregatorCyclingCadence current = new AggregatorCyclingCadence("", "");
// when
current.add(new Raw<>(new BluetoothHandlerCyclingCadence.CrankData(UintUtils.UINT32_MAX - 1, 1024)));
@@ -96,7 +96,7 @@ public class SensorDataCyclingTest {
@Test
public void compute_speed() {
SensorDataCyclingDistanceSpeed current = new SensorDataCyclingDistanceSpeed("", "");
AggregatorCyclingDistanceSpeed current = new AggregatorCyclingDistanceSpeed("", "");
current.setWheelCircumference(Distance.ofMM(2150));
// when
@@ -111,7 +111,7 @@ public class SensorDataCyclingTest {
@Test
@Deprecated
public void compute_speed_rollOverCount() {
SensorDataCyclingDistanceSpeed current = new SensorDataCyclingDistanceSpeed("", "");
AggregatorCyclingDistanceSpeed current = new AggregatorCyclingDistanceSpeed("", "");
current.setWheelCircumference(Distance.ofMM(2000));
// when
@@ -37,9 +37,9 @@ import de.dennisguse.opentracks.io.file.importer.TrackPointAssert;
import de.dennisguse.opentracks.sensors.AltitudeSumManager;
import de.dennisguse.opentracks.sensors.BluetoothHandlerRunningSpeedAndCadence;
import de.dennisguse.opentracks.sensors.SensorManager;
import de.dennisguse.opentracks.sensors.sensorData.AggregatorHeartRate;
import de.dennisguse.opentracks.sensors.sensorData.AggregatorRunning;
import de.dennisguse.opentracks.sensors.sensorData.Raw;
import de.dennisguse.opentracks.sensors.sensorData.SensorDataHeartRate;
import de.dennisguse.opentracks.sensors.sensorData.SensorDataRunning;
import de.dennisguse.opentracks.services.handlers.TrackPointCreator;
import de.dennisguse.opentracks.settings.PreferencesUtils;
import de.dennisguse.opentracks.stats.TrackStatistics;
@@ -255,7 +255,7 @@ public class TrackRecordingServiceRecordingTest {
Track.Id trackId = service.startNewTrack();
trackPointCreator.getSensorManager().setAltitudeSumManager(altitudeSumManager);
SensorManager sensorManager = trackPointCreator.getSensorManager();
sensorManager.sensorDataSet.add(new SensorDataHeartRate("", ""));
sensorManager.sensorDataSet.add(new AggregatorHeartRate("", ""));
// when
String sensor1 = "2020-02-02T02:02:03Z";
trackPointCreator.setClock(sensor1);
@@ -592,7 +592,7 @@ public class TrackRecordingServiceRecordingTest {
Track.Id trackId = service.startNewTrack();
trackPointCreator.getSensorManager().setAltitudeSumManager(altitudeSumManager);
SensorManager sensorManager = trackPointCreator.getSensorManager();
sensorManager.sensorDataSet.add(new SensorDataRunning("", ""));
sensorManager.sensorDataSet.add(new AggregatorRunning("", ""));
// when
String sensor1 = "2020-02-02T02:02:03Z";