From 7e370c136b3f21d0fd1088cef2c0df4eb24ad172 Mon Sep 17 00:00:00 2001 From: Kyriakos Tharrouniatis Date: Mon, 17 Feb 2020 11:37:56 +0000 Subject: [PATCH] Moving NotarisedTxs from SendStateFlow to VaultObserverExceptionTest inside NodeHandle.getNotarisedTransactionIds --- .../vault/VaultObserverExceptionTest.kt | 20 ++++++++++++++++++- .../r3/dbfailure/workflows/SendStateFlow.kt | 13 ------------ 2 files changed, 19 insertions(+), 14 deletions(-) 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 b5815de0c6..e412e8499a 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 @@ -12,6 +12,8 @@ import com.r3.transactionfailure.workflows.ErrorHandling.CheckpointAfterErrorFlo import net.corda.core.CordaRuntimeException import net.corda.core.contracts.StateAndRef import net.corda.core.contracts.UniqueIdentifier +import net.corda.core.flows.FlowLogic +import net.corda.core.flows.StartableByRPC import net.corda.core.identity.Party import net.corda.core.internal.concurrent.openFuture import net.corda.core.messaging.startFlow @@ -794,7 +796,22 @@ class VaultObserverExceptionTest { } private fun NodeHandle.getNotarisedTransactionIds(): List { - return rpc.startFlowDynamic(SendStateFlow.NotarisedTxs::class.java).returnValue.getOrThrow() + + @StartableByRPC + class NotarisedTxs : FlowLogic>() { + override fun call(): List { + val session = serviceHub.jdbcSession() + val statement = session.createStatement() + statement.execute("SELECT TRANSACTION_ID FROM NODE_NOTARY_COMMITTED_TXS;") + val result = mutableListOf() + while (statement.resultSet.next()) { + result.add(statement.resultSet.getString(1)) + } + return result + } + } + + return rpc.startFlowDynamic(NotarisedTxs::class.java).returnValue.getOrThrow() } private fun NodeHandle.getStatesById(id: UniqueIdentifier?, status: Vault.StateStatus): List> { @@ -809,4 +826,5 @@ class VaultObserverExceptionTest { private fun NodeHandle.getAllStates(status: Vault.StateStatus): List> { return getStatesById(null, status) } + } \ No newline at end of file diff --git a/testing/cordapps/dbfailure/dbfworkflows/src/main/kotlin/com/r3/dbfailure/workflows/SendStateFlow.kt b/testing/cordapps/dbfailure/dbfworkflows/src/main/kotlin/com/r3/dbfailure/workflows/SendStateFlow.kt index 9f7bdd0941..f1b02a9729 100644 --- a/testing/cordapps/dbfailure/dbfworkflows/src/main/kotlin/com/r3/dbfailure/workflows/SendStateFlow.kt +++ b/testing/cordapps/dbfailure/dbfworkflows/src/main/kotlin/com/r3/dbfailure/workflows/SendStateFlow.kt @@ -85,17 +85,4 @@ object SendStateFlow { } } - @StartableByRPC - class NotarisedTxs : FlowLogic>() { - override fun call(): List { - val session = serviceHub.jdbcSession() - val statement = session.createStatement() - statement.execute("SELECT TRANSACTION_ID FROM NODE_NOTARY_COMMITTED_TXS;") - val result = mutableListOf() - while (statement.resultSet.next()) { - result.add(statement.resultSet.getString(1)) - } - return result - } - } } \ No newline at end of file