mirror of
https://github.com/corda/corda.git
synced 2025-06-19 07:38:22 +00:00
Updated samples and demos to use new Vault Query service. (#924)
* Updated all sample code to use new Vault Query service APIs. * Fix broken Unit test. * Added missing transaction boundary. * Fix broken ScheduledFlow test (caused by assertion on non-ordered collection) * Remove redundant negative test (as new Vault Query no longer returns iterators). * Whitespace formatting fixed following PR review from SA. * Force query to specify a PAGE SIZE equivalent to total states to be exited (RP review comment). * Use single (and fail fast) instead of first - when only expecting a single result. * Demonstrate paging and sorting; failfast on single expected result. * Enhancement: added Sorting by CommonStateAttribute (StateRef txnId and index) * Fix: incorrect total states count. * Fixed incorrect total states counting. * Remove redundant filter (UNCONSUMED). * Updated tutorial code and associated documentation (building transactions). * Updated all vaultAndUpdates to vault[Track|Query]By. * Temporary disable failing Vault Query tests (awaiting pagination PR fix). * Rebase from master to pick up pagination changes/fix. * Fixed criteria filter on track. * Cleanup redundant print output. * Refactor to extract common function for Vault Query paging and sorting. * Identified problem in SimmValuation demo failing test caused by query by single participant in participants list (not yet supported in VaultQuery criteria). * Minor fixes following rebase from master. * Minor updates following rebase. * Removed redundant import. * Fixed type casting error. * Minor fixes following rebase from master. * VQ Fix - applied in other PR. * Removed duplication after rebase and minor fix to failing smoke test.
This commit is contained in:
@ -38,7 +38,6 @@ class FxTransactionBuildTutorialTest {
|
||||
|
||||
@After
|
||||
fun cleanUp() {
|
||||
println("Close DB")
|
||||
mockNet.stopNodes()
|
||||
}
|
||||
|
||||
|
@ -26,10 +26,9 @@ class WorkflowTransactionBuildTutorialTest {
|
||||
lateinit var nodeA: MockNetwork.MockNode
|
||||
lateinit var nodeB: MockNetwork.MockNode
|
||||
|
||||
// Helper method to locate the latest Vault version of a LinearState from a possibly out of date StateRef
|
||||
// Helper method to locate the latest Vault version of a LinearState
|
||||
private inline fun <reified T : LinearState> ServiceHub.latest(ref: UniqueIdentifier): StateAndRef<T> {
|
||||
val linearHeads = vaultQueryService.queryBy<T>(QueryCriteria.LinearStateQueryCriteria(linearId = listOf(ref))
|
||||
.and(QueryCriteria.VaultQueryCriteria(status = Vault.StateStatus.UNCONSUMED)))
|
||||
val linearHeads = vaultQueryService.queryBy<T>(QueryCriteria.LinearStateQueryCriteria(linearId = listOf(ref)))
|
||||
return linearHeads.states.single()
|
||||
}
|
||||
|
||||
@ -48,7 +47,6 @@ class WorkflowTransactionBuildTutorialTest {
|
||||
|
||||
@After
|
||||
fun cleanUp() {
|
||||
println("Close DB")
|
||||
mockNet.stopNodes()
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user