Add LibTest getTestDataDir to fix sled test on android

This commit is contained in:
Steve Myers
2021-06-26 18:50:58 -07:00
parent 1249a4c491
commit f5dd87b02a
17 changed files with 80 additions and 54 deletions

View File

@@ -35,7 +35,7 @@ afterEvaluate {
// You can then customize attributes of the publication as shown below.
groupId = 'org.bitcoindevkit'
artifactId = 'bdk'
version = '0.0.1-dev'
version = '0.0.1-SNAPSHOT'
}
// Creates a Maven publication called “debug”.
debug(MavenPublication) {
@@ -44,14 +44,14 @@ afterEvaluate {
groupId = 'org.bitcoindevkit'
artifactId = 'bdk-debug'
version = '0.0.1-dev'
version = '0.0.1-SNAPSHOT'
}
}
}
}
dependencies {
implementation (project(':jvm')) {
implementation(project(':jvm')) {
exclude group: 'net.java.dev.jna', module: 'jna'
}
@@ -62,7 +62,7 @@ dependencies {
api "org.slf4j:slf4j-api:1.7.30"
androidTestImplementation 'com.github.tony19:logback-android:2.0.0'
androidTestImplementation (project(':test-fixtures')) {
androidTestImplementation(project(':test-fixtures')) {
exclude group: 'net.java.dev.jna', module: 'jna'
}
androidTestImplementation 'androidx.test.ext:junit:1.1.2'

View File

@@ -1,11 +1,11 @@
package org.bitcoindevkit.bdk
import android.app.Application
import android.content.Context.MODE_PRIVATE
import androidx.test.core.app.ApplicationProvider
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
@@ -13,5 +13,9 @@ import org.junit.Assert.*
*/
@RunWith(AndroidJUnit4::class)
class AndroidLibTest : LibTest() {
override fun getTestDataDir(): String {
val context = ApplicationProvider.getApplicationContext<Application>()
return context.getDir("bdk-test", MODE_PRIVATE).toString()
}
}

View File

@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.bitcoindevkit.bdk" >
package="org.bitcoindevkit.bdk">
<uses-permission android:name="android.permission.INTERNET" />