Skip to content
This repository was archived by the owner on May 14, 2021. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ ext {
}

buildscript {
ext.kotlin_version = '1.3.31'
ext.kotlin_version = '1.3.41'
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:3.4.2"
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'org.jacoco:org.jacoco.core:0.8.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Aug 13 08:37:24 IDT 2019
#Wed Aug 21 09:30:12 IDT 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
10 changes: 5 additions & 5 deletions kin-backup-and-restore/kin-backup-and-restore-lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,18 @@ dependencies {
implementation project(':kin-sdk:kin-sdk-lib')
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.google.zxing:core:3.3.3'

androidTestImplementation 'junit:junit:4.12'
androidTestImplementation 'org.mockito:mockito-core:2.10.0'
androidTestImplementation 'org.mockito:mockito-core:2.23.0'
androidTestImplementation 'org.hamcrest:hamcrest-library:1.3'
androidTestImplementation 'com.android.support.test:runner:1.0.2'

testImplementation 'org.jetbrains.kotlin:kotlin-stdlib:1.2.71'
testImplementation 'com.nhaarman.mockitokotlin2:mockito-kotlin:2.0.0-RC1'
testImplementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
testImplementation 'com.nhaarman.mockitokotlin2:mockito-kotlin:2.1.0'
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:2.13.0'
testImplementation 'org.mockito:mockito-core:2.23.0'
testImplementation 'org.robolectric:robolectric:4.3'

}
Expand Down
12 changes: 6 additions & 6 deletions kin-sdk/kin-base/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: '*.jar')
implementation 'com.moandjiezana.toml:toml4j:0.5.1'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.squareup.okhttp3:okhttp:3.9.1'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'net.i2p.crypto:eddsa:0.3.0'
api 'com.github.kinecosystem:oksse:93f4ef7445f9c3db3c3bc2d1ccb2691fc7246810'

testImplementation 'org.mockito:mockito-core:2.13.0'
testImplementation "org.robolectric:robolectric:3.6.1"
testImplementation 'com.squareup.okhttp3:mockwebserver:3.8.1'
testImplementation group: 'junit', name: 'junit', version: '4.11'
testImplementation 'org.mockito:mockito-core:2.23.0'
testImplementation "org.robolectric:robolectric:4.3"
testImplementation 'com.squareup.okhttp3:mockwebserver:3.9.1'
testImplementation group: 'junit', name: 'junit', version: '4.12'
}
13 changes: 8 additions & 5 deletions kin-sdk/kin-sdk-lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,24 +50,27 @@ dependencies {
api 'com.github.kinecosystem:kin-utils-android:1.1'

testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:2.10.0'
testImplementation 'org.mockito:mockito-core:2.27.0'
testImplementation 'org.hamcrest:hamcrest-library:1.3'
testImplementation 'com.squareup.okhttp3:mockwebserver:3.9.1'
testImplementation 'org.robolectric:robolectric:4.3'
testImplementation 'com.google.code.gson:gson:2.8.2'
testImplementation 'com.google.code.gson:gson:2.8.5'
testImplementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
testImplementation 'com.nhaarman.mockitokotlin2:mockito-kotlin:2.1.0'
testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"

androidTestImplementation 'junit:junit:4.12'
androidTestImplementation 'org.mockito:mockito-core:2.10.0'
androidTestImplementation 'org.mockito:mockito-core:2.23.0'
androidTestImplementation 'org.hamcrest:hamcrest-library:1.3'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'org.mockito:mockito-android:2.10.0'
androidTestImplementation 'org.mockito:mockito-android:2.10.0'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
androidTestImplementation 'org.hamcrest:hamcrest-library:1.3'
androidTestImplementation 'com.android.support:multidex:1.0.2'
androidTestImplementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
androidTestImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
androidTestImplementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
androidTestImplementation 'com.nhaarman.mockitokotlin2:mockito-kotlin:2.1.0'
}

//bundle javadocs with published aar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void getStatusSync_DeletedAccount_AccountDeletedException() throws Except
public void sendTransactionSync_DeletedAccount_AccountDeletedException() throws Exception {
KinAccount kinAccount = kinClient.addAccount();
kinClient.deleteAccount(0);
PaymentTransaction transaction = kinAccount.buildTransactionSync(
Transaction transaction = kinAccount.buildTransactionSync(
"GBA2XHZRUAHEL4DZX7XNHR7HLBAUYPRNKLD2PIUKWV2LVVE6OJT4NDLM",
new BigDecimal(10), FEE);
kinAccount.sendTransactionSync(transaction);
Expand All @@ -63,10 +63,11 @@ public void sendTransactionSync_DeletedAccount_AccountDeletedException() throws
public void sendWhitelistTransaction_DeletedAccount_AccountDeletedException() throws Exception {
KinAccount kinAccount = kinClient.addAccount();
kinClient.deleteAccount(0);
PaymentTransaction transaction = kinAccount.buildTransactionSync("GBA2XHZRUAHEL4DZX7XNHR7HLBAUYPRNKLD2PIUKWV2LVVE6OJT4NDLM",
Transaction transaction = kinAccount.buildTransactionSync("GBA2XHZRUAHEL4DZX7XNHR7HLBAUYPRNKLD2PIUKWV2LVVE6OJT4NDLM",
new BigDecimal(10), 0);

String whitelist = new WhitelistServiceForTest().whitelistTransaction(transaction.whitelistPayload());
String whitelist = new WhitelistServiceForTest().whitelistTransaction(transaction.getWhitelistableTransaction().getTransactionPayload(),
transaction.getWhitelistableTransaction().getNetworkPassphrase());
kinAccount.sendWhitelistTransactionSync(whitelist);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public class WhitelistServiceForTest {
.build();
}

String whitelistTransaction(WhitelistPayload whitelistPayload) throws Exception {
RequestBody requestBody = RequestBody.create(JSON, toJson(whitelistPayload));
String whitelistTransaction(String txPayload, String passphrase) throws Exception {
RequestBody requestBody = RequestBody.create(JSON, toJson(txPayload, passphrase));
okhttp3.Request request = new Request.Builder()
.url(IntegConsts.URL_WHITELISTING_SERVICE)
.post(requestBody)
Expand All @@ -40,10 +40,10 @@ String whitelistTransaction(WhitelistPayload whitelistPayload) throws Exception
return whitelist;
}

private String toJson(WhitelistPayload whitelistPayload) throws JSONException {
private String toJson(String txPayload, String passphrase) throws JSONException {
JSONObject jo = new JSONObject();
jo.put("envelop", whitelistPayload.getTransactionPayload());
jo.put("network_id", whitelistPayload.getNetworkPassphrase());
jo.put("envelop", txPayload);
jo.put("network_id", passphrase);
return jo.toString();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ class KinAccountIntegrationTest {
expectedEx.expectMessage(kinAccountSender.publicAddress)

val transaction = kinAccountSender.buildTransactionSync(kinAccountReceiver.publicAddress.orEmpty(), BigDecimal("21.123"), fee)
val whitelist = WhitelistServiceForTest().whitelistTransaction(transaction.whitelistPayload())
val whitelist = WhitelistServiceForTest().whitelistTransaction(
transaction.whitelistableTransaction.transactionPayload, transaction.whitelistableTransaction.networkPassphrase)
kinAccountSender.sendWhitelistTransactionSync(whitelist)
}

Expand All @@ -225,7 +226,8 @@ class KinAccountIntegrationTest {
expectedEx.expectMessage(kinAccountReceiver.publicAddress)

val transaction = kinAccountSender.buildTransactionSync(kinAccountReceiver.publicAddress.orEmpty(), BigDecimal("21.123"), fee)
val whitelist = WhitelistServiceForTest().whitelistTransaction(transaction.whitelistPayload())
val whitelist = WhitelistServiceForTest().whitelistTransaction(
transaction.whitelistableTransaction.transactionPayload, transaction.whitelistableTransaction.networkPassphrase)
kinAccountSender.sendWhitelistTransactionSync(whitelist)

}
Expand All @@ -251,7 +253,8 @@ class KinAccountIntegrationTest {
val minFee: Int = Math.toIntExact(kinClient.minimumFeeSync)
val transaction = kinAccountSender.buildTransactionSync(kinAccountReceiver.publicAddress.orEmpty(),
BigDecimal("20"), minFee + 100000)
val whitelist = WhitelistServiceForTest().whitelistTransaction(transaction.whitelistPayload())
val whitelist = WhitelistServiceForTest().whitelistTransaction(
transaction.whitelistableTransaction.transactionPayload, transaction.whitelistableTransaction.networkPassphrase)
kinAccountSender.sendWhitelistTransactionSync(whitelist)
assertThat(kinAccountSender.balanceSync.value(), equalTo(BigDecimal("80.00000")))
}
Expand All @@ -265,7 +268,8 @@ class KinAccountIntegrationTest {
val minFee: Int = Math.toIntExact(kinClient.minimumFeeSync)
val transaction = kinAccountSender.buildTransactionSync(kinAccountReceiver.publicAddress.orEmpty(),
BigDecimal("20"), minFee)
val whitelist = WhitelistServiceForTest().whitelistTransaction(transaction.whitelistPayload())
val whitelist = WhitelistServiceForTest().whitelistTransaction(
transaction.whitelistableTransaction.transactionPayload, transaction.whitelistableTransaction.networkPassphrase)
kinAccountSender.sendWhitelistTransactionSync(whitelist)
assertThat(kinAccountSender.balanceSync.value(), equalTo(BigDecimal("80.00000")))
assertThat(kinAccountReceiver.balanceSync.value(), equalTo(BigDecimal("20.00000")))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package kin.sdk.internal.queue

import java.util.*
import kotlin.concurrent.schedule

open class FakeIntegrationTestQueueScheduler : QueueScheduler {

private var timer: Timer? = Timer()
private val futureTasks: HashMap<Runnable?, TimerTask?> = HashMap()

//TODO what is better? one of the commented one or the non commented one. Which one?

// override fun scheduleDelayed(runnable: Runnable?, delayInMillis: Long) {
// Handler().postDelayed({
// runnable?.run()
// }, delayInMillis)
// }

// override fun scheduleDelayed(runnable: Runnable?, delayInMillis: Long) {
// val timer = Timer()
// timer.schedule(object: TimerTask() {
// override fun run() {
// runnable?.run()
// }
// }, delayInMillis)
// }

// override fun scheduleDelayed(runnable: Runnable?, delayInMillis: Long) {
// val timer = Timer()
// timer.schedule(timerTask {runnable?.run() }, delayInMillis)
// }

override fun scheduleDelayed(runnable: Runnable?, delayInMillis: Long) {
val task = timer?.schedule(delayInMillis) {
runnable?.run()
}
futureTasks[runnable] = task
}

override fun removeAllPendingTasks() {
// killing all future futureTasks not including the current running task if there is one.
timer?.cancel()
timer?.purge()
futureTasks.clear()
timer = Timer()
}

override fun removePendingTask(runnable: Runnable?) {
futureTasks[runnable]?.cancel()
}

override fun schedule(runnable: Runnable?) {
runnable?.run()
}


}
Loading