From e464ce9feae644052d396aba02ceaca8756dc4aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=E2=89=A1ZRS?= <12814349+LZRS@users.noreply.github.com> Date: Thu, 28 Nov 2024 16:48:19 +0300 Subject: [PATCH] Update migration9to10 test --- .../db/impl/ResourceDatabaseMigrationTest.kt | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/engine/src/androidTest/java/com/google/android/fhir/db/impl/ResourceDatabaseMigrationTest.kt b/engine/src/androidTest/java/com/google/android/fhir/db/impl/ResourceDatabaseMigrationTest.kt index dc492ad3a0..2409c5f5e2 100644 --- a/engine/src/androidTest/java/com/google/android/fhir/db/impl/ResourceDatabaseMigrationTest.kt +++ b/engine/src/androidTest/java/com/google/android/fhir/db/impl/ResourceDatabaseMigrationTest.kt @@ -418,7 +418,33 @@ class ResourceDatabaseMigrationTest { assertThat(retrievedTask).isEqualTo(bedNetTask) } - @Test fun migrate9To10_should_execute_with_no_exception(): Unit = runBlocking { TODO() } + @Test fun migrate9To10_should_execute_with_no_exception(): Unit = runBlocking { + val patientId = "patient-001" + val patientResourceUuid = "e2c79e28-ed4d-4029-a12c-108d1eb5bedb" + val patient: String = Patient().apply { + id = patientId + }.let { iParser.encodeResourceToString(it) } + + val taskId = "bed-net-001" + val taskResourceUuid = "8593abf6-b8dd-44d7-a35f-1c8843bc2c45" + val bedNetTask = + Task() + .apply { + id = taskId + status = Task.TaskStatus.READY + `for` = Reference(patient) + } + .let { iParser.encodeResourceToString(it) } + + helper.createDatabase(DB_NAME, 9).apply { + execSQL("INSERT INTO ResourceEntity (resourceUuid, resourceType, resourceId, serializedResource) VALUES ('$patientResourceUuid', 'Patient', '$patientId', '$patient');") + execSQL("INSERT INTO ResourceEntity (resourceUuid, resourceType, resourceId, serializedResource) VALUES ('$taskResourceUuid', 'Task', '$taskId', '$bedNetTask');") + + execSQL("INSERT INTO ReferenceIndexEntity (resourceUuid, resourceType, index_name, index_path, index_value) VALUES ('$taskResourceUuid', 'Task', 'subject', 'Task.for', 'Patient/$patientId');") + } + + TODO("Finish test") + } companion object { const val DB_NAME = "migration_tests.db"