mirror of
https://github.com/corda/corda.git
synced 2025-06-23 17:53:31 +00:00
Rename net to network (#773)
* So net no longer interferes with IntelliJ auto-import of net.* packages * Use mockNet for MockNetwork to avoid clashing with Node network
This commit is contained in:
@ -18,28 +18,28 @@ import org.junit.Test
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
class FxTransactionBuildTutorialTest {
|
||||
lateinit var net: MockNetwork
|
||||
lateinit var mockNet: MockNetwork
|
||||
lateinit var notaryNode: MockNetwork.MockNode
|
||||
lateinit var nodeA: MockNetwork.MockNode
|
||||
lateinit var nodeB: MockNetwork.MockNode
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
net = MockNetwork(threadPerNode = true)
|
||||
mockNet = MockNetwork(threadPerNode = true)
|
||||
val notaryService = ServiceInfo(ValidatingNotaryService.type)
|
||||
notaryNode = net.createNode(
|
||||
notaryNode = mockNet.createNode(
|
||||
legalName = DUMMY_NOTARY.name,
|
||||
overrideServices = mapOf(notaryService to DUMMY_NOTARY_KEY),
|
||||
advertisedServices = *arrayOf(ServiceInfo(NetworkMapService.type), notaryService))
|
||||
nodeA = net.createPartyNode(notaryNode.info.address)
|
||||
nodeB = net.createPartyNode(notaryNode.info.address)
|
||||
nodeA = mockNet.createPartyNode(notaryNode.info.address)
|
||||
nodeB = mockNet.createPartyNode(notaryNode.info.address)
|
||||
nodeB.registerInitiatedFlow(ForeignExchangeRemoteFlow::class.java)
|
||||
}
|
||||
|
||||
@After
|
||||
fun cleanUp() {
|
||||
println("Close DB")
|
||||
net.stopNodes()
|
||||
mockNet.stopNodes()
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -20,7 +20,7 @@ import org.junit.Test
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
class WorkflowTransactionBuildTutorialTest {
|
||||
lateinit var net: MockNetwork
|
||||
lateinit var mockNet: MockNetwork
|
||||
lateinit var notaryNode: MockNetwork.MockNode
|
||||
lateinit var nodeA: MockNetwork.MockNode
|
||||
lateinit var nodeB: MockNetwork.MockNode
|
||||
@ -34,21 +34,21 @@ class WorkflowTransactionBuildTutorialTest {
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
net = MockNetwork(threadPerNode = true)
|
||||
mockNet = MockNetwork(threadPerNode = true)
|
||||
val notaryService = ServiceInfo(ValidatingNotaryService.type)
|
||||
notaryNode = net.createNode(
|
||||
notaryNode = mockNet.createNode(
|
||||
legalName = DUMMY_NOTARY.name,
|
||||
overrideServices = mapOf(Pair(notaryService, DUMMY_NOTARY_KEY)),
|
||||
advertisedServices = *arrayOf(ServiceInfo(NetworkMapService.type), notaryService))
|
||||
nodeA = net.createPartyNode(notaryNode.info.address)
|
||||
nodeB = net.createPartyNode(notaryNode.info.address)
|
||||
nodeA = mockNet.createPartyNode(notaryNode.info.address)
|
||||
nodeB = mockNet.createPartyNode(notaryNode.info.address)
|
||||
nodeA.registerInitiatedFlow(RecordCompletionFlow::class.java)
|
||||
}
|
||||
|
||||
@After
|
||||
fun cleanUp() {
|
||||
println("Close DB")
|
||||
net.stopNodes()
|
||||
mockNet.stopNodes()
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -20,24 +20,24 @@ with this basic skeleton:
|
||||
.. sourcecode:: kotlin
|
||||
|
||||
class ResolveTransactionsFlowTest {
|
||||
lateinit var net: MockNetwork
|
||||
lateinit var mockNet: MockNetwork
|
||||
lateinit var a: MockNetwork.MockNode
|
||||
lateinit var b: MockNetwork.MockNode
|
||||
lateinit var notary: Party
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
net = MockNetwork()
|
||||
val nodes = net.createSomeNodes()
|
||||
mockNet = MockNetwork()
|
||||
val nodes = mockNet.createSomeNodes()
|
||||
a = nodes.partyNodes[0]
|
||||
b = nodes.partyNodes[1]
|
||||
notary = nodes.notaryNode.info.notaryIdentity
|
||||
net.runNetwork()
|
||||
mockNet.runNetwork()
|
||||
}
|
||||
|
||||
@After
|
||||
fun tearDown() {
|
||||
net.stopNodes()
|
||||
mockNet.stopNodes()
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ We'll take a look at the ``makeTransactions`` function in a moment. For now, it'
|
||||
but not node B.
|
||||
|
||||
The test logic is simple enough: we create the flow, giving it node A's identity as the target to talk to.
|
||||
Then we start it on node B and use the ``net.runNetwork()`` method to bounce messages around until things have
|
||||
Then we start it on node B and use the ``mockNet.runNetwork()`` method to bounce messages around until things have
|
||||
settled (i.e. there are no more messages waiting to be delivered). All this is done using an in memory message
|
||||
routing implementation that is fast to initialise and use. Finally, we obtain the result of the flow and do
|
||||
some tests on it. We also check the contents of node B's database to see that the flow had the intended effect
|
||||
|
Reference in New Issue
Block a user