mirror of
https://github.com/corda/corda.git
synced 2025-05-29 05:34:22 +00:00
Removed unnecessary calls to MockNetwork.runNetwork (b/c there is no more P2P node registration) and removed redundant entries in cordappPackages
This commit is contained in:
parent
4e1578c19a
commit
a4be26a296
@ -1,7 +1,6 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
<component name="ProjectRunConfigurationManager">
|
||||||
<configuration default="false" name="BankOfCordaDriverKt - Issue Web" type="JetRunConfigurationType" factoryName="Kotlin">
|
<configuration default="false" name="BankOfCordaDriverKt - Issue Web" type="JetRunConfigurationType" factoryName="Kotlin">
|
||||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||||
<extension name="krasa.grepconsole.plugin.runConfiguration.GrepRunConfigurationExtension" selectedProfileId="0" />
|
|
||||||
<option name="MAIN_CLASS_NAME" value="net.corda.bank.BankOfCordaDriverKt" />
|
<option name="MAIN_CLASS_NAME" value="net.corda.bank.BankOfCordaDriverKt" />
|
||||||
<option name="VM_PARAMETERS" value="" />
|
<option name="VM_PARAMETERS" value="" />
|
||||||
<option name="PROGRAM_PARAMETERS" value="--role ISSUE_CASH_WEB --quantity 100 --currency USD" />
|
<option name="PROGRAM_PARAMETERS" value="--role ISSUE_CASH_WEB --quantity 100 --currency USD" />
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
<component name="ProjectRunConfigurationManager">
|
||||||
<configuration default="false" name="BankOfCordaDriverKt - Run Stack" type="JetRunConfigurationType" factoryName="Kotlin">
|
<configuration default="false" name="BankOfCordaDriverKt - Run Stack" type="JetRunConfigurationType" factoryName="Kotlin">
|
||||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||||
<extension name="krasa.grepconsole.plugin.runConfiguration.GrepRunConfigurationExtension" selectedProfileId="0" />
|
|
||||||
<option name="MAIN_CLASS_NAME" value="net.corda.bank.BankOfCordaDriverKt" />
|
<option name="MAIN_CLASS_NAME" value="net.corda.bank.BankOfCordaDriverKt" />
|
||||||
<option name="VM_PARAMETERS" value="" />
|
<option name="VM_PARAMETERS" value="" />
|
||||||
<option name="PROGRAM_PARAMETERS" value="--role ISSUER" />
|
<option name="PROGRAM_PARAMETERS" value="--role ISSUER" />
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
<component name="ProjectRunConfigurationManager">
|
||||||
<configuration default="false" name="Explorer - demo nodes" type="JetRunConfigurationType" factoryName="Kotlin" singleton="true">
|
<configuration default="false" name="Explorer - demo nodes" type="JetRunConfigurationType" factoryName="Kotlin" singleton="true">
|
||||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||||
<extension name="krasa.grepconsole.plugin.runConfiguration.GrepRunConfigurationExtension" selectedProfileId="0" />
|
|
||||||
<option name="MAIN_CLASS_NAME" value="net.corda.explorer.MainKt" />
|
<option name="MAIN_CLASS_NAME" value="net.corda.explorer.MainKt" />
|
||||||
<option name="VM_PARAMETERS" value="" />
|
<option name="VM_PARAMETERS" value="" />
|
||||||
<option name="PROGRAM_PARAMETERS" value="" />
|
<option name="PROGRAM_PARAMETERS" value="" />
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
<component name="ProjectRunConfigurationManager">
|
||||||
<configuration default="false" name="Explorer - demo nodes (simulation)" type="JetRunConfigurationType" factoryName="Kotlin" singleton="true">
|
<configuration default="false" name="Explorer - demo nodes (simulation)" type="JetRunConfigurationType" factoryName="Kotlin" singleton="true">
|
||||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||||
<extension name="krasa.grepconsole.plugin.runConfiguration.GrepRunConfigurationExtension" selectedProfileId="0" />
|
|
||||||
<option name="MAIN_CLASS_NAME" value="net.corda.explorer.MainKt" />
|
<option name="MAIN_CLASS_NAME" value="net.corda.explorer.MainKt" />
|
||||||
<option name="VM_PARAMETERS" value="" />
|
<option name="VM_PARAMETERS" value="" />
|
||||||
<option name="PROGRAM_PARAMETERS" value="-S" />
|
<option name="PROGRAM_PARAMETERS" value="-S" />
|
||||||
|
@ -26,9 +26,6 @@ public class FlowsInJavaTest {
|
|||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
aliceNode = mockNet.createPartyNode(TestConstants.getALICE().getName());
|
aliceNode = mockNet.createPartyNode(TestConstants.getALICE().getName());
|
||||||
bobNode = mockNet.createPartyNode(TestConstants.getBOB().getName());
|
bobNode = mockNet.createPartyNode(TestConstants.getBOB().getName());
|
||||||
mockNet.runNetwork();
|
|
||||||
// Ensure registration was successful
|
|
||||||
aliceNode.getInternals().getNodeReadyFuture().get();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
|
@ -54,8 +54,6 @@ class AttachmentTests {
|
|||||||
val aliceNode = mockNet.createPartyNode(ALICE.name)
|
val aliceNode = mockNet.createPartyNode(ALICE.name)
|
||||||
val bobNode = mockNet.createPartyNode(BOB.name)
|
val bobNode = mockNet.createPartyNode(BOB.name)
|
||||||
|
|
||||||
// Ensure that registration was successful before progressing any further
|
|
||||||
mockNet.runNetwork()
|
|
||||||
val alice = aliceNode.info.singleIdentity()
|
val alice = aliceNode.info.singleIdentity()
|
||||||
|
|
||||||
aliceNode.internals.registerInitiatedFlow(FetchAttachmentsResponse::class.java)
|
aliceNode.internals.registerInitiatedFlow(FetchAttachmentsResponse::class.java)
|
||||||
@ -91,15 +89,11 @@ class AttachmentTests {
|
|||||||
val aliceNode = mockNet.createPartyNode(ALICE.name)
|
val aliceNode = mockNet.createPartyNode(ALICE.name)
|
||||||
val bobNode = mockNet.createPartyNode(BOB.name)
|
val bobNode = mockNet.createPartyNode(BOB.name)
|
||||||
|
|
||||||
// Ensure that registration was successful before progressing any further
|
|
||||||
mockNet.runNetwork()
|
|
||||||
|
|
||||||
aliceNode.internals.registerInitiatedFlow(FetchAttachmentsResponse::class.java)
|
aliceNode.internals.registerInitiatedFlow(FetchAttachmentsResponse::class.java)
|
||||||
bobNode.internals.registerInitiatedFlow(FetchAttachmentsResponse::class.java)
|
bobNode.internals.registerInitiatedFlow(FetchAttachmentsResponse::class.java)
|
||||||
|
|
||||||
// Get node one to fetch a non-existent attachment.
|
// Get node one to fetch a non-existent attachment.
|
||||||
val hash = SecureHash.randomSHA256()
|
val hash = SecureHash.randomSHA256()
|
||||||
mockNet.runNetwork()
|
|
||||||
val alice = aliceNode.info.singleIdentity()
|
val alice = aliceNode.info.singleIdentity()
|
||||||
val bobFlow = bobNode.startAttachmentFlow(setOf(hash), alice)
|
val bobFlow = bobNode.startAttachmentFlow(setOf(hash), alice)
|
||||||
mockNet.runNetwork()
|
mockNet.runNetwork()
|
||||||
@ -116,7 +110,6 @@ class AttachmentTests {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
val bobNode = mockNet.createNode(MockNodeParameters(legalName = BOB.name))
|
val bobNode = mockNet.createNode(MockNodeParameters(legalName = BOB.name))
|
||||||
mockNet.runNetwork()
|
|
||||||
val alice = aliceNode.services.myInfo.identityFromX500Name(ALICE_NAME)
|
val alice = aliceNode.services.myInfo.identityFromX500Name(ALICE_NAME)
|
||||||
|
|
||||||
aliceNode.internals.registerInitiatedFlow(FetchAttachmentsResponse::class.java)
|
aliceNode.internals.registerInitiatedFlow(FetchAttachmentsResponse::class.java)
|
||||||
|
@ -23,10 +23,6 @@ import kotlin.reflect.KClass
|
|||||||
import kotlin.test.assertFailsWith
|
import kotlin.test.assertFailsWith
|
||||||
|
|
||||||
class CollectSignaturesFlowTests {
|
class CollectSignaturesFlowTests {
|
||||||
companion object {
|
|
||||||
private val cordappPackages = listOf("net.corda.testing.contracts")
|
|
||||||
}
|
|
||||||
|
|
||||||
private lateinit var mockNet: MockNetwork
|
private lateinit var mockNet: MockNetwork
|
||||||
private lateinit var aliceNode: StartedNode<MockNetwork.MockNode>
|
private lateinit var aliceNode: StartedNode<MockNetwork.MockNode>
|
||||||
private lateinit var bobNode: StartedNode<MockNetwork.MockNode>
|
private lateinit var bobNode: StartedNode<MockNetwork.MockNode>
|
||||||
@ -38,11 +34,10 @@ class CollectSignaturesFlowTests {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setup() {
|
fun setup() {
|
||||||
mockNet = MockNetwork(cordappPackages = cordappPackages)
|
mockNet = MockNetwork(cordappPackages = listOf("net.corda.testing.contracts"))
|
||||||
aliceNode = mockNet.createPartyNode(ALICE.name)
|
aliceNode = mockNet.createPartyNode(ALICE.name)
|
||||||
bobNode = mockNet.createPartyNode(BOB.name)
|
bobNode = mockNet.createPartyNode(BOB.name)
|
||||||
charlieNode = mockNet.createPartyNode(CHARLIE.name)
|
charlieNode = mockNet.createPartyNode(CHARLIE.name)
|
||||||
mockNet.runNetwork()
|
|
||||||
alice = aliceNode.info.singleIdentity()
|
alice = aliceNode.info.singleIdentity()
|
||||||
bob = bobNode.info.singleIdentity()
|
bob = bobNode.info.singleIdentity()
|
||||||
charlie = charlieNode.info.singleIdentity()
|
charlie = charlieNode.info.singleIdentity()
|
||||||
@ -181,7 +176,7 @@ class CollectSignaturesFlowTests {
|
|||||||
@Test
|
@Test
|
||||||
fun `fails when not signed by initiator`() {
|
fun `fails when not signed by initiator`() {
|
||||||
val onePartyDummyContract = DummyContract.generateInitial(1337, notary, alice.ref(1))
|
val onePartyDummyContract = DummyContract.generateInitial(1337, notary, alice.ref(1))
|
||||||
val miniCorpServices = MockServices(cordappPackages, MINI_CORP_KEY)
|
val miniCorpServices = MockServices(listOf("net.corda.testing.contracts"), MINI_CORP_KEY)
|
||||||
val ptx = miniCorpServices.signInitialTransaction(onePartyDummyContract)
|
val ptx = miniCorpServices.signInitialTransaction(onePartyDummyContract)
|
||||||
val flow = aliceNode.services.startFlow(CollectSignaturesFlow(ptx, emptySet()))
|
val flow = aliceNode.services.startFlow(CollectSignaturesFlow(ptx, emptySet()))
|
||||||
mockNet.runNetwork()
|
mockNet.runNetwork()
|
||||||
|
@ -33,20 +33,16 @@ import kotlin.test.assertFailsWith
|
|||||||
import kotlin.test.assertTrue
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
class ContractUpgradeFlowTest {
|
class ContractUpgradeFlowTest {
|
||||||
lateinit var mockNet: MockNetwork
|
private lateinit var mockNet: MockNetwork
|
||||||
lateinit var aliceNode: StartedNode<MockNetwork.MockNode>
|
private lateinit var aliceNode: StartedNode<MockNetwork.MockNode>
|
||||||
lateinit var bobNode: StartedNode<MockNetwork.MockNode>
|
private lateinit var bobNode: StartedNode<MockNetwork.MockNode>
|
||||||
lateinit var notary: Party
|
private lateinit var notary: Party
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setup() {
|
fun setup() {
|
||||||
mockNet = MockNetwork(cordappPackages = listOf("net.corda.testing.contracts", "net.corda.finance.contracts.asset", "net.corda.core.flows"))
|
mockNet = MockNetwork(cordappPackages = listOf("net.corda.testing.contracts", "net.corda.finance.contracts.asset", "net.corda.core.flows"))
|
||||||
aliceNode = mockNet.createPartyNode(ALICE.name)
|
aliceNode = mockNet.createPartyNode(ALICE.name)
|
||||||
bobNode = mockNet.createPartyNode(BOB.name)
|
bobNode = mockNet.createPartyNode(BOB.name)
|
||||||
|
|
||||||
// Process registration
|
|
||||||
mockNet.runNetwork()
|
|
||||||
|
|
||||||
notary = mockNet.defaultNotaryIdentity
|
notary = mockNet.defaultNotaryIdentity
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,6 @@ class FinalityFlowTests {
|
|||||||
mockNet = MockNetwork(cordappPackages = listOf("net.corda.finance.contracts.asset"))
|
mockNet = MockNetwork(cordappPackages = listOf("net.corda.finance.contracts.asset"))
|
||||||
val aliceNode = mockNet.createPartyNode(ALICE_NAME)
|
val aliceNode = mockNet.createPartyNode(ALICE_NAME)
|
||||||
val bobNode = mockNet.createPartyNode(BOB_NAME)
|
val bobNode = mockNet.createPartyNode(BOB_NAME)
|
||||||
mockNet.runNetwork()
|
|
||||||
aliceServices = aliceNode.services
|
aliceServices = aliceNode.services
|
||||||
bobServices = bobNode.services
|
bobServices = bobNode.services
|
||||||
alice = aliceNode.info.singleIdentity()
|
alice = aliceNode.info.singleIdentity()
|
||||||
|
@ -44,7 +44,6 @@ class ResolveTransactionsFlowTest {
|
|||||||
miniCorpNode = mockNet.createPartyNode(MINI_CORP.name)
|
miniCorpNode = mockNet.createPartyNode(MINI_CORP.name)
|
||||||
megaCorpNode.internals.registerInitiatedFlow(TestResponseFlow::class.java)
|
megaCorpNode.internals.registerInitiatedFlow(TestResponseFlow::class.java)
|
||||||
miniCorpNode.internals.registerInitiatedFlow(TestResponseFlow::class.java)
|
miniCorpNode.internals.registerInitiatedFlow(TestResponseFlow::class.java)
|
||||||
mockNet.runNetwork()
|
|
||||||
notary = notaryNode.services.getDefaultNotary()
|
notary = notaryNode.services.getDefaultNotary()
|
||||||
megaCorp = megaCorpNode.info.chooseIdentity()
|
megaCorp = megaCorpNode.info.chooseIdentity()
|
||||||
miniCorp = miniCorpNode.info.chooseIdentity()
|
miniCorp = miniCorpNode.info.chooseIdentity()
|
||||||
|
@ -69,7 +69,6 @@ class AttachmentSerializationTest {
|
|||||||
server = mockNet.createNode()
|
server = mockNet.createNode()
|
||||||
client = mockNet.createNode()
|
client = mockNet.createNode()
|
||||||
client.internals.disableDBCloseOnStop() // Otherwise the in-memory database may disappear (taking the checkpoint with it) while we reboot the client.
|
client.internals.disableDBCloseOnStop() // Otherwise the in-memory database may disappear (taking the checkpoint with it) while we reboot the client.
|
||||||
mockNet.runNetwork()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
|
@ -67,10 +67,7 @@ class TutorialMockNetwork {
|
|||||||
mockNet = MockNetwork()
|
mockNet = MockNetwork()
|
||||||
nodeA = mockNet.createPartyNode()
|
nodeA = mockNet.createPartyNode()
|
||||||
nodeB = mockNet.createPartyNode()
|
nodeB = mockNet.createPartyNode()
|
||||||
|
|
||||||
nodeB.registerInitiatedFlow(FlowB::class.java)
|
nodeB.registerInitiatedFlow(FlowB::class.java)
|
||||||
|
|
||||||
mockNet.runNetwork()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
|
@ -2,13 +2,11 @@ package net.corda.docs
|
|||||||
|
|
||||||
import net.corda.core.contracts.Amount
|
import net.corda.core.contracts.Amount
|
||||||
import net.corda.core.identity.Party
|
import net.corda.core.identity.Party
|
||||||
import net.corda.core.internal.packageName
|
|
||||||
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.*
|
import net.corda.finance.*
|
||||||
import net.corda.finance.contracts.getCashBalances
|
import net.corda.finance.contracts.getCashBalances
|
||||||
import net.corda.finance.flows.CashIssueFlow
|
import net.corda.finance.flows.CashIssueFlow
|
||||||
import net.corda.finance.schemas.CashSchemaV1
|
|
||||||
import net.corda.node.internal.StartedNode
|
import net.corda.node.internal.StartedNode
|
||||||
import net.corda.testing.chooseIdentity
|
import net.corda.testing.chooseIdentity
|
||||||
import net.corda.testing.getDefaultNotary
|
import net.corda.testing.getDefaultNotary
|
||||||
@ -27,13 +25,7 @@ class CustomVaultQueryTest {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setup() {
|
fun setup() {
|
||||||
mockNet = MockNetwork(threadPerNode = true,
|
mockNet = MockNetwork(threadPerNode = true, cordappPackages = listOf("net.corda.finance", "net.corda.docs"))
|
||||||
cordappPackages = listOf(
|
|
||||||
"net.corda.finance.contracts.asset",
|
|
||||||
CashSchemaV1::class.packageName,
|
|
||||||
"net.corda.docs"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
nodeA = mockNet.createPartyNode()
|
nodeA = mockNet.createPartyNode()
|
||||||
nodeB = mockNet.createPartyNode()
|
nodeB = mockNet.createPartyNode()
|
||||||
nodeA.internals.registerInitiatedFlow(TopupIssuerFlow.TopupIssuer::class.java)
|
nodeA.internals.registerInitiatedFlow(TopupIssuerFlow.TopupIssuer::class.java)
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
package net.corda.docs
|
package net.corda.docs
|
||||||
|
|
||||||
import net.corda.core.identity.Party
|
import net.corda.core.identity.Party
|
||||||
import net.corda.core.internal.packageName
|
|
||||||
import net.corda.core.toFuture
|
import net.corda.core.toFuture
|
||||||
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.*
|
import net.corda.finance.*
|
||||||
import net.corda.finance.contracts.getCashBalances
|
import net.corda.finance.contracts.getCashBalances
|
||||||
import net.corda.finance.flows.CashIssueFlow
|
import net.corda.finance.flows.CashIssueFlow
|
||||||
import net.corda.finance.schemas.CashSchemaV1
|
|
||||||
import net.corda.node.internal.StartedNode
|
import net.corda.node.internal.StartedNode
|
||||||
import net.corda.testing.chooseIdentity
|
import net.corda.testing.chooseIdentity
|
||||||
import net.corda.testing.getDefaultNotary
|
import net.corda.testing.getDefaultNotary
|
||||||
@ -26,7 +24,7 @@ class FxTransactionBuildTutorialTest {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setup() {
|
fun setup() {
|
||||||
mockNet = MockNetwork(threadPerNode = true, cordappPackages = listOf("net.corda.finance.contracts.asset", CashSchemaV1::class.packageName))
|
mockNet = MockNetwork(threadPerNode = true, cordappPackages = listOf("net.corda.finance"))
|
||||||
nodeA = mockNet.createPartyNode()
|
nodeA = mockNet.createPartyNode()
|
||||||
nodeB = mockNet.createPartyNode()
|
nodeB = mockNet.createPartyNode()
|
||||||
nodeB.internals.registerInitiatedFlow(ForeignExchangeRemoteFlow::class.java)
|
nodeB.internals.registerInitiatedFlow(ForeignExchangeRemoteFlow::class.java)
|
||||||
|
@ -33,8 +33,6 @@ class CashExitFlowTests {
|
|||||||
cordappPackages = listOf("net.corda.finance.contracts.asset"))
|
cordappPackages = listOf("net.corda.finance.contracts.asset"))
|
||||||
bankOfCordaNode = mockNet.createPartyNode(BOC.name)
|
bankOfCordaNode = mockNet.createPartyNode(BOC.name)
|
||||||
bankOfCorda = bankOfCordaNode.info.chooseIdentity()
|
bankOfCorda = bankOfCordaNode.info.chooseIdentity()
|
||||||
|
|
||||||
mockNet.runNetwork()
|
|
||||||
notary = bankOfCordaNode.services.getDefaultNotary()
|
notary = bankOfCordaNode.services.getDefaultNotary()
|
||||||
val future = bankOfCordaNode.services.startFlow(CashIssueFlow(initialBalance, ref, notary)).resultFuture
|
val future = bankOfCordaNode.services.startFlow(CashIssueFlow(initialBalance, ref, notary)).resultFuture
|
||||||
mockNet.runNetwork()
|
mockNet.runNetwork()
|
||||||
|
@ -30,7 +30,6 @@ class CashIssueFlowTests {
|
|||||||
bankOfCordaNode = mockNet.createPartyNode(BOC.name)
|
bankOfCordaNode = mockNet.createPartyNode(BOC.name)
|
||||||
bankOfCorda = bankOfCordaNode.info.chooseIdentity()
|
bankOfCorda = bankOfCordaNode.info.chooseIdentity()
|
||||||
notary = mockNet.defaultNotaryIdentity
|
notary = mockNet.defaultNotaryIdentity
|
||||||
mockNet.runNetwork()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
|
@ -34,7 +34,6 @@ class CashPaymentFlowTests {
|
|||||||
bankOfCordaNode = mockNet.createPartyNode(BOC.name)
|
bankOfCordaNode = mockNet.createPartyNode(BOC.name)
|
||||||
aliceNode = mockNet.createPartyNode(ALICE.name)
|
aliceNode = mockNet.createPartyNode(ALICE.name)
|
||||||
bankOfCorda = bankOfCordaNode.info.chooseIdentity()
|
bankOfCorda = bankOfCordaNode.info.chooseIdentity()
|
||||||
mockNet.runNetwork()
|
|
||||||
val future = bankOfCordaNode.services.startFlow(CashIssueFlow(initialBalance, ref, mockNet.defaultNotaryIdentity)).resultFuture
|
val future = bankOfCordaNode.services.startFlow(CashIssueFlow(initialBalance, ref, mockNet.defaultNotaryIdentity)).resultFuture
|
||||||
future.getOrThrow()
|
future.getOrThrow()
|
||||||
}
|
}
|
||||||
|
@ -68,9 +68,7 @@ class TwoPartyTradeFlowTests(private val anonymous: Boolean) {
|
|||||||
private val cordappPackages = listOf("net.corda.finance.contracts")
|
private val cordappPackages = listOf("net.corda.finance.contracts")
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@Parameterized.Parameters(name = "Anonymous = {0}")
|
@Parameterized.Parameters(name = "Anonymous = {0}")
|
||||||
fun data(): Collection<Boolean> {
|
fun data(): Collection<Boolean> = listOf(true, false)
|
||||||
return listOf(true, false)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private lateinit var mockNet: MockNetwork
|
private lateinit var mockNet: MockNetwork
|
||||||
@ -419,7 +417,6 @@ 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()
|
|
||||||
val notary = aliceNode.services.getDefaultNotary()
|
val notary = aliceNode.services.getDefaultNotary()
|
||||||
val alice: Party = aliceNode.info.singleIdentity()
|
val alice: Party = aliceNode.info.singleIdentity()
|
||||||
val bank: Party = bankNode.info.singleIdentity()
|
val bank: Party = bankNode.info.singleIdentity()
|
||||||
@ -450,8 +447,6 @@ class TwoPartyTradeFlowTests(private val anonymous: Boolean) {
|
|||||||
|
|
||||||
insertFakeTransactions(alicesFakePaper, aliceNode, notaryNode, bankNode)
|
insertFakeTransactions(alicesFakePaper, aliceNode, notaryNode, bankNode)
|
||||||
|
|
||||||
mockNet.runNetwork() // Clear network map registration messages
|
|
||||||
|
|
||||||
val aliceTxStream = aliceNode.services.validatedTransactions.track().updates
|
val aliceTxStream = aliceNode.services.validatedTransactions.track().updates
|
||||||
val aliceTxMappings = with(aliceNode) {
|
val aliceTxMappings = with(aliceNode) {
|
||||||
database.transaction { services.stateMachineRecordedTransactionMapping.track().updates }
|
database.transaction { services.stateMachineRecordedTransactionMapping.track().updates }
|
||||||
@ -574,7 +569,6 @@ class TwoPartyTradeFlowTests(private val anonymous: Boolean) {
|
|||||||
val bobNode = mockNet.createPartyNode(BOB_NAME)
|
val bobNode = mockNet.createPartyNode(BOB_NAME)
|
||||||
val bankNode = mockNet.createPartyNode(BOC_NAME)
|
val bankNode = mockNet.createPartyNode(BOC_NAME)
|
||||||
|
|
||||||
mockNet.runNetwork()
|
|
||||||
val notary = aliceNode.services.getDefaultNotary()
|
val notary = aliceNode.services.getDefaultNotary()
|
||||||
val alice = aliceNode.info.singleIdentity()
|
val alice = aliceNode.info.singleIdentity()
|
||||||
val bob = bobNode.info.singleIdentity()
|
val bob = bobNode.info.singleIdentity()
|
||||||
@ -591,8 +585,6 @@ class TwoPartyTradeFlowTests(private val anonymous: Boolean) {
|
|||||||
insertFakeTransactions(bobsBadCash, bobNode, notaryNode, bankNode)
|
insertFakeTransactions(bobsBadCash, bobNode, notaryNode, bankNode)
|
||||||
insertFakeTransactions(alicesFakePaper, aliceNode, notaryNode, bankNode)
|
insertFakeTransactions(alicesFakePaper, aliceNode, notaryNode, bankNode)
|
||||||
|
|
||||||
mockNet.runNetwork() // Clear network map registration messages
|
|
||||||
|
|
||||||
val (bobStateMachine, aliceResult) = runBuyerAndSeller(notary, aliceNode, bobNode, "alice's paper".outputStateAndRef())
|
val (bobStateMachine, aliceResult) = runBuyerAndSeller(notary, aliceNode, bobNode, "alice's paper".outputStateAndRef())
|
||||||
|
|
||||||
mockNet.runNetwork()
|
mockNet.runNetwork()
|
||||||
|
@ -44,7 +44,6 @@ class NotaryChangeTests {
|
|||||||
clientNodeA = mockNet.createNode()
|
clientNodeA = mockNet.createNode()
|
||||||
clientNodeB = mockNet.createNode()
|
clientNodeB = mockNet.createNode()
|
||||||
oldNotaryNode = mockNet.notaryNodes[1]
|
oldNotaryNode = mockNet.notaryNodes[1]
|
||||||
mockNet.runNetwork() // Clear network map registration messages
|
|
||||||
newNotaryParty = clientNodeA.services.networkMapCache.getNotary(DUMMY_NOTARY.name)!!
|
newNotaryParty = clientNodeA.services.networkMapCache.getNotary(DUMMY_NOTARY.name)!!
|
||||||
oldNotaryParty = clientNodeA.services.networkMapCache.getNotary(oldNotaryName)!!
|
oldNotaryParty = clientNodeA.services.networkMapCache.getNotary(oldNotaryName)!!
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ import java.math.BigInteger
|
|||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
|
|
||||||
class NetworkMapCacheTest {
|
class NetworkMapCacheTest {
|
||||||
val mockNet: MockNetwork = MockNetwork()
|
private val mockNet = MockNetwork()
|
||||||
|
|
||||||
@After
|
@After
|
||||||
fun teardown() {
|
fun teardown() {
|
||||||
@ -24,7 +24,6 @@ class NetworkMapCacheTest {
|
|||||||
fun `key collision`() {
|
fun `key collision`() {
|
||||||
val entropy = BigInteger.valueOf(24012017L)
|
val entropy = BigInteger.valueOf(24012017L)
|
||||||
val aliceNode = mockNet.createNode(MockNodeParameters(legalName = ALICE.name, entropyRoot = entropy))
|
val aliceNode = mockNet.createNode(MockNodeParameters(legalName = ALICE.name, entropyRoot = entropy))
|
||||||
mockNet.runNetwork()
|
|
||||||
|
|
||||||
// Node A currently knows only about itself, so this returns node A
|
// Node A currently knows only about itself, so this returns node A
|
||||||
assertEquals(aliceNode.services.networkMapCache.getNodesByLegalIdentityKey(aliceNode.info.chooseIdentity().owningKey).singleOrNull(), aliceNode.info)
|
assertEquals(aliceNode.services.networkMapCache.getNodesByLegalIdentityKey(aliceNode.info.chooseIdentity().owningKey).singleOrNull(), aliceNode.info)
|
||||||
@ -43,7 +42,6 @@ class NetworkMapCacheTest {
|
|||||||
val bobCache: NetworkMapCache = bobNode.services.networkMapCache
|
val bobCache: NetworkMapCache = bobNode.services.networkMapCache
|
||||||
val expected = aliceNode.info
|
val expected = aliceNode.info
|
||||||
|
|
||||||
mockNet.runNetwork()
|
|
||||||
val actual = bobNode.database.transaction { bobCache.getNodeByLegalIdentity(aliceNode.info.chooseIdentity()) }
|
val actual = bobNode.database.transaction { bobCache.getNodeByLegalIdentity(aliceNode.info.chooseIdentity()) }
|
||||||
assertEquals(expected, actual)
|
assertEquals(expected, actual)
|
||||||
|
|
||||||
@ -57,7 +55,6 @@ class NetworkMapCacheTest {
|
|||||||
val bobCache: NetworkMapCache = bobNode.services.networkMapCache
|
val bobCache: NetworkMapCache = bobNode.services.networkMapCache
|
||||||
val expected = aliceNode.info.legalIdentities.single()
|
val expected = aliceNode.info.legalIdentities.single()
|
||||||
|
|
||||||
mockNet.runNetwork()
|
|
||||||
val actual = bobNode.database.transaction { bobCache.getPeerByLegalName(ALICE.name) }
|
val actual = bobNode.database.transaction { bobCache.getPeerByLegalName(ALICE.name) }
|
||||||
assertEquals(expected, actual)
|
assertEquals(expected, actual)
|
||||||
}
|
}
|
||||||
@ -69,7 +66,6 @@ class NetworkMapCacheTest {
|
|||||||
val bobLegalIdentity = bobNode.info.chooseIdentity()
|
val bobLegalIdentity = bobNode.info.chooseIdentity()
|
||||||
val alice = aliceNode.info.chooseIdentity()
|
val alice = aliceNode.info.chooseIdentity()
|
||||||
val bobCache = bobNode.services.networkMapCache
|
val bobCache = bobNode.services.networkMapCache
|
||||||
mockNet.runNetwork()
|
|
||||||
bobNode.database.transaction {
|
bobNode.database.transaction {
|
||||||
assertThat(bobCache.getNodeByLegalIdentity(alice) != null)
|
assertThat(bobCache.getNodeByLegalIdentity(alice) != null)
|
||||||
bobCache.removeNode(aliceNode.info)
|
bobCache.removeNode(aliceNode.info)
|
||||||
|
@ -28,7 +28,6 @@ class NodeSchemaServiceTest {
|
|||||||
fun `registering custom schemas for testing with MockNode`() {
|
fun `registering custom schemas for testing with MockNode`() {
|
||||||
val mockNet = MockNetwork(cordappPackages = listOf(DummyLinearStateSchemaV1::class.packageName))
|
val mockNet = MockNetwork(cordappPackages = listOf(DummyLinearStateSchemaV1::class.packageName))
|
||||||
val mockNode = mockNet.createNode()
|
val mockNode = mockNet.createNode()
|
||||||
mockNet.runNetwork()
|
|
||||||
val schemaService = mockNode.services.schemaService
|
val schemaService = mockNode.services.schemaService
|
||||||
assertTrue(schemaService.schemaOptions.containsKey(DummyLinearStateSchemaV1))
|
assertTrue(schemaService.schemaOptions.containsKey(DummyLinearStateSchemaV1))
|
||||||
|
|
||||||
|
@ -209,7 +209,6 @@ class FlowFrameworkTests {
|
|||||||
@Test
|
@Test
|
||||||
fun `sending to multiple parties`() {
|
fun `sending to multiple parties`() {
|
||||||
val charlieNode = mockNet.createNode(MockNodeParameters(legalName = CHARLIE_NAME))
|
val charlieNode = mockNet.createNode(MockNodeParameters(legalName = CHARLIE_NAME))
|
||||||
mockNet.runNetwork()
|
|
||||||
val charlie = charlieNode.info.singleIdentity()
|
val charlie = charlieNode.info.singleIdentity()
|
||||||
bobNode.registerFlowFactory(SendFlow::class) { InitiatedReceiveFlow(it).nonTerminating() }
|
bobNode.registerFlowFactory(SendFlow::class) { InitiatedReceiveFlow(it).nonTerminating() }
|
||||||
charlieNode.registerFlowFactory(SendFlow::class) { InitiatedReceiveFlow(it).nonTerminating() }
|
charlieNode.registerFlowFactory(SendFlow::class) { InitiatedReceiveFlow(it).nonTerminating() }
|
||||||
@ -242,7 +241,6 @@ class FlowFrameworkTests {
|
|||||||
@Test
|
@Test
|
||||||
fun `receiving from multiple parties`() {
|
fun `receiving from multiple parties`() {
|
||||||
val charlieNode = mockNet.createNode(MockNodeParameters(legalName = CHARLIE_NAME))
|
val charlieNode = mockNet.createNode(MockNodeParameters(legalName = CHARLIE_NAME))
|
||||||
mockNet.runNetwork()
|
|
||||||
val charlie = charlieNode.info.singleIdentity()
|
val charlie = charlieNode.info.singleIdentity()
|
||||||
val bobPayload = "Test 1"
|
val bobPayload = "Test 1"
|
||||||
val charliePayload = "Test 2"
|
val charliePayload = "Test 2"
|
||||||
@ -396,7 +394,6 @@ class FlowFrameworkTests {
|
|||||||
@Test
|
@Test
|
||||||
fun `FlowException propagated in invocation chain`() {
|
fun `FlowException propagated in invocation chain`() {
|
||||||
val charlieNode = mockNet.createNode(MockNodeParameters(legalName = CHARLIE_NAME))
|
val charlieNode = mockNet.createNode(MockNodeParameters(legalName = CHARLIE_NAME))
|
||||||
mockNet.runNetwork()
|
|
||||||
val charlie = charlieNode.info.singleIdentity()
|
val charlie = charlieNode.info.singleIdentity()
|
||||||
|
|
||||||
charlieNode.registerFlowFactory(ReceiveFlow::class) { ExceptionFlow { MyFlowException("Chain") } }
|
charlieNode.registerFlowFactory(ReceiveFlow::class) { ExceptionFlow { MyFlowException("Chain") } }
|
||||||
@ -411,7 +408,6 @@ class FlowFrameworkTests {
|
|||||||
@Test
|
@Test
|
||||||
fun `FlowException thrown and there is a 3rd unrelated party flow`() {
|
fun `FlowException thrown and there is a 3rd unrelated party flow`() {
|
||||||
val charlieNode = mockNet.createNode(MockNodeParameters(legalName = CHARLIE_NAME))
|
val charlieNode = mockNet.createNode(MockNodeParameters(legalName = CHARLIE_NAME))
|
||||||
mockNet.runNetwork()
|
|
||||||
val charlie = charlieNode.info.singleIdentity()
|
val charlie = charlieNode.info.singleIdentity()
|
||||||
|
|
||||||
// Bob will send its payload and then block waiting for the receive from Alice. Meanwhile Alice will move
|
// Bob will send its payload and then block waiting for the receive from Alice. Meanwhile Alice will move
|
||||||
@ -662,7 +658,7 @@ class FlowFrameworkTests {
|
|||||||
val newNode = mockNet.createNode(MockNodeParameters(id))
|
val newNode = mockNet.createNode(MockNodeParameters(id))
|
||||||
newNode.internals.acceptableLiveFiberCountOnStop = 1
|
newNode.internals.acceptableLiveFiberCountOnStop = 1
|
||||||
manuallyCloseDB()
|
manuallyCloseDB()
|
||||||
mockNet.runNetwork() // allow NetworkMapService messages to stabilise and thus start the state machine
|
mockNet.runNetwork()
|
||||||
newNode.getSingleFlow<P>().first
|
newNode.getSingleFlow<P>().first
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,6 @@ class NotaryServiceTests {
|
|||||||
fun setup() {
|
fun setup() {
|
||||||
mockNet = MockNetwork(cordappPackages = listOf("net.corda.testing.contracts"))
|
mockNet = MockNetwork(cordappPackages = listOf("net.corda.testing.contracts"))
|
||||||
aliceServices = mockNet.createNode(MockNodeParameters(legalName = ALICE_NAME)).services
|
aliceServices = mockNet.createNode(MockNodeParameters(legalName = ALICE_NAME)).services
|
||||||
mockNet.runNetwork() // Clear network map registration messages
|
|
||||||
notaryServices = mockNet.defaultNotaryNode.services //TODO get rid of that
|
notaryServices = mockNet.defaultNotaryNode.services //TODO get rid of that
|
||||||
notary = aliceServices.getDefaultNotary()
|
notary = aliceServices.getDefaultNotary()
|
||||||
alice = aliceServices.myInfo.singleIdentity()
|
alice = aliceServices.myInfo.singleIdentity()
|
||||||
|
@ -41,7 +41,6 @@ class ValidatingNotaryServiceTests {
|
|||||||
fun setup() {
|
fun setup() {
|
||||||
mockNet = MockNetwork(cordappPackages = listOf("net.corda.testing.contracts"))
|
mockNet = MockNetwork(cordappPackages = listOf("net.corda.testing.contracts"))
|
||||||
val aliceNode = mockNet.createNode(MockNodeParameters(legalName = ALICE_NAME))
|
val aliceNode = mockNet.createNode(MockNodeParameters(legalName = ALICE_NAME))
|
||||||
mockNet.runNetwork() // Clear network map registration messages
|
|
||||||
notaryServices = mockNet.defaultNotaryNode.services
|
notaryServices = mockNet.defaultNotaryNode.services
|
||||||
aliceServices = aliceNode.services
|
aliceServices = aliceNode.services
|
||||||
notary = mockNet.defaultNotaryIdentity
|
notary = mockNet.defaultNotaryIdentity
|
||||||
|
@ -69,7 +69,7 @@ abstract class Simulation(val networkSendManuallyPumped: Boolean,
|
|||||||
val mockNet = MockNetwork(
|
val mockNet = MockNetwork(
|
||||||
networkSendManuallyPumped = networkSendManuallyPumped,
|
networkSendManuallyPumped = networkSendManuallyPumped,
|
||||||
threadPerNode = runAsync,
|
threadPerNode = runAsync,
|
||||||
cordappPackages = listOf("net.corda.irs.contract", "net.corda.finance.contract", "net.corda.irs"))
|
cordappPackages = listOf("net.corda.finance.contract", "net.corda.irs"))
|
||||||
// TODO: Regulatory nodes don't actually exist properly, this is a last minute demo request.
|
// TODO: Regulatory nodes don't actually exist properly, this is a last minute demo request.
|
||||||
// So we just fire a message at a node that doesn't know how to handle it, and it'll ignore it.
|
// So we just fire a message at a node that doesn't know how to handle it, and it'll ignore it.
|
||||||
// But that's fine for visualisation purposes.
|
// But that's fine for visualisation purposes.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user