mirror of
https://github.com/corda/corda.git
synced 2024-12-28 00:38:55 +00:00
Fix compilation errors in perftestcordapp
module.
This commit is contained in:
parent
fe34a4e7bc
commit
c817252e7a
@ -1,5 +1,8 @@
|
|||||||
package com.r3.corda.enterprise.perftestcordapp.contracts
|
package com.r3.corda.enterprise.perftestcordapp.contracts
|
||||||
|
|
||||||
|
import com.r3.corda.enterprise.perftestcordapp.DOLLARS
|
||||||
|
import com.r3.corda.enterprise.perftestcordapp.`issued by`
|
||||||
|
import com.r3.corda.enterprise.perftestcordapp.contracts.asset.*
|
||||||
import net.corda.core.contracts.*
|
import net.corda.core.contracts.*
|
||||||
import net.corda.core.identity.AnonymousParty
|
import net.corda.core.identity.AnonymousParty
|
||||||
import net.corda.core.identity.Party
|
import net.corda.core.identity.Party
|
||||||
@ -9,13 +12,8 @@ import net.corda.core.transactions.SignedTransaction
|
|||||||
import net.corda.core.transactions.TransactionBuilder
|
import net.corda.core.transactions.TransactionBuilder
|
||||||
import net.corda.core.utilities.days
|
import net.corda.core.utilities.days
|
||||||
import net.corda.core.utilities.seconds
|
import net.corda.core.utilities.seconds
|
||||||
import com.r3.corda.enterprise.perftestcordapp.DOLLARS
|
|
||||||
import com.r3.corda.enterprise.perftestcordapp.`issued by`
|
|
||||||
import com.r3.corda.enterprise.perftestcordapp.contracts.asset.*
|
|
||||||
import net.corda.testing.*
|
import net.corda.testing.*
|
||||||
import com.r3.corda.enterprise.perftestcordapp.contracts.asset.fillWithSomeTestCash
|
|
||||||
import net.corda.testing.node.MockServices
|
import net.corda.testing.node.MockServices
|
||||||
import net.corda.testing.node.MockServices.Companion.makeTestDatabaseAndMockServices
|
|
||||||
import org.junit.Ignore
|
import org.junit.Ignore
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
package com.r3.corda.enterprise.perftestcordapp.contracts.asset
|
package com.r3.corda.enterprise.perftestcordapp.contracts.asset
|
||||||
|
|
||||||
import net.corda.core.utilities.getOrThrow
|
|
||||||
import com.r3.corda.enterprise.perftestcordapp.DOLLARS
|
import com.r3.corda.enterprise.perftestcordapp.DOLLARS
|
||||||
import com.r3.corda.enterprise.perftestcordapp.flows.CashException
|
import com.r3.corda.enterprise.perftestcordapp.flows.CashException
|
||||||
import com.r3.corda.enterprise.perftestcordapp.flows.CashPaymentFlow
|
import com.r3.corda.enterprise.perftestcordapp.flows.CashPaymentFlow
|
||||||
|
import net.corda.core.utilities.getOrThrow
|
||||||
import net.corda.testing.node.MockNetwork
|
import net.corda.testing.node.MockNetwork
|
||||||
import net.corda.testing.node.MockNodeParameters
|
import net.corda.testing.node.MockNodeParameters
|
||||||
|
import net.corda.testing.startFlow
|
||||||
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
|
||||||
|
@ -104,7 +104,7 @@ class CashTests {
|
|||||||
@Before
|
@Before
|
||||||
fun setUp() = withTestSerialization {
|
fun setUp() = withTestSerialization {
|
||||||
LogHelper.setLevel(NodeVaultService::class)
|
LogHelper.setLevel(NodeVaultService::class)
|
||||||
megaCorpServices = MockServices(listOf("com.r3.corda.enterprise.perftestcordapp.contracts.asset"), MEGA_CORP_KEY)
|
megaCorpServices = MockServices(listOf("com.r3.corda.enterprise.perftestcordapp.contracts.asset"), MEGA_CORP.name, MEGA_CORP_KEY)
|
||||||
val databaseAndServices = makeTestDatabaseAndMockServices(cordappPackages = listOf("com.r3.corda.enterprise.perftestcordapp.contracts.asset"), keys = listOf(MINI_CORP_KEY, MEGA_CORP_KEY, OUR_KEY))
|
val databaseAndServices = makeTestDatabaseAndMockServices(cordappPackages = listOf("com.r3.corda.enterprise.perftestcordapp.contracts.asset"), keys = listOf(MINI_CORP_KEY, MEGA_CORP_KEY, OUR_KEY))
|
||||||
database = databaseAndServices.first
|
database = databaseAndServices.first
|
||||||
miniCorpServices = databaseAndServices.second
|
miniCorpServices = databaseAndServices.second
|
||||||
@ -828,7 +828,7 @@ class CashTests {
|
|||||||
// Double spend.
|
// Double spend.
|
||||||
@Test
|
@Test
|
||||||
fun chainCashDoubleSpendFailsWith() {
|
fun chainCashDoubleSpendFailsWith() {
|
||||||
val mockService = MockServices(listOf("com.r3.corda.enterprise.perftestcordapp.contracts.asset"), MEGA_CORP_KEY)
|
val mockService = MockServices(listOf("com.r3.corda.enterprise.perftestcordapp.contracts.asset"), MEGA_CORP.name, MEGA_CORP_KEY)
|
||||||
|
|
||||||
ledger(mockService) {
|
ledger(mockService) {
|
||||||
unverifiedTransaction {
|
unverifiedTransaction {
|
||||||
|
@ -6,13 +6,14 @@ import com.r3.corda.enterprise.perftestcordapp.contracts.asset.Cash
|
|||||||
import net.corda.core.identity.Party
|
import net.corda.core.identity.Party
|
||||||
import net.corda.core.utilities.OpaqueBytes
|
import net.corda.core.utilities.OpaqueBytes
|
||||||
import net.corda.core.utilities.getOrThrow
|
import net.corda.core.utilities.getOrThrow
|
||||||
|
import net.corda.finance.flows.CashIssueFlow
|
||||||
import net.corda.node.internal.StartedNode
|
import net.corda.node.internal.StartedNode
|
||||||
import net.corda.testing.BOC
|
import net.corda.testing.BOC
|
||||||
import net.corda.testing.chooseIdentity
|
import net.corda.testing.chooseIdentity
|
||||||
import net.corda.testing.getDefaultNotary
|
|
||||||
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.MockNetwork.MockNode
|
import net.corda.testing.node.MockNetwork.MockNode
|
||||||
|
import net.corda.testing.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
|
||||||
@ -35,7 +36,7 @@ class CashExitFlowTests {
|
|||||||
bankOfCorda = bankOfCordaNode.info.chooseIdentity()
|
bankOfCorda = bankOfCordaNode.info.chooseIdentity()
|
||||||
|
|
||||||
mockNet.runNetwork()
|
mockNet.runNetwork()
|
||||||
notary = bankOfCordaNode.services.getDefaultNotary()
|
notary = mockNet.defaultNotaryIdentity
|
||||||
val future = bankOfCordaNode.services.startFlow(CashIssueFlow(initialBalance, ref, notary)).resultFuture
|
val future = bankOfCordaNode.services.startFlow(CashIssueFlow(initialBalance, ref, notary)).resultFuture
|
||||||
mockNet.runNetwork()
|
mockNet.runNetwork()
|
||||||
future.getOrThrow()
|
future.getOrThrow()
|
||||||
|
@ -1,17 +1,18 @@
|
|||||||
package com.r3.corda.enterprise.perftestcordapp.flows
|
package com.r3.corda.enterprise.perftestcordapp.flows
|
||||||
|
|
||||||
import net.corda.core.identity.Party
|
|
||||||
import net.corda.core.utilities.OpaqueBytes
|
|
||||||
import net.corda.core.utilities.getOrThrow
|
|
||||||
import com.r3.corda.enterprise.perftestcordapp.DOLLARS
|
import com.r3.corda.enterprise.perftestcordapp.DOLLARS
|
||||||
import com.r3.corda.enterprise.perftestcordapp.`issued by`
|
import com.r3.corda.enterprise.perftestcordapp.`issued by`
|
||||||
import com.r3.corda.enterprise.perftestcordapp.contracts.asset.Cash
|
import com.r3.corda.enterprise.perftestcordapp.contracts.asset.Cash
|
||||||
|
import net.corda.core.identity.Party
|
||||||
|
import net.corda.core.utilities.OpaqueBytes
|
||||||
|
import net.corda.core.utilities.getOrThrow
|
||||||
import net.corda.node.internal.StartedNode
|
import net.corda.node.internal.StartedNode
|
||||||
import net.corda.testing.BOC
|
import net.corda.testing.BOC
|
||||||
import net.corda.testing.chooseIdentity
|
import net.corda.testing.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.MockNetwork.MockNode
|
import net.corda.testing.node.MockNetwork.MockNode
|
||||||
|
import net.corda.testing.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
|
||||||
@ -28,9 +29,8 @@ class CashIssueFlowTests {
|
|||||||
fun start() {
|
fun start() {
|
||||||
mockNet = MockNetwork(servicePeerAllocationStrategy = RoundRobin(), cordappPackages = listOf("com.r3.corda.enterprise.perftestcordapp.contracts.asset"))
|
mockNet = MockNetwork(servicePeerAllocationStrategy = RoundRobin(), cordappPackages = listOf("com.r3.corda.enterprise.perftestcordapp.contracts.asset"))
|
||||||
bankOfCordaNode = mockNet.createPartyNode(BOC.name)
|
bankOfCordaNode = mockNet.createPartyNode(BOC.name)
|
||||||
bankOfCorda = bankOfCordaNode.info.chooseIdentity()
|
bankOfCorda = bankOfCordaNode.info.identityFromX500Name(BOC_NAME)
|
||||||
notary = mockNet.defaultNotaryIdentity
|
notary = mockNet.defaultNotaryIdentity
|
||||||
mockNet.runNetwork()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
|
@ -47,7 +47,6 @@ import net.corda.testing.node.*
|
|||||||
import org.assertj.core.api.Assertions.assertThat
|
import org.assertj.core.api.Assertions.assertThat
|
||||||
import org.junit.After
|
import org.junit.After
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Ignore
|
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
import org.junit.runners.Parameterized
|
import org.junit.runners.Parameterized
|
||||||
@ -111,14 +110,14 @@ class TwoPartyTradeFlowTests(private val anonymous: Boolean) {
|
|||||||
// we run in the unit test thread exclusively to speed things up, ensure deterministic results and
|
// we run in the unit test thread exclusively to speed things up, ensure deterministic results and
|
||||||
// allow interruption half way through.
|
// allow interruption half way through.
|
||||||
mockNet = MockNetwork(threadPerNode = true, cordappPackages = cordappPackages)
|
mockNet = MockNetwork(threadPerNode = true, cordappPackages = cordappPackages)
|
||||||
ledger(MockServices(cordappPackages), initialiseSerialization = false) {
|
ledger(MockServices(cordappPackages)) {
|
||||||
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)
|
||||||
val bankNode = mockNet.createPartyNode(BOC_NAME)
|
val bankNode = mockNet.createPartyNode(BOC_NAME)
|
||||||
val alice = aliceNode.info.singleIdentity()
|
val alice = aliceNode.info.singleIdentity()
|
||||||
val bank = bankNode.info.singleIdentity()
|
val bank = bankNode.info.singleIdentity()
|
||||||
val notary = notaryNode.services.getDefaultNotary()
|
val notary = mockNet.defaultNotaryIdentity
|
||||||
val cashIssuer = bank.ref(1)
|
val cashIssuer = bank.ref(1)
|
||||||
val cpIssuer = bank.ref(1, 2, 3)
|
val cpIssuer = bank.ref(1, 2, 3)
|
||||||
|
|
||||||
@ -161,7 +160,7 @@ class TwoPartyTradeFlowTests(private val anonymous: Boolean) {
|
|||||||
@Test(expected = InsufficientBalanceException::class)
|
@Test(expected = InsufficientBalanceException::class)
|
||||||
fun `trade cash for commercial paper fails using soft locking`() {
|
fun `trade cash for commercial paper fails using soft locking`() {
|
||||||
mockNet = MockNetwork(threadPerNode = true, cordappPackages = cordappPackages)
|
mockNet = MockNetwork(threadPerNode = true, cordappPackages = cordappPackages)
|
||||||
ledger(MockServices(cordappPackages), initialiseSerialization = false) {
|
ledger(MockServices(cordappPackages)) {
|
||||||
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)
|
||||||
@ -169,7 +168,7 @@ class TwoPartyTradeFlowTests(private val anonymous: Boolean) {
|
|||||||
val alice = aliceNode.info.singleIdentity()
|
val alice = aliceNode.info.singleIdentity()
|
||||||
val bank = bankNode.info.singleIdentity()
|
val bank = bankNode.info.singleIdentity()
|
||||||
val issuer = bank.ref(1)
|
val issuer = bank.ref(1)
|
||||||
val notary = aliceNode.services.getDefaultNotary()
|
val notary = mockNet.defaultNotaryIdentity
|
||||||
|
|
||||||
aliceNode.internals.disableDBCloseOnStop()
|
aliceNode.internals.disableDBCloseOnStop()
|
||||||
bobNode.internals.disableDBCloseOnStop()
|
bobNode.internals.disableDBCloseOnStop()
|
||||||
@ -217,7 +216,7 @@ class TwoPartyTradeFlowTests(private val anonymous: Boolean) {
|
|||||||
@Test
|
@Test
|
||||||
fun `shutdown and restore`() {
|
fun `shutdown and restore`() {
|
||||||
mockNet = MockNetwork(cordappPackages = cordappPackages)
|
mockNet = MockNetwork(cordappPackages = cordappPackages)
|
||||||
ledger(MockServices(cordappPackages), initialiseSerialization = false) {
|
ledger(MockServices(cordappPackages)) {
|
||||||
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)
|
||||||
@ -228,7 +227,7 @@ class TwoPartyTradeFlowTests(private val anonymous: Boolean) {
|
|||||||
val bobAddr = bobNode.network.myAddress as InMemoryMessagingNetwork.PeerHandle
|
val bobAddr = bobNode.network.myAddress as InMemoryMessagingNetwork.PeerHandle
|
||||||
mockNet.runNetwork() // Clear network map registration messages
|
mockNet.runNetwork() // Clear network map registration messages
|
||||||
|
|
||||||
val notary = notaryNode.services.getDefaultNotary()
|
val notary = mockNet.defaultNotaryIdentity
|
||||||
val alice = aliceNode.info.singleIdentity()
|
val alice = aliceNode.info.singleIdentity()
|
||||||
val bank = bankNode.info.singleIdentity()
|
val bank = bankNode.info.singleIdentity()
|
||||||
val issuer = bank.ref(1, 2, 3)
|
val issuer = bank.ref(1, 2, 3)
|
||||||
@ -317,8 +316,8 @@ class TwoPartyTradeFlowTests(private val anonymous: Boolean) {
|
|||||||
return mockNet.createNode(MockNodeParameters(legalName = name), nodeFactory = { args ->
|
return mockNet.createNode(MockNodeParameters(legalName = name), nodeFactory = { args ->
|
||||||
object : MockNetwork.MockNode(args) {
|
object : MockNetwork.MockNode(args) {
|
||||||
// That constructs a recording tx storage
|
// That constructs a recording tx storage
|
||||||
override fun makeTransactionStorage(): WritableTransactionStorage {
|
override fun makeTransactionStorage(database: CordaPersistence): WritableTransactionStorage {
|
||||||
return RecordingTransactionStorage(database, super.makeTransactionStorage())
|
return RecordingTransactionStorage(database, super.makeTransactionStorage(database))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -332,13 +331,13 @@ class TwoPartyTradeFlowTests(private val anonymous: Boolean) {
|
|||||||
val bobNode = makeNodeWithTracking(BOB_NAME)
|
val bobNode = makeNodeWithTracking(BOB_NAME)
|
||||||
val bankNode = makeNodeWithTracking(BOC_NAME)
|
val bankNode = makeNodeWithTracking(BOC_NAME)
|
||||||
mockNet.runNetwork()
|
mockNet.runNetwork()
|
||||||
val notary = aliceNode.services.getDefaultNotary()
|
val notary = mockNet.defaultNotaryIdentity
|
||||||
val alice = aliceNode.info.singleIdentity()
|
val alice = aliceNode.info.singleIdentity()
|
||||||
val bob = bobNode.info.singleIdentity()
|
val bob = bobNode.info.singleIdentity()
|
||||||
val bank = bankNode.info.singleIdentity()
|
val bank = bankNode.info.singleIdentity()
|
||||||
val issuer = bank.ref(1, 2, 3)
|
val issuer = bank.ref(1, 2, 3)
|
||||||
|
|
||||||
ledger(aliceNode.services, initialiseSerialization = false) {
|
ledger(aliceNode.services) {
|
||||||
|
|
||||||
// Insert a prospectus type attachment into the commercial paper transaction.
|
// Insert a prospectus type attachment into the commercial paper transaction.
|
||||||
val stream = ByteArrayOutputStream()
|
val stream = ByteArrayOutputStream()
|
||||||
@ -439,12 +438,12 @@ class TwoPartyTradeFlowTests(private val anonymous: Boolean) {
|
|||||||
val bankNode = makeNodeWithTracking(BOC_NAME)
|
val bankNode = makeNodeWithTracking(BOC_NAME)
|
||||||
|
|
||||||
mockNet.runNetwork()
|
mockNet.runNetwork()
|
||||||
val notary = aliceNode.services.getDefaultNotary()
|
val notary = mockNet.defaultNotaryIdentity
|
||||||
val alice: Party = aliceNode.info.singleIdentity()
|
val alice: Party = aliceNode.info.singleIdentity()
|
||||||
val bank: Party = bankNode.info.singleIdentity()
|
val bank: Party = bankNode.info.singleIdentity()
|
||||||
val issuer = bank.ref(1, 2, 3)
|
val issuer = bank.ref(1, 2, 3)
|
||||||
|
|
||||||
ledger(aliceNode.services, initialiseSerialization = false) {
|
ledger(aliceNode.services) {
|
||||||
// Insert a prospectus type attachment into the commercial paper transaction.
|
// Insert a prospectus type attachment into the commercial paper transaction.
|
||||||
val stream = ByteArrayOutputStream()
|
val stream = ByteArrayOutputStream()
|
||||||
JarOutputStream(stream).use {
|
JarOutputStream(stream).use {
|
||||||
@ -514,7 +513,7 @@ class TwoPartyTradeFlowTests(private val anonymous: Boolean) {
|
|||||||
@Test
|
@Test
|
||||||
fun `dependency with error on buyer side`() {
|
fun `dependency with error on buyer side`() {
|
||||||
mockNet = MockNetwork(cordappPackages = cordappPackages)
|
mockNet = MockNetwork(cordappPackages = cordappPackages)
|
||||||
ledger(MockServices(cordappPackages), initialiseSerialization = false) {
|
ledger(MockServices(cordappPackages)) {
|
||||||
runWithError(true, false, "at least one cash input")
|
runWithError(true, false, "at least one cash input")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -522,7 +521,7 @@ class TwoPartyTradeFlowTests(private val anonymous: Boolean) {
|
|||||||
@Test
|
@Test
|
||||||
fun `dependency with error on seller side`() {
|
fun `dependency with error on seller side`() {
|
||||||
mockNet = MockNetwork(cordappPackages = cordappPackages)
|
mockNet = MockNetwork(cordappPackages = cordappPackages)
|
||||||
ledger(MockServices(cordappPackages), initialiseSerialization = false) {
|
ledger(MockServices(cordappPackages)) {
|
||||||
runWithError(false, true, "Issuances have a time-window")
|
runWithError(false, true, "Issuances have a time-window")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -594,7 +593,7 @@ class TwoPartyTradeFlowTests(private val anonymous: Boolean) {
|
|||||||
val bankNode = mockNet.createPartyNode(BOC_NAME)
|
val bankNode = mockNet.createPartyNode(BOC_NAME)
|
||||||
|
|
||||||
mockNet.runNetwork()
|
mockNet.runNetwork()
|
||||||
val notary = aliceNode.services.getDefaultNotary()
|
val notary = mockNet.defaultNotaryIdentity
|
||||||
val alice = aliceNode.info.singleIdentity()
|
val alice = aliceNode.info.singleIdentity()
|
||||||
val bob = bobNode.info.singleIdentity()
|
val bob = bobNode.info.singleIdentity()
|
||||||
val bank = bankNode.info.singleIdentity()
|
val bank = bankNode.info.singleIdentity()
|
||||||
|
Loading…
Reference in New Issue
Block a user