CORDA-2743 Add dynamic port allocation (#5042)

This commit is contained in:
Tudor Malene 2019-04-18 14:22:23 +01:00 committed by Shams Asari
parent c7f03247f4
commit 50649d7b99

View File

@ -17,14 +17,18 @@ import net.corda.finance.contracts.asset.Cash
import net.corda.finance.flows.CashIssueAndPaymentFlow
import net.corda.finance.schemas.CashSchemaV1
import net.corda.node.services.Permissions
import net.corda.testing.core.ALICE_NAME
import net.corda.testing.core.DUMMY_BANK_A_NAME
import net.corda.testing.core.DUMMY_BANK_B_NAME
import net.corda.testing.core.DUMMY_NOTARY_NAME
import net.corda.testing.driver.DriverParameters
import net.corda.testing.driver.OutOfProcess
import net.corda.testing.driver.driver
import net.corda.testing.driver.internal.OutOfProcessImpl
import net.corda.testing.driver.internal.incrementalPortAllocation
import net.corda.testing.node.User
import net.corda.testing.node.internal.FINANCE_CORDAPPS
import org.junit.ClassRule
import org.junit.Test
import java.util.*
import java.util.concurrent.CountDownLatch
@ -43,6 +47,8 @@ class RpcReconnectTests {
private val log = contextLogger()
}
private val portAllocator = incrementalPortAllocation(20006)
/**
* This test showcases and stress tests the demo [ReconnectingCordaRPCOps].
*
@ -59,8 +65,8 @@ class RpcReconnectTests {
val demoUser = User("demo", "demo", setOf(Permissions.all()))
val nodePort = 20006
val proxyPort = 20007
val nodePort = portAllocator.nextPort()
val proxyPort = portAllocator.nextPort()
val tcpProxy = RandomFailingProxy(serverPort = proxyPort, remotePort = nodePort).start()
// When this reaches 0 - the test will end.
@ -282,4 +288,3 @@ class RpcReconnectTests {
return getOrPut(id) { mutableListOf() }.let { if (progress != null) it.add(progress) else false }
}
}