diff --git a/owncloudApp/src/main/java/com/owncloud/android/dependecyinjection/LocalDataSourceModule.kt b/owncloudApp/src/main/java/com/owncloud/android/dependecyinjection/LocalDataSourceModule.kt index d0577d33e23..b3bda017327 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/dependecyinjection/LocalDataSourceModule.kt +++ b/owncloudApp/src/main/java/com/owncloud/android/dependecyinjection/LocalDataSourceModule.kt @@ -34,8 +34,8 @@ import com.owncloud.android.data.capabilities.datasources.LocalCapabilitiesDataS import com.owncloud.android.data.capabilities.datasources.implementation.OCLocalCapabilitiesDataSource import com.owncloud.android.data.files.datasources.LocalFileDataSource import com.owncloud.android.data.files.datasources.implementation.OCLocalFileDataSource -import com.owncloud.android.data.folderbackup.datasources.FolderBackupLocalDataSource -import com.owncloud.android.data.folderbackup.datasources.implementation.OCFolderBackupLocalDataSource +import com.owncloud.android.data.folderbackup.datasources.LocalFolderBackupDataSource +import com.owncloud.android.data.folderbackup.datasources.implementation.OCLocalFolderBackupDataSource import com.owncloud.android.data.providers.SharedPreferencesProvider import com.owncloud.android.data.providers.implementation.OCSharedPreferencesProvider import com.owncloud.android.data.sharing.shares.datasources.LocalShareDataSource @@ -70,7 +70,7 @@ val localDataSourceModule = module { single { ScopedStorageProvider(dataFolder, androidContext()) } factory { OCLocalAuthenticationDataSource(androidContext(), get(), get(), accountType) } - factoryOf(::OCFolderBackupLocalDataSource) bind FolderBackupLocalDataSource::class + factoryOf(::OCLocalFolderBackupDataSource) bind LocalFolderBackupDataSource::class factoryOf(::OCLocalAppRegistryDataSource) bind LocalAppRegistryDataSource::class factoryOf(::OCLocalCapabilitiesDataSource) bind LocalCapabilitiesDataSource::class factoryOf(::OCLocalFileDataSource) bind LocalFileDataSource::class diff --git a/owncloudApp/src/main/java/com/owncloud/android/providers/FileContentProvider.kt b/owncloudApp/src/main/java/com/owncloud/android/providers/FileContentProvider.kt index 982c6619768..4c9dcfc40ac 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/providers/FileContentProvider.kt +++ b/owncloudApp/src/main/java/com/owncloud/android/providers/FileContentProvider.kt @@ -55,8 +55,8 @@ import com.owncloud.android.data.capabilities.datasources.implementation.OCLocal import com.owncloud.android.data.capabilities.datasources.implementation.OCLocalCapabilitiesDataSource.Companion.toModel import com.owncloud.android.data.capabilities.db.OCCapabilityEntity import com.owncloud.android.data.files.db.OCFileEntity -import com.owncloud.android.data.folderbackup.datasources.FolderBackupLocalDataSource -import com.owncloud.android.data.folderbackup.datasources.implementation.OCFolderBackupLocalDataSource +import com.owncloud.android.data.folderbackup.datasources.LocalFolderBackupDataSource +import com.owncloud.android.data.folderbackup.datasources.implementation.OCLocalFolderBackupDataSource import com.owncloud.android.data.migrations.CameraUploadsMigrationToRoom import com.owncloud.android.data.providers.SharedPreferencesProvider import com.owncloud.android.data.providers.implementation.OCSharedPreferencesProvider @@ -973,8 +973,8 @@ class FileContentProvider(val executors: Executors = Executors()) : ContentProvi val pictureUploadsConfiguration = migrationToRoom.getPictureUploadsConfigurationPreferences(pictureUploadsTimestamp) val videoUploadsConfiguration = migrationToRoom.getVideoUploadsConfigurationPreferences(videoUploadsTimestamp) - val backupLocalDataSource: FolderBackupLocalDataSource = - OCFolderBackupLocalDataSource(OwncloudDatabase.getDatabase(context!!).folderBackUpDao()) + val backupLocalDataSource: LocalFolderBackupDataSource = + OCLocalFolderBackupDataSource(OwncloudDatabase.getDatabase(context!!).folderBackUpDao()) // Insert camera uploads configuration in new database executors.diskIO().execute { pictureUploadsConfiguration?.let { backupLocalDataSource.saveFolderBackupConfiguration(it) } diff --git a/owncloudData/src/main/java/com/owncloud/android/data/folderbackup/OCFolderBackupRepository.kt b/owncloudData/src/main/java/com/owncloud/android/data/folderbackup/OCFolderBackupRepository.kt index 04cd065fd7f..a88c5b00659 100644 --- a/owncloudData/src/main/java/com/owncloud/android/data/folderbackup/OCFolderBackupRepository.kt +++ b/owncloudData/src/main/java/com/owncloud/android/data/folderbackup/OCFolderBackupRepository.kt @@ -18,27 +18,27 @@ */ package com.owncloud.android.data.folderbackup -import com.owncloud.android.data.folderbackup.datasources.FolderBackupLocalDataSource +import com.owncloud.android.data.folderbackup.datasources.LocalFolderBackupDataSource import com.owncloud.android.domain.camerauploads.FolderBackupRepository import com.owncloud.android.domain.camerauploads.model.CameraUploadsConfiguration import com.owncloud.android.domain.camerauploads.model.FolderBackUpConfiguration import kotlinx.coroutines.flow.Flow class OCFolderBackupRepository( - private val folderBackupLocalDataSource: FolderBackupLocalDataSource + private val localFolderBackupDataSource: LocalFolderBackupDataSource ) : FolderBackupRepository { override fun getCameraUploadsConfiguration(): CameraUploadsConfiguration? = - folderBackupLocalDataSource.getCameraUploadsConfiguration() + localFolderBackupDataSource.getCameraUploadsConfiguration() override fun getFolderBackupConfigurationByNameAsFlow(name: String): Flow = - folderBackupLocalDataSource.getFolderBackupConfigurationByNameAsFlow(name) + localFolderBackupDataSource.getFolderBackupConfigurationByNameAsFlow(name) override fun saveFolderBackupConfiguration(folderBackUpConfiguration: FolderBackUpConfiguration) { - folderBackupLocalDataSource.saveFolderBackupConfiguration(folderBackUpConfiguration) + localFolderBackupDataSource.saveFolderBackupConfiguration(folderBackUpConfiguration) } override fun resetFolderBackupConfigurationByName(name: String) = - folderBackupLocalDataSource.resetFolderBackupConfigurationByName(name) + localFolderBackupDataSource.resetFolderBackupConfigurationByName(name) } diff --git a/owncloudData/src/main/java/com/owncloud/android/data/folderbackup/datasources/FolderBackupLocalDataSource.kt b/owncloudData/src/main/java/com/owncloud/android/data/folderbackup/datasources/LocalFolderBackupDataSource.kt similarity index 96% rename from owncloudData/src/main/java/com/owncloud/android/data/folderbackup/datasources/FolderBackupLocalDataSource.kt rename to owncloudData/src/main/java/com/owncloud/android/data/folderbackup/datasources/LocalFolderBackupDataSource.kt index 1efe4d6b68b..fcdcd1aa06f 100644 --- a/owncloudData/src/main/java/com/owncloud/android/data/folderbackup/datasources/FolderBackupLocalDataSource.kt +++ b/owncloudData/src/main/java/com/owncloud/android/data/folderbackup/datasources/LocalFolderBackupDataSource.kt @@ -22,7 +22,7 @@ import com.owncloud.android.domain.camerauploads.model.CameraUploadsConfiguratio import com.owncloud.android.domain.camerauploads.model.FolderBackUpConfiguration import kotlinx.coroutines.flow.Flow -interface FolderBackupLocalDataSource { +interface LocalFolderBackupDataSource { fun getCameraUploadsConfiguration(): CameraUploadsConfiguration? fun getFolderBackupConfigurationByNameAsFlow(name: String): Flow diff --git a/owncloudData/src/main/java/com/owncloud/android/data/folderbackup/datasources/implementation/OCFolderBackupLocalDataSource.kt b/owncloudData/src/main/java/com/owncloud/android/data/folderbackup/datasources/implementation/OCLocalFolderBackupDataSource.kt similarity index 96% rename from owncloudData/src/main/java/com/owncloud/android/data/folderbackup/datasources/implementation/OCFolderBackupLocalDataSource.kt rename to owncloudData/src/main/java/com/owncloud/android/data/folderbackup/datasources/implementation/OCLocalFolderBackupDataSource.kt index a28bbf8b143..5af4e0a5e18 100644 --- a/owncloudData/src/main/java/com/owncloud/android/data/folderbackup/datasources/implementation/OCFolderBackupLocalDataSource.kt +++ b/owncloudData/src/main/java/com/owncloud/android/data/folderbackup/datasources/implementation/OCLocalFolderBackupDataSource.kt @@ -19,7 +19,7 @@ package com.owncloud.android.data.folderbackup.datasources.implementation import androidx.annotation.VisibleForTesting -import com.owncloud.android.data.folderbackup.datasources.FolderBackupLocalDataSource +import com.owncloud.android.data.folderbackup.datasources.LocalFolderBackupDataSource import com.owncloud.android.data.folderbackup.db.FolderBackUpEntity import com.owncloud.android.data.folderbackup.db.FolderBackupDao import com.owncloud.android.domain.camerauploads.model.CameraUploadsConfiguration @@ -30,9 +30,9 @@ import com.owncloud.android.domain.camerauploads.model.UploadBehavior import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map -class OCFolderBackupLocalDataSource( +class OCLocalFolderBackupDataSource( private val folderBackupDao: FolderBackupDao, -) : FolderBackupLocalDataSource { +) : LocalFolderBackupDataSource { override fun getCameraUploadsConfiguration(): CameraUploadsConfiguration? { val pictureUploadsConfiguration = folderBackupDao.getFolderBackUpConfigurationByName(pictureUploadsName) diff --git a/owncloudData/src/test/java/com/owncloud/android/data/folderbackup/datasources/implementation/OCFolderBackupLocalDataSourceTest.kt b/owncloudData/src/test/java/com/owncloud/android/data/folderbackup/datasources/implementation/OCLocalFolderBackupDataSourceTest.kt similarity index 83% rename from owncloudData/src/test/java/com/owncloud/android/data/folderbackup/datasources/implementation/OCFolderBackupLocalDataSourceTest.kt rename to owncloudData/src/test/java/com/owncloud/android/data/folderbackup/datasources/implementation/OCLocalFolderBackupDataSourceTest.kt index f14b1b21cdf..487594e6b23 100644 --- a/owncloudData/src/test/java/com/owncloud/android/data/folderbackup/datasources/implementation/OCFolderBackupLocalDataSourceTest.kt +++ b/owncloudData/src/test/java/com/owncloud/android/data/folderbackup/datasources/implementation/OCLocalFolderBackupDataSourceTest.kt @@ -20,7 +20,7 @@ package com.owncloud.android.data.folderbackup.datasources.implementation -import com.owncloud.android.data.folderbackup.datasources.implementation.OCFolderBackupLocalDataSource.Companion.toModel +import com.owncloud.android.data.folderbackup.datasources.implementation.OCLocalFolderBackupDataSource.Companion.toModel import com.owncloud.android.data.folderbackup.db.FolderBackupDao import com.owncloud.android.domain.camerauploads.model.FolderBackUpConfiguration import com.owncloud.android.testutil.OC_BACKUP @@ -36,14 +36,14 @@ import kotlinx.coroutines.runBlocking import org.junit.Before import org.junit.Test -class OCFolderBackupLocalDataSourceTest { +class OCLocalFolderBackupDataSourceTest { - private lateinit var ocFolderBackupLocalDataSource: OCFolderBackupLocalDataSource + private lateinit var mOcLocalFolderBackupDataSource: OCLocalFolderBackupDataSource private val folderBackupDao = mockk(relaxed = true) @Before fun setUp() { - ocFolderBackupLocalDataSource = OCFolderBackupLocalDataSource(folderBackupDao) + mOcLocalFolderBackupDataSource = OCLocalFolderBackupDataSource(folderBackupDao) } @Test @@ -51,7 +51,7 @@ class OCFolderBackupLocalDataSourceTest { every { folderBackupDao.getFolderBackUpConfigurationByName(FolderBackUpConfiguration.pictureUploadsName) } returns OC_BACKUP_ENTITY every { folderBackupDao.getFolderBackUpConfigurationByName(FolderBackUpConfiguration.videoUploadsName) } returns OC_BACKUP_ENTITY - val resultCurrent = ocFolderBackupLocalDataSource.getCameraUploadsConfiguration() + val resultCurrent = mOcLocalFolderBackupDataSource.getCameraUploadsConfiguration() assertEquals(OC_BACKUP_ENTITY.toModel(), resultCurrent?.pictureUploadsConfiguration) assertEquals(OC_BACKUP_ENTITY.toModel(), resultCurrent?.videoUploadsConfiguration) @@ -67,7 +67,7 @@ class OCFolderBackupLocalDataSourceTest { every { folderBackupDao.getFolderBackUpConfigurationByName(FolderBackUpConfiguration.pictureUploadsName) } returns null every { folderBackupDao.getFolderBackUpConfigurationByName(FolderBackUpConfiguration.videoUploadsName) } returns null - val resultCurrent = ocFolderBackupLocalDataSource.getCameraUploadsConfiguration() + val resultCurrent = mOcLocalFolderBackupDataSource.getCameraUploadsConfiguration() assertNull(resultCurrent) @@ -83,7 +83,7 @@ class OCFolderBackupLocalDataSourceTest { OC_BACKUP_ENTITY ) - val resultCurrent = ocFolderBackupLocalDataSource.getFolderBackupConfigurationByNameAsFlow(FolderBackUpConfiguration.pictureUploadsName) + val resultCurrent = mOcLocalFolderBackupDataSource.getFolderBackupConfigurationByNameAsFlow(FolderBackUpConfiguration.pictureUploadsName) val result = resultCurrent.first() assertEquals(OC_BACKUP_ENTITY.toModel(), result) @@ -95,7 +95,7 @@ class OCFolderBackupLocalDataSourceTest { @Test fun `saveFolderBackupConfiguration with valid configurations saves the information`() { - ocFolderBackupLocalDataSource.saveFolderBackupConfiguration(OC_BACKUP) + mOcLocalFolderBackupDataSource.saveFolderBackupConfiguration(OC_BACKUP) verify(exactly = 1) { folderBackupDao.update(OC_BACKUP_ENTITY) @@ -104,7 +104,7 @@ class OCFolderBackupLocalDataSourceTest { @Test fun `resetFolderBackupConfigurationByName removes current folder backup configuration`() { - ocFolderBackupLocalDataSource.resetFolderBackupConfigurationByName(FolderBackUpConfiguration.pictureUploadsName) + mOcLocalFolderBackupDataSource.resetFolderBackupConfigurationByName(FolderBackUpConfiguration.pictureUploadsName) verify(exactly = 1) { folderBackupDao.delete(FolderBackUpConfiguration.pictureUploadsName) diff --git a/owncloudData/src/test/java/com/owncloud/android/data/shares/datasources/OCLocalShareDataSourceTest.kt b/owncloudData/src/test/java/com/owncloud/android/data/shares/datasources/OCLocalShareDataSourceTest.kt index aa6e931e37b..ea1841b898e 100644 --- a/owncloudData/src/test/java/com/owncloud/android/data/shares/datasources/OCLocalShareDataSourceTest.kt +++ b/owncloudData/src/test/java/com/owncloud/android/data/shares/datasources/OCLocalShareDataSourceTest.kt @@ -292,7 +292,7 @@ class OCLocalShareDataSourceTest { **************************************************************************************************************/ @Test - fun `replaceShares renewal shares related to a list of shares`() { + fun `replaceShares update a list of shares correctly`() { val expectedValues = listOf(1, 2) every { ocSharesDao.replaceShares(publicShares) } returns expectedValues