From 0611581b0928f58b4a9e6fc31c9152b264d2778b Mon Sep 17 00:00:00 2001 From: williamito Date: Mon, 3 Jun 2024 03:39:46 -0700 Subject: [PATCH] Mark many things as internal (#2494) * Mark ContentTypes and MediaTypes as internal * Mark more things internal, refactor demo to not use util function --------- Co-authored-by: santosh-pingle <86107848+santosh-pingle@users.noreply.github.com> --- .../fhir/demo/PatientDetailsViewModel.kt | 12 +++++++-- .../com/google/android/fhir/ContentTypes.kt | 6 ++--- .../com/google/android/fhir/DateProvider.kt | 4 +-- .../google/android/fhir/FhirEngineProvider.kt | 12 ++++----- .../com/google/android/fhir/LocalChange.kt | 2 +- .../main/java/com/google/android/fhir/Util.kt | 10 ++++---- .../com/google/android/fhir/db/Database.kt | 4 +-- .../android/fhir/db/impl/DatabaseImpl.kt | 2 +- .../android/fhir/db/impl/ResourceDatabase.kt | 16 ++++++------ .../fhir/db/impl/SQLCipherSupportHelper.kt | 4 +-- .../fhir/index/DualHapiWorkerContext.kt | 4 +-- .../android/fhir/index/ResourceIndexer.kt | 8 ++++-- .../fhir/index/entities/PositionIndex.kt | 4 +-- .../fhir/search/query/XFhirQueryTranslator.kt | 4 +-- .../fhir/sync/remote/FhirConverterFactory.kt | 2 +- .../android/fhir/sync/upload/patch/Patch.kt | 4 +-- .../request/BundleEntryComponentGenerator.kt | 4 +-- .../google/android/fhir/testing/Utilities.kt | 25 ++++++++++--------- .../android/fhir/sync/FhirSyncWorkerTest.kt | 2 +- .../request/RequestGeneratorTestUtils.kt | 4 +-- 20 files changed, 73 insertions(+), 60 deletions(-) diff --git a/demo/src/main/java/com/google/android/fhir/demo/PatientDetailsViewModel.kt b/demo/src/main/java/com/google/android/fhir/demo/PatientDetailsViewModel.kt index 14336bba7f..014177a327 100644 --- a/demo/src/main/java/com/google/android/fhir/demo/PatientDetailsViewModel.kt +++ b/demo/src/main/java/com/google/android/fhir/demo/PatientDetailsViewModel.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023 Google LLC + * Copyright 2023-2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,6 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.viewModelScope import com.google.android.fhir.FhirEngine -import com.google.android.fhir.logicalId import com.google.android.fhir.search.revInclude import com.google.android.fhir.search.search import java.text.SimpleDateFormat @@ -379,3 +378,12 @@ data class RiskAssessmentItem( var lastContacted: String, var patientCardColor: Int, ) + +/** + * The logical (unqualified) part of the ID. For example, if the ID is + * "http://example.com/fhir/Patient/123/_history/456", then this value would be "123". + */ +private val Resource.logicalId: String + get() { + return this.idElement?.idPart.orEmpty() + } diff --git a/engine/src/main/java/com/google/android/fhir/ContentTypes.kt b/engine/src/main/java/com/google/android/fhir/ContentTypes.kt index eaad96cf1b..6a491d04c0 100644 --- a/engine/src/main/java/com/google/android/fhir/ContentTypes.kt +++ b/engine/src/main/java/com/google/android/fhir/ContentTypes.kt @@ -1,5 +1,5 @@ /* - * Copyright 2021 Google LLC + * Copyright 2021-2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,11 +18,11 @@ package com.google.android.fhir import okhttp3.MediaType.Companion.toMediaType -object ContentTypes { +internal object ContentTypes { const val APPLICATION_JSON_PATCH = "application/json-patch+json" const val APPLICATION_FHIR_JSON = "application/fhir+json" } -object MediaTypes { +internal object MediaTypes { val MEDIA_TYPE_FHIR_JSON = ContentTypes.APPLICATION_FHIR_JSON.toMediaType() } diff --git a/engine/src/main/java/com/google/android/fhir/DateProvider.kt b/engine/src/main/java/com/google/android/fhir/DateProvider.kt index 9d98095f95..b62ea0d7d2 100644 --- a/engine/src/main/java/com/google/android/fhir/DateProvider.kt +++ b/engine/src/main/java/com/google/android/fhir/DateProvider.kt @@ -1,5 +1,5 @@ /* - * Copyright 2021-2023 Google LLC + * Copyright 2021-2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ import java.time.Instant import java.time.ZoneId /** The DateProvider Instance [FhirEngine] uses for date/time related operations. */ -object DateProvider { +internal object DateProvider { lateinit var clock: Clock private var fixed = false // TODO possibly provide more customization options diff --git a/engine/src/main/java/com/google/android/fhir/FhirEngineProvider.kt b/engine/src/main/java/com/google/android/fhir/FhirEngineProvider.kt index 076c0e27ed..ae3ab614fe 100644 --- a/engine/src/main/java/com/google/android/fhir/FhirEngineProvider.kt +++ b/engine/src/main/java/com/google/android/fhir/FhirEngineProvider.kt @@ -125,7 +125,7 @@ object FhirEngineProvider { * `enableEncryptionIfSupported` is true, the FHIR SDK will only enable database encryption on * supported devices. * - * WARNING: If database encryption is enabled, devices that are on API 22 (Android 5.1) or lower + * **WARNING:** If database encryption is enabled, devices that are on API 22 (Android 5.1) or lower * will have an unencrypted database. If those devices are later updated to API 23 or newer, they * will encounter an `IllegalStateException`. This is because the database was created without * encryption on the older API level, and enabling encryption in the new release will not @@ -143,11 +143,10 @@ object FhirEngineProvider { * engine with the Search API. These are in addition to the default * [search parameters](https://www.hl7.org/fhir/searchparameter-registry.html) defined in the FHIR * specification. Custom search parameters must be unique and not change existing or default - * search parameters. - * - * Note: The engine does not automatically reindex resources after new custom search parameters are - * added. You must manually reindex resources by updating them. Any new CRUD operations on a - * resource after adding new search parameters will automatically trigger reindexing. + * search parameters.

**Note:** The engine does not automatically reindex resources after new + * custom search parameters are added. You must manually reindex resources by updating them. Any + * new CRUD operations on a resource after adding new search parameters will automatically trigger + * reindexing. */ data class FhirEngineConfiguration( val enableEncryptionIfSupported: Boolean = false, @@ -157,6 +156,7 @@ data class FhirEngineConfiguration( val customSearchParameters: List? = null, ) +/** How database errors should be handled. */ enum class DatabaseErrorStrategy { /** * If unspecified, all database errors will be propagated to the call site. The caller shall diff --git a/engine/src/main/java/com/google/android/fhir/LocalChange.kt b/engine/src/main/java/com/google/android/fhir/LocalChange.kt index c790e95862..e1e7d7c8a0 100644 --- a/engine/src/main/java/com/google/android/fhir/LocalChange.kt +++ b/engine/src/main/java/com/google/android/fhir/LocalChange.kt @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Google LLC + * Copyright 2022-2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/engine/src/main/java/com/google/android/fhir/Util.kt b/engine/src/main/java/com/google/android/fhir/Util.kt index 5c9dc0f69f..5ad65a52e9 100644 --- a/engine/src/main/java/com/google/android/fhir/Util.kt +++ b/engine/src/main/java/com/google/android/fhir/Util.kt @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2022-2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,7 +50,7 @@ internal fun isValidDateOnly(date: String) = * The logical (unqualified) part of the ID. For example, if the ID is * "http://example.com/fhir/Patient/123/_history/456", then this value would be "123". */ -val Resource.logicalId: String +internal val Resource.logicalId: String get() { return this.idElement?.idPart.orEmpty() } @@ -62,14 +62,14 @@ val Resource.logicalId: String * operation success/failure. TODO: pass along the HTTP result (or any other signal) to determine * the outcome of an instance level RESTful operation. */ -fun Resource.isUploadSuccess(): Boolean { +internal fun Resource.isUploadSuccess(): Boolean { if (!this.resourceType.equals(ResourceType.OperationOutcome)) return false val outcome: OperationOutcome = this as OperationOutcome return outcome.issue.isNotEmpty() && outcome.issue.all { it.severity.equals(OperationOutcome.IssueSeverity.INFORMATION) } } -class OffsetDateTimeTypeAdapter : TypeAdapter() { +internal class OffsetDateTimeTypeAdapter : TypeAdapter() { override fun write(out: JsonWriter, value: OffsetDateTime) { out.value(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value)) } @@ -78,7 +78,7 @@ class OffsetDateTimeTypeAdapter : TypeAdapter() { } /** Url for the UCUM system of measures. */ -const val ucumUrl = "http://unitsofmeasure.org" +internal const val ucumUrl = "http://unitsofmeasure.org" internal fun percentOf(value: Number, total: Number) = if (total == 0) 0.0 else value.toDouble() / total.toDouble() diff --git a/engine/src/main/java/com/google/android/fhir/db/Database.kt b/engine/src/main/java/com/google/android/fhir/db/Database.kt index 0107f67d2f..251bf21b6c 100644 --- a/engine/src/main/java/com/google/android/fhir/db/Database.kt +++ b/engine/src/main/java/com/google/android/fhir/db/Database.kt @@ -196,12 +196,12 @@ internal interface Database { ): List } -data class ResourceWithUUID( +internal data class ResourceWithUUID( val uuid: UUID, val resource: R, ) -data class LocalChangeResourceReference( +internal data class LocalChangeResourceReference( val localChangeId: Long, val resourceReferenceValue: String, val resourceReferencePath: String?, diff --git a/engine/src/main/java/com/google/android/fhir/db/impl/DatabaseImpl.kt b/engine/src/main/java/com/google/android/fhir/db/impl/DatabaseImpl.kt index b156b46728..2e14ea6b1d 100644 --- a/engine/src/main/java/com/google/android/fhir/db/impl/DatabaseImpl.kt +++ b/engine/src/main/java/com/google/android/fhir/db/impl/DatabaseImpl.kt @@ -444,7 +444,7 @@ internal class DatabaseImpl( } } -data class DatabaseConfig( +internal data class DatabaseConfig( val inMemory: Boolean, val enableEncryption: Boolean, val databaseErrorStrategy: DatabaseErrorStrategy, diff --git a/engine/src/main/java/com/google/android/fhir/db/impl/ResourceDatabase.kt b/engine/src/main/java/com/google/android/fhir/db/impl/ResourceDatabase.kt index 3502ab0b8e..158bb4b146 100644 --- a/engine/src/main/java/com/google/android/fhir/db/impl/ResourceDatabase.kt +++ b/engine/src/main/java/com/google/android/fhir/db/impl/ResourceDatabase.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023 Google LLC + * Copyright 2023-2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -64,14 +64,14 @@ internal abstract class ResourceDatabase : RoomDatabase() { abstract fun localChangeDao(): LocalChangeDao } -val MIGRATION_1_2 = +internal val MIGRATION_1_2 = object : Migration(1, 2) { override fun migrate(database: SupportSQLiteDatabase) { database.execSQL("DROP table if exists SyncedResourceEntity") } } -val MIGRATION_2_3 = +internal val MIGRATION_2_3 = object : Migration(2, 3) { override fun migrate(database: SupportSQLiteDatabase) { database.execSQL( @@ -80,7 +80,7 @@ val MIGRATION_2_3 = } } -val MIGRATION_3_4 = +internal val MIGRATION_3_4 = object : Migration(3, 4) { override fun migrate(database: SupportSQLiteDatabase) { database.execSQL( @@ -105,7 +105,7 @@ val MIGRATION_3_4 = } } -val MIGRATION_4_5 = +internal val MIGRATION_4_5 = object : Migration(4, 5) { override fun migrate(database: SupportSQLiteDatabase) { database.execSQL( @@ -115,7 +115,7 @@ val MIGRATION_4_5 = } /** Changes column type of [LocalChangeEntity.timestamp] from [String] to [java.time.Instant]. */ -val MIGRATION_5_6 = +internal val MIGRATION_5_6 = object : Migration(5, 6) { override fun migrate(database: SupportSQLiteDatabase) { database.execSQL( @@ -133,7 +133,7 @@ val MIGRATION_5_6 = } /** Add column resourceUuid in [LocalChangeEntity] */ -val MIGRATION_6_7 = +internal val MIGRATION_6_7 = object : Migration(6, 7) { override fun migrate(database: SupportSQLiteDatabase) { database.execSQL( @@ -155,7 +155,7 @@ val MIGRATION_6_7 = } /** Create [LocalChangeResourceReferenceEntity] */ -val MIGRATION_7_8 = +internal val MIGRATION_7_8 = object : Migration(7, 8) { override fun migrate(database: SupportSQLiteDatabase) { database.execSQL( diff --git a/engine/src/main/java/com/google/android/fhir/db/impl/SQLCipherSupportHelper.kt b/engine/src/main/java/com/google/android/fhir/db/impl/SQLCipherSupportHelper.kt index eaf8393d51..f761656e11 100644 --- a/engine/src/main/java/com/google/android/fhir/db/impl/SQLCipherSupportHelper.kt +++ b/engine/src/main/java/com/google/android/fhir/db/impl/SQLCipherSupportHelper.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023 Google LLC + * Copyright 2023-2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,7 +33,7 @@ import net.sqlcipher.database.SQLiteOpenHelper import timber.log.Timber /** A [SupportSQLiteOpenHelper] which initializes a [SQLiteDatabase] with a passphrase. */ -class SQLCipherSupportHelper( +internal class SQLCipherSupportHelper( private val configuration: SupportSQLiteOpenHelper.Configuration, hook: SQLiteDatabaseHook? = null, private val databaseErrorStrategy: DatabaseErrorStrategy, diff --git a/engine/src/main/java/com/google/android/fhir/index/DualHapiWorkerContext.kt b/engine/src/main/java/com/google/android/fhir/index/DualHapiWorkerContext.kt index bfd12c5422..02306848ce 100644 --- a/engine/src/main/java/com/google/android/fhir/index/DualHapiWorkerContext.kt +++ b/engine/src/main/java/com/google/android/fhir/index/DualHapiWorkerContext.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023 Google LLC + * Copyright 2023-2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,7 @@ import org.hl7.fhir.r4.model.Resource * * TODO: Ideally we update the upstream's HapiWorkerContext to support ucumServices. */ -class DualHapiWorkerContext : SimpleWorkerContext() { +internal class DualHapiWorkerContext : SimpleWorkerContext() { val hapi = HapiWorkerContext( FhirContext.forR4Cached(), diff --git a/engine/src/main/java/com/google/android/fhir/index/ResourceIndexer.kt b/engine/src/main/java/com/google/android/fhir/index/ResourceIndexer.kt index b1c3f81468..8e07a8b5ae 100644 --- a/engine/src/main/java/com/google/android/fhir/index/ResourceIndexer.kt +++ b/engine/src/main/java/com/google/android/fhir/index/ResourceIndexer.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023 Google LLC + * Copyright 2023-2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -389,4 +389,8 @@ internal class ResourceIndexer( } } -data class SearchParamDefinition(val name: String, val type: SearchParamType, val path: String) +internal data class SearchParamDefinition( + val name: String, + val type: SearchParamType, + val path: String, +) diff --git a/engine/src/main/java/com/google/android/fhir/index/entities/PositionIndex.kt b/engine/src/main/java/com/google/android/fhir/index/entities/PositionIndex.kt index d052326ef5..f6bcfcc161 100644 --- a/engine/src/main/java/com/google/android/fhir/index/entities/PositionIndex.kt +++ b/engine/src/main/java/com/google/android/fhir/index/entities/PositionIndex.kt @@ -1,5 +1,5 @@ /* - * Copyright 2021 Google LLC + * Copyright 2021-2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,4 +21,4 @@ package com.google.android.fhir.index.entities * * See https://www.hl7.org/fhir/search.html#special. */ -data class PositionIndex(val latitude: Double, val longitude: Double) +internal data class PositionIndex(val latitude: Double, val longitude: Double) diff --git a/engine/src/main/java/com/google/android/fhir/search/query/XFhirQueryTranslator.kt b/engine/src/main/java/com/google/android/fhir/search/query/XFhirQueryTranslator.kt index ce158d32d9..9681728c0a 100644 --- a/engine/src/main/java/com/google/android/fhir/search/query/XFhirQueryTranslator.kt +++ b/engine/src/main/java/com/google/android/fhir/search/query/XFhirQueryTranslator.kt @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 Google LLC + * Copyright 2022-2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,7 +44,7 @@ import org.hl7.fhir.r4.model.ResourceType * http://build.fhir.org/ig/HL7/sdc/expressions.html#x-fhir-query-enhancements and * http://hl7.org/fhir/R4/search.html */ -object XFhirQueryTranslator { +internal object XFhirQueryTranslator { private const val XFHIR_QUERY_SORT_PARAM = "_sort" private const val XFHIR_QUERY_COUNT_PARAM = "_count" diff --git a/engine/src/main/java/com/google/android/fhir/sync/remote/FhirConverterFactory.kt b/engine/src/main/java/com/google/android/fhir/sync/remote/FhirConverterFactory.kt index fc2fab0c70..bd8fbe63f3 100644 --- a/engine/src/main/java/com/google/android/fhir/sync/remote/FhirConverterFactory.kt +++ b/engine/src/main/java/com/google/android/fhir/sync/remote/FhirConverterFactory.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023 Google LLC + * Copyright 2023-2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/engine/src/main/java/com/google/android/fhir/sync/upload/patch/Patch.kt b/engine/src/main/java/com/google/android/fhir/sync/upload/patch/Patch.kt index bf3b6fac68..103aaac1bf 100644 --- a/engine/src/main/java/com/google/android/fhir/sync/upload/patch/Patch.kt +++ b/engine/src/main/java/com/google/android/fhir/sync/upload/patch/Patch.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023 Google LLC + * Copyright 2023-2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ import java.time.Instant import org.hl7.fhir.r4.model.Resource /** Data class for squashed local changes for resource */ -data class Patch( +internal data class Patch( /** The [ResourceType] */ val resourceType: String, /** The resource id [Resource.id] */ diff --git a/engine/src/main/java/com/google/android/fhir/sync/upload/request/BundleEntryComponentGenerator.kt b/engine/src/main/java/com/google/android/fhir/sync/upload/request/BundleEntryComponentGenerator.kt index 372ed59c93..329a2965a9 100644 --- a/engine/src/main/java/com/google/android/fhir/sync/upload/request/BundleEntryComponentGenerator.kt +++ b/engine/src/main/java/com/google/android/fhir/sync/upload/request/BundleEntryComponentGenerator.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023 Google LLC + * Copyright 2023-2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,7 +30,7 @@ import org.hl7.fhir.r4.model.UriType * [LocalChangeEntity]. See [https://www.hl7.org/fhir/http.html#transaction] for more info regarding * the supported [Bundle.HTTPVerb]. */ -abstract class BundleEntryComponentGenerator( +internal abstract class BundleEntryComponentGenerator( private val httpVerb: Bundle.HTTPVerb, private val useETagForUpload: Boolean, ) { diff --git a/engine/src/main/java/com/google/android/fhir/testing/Utilities.kt b/engine/src/main/java/com/google/android/fhir/testing/Utilities.kt index e6c0441158..c99e17be73 100644 --- a/engine/src/main/java/com/google/android/fhir/testing/Utilities.kt +++ b/engine/src/main/java/com/google/android/fhir/testing/Utilities.kt @@ -55,21 +55,21 @@ import org.hl7.fhir.r4.model.ResourceType import org.json.JSONArray import org.json.JSONObject -val jsonParser: IParser = FhirContext.forCached(FhirVersionEnum.R4).newJsonParser() +internal val jsonParser: IParser = FhirContext.forCached(FhirVersionEnum.R4).newJsonParser() /** Asserts that the `expected` and the `actual` FHIR resources are equal. */ -fun assertResourceEquals(expected: Resource?, actual: Resource?) { +internal fun assertResourceEquals(expected: Resource?, actual: Resource?) { assertThat(jsonParser.encodeResourceToString(actual)) .isEqualTo(jsonParser.encodeResourceToString(expected)) } /** Asserts that the `expected` and the `actual` FHIR resources are not equal. */ -fun assertResourceNotEquals(expected: Resource?, actual: Resource?) { +internal fun assertResourceNotEquals(expected: Resource?, actual: Resource?) { assertThat(jsonParser.encodeResourceToString(actual)) .isNotEqualTo(jsonParser.encodeResourceToString(expected)) } -fun assertJsonArrayEqualsIgnoringOrder(actual: JSONArray, expected: JSONArray) { +internal fun assertJsonArrayEqualsIgnoringOrder(actual: JSONArray, expected: JSONArray) { assertThat(actual.length()).isEqualTo(expected.length()) val actuals = mutableListOf() val expecteds = mutableListOf() @@ -83,7 +83,7 @@ fun assertJsonArrayEqualsIgnoringOrder(actual: JSONArray, expected: JSONArray) { } /** Reads a [Resource] from given file in the `sampledata` dir */ -fun readFromFile(clazz: Class, filename: String): R { +internal fun readFromFile(clazz: Class, filename: String): R { val resourceJson = readJsonFromFile(filename) return jsonParser.parseResource(clazz, resourceJson.toString()) as R } @@ -96,13 +96,13 @@ private fun readJsonFromFile(filename: String): JSONObject { } /** Reads a [JSONArray] from given file in the `sampledata` dir */ -fun readJsonArrayFromFile(filename: String): JSONArray { +internal fun readJsonArrayFromFile(filename: String): JSONArray { val inputStream = {}.javaClass.getResourceAsStream(filename) val content = inputStream!!.bufferedReader(Charsets.UTF_8).readText() return JSONArray(content) } -object TestDataSourceImpl : DataSource { +internal object TestDataSourceImpl : DataSource { override suspend fun download(downloadRequest: DownloadRequest) = when (downloadRequest) { @@ -120,7 +120,7 @@ object TestDataSourceImpl : DataSource { } } -open class TestDownloadManagerImpl( +internal open class TestDownloadManagerImpl( private val queries: List = listOf("Patient?address-city=NAIROBI"), ) : DownloadWorkManager { private val urls = LinkedList(queries) @@ -141,7 +141,7 @@ open class TestDownloadManagerImpl( } } -object TestFhirEngineImpl : FhirEngine { +internal object TestFhirEngineImpl : FhirEngine { override suspend fun create(vararg resource: Resource) = emptyList() override suspend fun update(vararg resource: Resource) {} @@ -204,7 +204,7 @@ object TestFhirEngineImpl : FhirEngine { override suspend fun purge(type: ResourceType, ids: Set, forcePurge: Boolean) {} } -object TestFailingDatasource : DataSource { +internal object TestFailingDatasource : DataSource { override suspend fun download(downloadRequest: DownloadRequest) = when (downloadRequest) { @@ -223,7 +223,8 @@ object TestFailingDatasource : DataSource { } } -class BundleDataSource(val onPostBundle: suspend (BundleUploadRequest) -> Resource) : DataSource { +internal class BundleDataSource(val onPostBundle: suspend (BundleUploadRequest) -> Resource) : + DataSource { override suspend fun download(downloadRequest: DownloadRequest): Resource { TODO("Not yet implemented") @@ -233,7 +234,7 @@ class BundleDataSource(val onPostBundle: suspend (BundleUploadRequest) -> Resour onPostBundle((request as BundleUploadRequest)) } -class UrlRequestDataSource(val onUrlRequestSend: suspend (UrlUploadRequest) -> Resource) : +internal class UrlRequestDataSource(val onUrlRequestSend: suspend (UrlUploadRequest) -> Resource) : DataSource { override suspend fun download(downloadRequest: DownloadRequest): Resource { diff --git a/engine/src/test/java/com/google/android/fhir/sync/FhirSyncWorkerTest.kt b/engine/src/test/java/com/google/android/fhir/sync/FhirSyncWorkerTest.kt index 8932338bb1..ba51d5d5e6 100644 --- a/engine/src/test/java/com/google/android/fhir/sync/FhirSyncWorkerTest.kt +++ b/engine/src/test/java/com/google/android/fhir/sync/FhirSyncWorkerTest.kt @@ -42,7 +42,7 @@ import org.robolectric.annotation.Config @RunWith(RobolectricTestRunner::class) @Config(manifest = Config.NONE) -class FhirSyncWorkerTest { +internal class FhirSyncWorkerTest { private lateinit var context: Context class PassingPeriodicSyncWorker(appContext: Context, workerParams: WorkerParameters) : diff --git a/engine/src/test/java/com/google/android/fhir/sync/upload/request/RequestGeneratorTestUtils.kt b/engine/src/test/java/com/google/android/fhir/sync/upload/request/RequestGeneratorTestUtils.kt index 6f8bc949dd..b9ea837690 100644 --- a/engine/src/test/java/com/google/android/fhir/sync/upload/request/RequestGeneratorTestUtils.kt +++ b/engine/src/test/java/com/google/android/fhir/sync/upload/request/RequestGeneratorTestUtils.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023 Google LLC + * Copyright 2023-2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ import org.hl7.fhir.r4.model.HumanName import org.hl7.fhir.r4.model.Patient import org.hl7.fhir.r4.model.ResourceType -object RequestGeneratorTestUtils { +internal object RequestGeneratorTestUtils { fun LocalChange.toPatch() = Patch(