Move bdk-kotlin test-fixtures tests to jvm module
This commit is contained in:
parent
5ece17d67a
commit
e9f00dcb75
@ -62,8 +62,10 @@ dependencies {
|
|||||||
api "org.slf4j:slf4j-api:1.7.30"
|
api "org.slf4j:slf4j-api:1.7.30"
|
||||||
|
|
||||||
androidTestImplementation 'com.github.tony19:logback-android:2.0.0'
|
androidTestImplementation 'com.github.tony19:logback-android:2.0.0'
|
||||||
androidTestImplementation(project(':test-fixtures')) {
|
androidTestImplementation(testFixtures(project(':jvm'))) {
|
||||||
exclude group: 'net.java.dev.jna', module: 'jna'
|
exclude group: 'net.java.dev.jna', module: 'jna'
|
||||||
|
exclude group: 'ch.qos.logback', module: 'logback-core'
|
||||||
|
exclude group: 'ch.qos.logback', module: 'logback-classic'
|
||||||
}
|
}
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'org.jetbrains.kotlin.jvm'
|
id 'org.jetbrains.kotlin.jvm'
|
||||||
id 'java-library'
|
id 'java-library'
|
||||||
id 'maven-publish'
|
id 'java-test-fixtures'
|
||||||
|
id 'maven-publish'
|
||||||
}
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
@ -10,30 +11,29 @@ java {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test {
|
test {
|
||||||
testLogging {
|
testLogging {
|
||||||
events "PASSED", "SKIPPED", "FAILED", "STANDARD_OUT", "STANDARD_ERROR"
|
events "PASSED", "SKIPPED", "FAILED", "STANDARD_OUT", "STANDARD_ERROR"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation platform('org.jetbrains.kotlin:kotlin-bom')
|
implementation platform('org.jetbrains.kotlin:kotlin-bom')
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||||
implementation "net.java.dev.jna:jna:5.8.0"
|
implementation "net.java.dev.jna:jna:5.8.0"
|
||||||
implementation "junit:junit:4.13.2"
|
api "org.slf4j:slf4j-api:1.7.30"
|
||||||
api "org.slf4j:slf4j-api:1.7.30"
|
testFixturesImplementation "junit:junit:4.13.2"
|
||||||
testImplementation "ch.qos.logback:logback-classic:1.2.3"
|
testFixturesImplementation "ch.qos.logback:logback-classic:1.2.3"
|
||||||
testImplementation "ch.qos.logback:logback-core:1.2.3"
|
testFixturesImplementation "ch.qos.logback:logback-core:1.2.3"
|
||||||
testImplementation(project(':test-fixtures'))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
maven(MavenPublication) {
|
maven(MavenPublication) {
|
||||||
groupId = 'org.bitcoindevkit'
|
groupId = 'org.bitcoindevkit'
|
||||||
artifactId = 'bdk'
|
artifactId = 'bdk'
|
||||||
version = '0.0.1-SNAPSHOT'
|
version = '0.0.1-SNAPSHOT'
|
||||||
|
|
||||||
from components.java
|
from components.java
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ abstract class LibTest {
|
|||||||
assertEquals(address, "bcrt1qzg4mckdh50nwdm9hkzq06528rsu73hjxytqkxs")
|
assertEquals(address, "bcrt1qzg4mckdh50nwdm9hkzq06528rsu73hjxytqkxs")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected= BdkException.Descriptor::class)
|
@Test(expected = BdkException.Descriptor::class)
|
||||||
fun invalidDescriptorExceptionIsThrown() {
|
fun invalidDescriptorExceptionIsThrown() {
|
||||||
val config = DatabaseConfig.Memory("")
|
val config = DatabaseConfig.Memory("")
|
||||||
OfflineWallet("invalid-descriptor", Network.REGTEST, config)
|
OfflineWallet("invalid-descriptor", Network.REGTEST, config)
|
||||||
@ -52,14 +52,22 @@ abstract class LibTest {
|
|||||||
@Test
|
@Test
|
||||||
fun onlineWalletInMemory() {
|
fun onlineWalletInMemory() {
|
||||||
val db = DatabaseConfig.Memory("")
|
val db = DatabaseConfig.Memory("")
|
||||||
val client = BlockchainConfig.Electrum(ElectrumConfig("ssl://electrum.blockstream.info:60002", null, 5u, null, 100u))
|
val client = BlockchainConfig.Electrum(
|
||||||
|
ElectrumConfig(
|
||||||
|
"ssl://electrum.blockstream.info:60002",
|
||||||
|
null,
|
||||||
|
5u,
|
||||||
|
null,
|
||||||
|
100u
|
||||||
|
)
|
||||||
|
)
|
||||||
val wallet = OnlineWallet(desc, Network.TESTNET, db, client)
|
val wallet = OnlineWallet(desc, Network.TESTNET, db, client)
|
||||||
assertNotNull(wallet)
|
assertNotNull(wallet)
|
||||||
val network = wallet.getNetwork()
|
val network = wallet.getNetwork()
|
||||||
assertEquals(network, Network.TESTNET)
|
assertEquals(network, Network.TESTNET)
|
||||||
}
|
}
|
||||||
|
|
||||||
class LogProgress: BdkProgress {
|
class LogProgress : BdkProgress {
|
||||||
val log: Logger = LoggerFactory.getLogger(LibTest::class.java)
|
val log: Logger = LoggerFactory.getLogger(LibTest::class.java)
|
||||||
|
|
||||||
override fun update(progress: Float, message: String?) {
|
override fun update(progress: Float, message: String?) {
|
||||||
@ -70,7 +78,15 @@ abstract class LibTest {
|
|||||||
@Test
|
@Test
|
||||||
fun onlineWalletSyncGetBalance() {
|
fun onlineWalletSyncGetBalance() {
|
||||||
val db = DatabaseConfig.Memory("")
|
val db = DatabaseConfig.Memory("")
|
||||||
val client = BlockchainConfig.Electrum(ElectrumConfig("ssl://electrum.blockstream.info:60002", null, 5u, null, 100u))
|
val client = BlockchainConfig.Electrum(
|
||||||
|
ElectrumConfig(
|
||||||
|
"ssl://electrum.blockstream.info:60002",
|
||||||
|
null,
|
||||||
|
5u,
|
||||||
|
null,
|
||||||
|
100u
|
||||||
|
)
|
||||||
|
)
|
||||||
val wallet = OnlineWallet(desc, Network.TESTNET, db, client)
|
val wallet = OnlineWallet(desc, Network.TESTNET, db, client)
|
||||||
wallet.sync(LogProgress(), null)
|
wallet.sync(LogProgress(), null)
|
||||||
val balance = wallet.getBalance()
|
val balance = wallet.getBalance()
|
@ -1,4 +1,4 @@
|
|||||||
rootProject.name = 'bdk-kotlin'
|
rootProject.name = 'bdk-kotlin'
|
||||||
|
|
||||||
include ':jvm',':demo',':test-fixtures',':android'
|
include ':jvm',':demo',':android'
|
||||||
|
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
plugins {
|
|
||||||
id 'org.jetbrains.kotlin.jvm'
|
|
||||||
id 'java-library'
|
|
||||||
}
|
|
||||||
|
|
||||||
java {
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation platform('org.jetbrains.kotlin:kotlin-bom')
|
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
|
||||||
|
|
||||||
implementation(project(':jvm'))
|
|
||||||
implementation "junit:junit:4.13.2"
|
|
||||||
api "org.slf4j:slf4j-api:1.7.30"
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user