mirror of
https://github.com/corda/corda.git
synced 2025-06-15 05:38:14 +00:00
Bunch of changes to get ENT working in light of the new FinalityFlow API
* Updated the performance cordapp tests to use target version 3 as it's not been updated and uses the old FinalityFlow API * Updated the api-current.txt file as the API checker on TC is throwing a false-negative * Deleted IntegrationTestingTutorial, rather than fixing its failure, as it's a leftover of KotlinIntegrationTestingTutorial
This commit is contained in:
1256
.ci/api-current.txt
1256
.ci/api-current.txt
File diff suppressed because it is too large
Load Diff
@ -1,152 +0,0 @@
|
|||||||
package net.corda.docs
|
|
||||||
|
|
||||||
import net.corda.client.rpc.CordaRPCClient
|
|
||||||
import net.corda.core.internal.concurrent.transpose
|
|
||||||
import net.corda.core.messaging.CordaRPCOps
|
|
||||||
import net.corda.core.messaging.startFlow
|
|
||||||
import net.corda.core.messaging.vaultTrackBy
|
|
||||||
import net.corda.core.node.services.Vault
|
|
||||||
import net.corda.core.node.services.vault.QueryCriteria
|
|
||||||
import net.corda.core.utilities.OpaqueBytes
|
|
||||||
import net.corda.core.utilities.getOrThrow
|
|
||||||
import net.corda.finance.DOLLARS
|
|
||||||
import net.corda.finance.contracts.asset.Cash
|
|
||||||
import net.corda.finance.flows.CashIssueFlow
|
|
||||||
import net.corda.finance.flows.CashPaymentFlow
|
|
||||||
import net.corda.node.services.Permissions.Companion.invokeRpc
|
|
||||||
import net.corda.node.services.Permissions.Companion.startFlow
|
|
||||||
import net.corda.testing.core.*
|
|
||||||
import net.corda.testing.driver.DriverParameters
|
|
||||||
import net.corda.testing.driver.driver
|
|
||||||
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 org.junit.ClassRule
|
|
||||||
import org.junit.Test
|
|
||||||
import kotlin.test.assertEquals
|
|
||||||
|
|
||||||
class IntegrationTestingTutorial : IntegrationTest() {
|
|
||||||
companion object {
|
|
||||||
@ClassRule
|
|
||||||
@JvmField
|
|
||||||
val databaseSchemas = IntegrationTestSchemas(ALICE_NAME.toDatabaseSchemaName(), BOB_NAME.toDatabaseSchemaName(),
|
|
||||||
DUMMY_NOTARY_NAME.toDatabaseSchemaName())
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun `alice bob cash exchange example`() {
|
|
||||||
// START 1
|
|
||||||
driver(DriverParameters(
|
|
||||||
startNodesInProcess = true,
|
|
||||||
extraCordappPackagesToScan = listOf("net.corda.finance.contracts.asset","net.corda.finance.schemas")
|
|
||||||
)) {
|
|
||||||
val aliceUser = User("aliceUser", "testPassword1", permissions = setOf(
|
|
||||||
startFlow<CashIssueFlow>(),
|
|
||||||
startFlow<CashPaymentFlow>(),
|
|
||||||
invokeRpc("vaultTrackBy"),
|
|
||||||
invokeRpc(CordaRPCOps::notaryIdentities),
|
|
||||||
invokeRpc(CordaRPCOps::networkMapFeed)
|
|
||||||
))
|
|
||||||
val bobUser = User("bobUser", "testPassword2", permissions = setOf(
|
|
||||||
startFlow<CashPaymentFlow>(),
|
|
||||||
invokeRpc("vaultTrackBy"),
|
|
||||||
invokeRpc(CordaRPCOps::networkMapFeed)
|
|
||||||
))
|
|
||||||
val (alice, bob) = listOf(
|
|
||||||
startNode(providedName = ALICE_NAME, rpcUsers = listOf(aliceUser)),
|
|
||||||
startNode(providedName = BOB_NAME, rpcUsers = listOf(bobUser))
|
|
||||||
).transpose().getOrThrow()
|
|
||||||
|
|
||||||
// END 1
|
|
||||||
|
|
||||||
// START 2
|
|
||||||
val aliceClient = CordaRPCClient(alice.rpcAddress)
|
|
||||||
val aliceProxy = aliceClient.start("aliceUser", "testPassword1").proxy
|
|
||||||
|
|
||||||
val bobClient = CordaRPCClient(bob.rpcAddress)
|
|
||||||
val bobProxy = bobClient.start("bobUser", "testPassword2").proxy
|
|
||||||
// END 2
|
|
||||||
|
|
||||||
// START 3
|
|
||||||
val bobVaultUpdates = bobProxy.vaultTrackBy<Cash.State>(criteria = QueryCriteria.VaultQueryCriteria(status = Vault.StateStatus.ALL)).updates
|
|
||||||
val aliceVaultUpdates = aliceProxy.vaultTrackBy<Cash.State>(criteria = QueryCriteria.VaultQueryCriteria(status = Vault.StateStatus.ALL)).updates
|
|
||||||
// END 3
|
|
||||||
|
|
||||||
// START 4
|
|
||||||
val numberOfStates = 10
|
|
||||||
val issueRef = OpaqueBytes.of(0)
|
|
||||||
val notaryParty = aliceProxy.notaryIdentities().first()
|
|
||||||
(1..numberOfStates).map { i ->
|
|
||||||
aliceProxy.startFlow(::CashIssueFlow,
|
|
||||||
i.DOLLARS,
|
|
||||||
issueRef,
|
|
||||||
notaryParty
|
|
||||||
).returnValue
|
|
||||||
}.transpose().getOrThrow()
|
|
||||||
// We wait for all of the issuances to run before we start making payments
|
|
||||||
(1..numberOfStates).map { i ->
|
|
||||||
aliceProxy.startFlow(::CashPaymentFlow,
|
|
||||||
i.DOLLARS,
|
|
||||||
bob.nodeInfo.singleIdentity(),
|
|
||||||
true
|
|
||||||
).returnValue
|
|
||||||
}.transpose().getOrThrow()
|
|
||||||
|
|
||||||
bobVaultUpdates.expectEvents {
|
|
||||||
parallel(
|
|
||||||
(1..numberOfStates).map { i ->
|
|
||||||
expect(
|
|
||||||
match = { update: Vault.Update<Cash.State> ->
|
|
||||||
update.produced.first().state.data.amount.quantity == i * 100L
|
|
||||||
}
|
|
||||||
) { update ->
|
|
||||||
println("Bob vault update of $update")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
// END 4
|
|
||||||
|
|
||||||
// START 5
|
|
||||||
for (i in 1..numberOfStates) {
|
|
||||||
bobProxy.startFlow(::CashPaymentFlow, i.DOLLARS, alice.nodeInfo.singleIdentity()).returnValue.getOrThrow()
|
|
||||||
}
|
|
||||||
|
|
||||||
aliceVaultUpdates.expectEvents {
|
|
||||||
sequence(
|
|
||||||
// issuance
|
|
||||||
parallel(
|
|
||||||
(1..numberOfStates).map { i ->
|
|
||||||
expect(match = { it.moved() == -i * 100 }) { update: Vault.Update<Cash.State> ->
|
|
||||||
assertEquals(0, update.consumed.size)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
),
|
|
||||||
// move to Bob
|
|
||||||
parallel(
|
|
||||||
(1..numberOfStates).map { i ->
|
|
||||||
expect(match = { it.moved() == i * 100 }) { _: Vault.Update<Cash.State> ->
|
|
||||||
}
|
|
||||||
}
|
|
||||||
),
|
|
||||||
// move back to Alice
|
|
||||||
sequence(
|
|
||||||
(1..numberOfStates).map { i ->
|
|
||||||
expect(match = { it.moved() == -i * 100 }) { update: Vault.Update<Cash.State> ->
|
|
||||||
assertEquals(update.consumed.size, 0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
// END 5
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun Vault.Update<Cash.State>.moved(): Int {
|
|
||||||
val consumedSum = consumed.sumBy { it.state.data.amount.quantity.toInt() }
|
|
||||||
val producedSum = produced.sumBy { it.state.data.amount.quantity.toInt() }
|
|
||||||
return consumedSum - producedSum
|
|
||||||
}
|
|
||||||
}
|
|
@ -72,7 +72,9 @@ cordapp {
|
|||||||
info {
|
info {
|
||||||
name "net/corda/perftestcordapp"
|
name "net/corda/perftestcordapp"
|
||||||
vendor "R3"
|
vendor "R3"
|
||||||
targetPlatformVersion corda_platform_version.toInteger()
|
// TODO Update the performance test cordapp to use the new FinalityFlow API
|
||||||
|
// targetPlatformVersion corda_platform_version.toInteger()
|
||||||
|
targetPlatformVersion 3
|
||||||
minimumPlatformVersion 1
|
minimumPlatformVersion 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import net.corda.core.utilities.getOrThrow
|
|||||||
import net.corda.testing.node.MockNetwork
|
import net.corda.testing.node.MockNetwork
|
||||||
import net.corda.testing.node.MockNodeConfigOverrides
|
import net.corda.testing.node.MockNodeConfigOverrides
|
||||||
import net.corda.testing.node.MockNodeParameters
|
import net.corda.testing.node.MockNodeParameters
|
||||||
|
import net.corda.testing.node.internal.cordappForPackages
|
||||||
import org.assertj.core.api.Assertions.assertThatThrownBy
|
import org.assertj.core.api.Assertions.assertThatThrownBy
|
||||||
import org.junit.After
|
import org.junit.After
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
@ -19,7 +20,10 @@ import java.util.Collections.nCopies
|
|||||||
class CashSelectionH2Test {
|
class CashSelectionH2Test {
|
||||||
private val mockNet = MockNetwork(
|
private val mockNet = MockNetwork(
|
||||||
threadPerNode = true,
|
threadPerNode = true,
|
||||||
cordappPackages = listOf("com.r3.corda.enterprise.perftestcordapp.contracts.asset", "com.r3.corda.enterprise.perftestcordapp.schemas"))
|
cordappPackages = emptyList(),
|
||||||
|
// TODO Update the performance test cordapp to use the new FinalityFlow API
|
||||||
|
cordappsForAllNodes = listOf(cordappForPackages("com.r3.corda.enterprise.perftestcordapp").withTargetVersion(3))
|
||||||
|
)
|
||||||
|
|
||||||
@After
|
@After
|
||||||
fun cleanUp() {
|
fun cleanUp() {
|
||||||
|
@ -10,6 +10,7 @@ import net.corda.testing.core.BOC_NAME
|
|||||||
import net.corda.testing.node.InMemoryMessagingNetwork.ServicePeerAllocationStrategy.RoundRobin
|
import net.corda.testing.node.InMemoryMessagingNetwork.ServicePeerAllocationStrategy.RoundRobin
|
||||||
import net.corda.testing.node.MockNetwork
|
import net.corda.testing.node.MockNetwork
|
||||||
import net.corda.testing.node.StartedMockNode
|
import net.corda.testing.node.StartedMockNode
|
||||||
|
import net.corda.testing.node.internal.cordappForPackages
|
||||||
import org.junit.After
|
import org.junit.After
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
@ -26,8 +27,12 @@ class CashExitFlowTests {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun start() {
|
fun start() {
|
||||||
mockNet = MockNetwork(servicePeerAllocationStrategy = RoundRobin(),
|
mockNet = MockNetwork(
|
||||||
cordappPackages = listOf("com.r3.corda.enterprise.perftestcordapp.contracts.asset", "com.r3.corda.enterprise.perftestcordapp.schemas"))
|
servicePeerAllocationStrategy = RoundRobin(),
|
||||||
|
cordappPackages = emptyList(),
|
||||||
|
// TODO Update the performance test cordapp to use the new FinalityFlow API
|
||||||
|
cordappsForAllNodes = listOf(cordappForPackages("com.r3.corda.enterprise.perftestcordapp").withTargetVersion(3))
|
||||||
|
)
|
||||||
bankOfCordaNode = mockNet.createPartyNode(BOC_NAME)
|
bankOfCordaNode = mockNet.createPartyNode(BOC_NAME)
|
||||||
bankOfCorda = bankOfCordaNode.info.identityFromX500Name(BOC_NAME)
|
bankOfCorda = bankOfCordaNode.info.identityFromX500Name(BOC_NAME)
|
||||||
notary = mockNet.defaultNotaryIdentity
|
notary = mockNet.defaultNotaryIdentity
|
||||||
|
@ -11,10 +11,7 @@ import net.corda.core.utilities.OpaqueBytes
|
|||||||
import net.corda.core.utilities.getOrThrow
|
import net.corda.core.utilities.getOrThrow
|
||||||
import net.corda.testing.core.*
|
import net.corda.testing.core.*
|
||||||
import net.corda.testing.node.InMemoryMessagingNetwork.ServicePeerAllocationStrategy.RoundRobin
|
import net.corda.testing.node.InMemoryMessagingNetwork.ServicePeerAllocationStrategy.RoundRobin
|
||||||
import net.corda.testing.node.internal.InternalMockNetwork
|
import net.corda.testing.node.internal.*
|
||||||
import net.corda.testing.node.internal.TestStartedNode
|
|
||||||
import net.corda.testing.node.internal.cordappsForPackages
|
|
||||||
import net.corda.testing.node.internal.startFlow
|
|
||||||
import org.junit.After
|
import org.junit.After
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
@ -30,8 +27,11 @@ class CashIssueAndPaymentFlowTests {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun start() {
|
fun start() {
|
||||||
mockNet = InternalMockNetwork(servicePeerAllocationStrategy = RoundRobin(),
|
mockNet = InternalMockNetwork(
|
||||||
cordappsForAllNodes = cordappsForPackages("com.r3.corda.enterprise.perftestcordapp.contracts.asset", "com.r3.corda.enterprise.perftestcordapp.schemas"))
|
servicePeerAllocationStrategy = RoundRobin(),
|
||||||
|
// TODO Update the performance test cordapp to use the new FinalityFlow API
|
||||||
|
cordappsForAllNodes = listOf(cordappForPackages("com.r3.corda.enterprise.perftestcordapp").withTargetVersion(3))
|
||||||
|
)
|
||||||
bankOfCordaNode = mockNet.createPartyNode(BOC_NAME)
|
bankOfCordaNode = mockNet.createPartyNode(BOC_NAME)
|
||||||
aliceNode = mockNet.createPartyNode(ALICE_NAME)
|
aliceNode = mockNet.createPartyNode(ALICE_NAME)
|
||||||
bankOfCorda = bankOfCordaNode.info.singleIdentity()
|
bankOfCorda = bankOfCordaNode.info.singleIdentity()
|
||||||
|
@ -11,10 +11,7 @@ import net.corda.core.utilities.OpaqueBytes
|
|||||||
import net.corda.core.utilities.getOrThrow
|
import net.corda.core.utilities.getOrThrow
|
||||||
import net.corda.testing.core.*
|
import net.corda.testing.core.*
|
||||||
import net.corda.testing.node.InMemoryMessagingNetwork.ServicePeerAllocationStrategy.RoundRobin
|
import net.corda.testing.node.InMemoryMessagingNetwork.ServicePeerAllocationStrategy.RoundRobin
|
||||||
import net.corda.testing.node.internal.InternalMockNetwork
|
import net.corda.testing.node.internal.*
|
||||||
import net.corda.testing.node.internal.TestStartedNode
|
|
||||||
import net.corda.testing.node.internal.cordappsForPackages
|
|
||||||
import net.corda.testing.node.internal.startFlow
|
|
||||||
import org.junit.After
|
import org.junit.After
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
@ -23,7 +20,7 @@ import org.junit.runners.Parameterized
|
|||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
|
|
||||||
@RunWith(Parameterized::class)
|
@RunWith(Parameterized::class)
|
||||||
class CashIssueAndPayNoSelectionTests(private val anonymous: Boolean) {
|
class CashIssueAndPaymentNoSelectionTests(private val anonymous: Boolean) {
|
||||||
companion object {
|
companion object {
|
||||||
@Parameterized.Parameters(name = "Anonymous = {0}")
|
@Parameterized.Parameters(name = "Anonymous = {0}")
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@ -39,8 +36,11 @@ class CashIssueAndPayNoSelectionTests(private val anonymous: Boolean) {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun start() {
|
fun start() {
|
||||||
mockNet = InternalMockNetwork(servicePeerAllocationStrategy = RoundRobin(),
|
mockNet = InternalMockNetwork(
|
||||||
cordappsForAllNodes = cordappsForPackages("com.r3.corda.enterprise.perftestcordapp.contracts.asset", "com.r3.corda.enterprise.perftestcordapp.schemas"))
|
servicePeerAllocationStrategy = RoundRobin(),
|
||||||
|
// TODO Update the performance test cordapp to use the new FinalityFlow API
|
||||||
|
cordappsForAllNodes = listOf(cordappForPackages("com.r3.corda.enterprise.perftestcordapp").withTargetVersion(3))
|
||||||
|
)
|
||||||
bankOfCordaNode = mockNet.createPartyNode(BOC_NAME)
|
bankOfCordaNode = mockNet.createPartyNode(BOC_NAME)
|
||||||
aliceNode = mockNet.createPartyNode(ALICE_NAME)
|
aliceNode = mockNet.createPartyNode(ALICE_NAME)
|
||||||
bankOfCorda = bankOfCordaNode.info.singleIdentity()
|
bankOfCorda = bankOfCordaNode.info.singleIdentity()
|
@ -10,6 +10,7 @@ import net.corda.testing.core.BOC_NAME
|
|||||||
import net.corda.testing.node.InMemoryMessagingNetwork.ServicePeerAllocationStrategy.RoundRobin
|
import net.corda.testing.node.InMemoryMessagingNetwork.ServicePeerAllocationStrategy.RoundRobin
|
||||||
import net.corda.testing.node.MockNetwork
|
import net.corda.testing.node.MockNetwork
|
||||||
import net.corda.testing.node.StartedMockNode
|
import net.corda.testing.node.StartedMockNode
|
||||||
|
import net.corda.testing.node.internal.cordappForPackages
|
||||||
import org.junit.After
|
import org.junit.After
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
@ -26,7 +27,10 @@ class CashIssueFlowTests {
|
|||||||
fun start() {
|
fun start() {
|
||||||
mockNet = MockNetwork(
|
mockNet = MockNetwork(
|
||||||
servicePeerAllocationStrategy = RoundRobin(),
|
servicePeerAllocationStrategy = RoundRobin(),
|
||||||
cordappPackages = listOf("com.r3.corda.enterprise.perftestcordapp.contracts.asset", "com.r3.corda.enterprise.perftestcordapp.schemas"))
|
cordappPackages = emptyList(),
|
||||||
|
// TODO Update the performance test cordapp to use the new FinalityFlow API
|
||||||
|
cordappsForAllNodes = listOf(cordappForPackages("com.r3.corda.enterprise.perftestcordapp").withTargetVersion(3))
|
||||||
|
)
|
||||||
bankOfCordaNode = mockNet.createPartyNode(BOC_NAME)
|
bankOfCordaNode = mockNet.createPartyNode(BOC_NAME)
|
||||||
bankOfCorda = bankOfCordaNode.info.identityFromX500Name(BOC_NAME)
|
bankOfCorda = bankOfCordaNode.info.identityFromX500Name(BOC_NAME)
|
||||||
notary = mockNet.defaultNotaryIdentity
|
notary = mockNet.defaultNotaryIdentity
|
||||||
|
@ -11,10 +11,7 @@ import net.corda.core.utilities.OpaqueBytes
|
|||||||
import net.corda.core.utilities.getOrThrow
|
import net.corda.core.utilities.getOrThrow
|
||||||
import net.corda.testing.core.*
|
import net.corda.testing.core.*
|
||||||
import net.corda.testing.node.InMemoryMessagingNetwork.ServicePeerAllocationStrategy.RoundRobin
|
import net.corda.testing.node.InMemoryMessagingNetwork.ServicePeerAllocationStrategy.RoundRobin
|
||||||
import net.corda.testing.node.internal.InternalMockNetwork
|
import net.corda.testing.node.internal.*
|
||||||
import net.corda.testing.node.internal.TestStartedNode
|
|
||||||
import net.corda.testing.node.internal.cordappsForPackages
|
|
||||||
import net.corda.testing.node.internal.startFlow
|
|
||||||
import org.junit.After
|
import org.junit.After
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
@ -33,7 +30,9 @@ class CashPaymentFlowTests {
|
|||||||
fun start() {
|
fun start() {
|
||||||
mockNet = InternalMockNetwork(
|
mockNet = InternalMockNetwork(
|
||||||
servicePeerAllocationStrategy = RoundRobin(),
|
servicePeerAllocationStrategy = RoundRobin(),
|
||||||
cordappsForAllNodes = cordappsForPackages("com.r3.corda.enterprise.perftestcordapp.contracts.asset", "com.r3.corda.enterprise.perftestcordapp.schemas"))
|
// TODO Update the performance test cordapp to use the new FinalityFlow API
|
||||||
|
cordappsForAllNodes = listOf(cordappForPackages("com.r3.corda.enterprise.perftestcordapp").withTargetVersion(3))
|
||||||
|
)
|
||||||
bankOfCordaNode = mockNet.createPartyNode(BOC_NAME)
|
bankOfCordaNode = mockNet.createPartyNode(BOC_NAME)
|
||||||
aliceNode = mockNet.createPartyNode(ALICE_NAME)
|
aliceNode = mockNet.createPartyNode(ALICE_NAME)
|
||||||
bankOfCorda = bankOfCordaNode.info.singleIdentity()
|
bankOfCorda = bankOfCordaNode.info.singleIdentity()
|
||||||
|
@ -52,7 +52,6 @@ import net.corda.testing.dsl.TestTransactionDSLInterpreter
|
|||||||
import net.corda.testing.internal.LogHelper
|
import net.corda.testing.internal.LogHelper
|
||||||
import net.corda.testing.internal.TEST_TX_TIME
|
import net.corda.testing.internal.TEST_TX_TIME
|
||||||
import net.corda.testing.internal.rigorousMock
|
import net.corda.testing.internal.rigorousMock
|
||||||
import net.corda.testing.node.MockServices
|
|
||||||
import net.corda.testing.node.internal.*
|
import net.corda.testing.node.internal.*
|
||||||
import net.corda.testing.node.ledger
|
import net.corda.testing.node.ledger
|
||||||
import org.assertj.core.api.Assertions.assertThat
|
import org.assertj.core.api.Assertions.assertThat
|
||||||
@ -86,14 +85,13 @@ internal fun CheckpointStorage.checkpoints(): List<SerializedBytes<Checkpoint>>
|
|||||||
@RunWith(Parameterized::class)
|
@RunWith(Parameterized::class)
|
||||||
class TwoPartyTradeFlowTests(private val anonymous: Boolean) {
|
class TwoPartyTradeFlowTests(private val anonymous: Boolean) {
|
||||||
companion object {
|
companion object {
|
||||||
private val cordappPackages = listOf("com.r3.corda.enterprise.perftestcordapp.contracts", "com.r3.corda.enterprise.perftestcordapp.schemas")
|
// TODO Update the performance test cordapp to use the new FinalityFlow API
|
||||||
private val cordappsForAllNodes = cordappsForPackages(cordappPackages)
|
private val cordappsForAllNodes = listOf(cordappForPackages("com.r3.corda.enterprise.perftestcordapp").withTargetVersion(3))
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@Parameterized.Parameters(name = "Anonymous = {0}")
|
@Parameterized.Parameters(name = "Anonymous = {0}")
|
||||||
fun data(): Collection<Boolean> = listOf(true, false)
|
fun data(): Collection<Boolean> = listOf(true, false)
|
||||||
|
|
||||||
private val dummyNotary = TestIdentity(DUMMY_NOTARY_NAME, 20)
|
private val dummyNotary = TestIdentity(DUMMY_NOTARY_NAME, 20)
|
||||||
private val MEGA_CORP = TestIdentity(CordaX500Name("MegaCorp", "London", "GB")).party
|
|
||||||
private val DUMMY_NOTARY get() = dummyNotary.party
|
private val DUMMY_NOTARY get() = dummyNotary.party
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,7 +115,7 @@ class TwoPartyTradeFlowTests(private val anonymous: Boolean) {
|
|||||||
// allow interruption half way through.
|
// allow interruption half way through.
|
||||||
mockNet = InternalMockNetwork(threadPerNode = true, cordappsForAllNodes = cordappsForAllNodes)
|
mockNet = InternalMockNetwork(threadPerNode = true, cordappsForAllNodes = cordappsForAllNodes)
|
||||||
val ledgerIdentityService = rigorousMock<IdentityServiceInternal>()
|
val ledgerIdentityService = rigorousMock<IdentityServiceInternal>()
|
||||||
MockServices(cordappPackages, MEGA_CORP.name, ledgerIdentityService).ledger(DUMMY_NOTARY) {
|
mockNet.defaultNotaryNode.services.ledger(DUMMY_NOTARY) {
|
||||||
val notaryNode = mockNet.defaultNotaryNode
|
val notaryNode = mockNet.defaultNotaryNode
|
||||||
val aliceNode = mockNet.createPartyNode(ALICE_NAME)
|
val aliceNode = mockNet.createPartyNode(ALICE_NAME)
|
||||||
val bobNode = mockNet.createPartyNode(BOB_NAME)
|
val bobNode = mockNet.createPartyNode(BOB_NAME)
|
||||||
@ -170,7 +168,7 @@ class TwoPartyTradeFlowTests(private val anonymous: Boolean) {
|
|||||||
fun `trade cash for commercial paper fails using soft locking`() {
|
fun `trade cash for commercial paper fails using soft locking`() {
|
||||||
mockNet = InternalMockNetwork(threadPerNode = true, cordappsForAllNodes = cordappsForAllNodes)
|
mockNet = InternalMockNetwork(threadPerNode = true, cordappsForAllNodes = cordappsForAllNodes)
|
||||||
val ledgerIdentityService = rigorousMock<IdentityServiceInternal>()
|
val ledgerIdentityService = rigorousMock<IdentityServiceInternal>()
|
||||||
MockServices(cordappPackages, MEGA_CORP.name, ledgerIdentityService).ledger(DUMMY_NOTARY) {
|
mockNet.defaultNotaryNode.services.ledger(DUMMY_NOTARY) {
|
||||||
val notaryNode = mockNet.defaultNotaryNode
|
val notaryNode = mockNet.defaultNotaryNode
|
||||||
val aliceNode = mockNet.createPartyNode(ALICE_NAME)
|
val aliceNode = mockNet.createPartyNode(ALICE_NAME)
|
||||||
val bobNode = mockNet.createPartyNode(BOB_NAME)
|
val bobNode = mockNet.createPartyNode(BOB_NAME)
|
||||||
@ -228,7 +226,7 @@ class TwoPartyTradeFlowTests(private val anonymous: Boolean) {
|
|||||||
fun `shutdown and restore`() {
|
fun `shutdown and restore`() {
|
||||||
mockNet = InternalMockNetwork(cordappsForAllNodes = cordappsForAllNodes)
|
mockNet = InternalMockNetwork(cordappsForAllNodes = cordappsForAllNodes)
|
||||||
val ledgerIdentityService = rigorousMock<IdentityServiceInternal>()
|
val ledgerIdentityService = rigorousMock<IdentityServiceInternal>()
|
||||||
MockServices(cordappPackages, MEGA_CORP.name, ledgerIdentityService).ledger(DUMMY_NOTARY) {
|
mockNet.defaultNotaryNode.services.ledger(DUMMY_NOTARY) {
|
||||||
val notaryNode = mockNet.defaultNotaryNode
|
val notaryNode = mockNet.defaultNotaryNode
|
||||||
val aliceNode = mockNet.createPartyNode(ALICE_NAME)
|
val aliceNode = mockNet.createPartyNode(ALICE_NAME)
|
||||||
var bobNode = mockNet.createPartyNode(BOB_NAME)
|
var bobNode = mockNet.createPartyNode(BOB_NAME)
|
||||||
@ -523,7 +521,7 @@ class TwoPartyTradeFlowTests(private val anonymous: Boolean) {
|
|||||||
fun `dependency with error on buyer side`() {
|
fun `dependency with error on buyer side`() {
|
||||||
mockNet = InternalMockNetwork(cordappsForAllNodes = cordappsForAllNodes)
|
mockNet = InternalMockNetwork(cordappsForAllNodes = cordappsForAllNodes)
|
||||||
val ledgerIdentityService = rigorousMock<IdentityServiceInternal>()
|
val ledgerIdentityService = rigorousMock<IdentityServiceInternal>()
|
||||||
MockServices(cordappPackages, MEGA_CORP.name, ledgerIdentityService).ledger(DUMMY_NOTARY) {
|
mockNet.defaultNotaryNode.services.ledger(DUMMY_NOTARY) {
|
||||||
runWithError(ledgerIdentityService, true, false, "at least one cash input")
|
runWithError(ledgerIdentityService, true, false, "at least one cash input")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -532,7 +530,7 @@ class TwoPartyTradeFlowTests(private val anonymous: Boolean) {
|
|||||||
fun `dependency with error on seller side`() {
|
fun `dependency with error on seller side`() {
|
||||||
mockNet = InternalMockNetwork(cordappsForAllNodes = cordappsForAllNodes)
|
mockNet = InternalMockNetwork(cordappsForAllNodes = cordappsForAllNodes)
|
||||||
val ledgerIdentityService = rigorousMock<IdentityServiceInternal>()
|
val ledgerIdentityService = rigorousMock<IdentityServiceInternal>()
|
||||||
MockServices(cordappPackages, MEGA_CORP.name, ledgerIdentityService).ledger(DUMMY_NOTARY) {
|
mockNet.defaultNotaryNode.services.ledger(DUMMY_NOTARY) {
|
||||||
runWithError(ledgerIdentityService, false, true, "Issuances have a time-window")
|
runWithError(ledgerIdentityService, false, true, "Issuances have a time-window")
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user