Move InMemoryBackendStorage to separate module
This commit is contained in:
parent
30f5cac95e
commit
f993b32aae
8 changed files with 47 additions and 2 deletions
|
@ -16,6 +16,7 @@ dependencies {
|
|||
kapt "com.squareup.moshi:moshi-kotlin-codegen:${versions.moshi}"
|
||||
|
||||
testImplementation project(":mail:testing")
|
||||
testImplementation project(':backend:testing')
|
||||
testImplementation "org.mockito:mockito-core:${versions.mockito}"
|
||||
testImplementation("com.squareup.okhttp3:mockwebserver:${versions.okhttp}")
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.fsck.k9.backend.jmap
|
||||
|
||||
import app.k9mail.backend.testing.InMemoryBackendStorage
|
||||
import com.fsck.k9.backend.api.BackendFolderUpdater
|
||||
import com.fsck.k9.backend.api.FolderInfo
|
||||
import com.fsck.k9.backend.api.updateFolders
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.fsck.k9.backend.jmap
|
||||
|
||||
import app.k9mail.backend.testing.InMemoryBackendFolder
|
||||
import app.k9mail.backend.testing.InMemoryBackendStorage
|
||||
import com.fsck.k9.backend.api.FolderInfo
|
||||
import com.fsck.k9.backend.api.SyncConfig
|
||||
import com.fsck.k9.backend.api.SyncConfig.ExpungePolicy
|
||||
|
|
31
backend/testing/build.gradle
Normal file
31
backend/testing/build.gradle
Normal file
|
@ -0,0 +1,31 @@
|
|||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'org.jetbrains.kotlin.android'
|
||||
|
||||
dependencies {
|
||||
implementation project(":backend:api")
|
||||
implementation "com.squareup.okio:okio:${versions.okio}"
|
||||
implementation "junit:junit:${versions.junit}"
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion buildConfig.compileSdk
|
||||
buildToolsVersion buildConfig.buildTools
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion buildConfig.minSdk
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
lintConfig file("$rootProject.projectDir/config/lint/lint.xml")
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility javaVersion
|
||||
targetCompatibility javaVersion
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = kotlinJvmVersion
|
||||
}
|
||||
}
|
2
backend/testing/src/main/AndroidManifest.xml
Normal file
2
backend/testing/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest package="app.k9mail.backend.testing" />
|
|
@ -1,4 +1,4 @@
|
|||
package com.fsck.k9.backend.jmap
|
||||
package app.k9mail.backend.testing
|
||||
|
||||
import com.fsck.k9.backend.api.BackendFolder
|
||||
import com.fsck.k9.mail.Flag
|
||||
|
@ -8,6 +8,8 @@ import com.fsck.k9.mail.MessageDownloadState
|
|||
import com.fsck.k9.mail.internet.MimeMessage
|
||||
import java.util.Date
|
||||
import okio.Buffer
|
||||
import okio.buffer
|
||||
import okio.source
|
||||
import org.junit.Assert.assertEquals
|
||||
|
||||
class InMemoryBackendFolder(override var name: String, var type: FolderType) : BackendFolder {
|
||||
|
@ -142,4 +144,9 @@ class InMemoryBackendFolder(override var name: String, var type: FolderType) : B
|
|||
override fun setFolderExtraNumber(name: String, value: Long) {
|
||||
extraNumbers[name] = value
|
||||
}
|
||||
|
||||
private fun loadResource(name: String): String {
|
||||
val resourceAsStream = javaClass.getResourceAsStream(name) ?: error("Couldn't load resource: $name")
|
||||
return resourceAsStream.use { it.source().buffer().readUtf8() }
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.fsck.k9.backend.jmap
|
||||
package app.k9mail.backend.testing
|
||||
|
||||
import com.fsck.k9.backend.api.BackendFolderUpdater
|
||||
import com.fsck.k9.backend.api.BackendStorage
|
|
@ -18,6 +18,7 @@ include ':mail:protocols:pop3'
|
|||
include ':mail:protocols:webdav'
|
||||
include ':mail:protocols:smtp'
|
||||
include ':backend:api'
|
||||
include ':backend:testing'
|
||||
include ':backend:imap'
|
||||
include ':backend:pop3'
|
||||
include ':backend:webdav'
|
||||
|
|
Loading…
Reference in a new issue