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:
Andrzej Cichocki
2017-06-05 14:00:14 +01:00
committed by GitHub
parent e5fba5d0af
commit 101e96d8d7
38 changed files with 353 additions and 354 deletions

View File

@ -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

View File

@ -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

View File

@ -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