Refactor then/success/failure (#984)

to make ListenableFuture replacement less fiddly.
This commit is contained in:
Andrzej Cichocki
2017-07-07 15:50:50 +01:00
committed by GitHub
parent 74c8346863
commit d2869e4f45
17 changed files with 90 additions and 117 deletions

View File

@ -5,7 +5,7 @@ import com.google.common.util.concurrent.ListenableFuture
import com.google.common.util.concurrent.SettableFuture
import net.corda.core.getOrThrow
import net.corda.core.messaging.RPCOps
import net.corda.core.success
import net.corda.core.thenMatch
import net.corda.node.services.messaging.getRpcContext
import net.corda.nodeapi.RPCSinceVersion
import net.corda.testing.RPCDriverExposedDSLInterface
@ -158,12 +158,12 @@ class ClientRPCInfrastructureTests : AbstractRPCTest() {
val clientQuotes = LinkedBlockingQueue<String>()
val clientFuture = proxy.makeComplicatedListenableFuture()
clientFuture.success {
clientFuture.thenMatch({
val name = it.first
it.second.success {
it.second.thenMatch({
clientQuotes += "Quote by $name: $it"
}
}
}, {})
}, {})
assertThat(clientQuotes).isEmpty()