mirror of
https://github.com/corda/corda.git
synced 2025-02-21 17:56:54 +00:00
Flakey test fix
This commit is contained in:
parent
fc758ab766
commit
e5a6cac9e8
@ -8,6 +8,7 @@ import net.corda.core.flows.*
|
|||||||
import net.corda.core.identity.Party
|
import net.corda.core.identity.Party
|
||||||
import net.corda.core.internal.concurrent.transpose
|
import net.corda.core.internal.concurrent.transpose
|
||||||
import net.corda.core.messaging.startFlow
|
import net.corda.core.messaging.startFlow
|
||||||
|
import net.corda.core.node.services.StatesNotAvailableException
|
||||||
import net.corda.core.node.services.queryBy
|
import net.corda.core.node.services.queryBy
|
||||||
import net.corda.core.node.services.vault.QueryCriteria
|
import net.corda.core.node.services.vault.QueryCriteria
|
||||||
import net.corda.core.transactions.TransactionBuilder
|
import net.corda.core.transactions.TransactionBuilder
|
||||||
@ -69,7 +70,11 @@ class ScheduledFlowIntegrationTests {
|
|||||||
val state = results.states.firstOrNull() ?: return
|
val state = results.states.firstOrNull() ?: return
|
||||||
require(!state.state.data.processed) { "Cannot spend an already processed state" }
|
require(!state.state.data.processed) { "Cannot spend an already processed state" }
|
||||||
val lock = UUID.randomUUID()
|
val lock = UUID.randomUUID()
|
||||||
serviceHub.vaultService.softLockReserve(lock, NonEmptySet.of(state.ref))
|
try {
|
||||||
|
serviceHub.vaultService.softLockReserve(lock, NonEmptySet.of(state.ref))
|
||||||
|
} catch (e: StatesNotAvailableException) {
|
||||||
|
return
|
||||||
|
}
|
||||||
val notary = state.state.notary
|
val notary = state.state.notary
|
||||||
val outputState = SpentState(identity, ourIdentity, state.state.data.destination)
|
val outputState = SpentState(identity, ourIdentity, state.state.data.destination)
|
||||||
val builder = TransactionBuilder(notary)
|
val builder = TransactionBuilder(notary)
|
||||||
|
@ -4,6 +4,7 @@ import co.paralleluniverse.fibers.Suspendable
|
|||||||
import net.corda.core.contracts.*
|
import net.corda.core.contracts.*
|
||||||
import net.corda.core.flows.*
|
import net.corda.core.flows.*
|
||||||
import net.corda.core.identity.Party
|
import net.corda.core.identity.Party
|
||||||
|
import net.corda.core.node.services.StatesNotAvailableException
|
||||||
import net.corda.core.transactions.TransactionBuilder
|
import net.corda.core.transactions.TransactionBuilder
|
||||||
import net.corda.core.utilities.NonEmptySet
|
import net.corda.core.utilities.NonEmptySet
|
||||||
import net.corda.testing.contracts.DummyContract
|
import net.corda.testing.contracts.DummyContract
|
||||||
@ -25,7 +26,11 @@ class ScheduledFlow(private val stateRef: StateRef) : FlowLogic<Unit>() {
|
|||||||
}
|
}
|
||||||
require(!scheduledState.processed) { "State should not have been previously processed" }
|
require(!scheduledState.processed) { "State should not have been previously processed" }
|
||||||
val lock = UUID.randomUUID()
|
val lock = UUID.randomUUID()
|
||||||
serviceHub.vaultService.softLockReserve(lock, NonEmptySet.of(state.ref))
|
try {
|
||||||
|
serviceHub.vaultService.softLockReserve(lock, NonEmptySet.of(state.ref))
|
||||||
|
} catch (e: StatesNotAvailableException) {
|
||||||
|
return
|
||||||
|
}
|
||||||
val notary = state.state.notary
|
val notary = state.state.notary
|
||||||
val newStateOutput = scheduledState.copy(processed = true)
|
val newStateOutput = scheduledState.copy(processed = true)
|
||||||
val builder = TransactionBuilder(notary)
|
val builder = TransactionBuilder(notary)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user