diff --git a/node/src/integration-test/kotlin/net/corda/node/services/vault/VaultObserverExceptionTest.kt b/node/src/integration-test/kotlin/net/corda/node/services/vault/VaultObserverExceptionTest.kt index e412e8499a..55e2cc5e94 100644 --- a/node/src/integration-test/kotlin/net/corda/node/services/vault/VaultObserverExceptionTest.kt +++ b/node/src/integration-test/kotlin/net/corda/node/services/vault/VaultObserverExceptionTest.kt @@ -749,10 +749,10 @@ class VaultObserverExceptionTest { ) { val aliceNode = startNode(providedName = ALICE_NAME, rpcUsers = listOf(user)).getOrThrow() - val flowHandle = aliceNode.rpc.startFlow(ErrorHandling::SubscribingRawUpdatesFlow) + val flowHandle = aliceNode.rpc.startFlow(::SubscribingRawUpdatesFlow) assertFailsWith( - "Flow ${ErrorHandling.SubscribingRawUpdatesFlow::class.java.name} tried to subscribe an Rx.Observer to VaultService.rawUpdates " + + "Flow ${SubscribingRawUpdatesFlow::class.java.name} tried to subscribe an Rx.Observer to VaultService.rawUpdates " + "- Rx.Observables should only be subscribed outside the context of a flow " + "- the subscription did not succeed " ) { @@ -827,4 +827,14 @@ class VaultObserverExceptionTest { return getStatesById(null, status) } + @StartableByRPC + class SubscribingRawUpdatesFlow: FlowLogic() { + override fun call() { + val rawUpdates = serviceHub.vaultService.rawUpdates + logger.info("Accessing rawUpdates in a flow is fine! ") + rawUpdates.subscribe { + println("However, adding a subscription will make the flow fail!") + } + } + } } \ No newline at end of file diff --git a/testing/cordapps/dbfailure/dbfworkflows/src/main/kotlin/com/r3/transactionfailure/workflows/ErrorHandling.kt b/testing/cordapps/dbfailure/dbfworkflows/src/main/kotlin/com/r3/transactionfailure/workflows/ErrorHandling.kt index b11fea0cff..7a3ea10d82 100644 --- a/testing/cordapps/dbfailure/dbfworkflows/src/main/kotlin/com/r3/transactionfailure/workflows/ErrorHandling.kt +++ b/testing/cordapps/dbfailure/dbfworkflows/src/main/kotlin/com/r3/transactionfailure/workflows/ErrorHandling.kt @@ -51,16 +51,4 @@ object ErrorHandling { hookAfterSecondCheckpoint.invoke() // should be never executed } } - - @StartableByRPC - class SubscribingRawUpdatesFlow: FlowLogic() { - override fun call() { - val rawUpdates = serviceHub.vaultService.rawUpdates - logger.info("Accessing rawUpdates in a flow is fine! ") - rawUpdates.subscribe { - println("However, adding a subscription will make the flow fail!") - } - } - } - } \ No newline at end of file