mirror of
https://github.com/corda/corda.git
synced 2025-06-19 23:53:52 +00:00
Upgrade integration test introduced by CORDA-1465 to run in database mode (#887)
This commit is contained in:
committed by
Michele Sollecito
parent
74a3c70ee5
commit
d377f14ac3
@ -10,12 +10,16 @@ import net.corda.core.utilities.ProgressTracker
|
|||||||
import net.corda.core.utilities.getOrThrow
|
import net.corda.core.utilities.getOrThrow
|
||||||
import net.corda.core.utilities.unwrap
|
import net.corda.core.utilities.unwrap
|
||||||
import net.corda.node.services.Permissions
|
import net.corda.node.services.Permissions
|
||||||
import net.corda.testing.core.singleIdentity
|
import net.corda.testing.core.*
|
||||||
import net.corda.testing.driver.DriverParameters
|
import net.corda.testing.driver.DriverParameters
|
||||||
import net.corda.testing.driver.driver
|
import net.corda.testing.driver.driver
|
||||||
import net.corda.testing.driver.internal.RandomFree
|
import net.corda.testing.driver.internal.RandomFree
|
||||||
|
import net.corda.testing.internal.IntegrationTest
|
||||||
|
import net.corda.testing.internal.IntegrationTestSchemas
|
||||||
|
import net.corda.testing.internal.toDatabaseSchemaName
|
||||||
import net.corda.testing.node.User
|
import net.corda.testing.node.User
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
|
import org.junit.ClassRule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import java.lang.management.ManagementFactory
|
import java.lang.management.ManagementFactory
|
||||||
import java.sql.SQLException
|
import java.sql.SQLException
|
||||||
@ -24,7 +28,13 @@ import kotlin.test.assertEquals
|
|||||||
import kotlin.test.assertNotNull
|
import kotlin.test.assertNotNull
|
||||||
|
|
||||||
|
|
||||||
class FlowRetryTest {
|
class FlowRetryTest : IntegrationTest() {
|
||||||
|
companion object {
|
||||||
|
@ClassRule
|
||||||
|
@JvmField
|
||||||
|
val databaseSchemas = IntegrationTestSchemas(ALICE_NAME.toDatabaseSchemaName(), BOB_NAME.toDatabaseSchemaName(), DUMMY_NOTARY_NAME.toDatabaseSchemaName())
|
||||||
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun resetCounters() {
|
fun resetCounters() {
|
||||||
InitiatorFlow.seen.clear()
|
InitiatorFlow.seen.clear()
|
||||||
@ -39,8 +49,8 @@ class FlowRetryTest {
|
|||||||
val result: Any? = driver(DriverParameters(isDebug = true, startNodesInProcess = isQuasarAgentSpecified(),
|
val result: Any? = driver(DriverParameters(isDebug = true, startNodesInProcess = isQuasarAgentSpecified(),
|
||||||
portAllocation = RandomFree)) {
|
portAllocation = RandomFree)) {
|
||||||
|
|
||||||
val nodeAHandle = startNode(rpcUsers = listOf(user)).getOrThrow()
|
val nodeAHandle = startNode(providedName = ALICE_NAME, rpcUsers = listOf(user)).getOrThrow()
|
||||||
val nodeBHandle = startNode(rpcUsers = listOf(user)).getOrThrow()
|
val nodeBHandle = startNode(providedName = BOB_NAME, rpcUsers = listOf(user)).getOrThrow()
|
||||||
|
|
||||||
val result = CordaRPCClient(nodeAHandle.rpcAddress).start(user.username, user.password).use {
|
val result = CordaRPCClient(nodeAHandle.rpcAddress).start(user.username, user.password).use {
|
||||||
it.proxy.startFlow(::InitiatorFlow, numSessions, numIterations, nodeBHandle.nodeInfo.singleIdentity()).returnValue.getOrThrow()
|
it.proxy.startFlow(::InitiatorFlow, numSessions, numIterations, nodeBHandle.nodeInfo.singleIdentity()).returnValue.getOrThrow()
|
||||||
|
@ -15,11 +15,7 @@ import net.corda.core.utilities.getOrThrow
|
|||||||
import net.corda.core.utilities.unwrap
|
import net.corda.core.utilities.unwrap
|
||||||
import net.corda.node.services.Permissions
|
import net.corda.node.services.Permissions
|
||||||
import net.corda.nodeapi.exceptions.InternalNodeException
|
import net.corda.nodeapi.exceptions.InternalNodeException
|
||||||
import net.corda.testing.core.ALICE_NAME
|
import net.corda.testing.core.*
|
||||||
import net.corda.testing.core.BOB_NAME
|
|
||||||
import net.corda.testing.core.DUMMY_BANK_A_NAME
|
|
||||||
import net.corda.testing.core.DUMMY_NOTARY_NAME
|
|
||||||
import net.corda.testing.core.singleIdentity
|
|
||||||
import net.corda.testing.driver.DriverDSL
|
import net.corda.testing.driver.DriverDSL
|
||||||
import net.corda.testing.driver.DriverParameters
|
import net.corda.testing.driver.DriverParameters
|
||||||
import net.corda.testing.driver.NodeHandle
|
import net.corda.testing.driver.NodeHandle
|
||||||
@ -41,7 +37,7 @@ class RpcExceptionHandlingTest : IntegrationTest() {
|
|||||||
companion object {
|
companion object {
|
||||||
@ClassRule
|
@ClassRule
|
||||||
@JvmField
|
@JvmField
|
||||||
val databaseSchemas = IntegrationTestSchemas(*listOf(ALICE_NAME, BOB_NAME, DUMMY_BANK_A_NAME, DUMMY_NOTARY_NAME)
|
val databaseSchemas = IntegrationTestSchemas(*listOf(ALICE_NAME, BOB_NAME, DUMMY_BANK_A_NAME, DUMMY_BANK_B_NAME, DUMMY_NOTARY_NAME)
|
||||||
.map { it.toDatabaseSchemaName() }.toTypedArray())
|
.map { it.toDatabaseSchemaName() }.toTypedArray())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +64,7 @@ class RpcExceptionHandlingTest : IntegrationTest() {
|
|||||||
|
|
||||||
driver(DriverParameters(startNodesInProcess = true, notarySpecs = emptyList())) {
|
driver(DriverParameters(startNodesInProcess = true, notarySpecs = emptyList())) {
|
||||||
val devModeNode = startNode(params).getOrThrow()
|
val devModeNode = startNode(params).getOrThrow()
|
||||||
val node = startNode(ALICE_NAME, devMode = false, parameters = params).getOrThrow()
|
val node = startNode(DUMMY_BANK_B_NAME, devMode = false, parameters = params).getOrThrow()
|
||||||
|
|
||||||
assertThatThrownExceptionIsReceivedUnwrapped(devModeNode)
|
assertThatThrownExceptionIsReceivedUnwrapped(devModeNode)
|
||||||
assertThatThrownExceptionIsReceivedUnwrapped(node)
|
assertThatThrownExceptionIsReceivedUnwrapped(node)
|
||||||
@ -87,7 +83,7 @@ class RpcExceptionHandlingTest : IntegrationTest() {
|
|||||||
|
|
||||||
driver(DriverParameters(startNodesInProcess = true, notarySpecs = emptyList())) {
|
driver(DriverParameters(startNodesInProcess = true, notarySpecs = emptyList())) {
|
||||||
val devModeNode = startNode(params).getOrThrow()
|
val devModeNode = startNode(params).getOrThrow()
|
||||||
val node = startNode(ALICE_NAME, devMode = false, parameters = params).getOrThrow()
|
val node = startNode(DUMMY_BANK_B_NAME, devMode = false, parameters = params).getOrThrow()
|
||||||
|
|
||||||
assertThatThrownBy { devModeNode.throwExceptionFromFlow() }.isInstanceOfSatisfying(FlowException::class.java) { exception ->
|
assertThatThrownBy { devModeNode.throwExceptionFromFlow() }.isInstanceOfSatisfying(FlowException::class.java) { exception ->
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user