Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,41 @@ class RegistryDayOwnerSourceTest {
override suspend fun deleteLiveSessionsFor(deviceId: String) {}
override suspend fun deleteDismissedWorkoutsFor(deviceId: String) {}
override suspend fun deleteDismissedSleepsFor(deviceId: String) {}

// #771 adopt-serial re-key: sample-table re-keys are unmodelled here (no per-table storage in
// this fake), same as the delete*For no-ops above. dayOwnership IS modelled ([owners]), so its
// re-key actually mutates state.
override suspend fun reKeyHr(from: String, to: String) {}
override suspend fun reKeyRr(from: String, to: String) {}
override suspend fun reKeySpo2(from: String, to: String) {}
override suspend fun reKeySkinTemp(from: String, to: String) {}
override suspend fun reKeyResp(from: String, to: String) {}
override suspend fun reKeyGravity(from: String, to: String) {}
override suspend fun reKeySteps(from: String, to: String) {}
override suspend fun reKeyPpgHr(from: String, to: String) {}
override suspend fun reKeyPpgWaveform(from: String, to: String) {}
override suspend fun reKeyRawImu(from: String, to: String) {}
override suspend fun reKeyEvents(from: String, to: String) {}
override suspend fun reKeyBattery(from: String, to: String) {}
override suspend fun reKeyDailyMetrics(from: String, to: String) {}
override suspend fun reKeySleepSessions(from: String, to: String) {}
override suspend fun reKeyJournal(from: String, to: String) {}
override suspend fun reKeyWorkouts(from: String, to: String) {}
override suspend fun reKeyAppleDaily(from: String, to: String) {}
override suspend fun reKeyMetricSeries(from: String, to: String) {}
override suspend fun reKeyDayOwnership(from: String, to: String) {
for ((day, row) in owners) if (row.deviceId == from) owners[day] = row.copy(deviceId = to)
}
override suspend fun reKeySleepStates(from: String, to: String) {}
override suspend fun reKeyLabMarkers(from: String, to: String) {}
override suspend fun reKeyLiveSessions(from: String, to: String) {}
override suspend fun reKeyDismissedWorkouts(from: String, to: String) {}
override suspend fun reKeyDismissedSleeps(from: String, to: String) {}

override suspend fun pairedDevice(id: String): PairedDeviceRow? = devices[id]

override suspend fun deletePairedDeviceRow(id: String) { devices.remove(id) }
override suspend fun deleteDeviceRow(id: String) {}
}

private fun registry(dao: FakeDao) = DeviceRegistry(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,41 @@ class SourceCoordinatorAdoptionTest {
owners.entries.removeIf { it.value.deviceId == deviceId }
}
override suspend fun deleteScoreInputProvenanceFor(deviceId: String) {}

// #771 adopt-serial re-key: sample-table re-keys are unmodelled here (no per-table storage in
// this fake), same as the delete*For no-ops above. dayOwnership IS modelled ([owners]), so its
// re-key actually mutates state.
override suspend fun reKeyHr(from: String, to: String) {}
override suspend fun reKeyRr(from: String, to: String) {}
override suspend fun reKeySpo2(from: String, to: String) {}
override suspend fun reKeySkinTemp(from: String, to: String) {}
override suspend fun reKeyResp(from: String, to: String) {}
override suspend fun reKeyGravity(from: String, to: String) {}
override suspend fun reKeySteps(from: String, to: String) {}
override suspend fun reKeyPpgHr(from: String, to: String) {}
override suspend fun reKeyPpgWaveform(from: String, to: String) {}
override suspend fun reKeyRawImu(from: String, to: String) {}
override suspend fun reKeyEvents(from: String, to: String) {}
override suspend fun reKeyBattery(from: String, to: String) {}
override suspend fun reKeyDailyMetrics(from: String, to: String) {}
override suspend fun reKeySleepSessions(from: String, to: String) {}
override suspend fun reKeyJournal(from: String, to: String) {}
override suspend fun reKeyWorkouts(from: String, to: String) {}
override suspend fun reKeyAppleDaily(from: String, to: String) {}
override suspend fun reKeyMetricSeries(from: String, to: String) {}
override suspend fun reKeyDayOwnership(from: String, to: String) {
for ((day, row) in owners) if (row.deviceId == from) owners[day] = row.copy(deviceId = to)
}
override suspend fun reKeySleepStates(from: String, to: String) {}
override suspend fun reKeyLabMarkers(from: String, to: String) {}
override suspend fun reKeyLiveSessions(from: String, to: String) {}
override suspend fun reKeyDismissedWorkouts(from: String, to: String) {}
override suspend fun reKeyDismissedSleeps(from: String, to: String) {}

override suspend fun pairedDevice(id: String): PairedDeviceRow? = devices[id]

override suspend fun deletePairedDeviceRow(id: String) { devices.remove(id) }
override suspend fun deleteDeviceRow(id: String) {}
}

private fun registryWith(dao: FakeRegistryDao) = DeviceRegistry(
Expand Down
37 changes: 37 additions & 0 deletions android/app/src/test/java/com/noop/data/DeviceRegistryTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,43 @@ class DeviceRegistryTest {
override suspend fun deleteLiveSessionsFor(deviceId: String) { deletedTables += "liveSession" to deviceId }
override suspend fun deleteDismissedWorkoutsFor(deviceId: String) { deletedTables += "dismissedWorkout" to deviceId }
override suspend fun deleteDismissedSleepsFor(deviceId: String) { deletedTables += "dismissedSleep" to deviceId }

// #771 adopt-serial re-key: sample-table re-keys are unmodelled here (no per-table storage in
// this fake), same as the delete*For no-ops above for those tables. dayOwnership IS modelled
// ([owners]), so its re-key actually mutates state, mirroring `UPDATE OR IGNORE ... WHERE
// deviceId = :from` (no PK clash possible since `day`, not `deviceId`, is the row's key).
override suspend fun reKeyHr(from: String, to: String) {}
override suspend fun reKeyRr(from: String, to: String) {}
override suspend fun reKeySpo2(from: String, to: String) {}
override suspend fun reKeySkinTemp(from: String, to: String) {}
override suspend fun reKeyResp(from: String, to: String) {}
override suspend fun reKeyGravity(from: String, to: String) {}
override suspend fun reKeySteps(from: String, to: String) {}
override suspend fun reKeyPpgHr(from: String, to: String) {}
override suspend fun reKeyPpgWaveform(from: String, to: String) {}
override suspend fun reKeyRawImu(from: String, to: String) {}
override suspend fun reKeyEvents(from: String, to: String) {}
override suspend fun reKeyBattery(from: String, to: String) {}
override suspend fun reKeyDailyMetrics(from: String, to: String) {}
override suspend fun reKeySleepSessions(from: String, to: String) {}
override suspend fun reKeyJournal(from: String, to: String) {}
override suspend fun reKeyWorkouts(from: String, to: String) {}
override suspend fun reKeyAppleDaily(from: String, to: String) {}
override suspend fun reKeyMetricSeries(from: String, to: String) {}
override suspend fun reKeyDayOwnership(from: String, to: String) {
for ((day, row) in owners) if (row.deviceId == from) owners[day] = row.copy(deviceId = to)
}
override suspend fun reKeySleepStates(from: String, to: String) {}
override suspend fun reKeyLabMarkers(from: String, to: String) {}
override suspend fun reKeyLiveSessions(from: String, to: String) {}
override suspend fun reKeyDismissedWorkouts(from: String, to: String) {}
override suspend fun reKeyDismissedSleeps(from: String, to: String) {}

/** The registry row for [id], or null (#771 adopt-serial needs the active row's fields). */
override suspend fun pairedDevice(id: String): PairedDeviceRow? = devices[id]

override suspend fun deletePairedDeviceRow(id: String) { devices.remove(id) }
override suspend fun deleteDeviceRow(id: String) {}
}

/** Registry over the fake DAO with a pass-through transactor (Room's withTransaction stand-in). */
Expand Down