diff --git a/node/src/test/kotlin/com/r3corda/node/ServerRPCTest.kt b/node/src/test/kotlin/com/r3corda/node/ServerRPCTest.kt index fcb429deaa..d0a40228f6 100644 --- a/node/src/test/kotlin/com/r3corda/node/ServerRPCTest.kt +++ b/node/src/test/kotlin/com/r3corda/node/ServerRPCTest.kt @@ -11,6 +11,7 @@ import com.r3corda.node.internal.ServerRPCOps import com.r3corda.node.services.messaging.StateMachineUpdate import com.r3corda.node.services.network.NetworkMapService import com.r3corda.node.services.transactions.SimpleNotaryService +import com.r3corda.node.utilities.databaseTransaction import com.r3corda.testing.expect import com.r3corda.testing.expectEvents import com.r3corda.testing.node.MockNetwork @@ -53,7 +54,9 @@ class ServerRPCTest { val ref = OpaqueBytes(ByteArray(1) {1}) // Check the monitoring service wallet is empty - assertFalse(aliceNode.services.vaultService.currentVault.states.iterator().hasNext()) + databaseTransaction(aliceNode.database) { + assertFalse(aliceNode.services.vaultService.currentVault.states.iterator().hasNext()) + } // Tell the monitoring service node to issue some cash val recipient = aliceNode.info.legalIdentity diff --git a/node/src/test/kotlin/com/r3corda/node/services/persistence/DataVendingServiceTests.kt b/node/src/test/kotlin/com/r3corda/node/services/persistence/DataVendingServiceTests.kt index 5e03089070..e497be06de 100644 --- a/node/src/test/kotlin/com/r3corda/node/services/persistence/DataVendingServiceTests.kt +++ b/node/src/test/kotlin/com/r3corda/node/services/persistence/DataVendingServiceTests.kt @@ -11,6 +11,7 @@ import com.r3corda.core.protocols.ProtocolLogic import com.r3corda.core.transactions.SignedTransaction import com.r3corda.core.utilities.DUMMY_NOTARY import com.r3corda.node.services.persistence.DataVending.Service.NotifyTransactionHandler +import com.r3corda.node.utilities.databaseTransaction import com.r3corda.protocols.BroadcastTransactionProtocol.NotifyTxRequest import com.r3corda.testing.MEGA_CORP import com.r3corda.testing.node.MockNetwork @@ -45,15 +46,17 @@ class DataVendingServiceTests { val registerKey = registerNode.services.legalIdentityKey ptx.signWith(registerKey) val tx = ptx.toSignedTransaction() - assertEquals(0, vaultServiceNode.services.vaultService.currentVault.states.toList().size) + databaseTransaction(vaultServiceNode.database) { + assertEquals(0, vaultServiceNode.services.vaultService.currentVault.states.toList().size) - registerNode.sendNotifyTx(tx, vaultServiceNode) + registerNode.sendNotifyTx(tx, vaultServiceNode) - // Check the transaction is in the receiving node - val actual = vaultServiceNode.services.vaultService.currentVault.states.singleOrNull() - val expected = tx.tx.outRef(0) + // Check the transaction is in the receiving node + val actual = vaultServiceNode.services.vaultService.currentVault.states.singleOrNull() + val expected = tx.tx.outRef(0) - assertEquals(expected, actual) + assertEquals(expected, actual) + } } /** @@ -74,12 +77,14 @@ class DataVendingServiceTests { val registerKey = registerNode.services.legalIdentityKey ptx.signWith(registerKey) val tx = ptx.toSignedTransaction(false) - assertEquals(0, vaultServiceNode.services.vaultService.currentVault.states.toList().size) + databaseTransaction(vaultServiceNode.database) { + assertEquals(0, vaultServiceNode.services.vaultService.currentVault.states.toList().size) - registerNode.sendNotifyTx(tx, vaultServiceNode) + registerNode.sendNotifyTx(tx, vaultServiceNode) - // Check the transaction is not in the receiving node - assertEquals(0, vaultServiceNode.services.vaultService.currentVault.states.toList().size) + // Check the transaction is not in the receiving node + assertEquals(0, vaultServiceNode.services.vaultService.currentVault.states.toList().size) + } } private fun MockNode.sendNotifyTx(tx: SignedTransaction, walletServiceNode: MockNode) {