mirror of
https://github.com/corda/corda.git
synced 2024-12-27 00:21:12 +00:00
Merge branch 'master' of https://github.com/corda/corda into christians_os_merge_20171106
This commit is contained in:
parent
7765de0bf9
commit
8b55f415bd
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,6 @@
|
|||||||
|
#Mon Nov 06 15:05:49 GMT 2017
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3-all.zip
|
||||||
|
@ -7,7 +7,6 @@ import net.corda.core.utilities.loggerFor
|
|||||||
import net.corda.node.VersionInfo
|
import net.corda.node.VersionInfo
|
||||||
import net.corda.node.services.config.NodeConfiguration
|
import net.corda.node.services.config.NodeConfiguration
|
||||||
import net.corda.node.services.config.RelayConfiguration
|
import net.corda.node.services.config.RelayConfiguration
|
||||||
import net.corda.nodeapi.internal.ServiceInfo
|
|
||||||
import org.fusesource.jansi.Ansi
|
import org.fusesource.jansi.Ansi
|
||||||
import org.fusesource.jansi.AnsiConsole
|
import org.fusesource.jansi.AnsiConsole
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
|
@ -4,38 +4,35 @@ 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.testing.chooseIdentity
|
|
||||||
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 org.assertj.core.api.Assertions.assertThatThrownBy
|
import org.assertj.core.api.Assertions.assertThatThrownBy
|
||||||
|
import org.junit.After
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
|
|
||||||
class CashSelectionH2Test {
|
class CashSelectionH2Test {
|
||||||
|
private val mockNet = MockNetwork(threadPerNode = true, cordappPackages = listOf("net.corda.finance"))
|
||||||
|
|
||||||
|
@After
|
||||||
|
fun cleanUp() {
|
||||||
|
mockNet.stopNodes()
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `check does not hold connection over retries`() {
|
fun `check does not hold connection over retries`() {
|
||||||
val mockNet = MockNetwork(threadPerNode = true)
|
val bankA = mockNet.createNode(MockNodeParameters(configOverrides = {
|
||||||
try {
|
// Tweak connections to be minimal to make this easier (1 results in a hung node during start up, so use 2 connections).
|
||||||
val notaryNode = mockNet.createNotaryNode()
|
it.dataSourceProperties.setProperty("maximumPoolSize", "2")
|
||||||
val bankA = mockNet.createNode(MockNodeParameters(configOverrides = { existingConfig ->
|
}))
|
||||||
// Tweak connections to be minimal to make this easier (1 results in a hung node during start up, so use 2 connections).
|
val notary = mockNet.defaultNotaryIdentity
|
||||||
existingConfig.dataSourceProperties.setProperty("maximumPoolSize", "2")
|
|
||||||
existingConfig
|
|
||||||
}))
|
|
||||||
|
|
||||||
mockNet.startNodes()
|
// Start more cash spends than we have connections. If spend leaks a connection on retry, we will run out of connections.
|
||||||
|
val flow1 = bankA.services.startFlow(CashPaymentFlow(amount = 100.DOLLARS, anonymous = false, recipient = notary))
|
||||||
|
val flow2 = bankA.services.startFlow(CashPaymentFlow(amount = 100.DOLLARS, anonymous = false, recipient = notary))
|
||||||
|
val flow3 = bankA.services.startFlow(CashPaymentFlow(amount = 100.DOLLARS, anonymous = false, recipient = notary))
|
||||||
|
|
||||||
// Start more cash spends than we have connections. If spend leaks a connection on retry, we will run out of connections.
|
assertThatThrownBy { flow1.resultFuture.getOrThrow() }.isInstanceOf(CashException::class.java)
|
||||||
val flow1 = bankA.services.startFlow(CashPaymentFlow(amount = 100.DOLLARS, anonymous = false, recipient = notaryNode.info.chooseIdentity()))
|
assertThatThrownBy { flow2.resultFuture.getOrThrow() }.isInstanceOf(CashException::class.java)
|
||||||
val flow2 = bankA.services.startFlow(CashPaymentFlow(amount = 100.DOLLARS, anonymous = false, recipient = notaryNode.info.chooseIdentity()))
|
assertThatThrownBy { flow3.resultFuture.getOrThrow() }.isInstanceOf(CashException::class.java)
|
||||||
val flow3 = bankA.services.startFlow(CashPaymentFlow(amount = 100.DOLLARS, anonymous = false, recipient = notaryNode.info.chooseIdentity()))
|
|
||||||
|
|
||||||
assertThatThrownBy { flow1.resultFuture.getOrThrow() }.isInstanceOf(CashException::class.java)
|
|
||||||
assertThatThrownBy { flow2.resultFuture.getOrThrow() }.isInstanceOf(CashException::class.java)
|
|
||||||
assertThatThrownBy { flow3.resultFuture.getOrThrow() }.isInstanceOf(CashException::class.java)
|
|
||||||
} finally {
|
|
||||||
mockNet.stopNodes()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -20,20 +20,18 @@ import kotlin.test.assertEquals
|
|||||||
import kotlin.test.assertFailsWith
|
import kotlin.test.assertFailsWith
|
||||||
|
|
||||||
class CashExitFlowTests {
|
class CashExitFlowTests {
|
||||||
private lateinit var mockNet : MockNetwork
|
private lateinit var mockNet: MockNetwork
|
||||||
private val initialBalance = 2000.DOLLARS
|
private val initialBalance = 2000.DOLLARS
|
||||||
private val ref = OpaqueBytes.of(0x01)
|
private val ref = OpaqueBytes.of(0x01)
|
||||||
private lateinit var bankOfCordaNode: StartedNode<MockNode>
|
private lateinit var bankOfCordaNode: StartedNode<MockNode>
|
||||||
private lateinit var bankOfCorda: Party
|
private lateinit var bankOfCorda: Party
|
||||||
private lateinit var notaryNode: StartedNode<MockNode>
|
|
||||||
private lateinit var notary: Party
|
private lateinit var notary: Party
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun start() {
|
fun start() {
|
||||||
mockNet = MockNetwork(servicePeerAllocationStrategy = RoundRobin(), cordappPackages = listOf("com.r3.corda.enterprise.perftestcordapp.contracts.asset"))
|
mockNet = MockNetwork(servicePeerAllocationStrategy = RoundRobin(),
|
||||||
notaryNode = mockNet.createNotaryNode()
|
cordappPackages = listOf("com.r3.corda.enterprise.perftestcordapp.contracts.asset"))
|
||||||
bankOfCordaNode = mockNet.createPartyNode(BOC.name)
|
bankOfCordaNode = mockNet.createPartyNode(BOC.name)
|
||||||
notary = notaryNode.services.getDefaultNotary()
|
|
||||||
bankOfCorda = bankOfCordaNode.info.chooseIdentity()
|
bankOfCorda = bankOfCordaNode.info.chooseIdentity()
|
||||||
|
|
||||||
mockNet.runNetwork()
|
mockNet.runNetwork()
|
||||||
|
@ -7,9 +7,8 @@ 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.node.internal.StartedNode
|
import net.corda.node.internal.StartedNode
|
||||||
import net.corda.testing.chooseIdentity
|
|
||||||
import net.corda.testing.getDefaultNotary
|
|
||||||
import net.corda.testing.BOC
|
import net.corda.testing.BOC
|
||||||
|
import net.corda.testing.chooseIdentity
|
||||||
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
|
||||||
@ -20,19 +19,17 @@ import kotlin.test.assertEquals
|
|||||||
import kotlin.test.assertFailsWith
|
import kotlin.test.assertFailsWith
|
||||||
|
|
||||||
class CashIssueFlowTests {
|
class CashIssueFlowTests {
|
||||||
private lateinit var mockNet : MockNetwork
|
private lateinit var mockNet: MockNetwork
|
||||||
private lateinit var bankOfCordaNode: StartedNode<MockNode>
|
private lateinit var bankOfCordaNode: StartedNode<MockNode>
|
||||||
private lateinit var bankOfCorda: Party
|
private lateinit var bankOfCorda: Party
|
||||||
private lateinit var notaryNode: StartedNode<MockNode>
|
|
||||||
private lateinit var notary: Party
|
private lateinit var notary: Party
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
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"))
|
||||||
notaryNode = mockNet.createNotaryNode()
|
|
||||||
bankOfCordaNode = mockNet.createPartyNode(BOC.name)
|
bankOfCordaNode = mockNet.createPartyNode(BOC.name)
|
||||||
bankOfCorda = bankOfCordaNode.info.chooseIdentity()
|
bankOfCorda = bankOfCordaNode.info.chooseIdentity()
|
||||||
notary = notaryNode.services.getDefaultNotary()
|
notary = mockNet.defaultNotaryIdentity
|
||||||
mockNet.runNetwork()
|
mockNet.runNetwork()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,23 +21,21 @@ import kotlin.test.assertEquals
|
|||||||
import kotlin.test.assertFailsWith
|
import kotlin.test.assertFailsWith
|
||||||
|
|
||||||
class CashPaymentFlowTests {
|
class CashPaymentFlowTests {
|
||||||
private lateinit var mockNet : MockNetwork
|
private lateinit var mockNet: MockNetwork
|
||||||
private val initialBalance = 2000.DOLLARS
|
private val initialBalance = 2000.DOLLARS
|
||||||
private val ref = OpaqueBytes.of(0x01)
|
private val ref = OpaqueBytes.of(0x01)
|
||||||
private lateinit var bankOfCordaNode: StartedNode<MockNode>
|
private lateinit var bankOfCordaNode: StartedNode<MockNode>
|
||||||
private lateinit var bankOfCorda: Party
|
private lateinit var bankOfCorda: Party
|
||||||
private lateinit var notaryNode: StartedNode<MockNode>
|
private lateinit var aliceNode: StartedNode<MockNode>
|
||||||
private lateinit var notary: Party
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
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"))
|
||||||
notaryNode = mockNet.createNotaryNode()
|
|
||||||
bankOfCordaNode = mockNet.createPartyNode(BOC.name)
|
bankOfCordaNode = mockNet.createPartyNode(BOC.name)
|
||||||
|
aliceNode = mockNet.createPartyNode(ALICE.name)
|
||||||
bankOfCorda = bankOfCordaNode.info.chooseIdentity()
|
bankOfCorda = bankOfCordaNode.info.chooseIdentity()
|
||||||
notary = notaryNode.services.getDefaultNotary()
|
|
||||||
val future = bankOfCordaNode.services.startFlow(CashIssueFlow(initialBalance, ref, notary)).resultFuture
|
|
||||||
mockNet.runNetwork()
|
mockNet.runNetwork()
|
||||||
|
val future = bankOfCordaNode.services.startFlow(CashIssueFlow(initialBalance, ref, mockNet.defaultNotaryIdentity)).resultFuture
|
||||||
future.getOrThrow()
|
future.getOrThrow()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,7 +46,7 @@ class CashPaymentFlowTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `pay some cash`() {
|
fun `pay some cash`() {
|
||||||
val payTo = notaryNode.info.chooseIdentity()
|
val payTo = aliceNode.info.chooseIdentity()
|
||||||
val expectedPayment = 500.DOLLARS
|
val expectedPayment = 500.DOLLARS
|
||||||
val expectedChange = 1500.DOLLARS
|
val expectedChange = 1500.DOLLARS
|
||||||
|
|
||||||
@ -56,7 +54,7 @@ class CashPaymentFlowTests {
|
|||||||
// Register for vault updates
|
// Register for vault updates
|
||||||
val criteria = QueryCriteria.VaultQueryCriteria(status = Vault.StateStatus.ALL)
|
val criteria = QueryCriteria.VaultQueryCriteria(status = Vault.StateStatus.ALL)
|
||||||
val (_, vaultUpdatesBoc) = bankOfCordaNode.services.vaultService.trackBy<Cash.State>(criteria)
|
val (_, vaultUpdatesBoc) = bankOfCordaNode.services.vaultService.trackBy<Cash.State>(criteria)
|
||||||
val (_, vaultUpdatesBankClient) = notaryNode.services.vaultService.trackBy<Cash.State>(criteria)
|
val (_, vaultUpdatesBankClient) = aliceNode.services.vaultService.trackBy<Cash.State>(criteria)
|
||||||
|
|
||||||
val future = bankOfCordaNode.services.startFlow(CashPaymentFlow(expectedPayment,
|
val future = bankOfCordaNode.services.startFlow(CashPaymentFlow(expectedPayment,
|
||||||
payTo)).resultFuture
|
payTo)).resultFuture
|
||||||
@ -88,7 +86,7 @@ class CashPaymentFlowTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `pay more than we have`() {
|
fun `pay more than we have`() {
|
||||||
val payTo = notaryNode.info.chooseIdentity()
|
val payTo = aliceNode.info.chooseIdentity()
|
||||||
val expected = 4000.DOLLARS
|
val expected = 4000.DOLLARS
|
||||||
val future = bankOfCordaNode.services.startFlow(CashPaymentFlow(expected,
|
val future = bankOfCordaNode.services.startFlow(CashPaymentFlow(expected,
|
||||||
payTo)).resultFuture
|
payTo)).resultFuture
|
||||||
@ -100,7 +98,7 @@ class CashPaymentFlowTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `pay zero cash`() {
|
fun `pay zero cash`() {
|
||||||
val payTo = notaryNode.info.chooseIdentity()
|
val payTo = aliceNode.info.chooseIdentity()
|
||||||
val expected = 0.DOLLARS
|
val expected = 0.DOLLARS
|
||||||
val future = bankOfCordaNode.services.startFlow(CashPaymentFlow(expected,
|
val future = bankOfCordaNode.services.startFlow(CashPaymentFlow(expected,
|
||||||
payTo)).resultFuture
|
payTo)).resultFuture
|
||||||
|
@ -82,7 +82,7 @@ internal fun CheckpointStorage.checkpoints(): List<Checkpoint> {
|
|||||||
* We assume that Alice and Bob already found each other via some market, and have agreed the details already.
|
* We assume that Alice and Bob already found each other via some market, and have agreed the details already.
|
||||||
*/
|
*/
|
||||||
@RunWith(Parameterized::class)
|
@RunWith(Parameterized::class)
|
||||||
class TwoPartyTradeFlowTests(val anonymous: Boolean) {
|
class TwoPartyTradeFlowTests(private val anonymous: Boolean) {
|
||||||
companion object {
|
companion object {
|
||||||
private val cordappPackages = listOf("com.r3.corda.enterprise.perftestcordapp.contracts")
|
private val cordappPackages = listOf("com.r3.corda.enterprise.perftestcordapp.contracts")
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@ -112,7 +112,7 @@ class TwoPartyTradeFlowTests(val anonymous: Boolean) {
|
|||||||
// 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), initialiseSerialization = false) {
|
||||||
val notaryNode = mockNet.createNotaryNode()
|
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)
|
||||||
@ -162,7 +162,7 @@ class TwoPartyTradeFlowTests(val anonymous: Boolean) {
|
|||||||
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), initialiseSerialization = false) {
|
||||||
val notaryNode = mockNet.createNotaryNode()
|
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)
|
||||||
@ -218,7 +218,7 @@ class TwoPartyTradeFlowTests(val anonymous: Boolean) {
|
|||||||
fun `shutdown and restore`() {
|
fun `shutdown and restore`() {
|
||||||
mockNet = MockNetwork(cordappPackages = cordappPackages)
|
mockNet = MockNetwork(cordappPackages = cordappPackages)
|
||||||
ledger(MockServices(cordappPackages), initialiseSerialization = false) {
|
ledger(MockServices(cordappPackages), initialiseSerialization = false) {
|
||||||
val notaryNode = mockNet.createNotaryNode()
|
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)
|
||||||
val bankNode = mockNet.createPartyNode(BOC_NAME)
|
val bankNode = mockNet.createPartyNode(BOC_NAME)
|
||||||
@ -311,15 +311,14 @@ class TwoPartyTradeFlowTests(val anonymous: Boolean) {
|
|||||||
|
|
||||||
// Creates a mock node with an overridden storage service that uses a RecordingMap, that lets us test the order
|
// Creates a mock node with an overridden storage service that uses a RecordingMap, that lets us test the order
|
||||||
// of gets and puts.
|
// of gets and puts.
|
||||||
private fun makeNodeWithTracking(name: CordaX500Name): StartedNode<MockNetwork.MockNode> {
|
private fun makeNodeWithTracking(
|
||||||
|
name: CordaX500Name): StartedNode<MockNetwork.MockNode> {
|
||||||
// Create a node in the mock network ...
|
// Create a node in the mock network ...
|
||||||
return mockNet.createNode(MockNodeParameters(legalName = name), nodeFactory = object : MockNetwork.Factory<MockNetwork.MockNode> {
|
return mockNet.createNode(MockNodeParameters(legalName = name), nodeFactory = { args ->
|
||||||
override fun create(args: MockNodeArgs): MockNetwork.MockNode {
|
object : MockNetwork.MockNode(args) {
|
||||||
return object : MockNetwork.MockNode(args) {
|
// That constructs a recording tx storage
|
||||||
// That constructs a recording tx storage
|
override fun makeTransactionStorage(): WritableTransactionStorage {
|
||||||
override fun makeTransactionStorage(): WritableTransactionStorage {
|
return RecordingTransactionStorage(database, super.makeTransactionStorage())
|
||||||
return RecordingTransactionStorage(database, super.makeTransactionStorage())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -328,7 +327,7 @@ class TwoPartyTradeFlowTests(val anonymous: Boolean) {
|
|||||||
@Test
|
@Test
|
||||||
fun `check dependencies of sale asset are resolved`() {
|
fun `check dependencies of sale asset are resolved`() {
|
||||||
mockNet = MockNetwork(cordappPackages = cordappPackages)
|
mockNet = MockNetwork(cordappPackages = cordappPackages)
|
||||||
val notaryNode = mockNet.createNotaryNode()
|
val notaryNode = mockNet.defaultNotaryNode
|
||||||
val aliceNode = makeNodeWithTracking(ALICE_NAME)
|
val aliceNode = makeNodeWithTracking(ALICE_NAME)
|
||||||
val bobNode = makeNodeWithTracking(BOB_NAME)
|
val bobNode = makeNodeWithTracking(BOB_NAME)
|
||||||
val bankNode = makeNodeWithTracking(BOC_NAME)
|
val bankNode = makeNodeWithTracking(BOC_NAME)
|
||||||
@ -434,7 +433,7 @@ class TwoPartyTradeFlowTests(val anonymous: Boolean) {
|
|||||||
@Test
|
@Test
|
||||||
fun `track works`() {
|
fun `track works`() {
|
||||||
mockNet = MockNetwork(cordappPackages = cordappPackages)
|
mockNet = MockNetwork(cordappPackages = cordappPackages)
|
||||||
val notaryNode = mockNet.createNotaryNode()
|
val notaryNode = mockNet.defaultNotaryNode
|
||||||
val aliceNode = makeNodeWithTracking(ALICE_NAME)
|
val aliceNode = makeNodeWithTracking(ALICE_NAME)
|
||||||
val bobNode = makeNodeWithTracking(BOB_NAME)
|
val bobNode = makeNodeWithTracking(BOB_NAME)
|
||||||
val bankNode = makeNodeWithTracking(BOC_NAME)
|
val bankNode = makeNodeWithTracking(BOC_NAME)
|
||||||
@ -589,7 +588,7 @@ class TwoPartyTradeFlowTests(val anonymous: Boolean) {
|
|||||||
aliceError: Boolean,
|
aliceError: Boolean,
|
||||||
expectedMessageSubstring: String
|
expectedMessageSubstring: String
|
||||||
) {
|
) {
|
||||||
val notaryNode = mockNet.createNotaryNode()
|
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)
|
||||||
@ -636,18 +635,25 @@ class TwoPartyTradeFlowTests(val anonymous: Boolean) {
|
|||||||
notaryNode: StartedNode<*>,
|
notaryNode: StartedNode<*>,
|
||||||
vararg extraSigningNodes: StartedNode<*>): Map<SecureHash, SignedTransaction> {
|
vararg extraSigningNodes: StartedNode<*>): Map<SecureHash, SignedTransaction> {
|
||||||
|
|
||||||
|
val notaryParty = notaryNode.info.legalIdentities[0]
|
||||||
val signed = wtxToSign.map {
|
val signed = wtxToSign.map {
|
||||||
val id = it.id
|
val id = it.id
|
||||||
val sigs = mutableListOf<TransactionSignature>()
|
val sigs = mutableListOf<TransactionSignature>()
|
||||||
val nodeKey = node.info.chooseIdentity().owningKey
|
val nodeKey = node.info.chooseIdentity().owningKey
|
||||||
sigs.add(node.services.keyManagementService.sign(SignableData(id, SignatureMetadata(1, Crypto.findSignatureScheme(nodeKey).schemeNumberID)), nodeKey))
|
sigs += node.services.keyManagementService.sign(
|
||||||
sigs.add(notaryNode.services.keyManagementService.sign(SignableData(id, SignatureMetadata(1,
|
SignableData(id, SignatureMetadata(1, Crypto.findSignatureScheme(nodeKey).schemeNumberID)),
|
||||||
Crypto.findSignatureScheme(notaryNode.info.legalIdentities[1].owningKey).schemeNumberID)), notaryNode.info.legalIdentities[1].owningKey))
|
nodeKey
|
||||||
|
)
|
||||||
|
sigs += notaryNode.services.keyManagementService.sign(
|
||||||
|
SignableData(id, SignatureMetadata(1, Crypto.findSignatureScheme(notaryParty.owningKey).schemeNumberID)),
|
||||||
|
notaryParty.owningKey
|
||||||
|
)
|
||||||
extraSigningNodes.forEach { currentNode ->
|
extraSigningNodes.forEach { currentNode ->
|
||||||
sigs.add(currentNode.services.keyManagementService.sign(
|
sigs += currentNode.services.keyManagementService.sign(
|
||||||
SignableData(id, SignatureMetadata(1, Crypto.findSignatureScheme(currentNode.info.chooseIdentity().owningKey).schemeNumberID)),
|
SignableData(id, SignatureMetadata(
|
||||||
|
1,
|
||||||
|
Crypto.findSignatureScheme(currentNode.info.chooseIdentity().owningKey).schemeNumberID)),
|
||||||
currentNode.info.chooseIdentity().owningKey)
|
currentNode.info.chooseIdentity().owningKey)
|
||||||
)
|
|
||||||
}
|
}
|
||||||
SignedTransaction(it, sigs)
|
SignedTransaction(it, sigs)
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ import net.corda.core.identity.CordaX500Name
|
|||||||
import net.corda.core.utilities.getOrThrow
|
import net.corda.core.utilities.getOrThrow
|
||||||
import net.corda.testing.DUMMY_BANK_A
|
import net.corda.testing.DUMMY_BANK_A
|
||||||
import net.corda.testing.DUMMY_BANK_B
|
import net.corda.testing.DUMMY_BANK_B
|
||||||
import net.corda.testing.IntegrationTestCategory
|
|
||||||
import net.corda.testing.driver.driver
|
import net.corda.testing.driver.driver
|
||||||
import net.corda.testing.http.HttpApi
|
import net.corda.testing.http.HttpApi
|
||||||
import net.corda.vega.api.PortfolioApi
|
import net.corda.vega.api.PortfolioApi
|
||||||
|
@ -19,7 +19,7 @@ include 'experimental'
|
|||||||
include 'experimental:sandbox'
|
include 'experimental:sandbox'
|
||||||
include 'experimental:quasar-hook'
|
include 'experimental:quasar-hook'
|
||||||
include 'experimental:kryo-hook'
|
include 'experimental:kryo-hook'
|
||||||
include 'experimental:intellij-plugin'
|
//include 'experimental:intellij-plugin'
|
||||||
include 'verifier'
|
include 'verifier'
|
||||||
include 'test-common'
|
include 'test-common'
|
||||||
include 'test-utils'
|
include 'test-utils'
|
||||||
|
@ -3,10 +3,10 @@ package com.r3.enclaves.txverify
|
|||||||
import net.corda.core.serialization.SerializationContext
|
import net.corda.core.serialization.SerializationContext
|
||||||
import net.corda.core.serialization.SerializationDefaults
|
import net.corda.core.serialization.SerializationDefaults
|
||||||
import net.corda.core.utilities.ByteSequence
|
import net.corda.core.utilities.ByteSequence
|
||||||
import net.corda.nodeapi.internal.serialization.AbstractKryoSerializationScheme
|
|
||||||
import net.corda.nodeapi.internal.serialization.KRYO_P2P_CONTEXT
|
import net.corda.nodeapi.internal.serialization.KRYO_P2P_CONTEXT
|
||||||
import net.corda.nodeapi.internal.serialization.KryoHeaderV0_1
|
|
||||||
import net.corda.nodeapi.internal.serialization.SerializationFactoryImpl
|
import net.corda.nodeapi.internal.serialization.SerializationFactoryImpl
|
||||||
|
import net.corda.nodeapi.internal.serialization.kryo.AbstractKryoSerializationScheme
|
||||||
|
import net.corda.nodeapi.internal.serialization.kryo.KryoHeaderV0_1
|
||||||
|
|
||||||
@Suppress("UNUSED")
|
@Suppress("UNUSED")
|
||||||
private class KryoVerifierSerializationScheme : AbstractKryoSerializationScheme() {
|
private class KryoVerifierSerializationScheme : AbstractKryoSerializationScheme() {
|
||||||
|
Loading…
Reference in New Issue
Block a user