Fixed tests and updated dependencies
This commit is contained in:
parent
49e77199b0
commit
f374748f71
@ -14,8 +14,11 @@ if (project.hasProperty("project.configs")
|
|||||||
//noinspection GroovyMissingReturnStatement
|
//noinspection GroovyMissingReturnStatement
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 27
|
compileSdkVersion 27
|
||||||
buildToolsVersion "26.0.2"
|
buildToolsVersion "27.0.3"
|
||||||
|
|
||||||
|
signingConfigs {
|
||||||
|
release
|
||||||
|
}
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "ch.dissem.apps.${appName.toLowerCase()}"
|
applicationId "ch.dissem.apps.${appName.toLowerCase()}"
|
||||||
minSdkVersion 19
|
minSdkVersion 19
|
||||||
@ -69,10 +72,11 @@ dependencies {
|
|||||||
|
|
||||||
implementation "ch.dissem.jabit:jabit-core:$jabitVersion"
|
implementation "ch.dissem.jabit:jabit-core:$jabitVersion"
|
||||||
implementation "ch.dissem.jabit:jabit-networking:$jabitVersion"
|
implementation "ch.dissem.jabit:jabit-networking:$jabitVersion"
|
||||||
implementation "ch.dissem.jabit:jabit-cryptography-spongy:$jabitVersion"
|
|
||||||
implementation "ch.dissem.jabit:jabit-extensions:$jabitVersion"
|
implementation "ch.dissem.jabit:jabit-extensions:$jabitVersion"
|
||||||
implementation "ch.dissem.jabit:jabit-wif:$jabitVersion"
|
implementation "ch.dissem.jabit:jabit-wif:$jabitVersion"
|
||||||
implementation "ch.dissem.jabit:jabit-exports:$jabitVersion"
|
implementation "ch.dissem.jabit:jabit-exports:$jabitVersion"
|
||||||
|
implementation "ch.dissem.jabit:jabit-cryptography-spongy:$jabitVersion"
|
||||||
|
testImplementation "ch.dissem.jabit:jabit-cryptography-bouncy:$jabitVersion"
|
||||||
|
|
||||||
implementation 'org.slf4j:slf4j-android:1.7.25'
|
implementation 'org.slf4j:slf4j-android:1.7.25'
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ import ch.dissem.apps.abit.repository.AndroidAddressRepository
|
|||||||
import ch.dissem.apps.abit.repository.AndroidLabelRepository
|
import ch.dissem.apps.abit.repository.AndroidLabelRepository
|
||||||
import ch.dissem.apps.abit.repository.AndroidMessageRepository
|
import ch.dissem.apps.abit.repository.AndroidMessageRepository
|
||||||
import ch.dissem.apps.abit.repository.SqlHelper
|
import ch.dissem.apps.abit.repository.SqlHelper
|
||||||
import ch.dissem.bitmessage.cryptography.sc.SpongyCryptography
|
import ch.dissem.bitmessage.cryptography.bc.BouncyCryptography
|
||||||
import ch.dissem.bitmessage.entity.BitmessageAddress
|
import ch.dissem.bitmessage.entity.BitmessageAddress
|
||||||
import ch.dissem.bitmessage.entity.ObjectMessage
|
import ch.dissem.bitmessage.entity.ObjectMessage
|
||||||
import ch.dissem.bitmessage.entity.Plaintext
|
import ch.dissem.bitmessage.entity.Plaintext
|
||||||
@ -69,7 +69,7 @@ class AndroidMessageRepositoryTest : TestBase() {
|
|||||||
val labelRepo = AndroidLabelRepository(sqlHelper, RuntimeEnvironment.application)
|
val labelRepo = AndroidLabelRepository(sqlHelper, RuntimeEnvironment.application)
|
||||||
repo = AndroidMessageRepository(sqlHelper)
|
repo = AndroidMessageRepository(sqlHelper)
|
||||||
mockedInternalContext(
|
mockedInternalContext(
|
||||||
cryptography = SpongyCryptography(),
|
cryptography = BouncyCryptography(),
|
||||||
addressRepository = addressRepo,
|
addressRepository = addressRepo,
|
||||||
labelRepository = labelRepo,
|
labelRepository = labelRepo,
|
||||||
messageRepository = repo,
|
messageRepository = repo,
|
||||||
|
@ -59,7 +59,6 @@ class AndroidProofOfWorkRepositoryTest : TestBase() {
|
|||||||
fun setUp() {
|
fun setUp() {
|
||||||
RuntimeEnvironment.application.deleteDatabase(SqlHelper.DATABASE_NAME)
|
RuntimeEnvironment.application.deleteDatabase(SqlHelper.DATABASE_NAME)
|
||||||
val sqlHelper = SqlHelper(RuntimeEnvironment.application)
|
val sqlHelper = SqlHelper(RuntimeEnvironment.application)
|
||||||
|
|
||||||
addressRepo = AndroidAddressRepository(sqlHelper)
|
addressRepo = AndroidAddressRepository(sqlHelper)
|
||||||
messageRepo = AndroidMessageRepository(sqlHelper)
|
messageRepo = AndroidMessageRepository(sqlHelper)
|
||||||
repo = AndroidProofOfWorkRepository(sqlHelper)
|
repo = AndroidProofOfWorkRepository(sqlHelper)
|
||||||
@ -94,12 +93,14 @@ class AndroidProofOfWorkRepositoryTest : TestBase() {
|
|||||||
messageRepo.save(plaintext)
|
messageRepo.save(plaintext)
|
||||||
plaintext.ackMessage!!.let { ackMessage ->
|
plaintext.ackMessage!!.let { ackMessage ->
|
||||||
initialHash2 = cryptography().getInitialHash(ackMessage)
|
initialHash2 = cryptography().getInitialHash(ackMessage)
|
||||||
repo.putObject(ProofOfWorkRepository.Item(
|
repo.putObject(
|
||||||
objectMessage = ackMessage,
|
ProofOfWorkRepository.Item(
|
||||||
nonceTrialsPerByte = 1000, extraBytes = 1000,
|
objectMessage = ackMessage,
|
||||||
expirationTime = UnixTime.now + 10 * UnixTime.MINUTE,
|
nonceTrialsPerByte = 1000, extraBytes = 1000,
|
||||||
message = plaintext
|
expirationTime = UnixTime.now + 10 * UnixTime.MINUTE,
|
||||||
))
|
message = plaintext
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,13 +133,15 @@ class AndroidProofOfWorkRepositoryTest : TestBase() {
|
|||||||
.build()
|
.build()
|
||||||
messageRepo.save(plaintext)
|
messageRepo.save(plaintext)
|
||||||
plaintext.ackMessage!!.let { ackMessage ->
|
plaintext.ackMessage!!.let { ackMessage ->
|
||||||
repo.putObject(ProofOfWorkRepository.Item(
|
repo.putObject(
|
||||||
objectMessage = ackMessage,
|
ProofOfWorkRepository.Item(
|
||||||
nonceTrialsPerByte = 1000,
|
objectMessage = ackMessage,
|
||||||
extraBytes = 1000,
|
nonceTrialsPerByte = 1000,
|
||||||
expirationTime = UnixTime.now + 10 * UnixTime.MINUTE,
|
extraBytes = 1000,
|
||||||
message = plaintext
|
expirationTime = UnixTime.now + 10 * UnixTime.MINUTE,
|
||||||
))
|
message = plaintext
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
assertThat(repo.getItems().size, `is`(sizeBefore + 1))
|
assertThat(repo.getItems().size, `is`(sizeBefore + 1))
|
||||||
}
|
}
|
||||||
@ -147,7 +150,10 @@ class AndroidProofOfWorkRepositoryTest : TestBase() {
|
|||||||
fun `ensure item can be retrieved`() {
|
fun `ensure item can be retrieved`() {
|
||||||
val item = repo.getItem(initialHash1)
|
val item = repo.getItem(initialHash1)
|
||||||
assertThat(item, notNullValue())
|
assertThat(item, notNullValue())
|
||||||
assertThat<ObjectPayload>(item.objectMessage.payload, instanceOf<ObjectPayload>(GetPubkey::class.java))
|
assertThat<ObjectPayload>(
|
||||||
|
item.objectMessage.payload,
|
||||||
|
instanceOf<ObjectPayload>(GetPubkey::class.java)
|
||||||
|
)
|
||||||
assertThat(item.nonceTrialsPerByte, `is`(1000L))
|
assertThat(item.nonceTrialsPerByte, `is`(1000L))
|
||||||
assertThat(item.extraBytes, `is`(1000L))
|
assertThat(item.extraBytes, `is`(1000L))
|
||||||
}
|
}
|
||||||
@ -156,7 +162,10 @@ class AndroidProofOfWorkRepositoryTest : TestBase() {
|
|||||||
fun `ensure ack item can be retrieved`() {
|
fun `ensure ack item can be retrieved`() {
|
||||||
val item = repo.getItem(initialHash2)
|
val item = repo.getItem(initialHash2)
|
||||||
assertThat(item, notNullValue())
|
assertThat(item, notNullValue())
|
||||||
assertThat<ObjectPayload>(item.objectMessage.payload, instanceOf<ObjectPayload>(GenericPayload::class.java))
|
assertThat<ObjectPayload>(
|
||||||
|
item.objectMessage.payload,
|
||||||
|
instanceOf<ObjectPayload>(GenericPayload::class.java)
|
||||||
|
)
|
||||||
assertThat(item.nonceTrialsPerByte, `is`(1000L))
|
assertThat(item.nonceTrialsPerByte, `is`(1000L))
|
||||||
assertThat(item.extraBytes, `is`(1000L))
|
assertThat(item.extraBytes, `is`(1000L))
|
||||||
assertThat(item.expirationTime, not<Number>(0))
|
assertThat(item.expirationTime, not<Number>(0))
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.2.30'
|
ext.kotlin_version = '1.2.31'
|
||||||
ext.anko_version = '0.10.4'
|
ext.anko_version = '0.10.4'
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
google()
|
google()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.0.1'
|
classpath 'com.android.tools.build:gradle:3.1.0'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
classpath 'com.github.ben-manes:gradle-versions-plugin:0.17.0'
|
classpath 'com.github.ben-manes:gradle-versions-plugin:0.17.0'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user