mirror of
https://github.com/corda/corda.git
synced 2025-03-03 21:00:56 +00:00
Standardise identities used in tests, demos, etc.
Standaridise the identity names of Alice, Bob and Charlie, notary, map service, etc. in order to ensure consistency across the code base and reduce number of places that have to be changed to introduce proper X.500 names. Move Alice, Bob & Charlie identities into the utilities package so they can be used in demos
This commit is contained in:
parent
ea1bbd6baf
commit
d35bd74596
@ -20,6 +20,10 @@ import net.corda.core.node.services.StateMachineTransactionMapping
|
|||||||
import net.corda.core.node.services.Vault
|
import net.corda.core.node.services.Vault
|
||||||
import net.corda.core.serialization.OpaqueBytes
|
import net.corda.core.serialization.OpaqueBytes
|
||||||
import net.corda.core.transactions.SignedTransaction
|
import net.corda.core.transactions.SignedTransaction
|
||||||
|
import net.corda.core.utilities.ALICE
|
||||||
|
import net.corda.core.utilities.BOB
|
||||||
|
import net.corda.core.utilities.CHARLIE
|
||||||
|
import net.corda.core.utilities.DUMMY_NOTARY
|
||||||
import net.corda.flows.CashExitFlow
|
import net.corda.flows.CashExitFlow
|
||||||
import net.corda.flows.CashIssueFlow
|
import net.corda.flows.CashIssueFlow
|
||||||
import net.corda.flows.CashPaymentFlow
|
import net.corda.flows.CashPaymentFlow
|
||||||
@ -54,8 +58,8 @@ class NodeMonitorModelTest : DriverBasedTest() {
|
|||||||
startFlowPermission<CashPaymentFlow>(),
|
startFlowPermission<CashPaymentFlow>(),
|
||||||
startFlowPermission<CashExitFlow>())
|
startFlowPermission<CashExitFlow>())
|
||||||
)
|
)
|
||||||
val aliceNodeFuture = startNode("Alice", rpcUsers = listOf(cashUser))
|
val aliceNodeFuture = startNode(ALICE.name, rpcUsers = listOf(cashUser))
|
||||||
val notaryNodeFuture = startNode("Notary", advertisedServices = setOf(ServiceInfo(SimpleNotaryService.type)))
|
val notaryNodeFuture = startNode(DUMMY_NOTARY.name, advertisedServices = setOf(ServiceInfo(SimpleNotaryService.type)))
|
||||||
val aliceNodeHandle = aliceNodeFuture.getOrThrow()
|
val aliceNodeHandle = aliceNodeFuture.getOrThrow()
|
||||||
val notaryNodeHandle = notaryNodeFuture.getOrThrow()
|
val notaryNodeHandle = notaryNodeFuture.getOrThrow()
|
||||||
aliceNode = aliceNodeHandle.nodeInfo
|
aliceNode = aliceNodeHandle.nodeInfo
|
||||||
@ -77,21 +81,21 @@ class NodeMonitorModelTest : DriverBasedTest() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `network map update`() {
|
fun `network map update`() {
|
||||||
newNode("Bob")
|
newNode(BOB.name)
|
||||||
newNode("Charlie")
|
newNode(CHARLIE.name)
|
||||||
networkMapUpdates.filter { !it.node.advertisedServices.any { it.info.type.isNotary() } }
|
networkMapUpdates.filter { !it.node.advertisedServices.any { it.info.type.isNotary() } }
|
||||||
.filter { !it.node.advertisedServices.any { it.info.type == NetworkMapService.type } }
|
.filter { !it.node.advertisedServices.any { it.info.type == NetworkMapService.type } }
|
||||||
.expectEvents(isStrict = false) {
|
.expectEvents(isStrict = false) {
|
||||||
sequence(
|
sequence(
|
||||||
// TODO : Add test for remove when driver DSL support individual node shutdown.
|
// TODO : Add test for remove when driver DSL support individual node shutdown.
|
||||||
expect { output: NetworkMapCache.MapChange ->
|
expect { output: NetworkMapCache.MapChange ->
|
||||||
require(output.node.legalIdentity.name == "Alice") { "Expecting : Alice, Actual : ${output.node.legalIdentity.name}" }
|
require(output.node.legalIdentity.name == ALICE.name) { "Expecting : ${ALICE.name}, Actual : ${output.node.legalIdentity.name}" }
|
||||||
},
|
},
|
||||||
expect { output: NetworkMapCache.MapChange ->
|
expect { output: NetworkMapCache.MapChange ->
|
||||||
require(output.node.legalIdentity.name == "Bob") { "Expecting : Bob, Actual : ${output.node.legalIdentity.name}" }
|
require(output.node.legalIdentity.name == BOB.name) { "Expecting : ${BOB.name}, Actual : ${output.node.legalIdentity.name}" }
|
||||||
},
|
},
|
||||||
expect { output: NetworkMapCache.MapChange ->
|
expect { output: NetworkMapCache.MapChange ->
|
||||||
require(output.node.legalIdentity.name == "Charlie") { "Expecting : Charlie, Actual : ${output.node.legalIdentity.name}" }
|
require(output.node.legalIdentity.name == CHARLIE.name) { "Expecting : ${CHARLIE.name}, Actual : ${output.node.legalIdentity.name}" }
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import net.corda.core.messaging.startFlow
|
|||||||
import net.corda.core.node.services.ServiceInfo
|
import net.corda.core.node.services.ServiceInfo
|
||||||
import net.corda.core.random63BitValue
|
import net.corda.core.random63BitValue
|
||||||
import net.corda.core.serialization.OpaqueBytes
|
import net.corda.core.serialization.OpaqueBytes
|
||||||
|
import net.corda.core.utilities.ALICE
|
||||||
import net.corda.flows.CashIssueFlow
|
import net.corda.flows.CashIssueFlow
|
||||||
import net.corda.flows.CashPaymentFlow
|
import net.corda.flows.CashPaymentFlow
|
||||||
import net.corda.node.internal.Node
|
import net.corda.node.internal.Node
|
||||||
@ -33,7 +34,7 @@ class CordaRPCClientTest : NodeBasedTest() {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setUp() {
|
fun setUp() {
|
||||||
node = startNode("Alice", rpcUsers = listOf(rpcUser), advertisedServices = setOf(ServiceInfo(ValidatingNotaryService.type))).getOrThrow()
|
node = startNode(ALICE.name, rpcUsers = listOf(rpcUser), advertisedServices = setOf(ServiceInfo(ValidatingNotaryService.type))).getOrThrow()
|
||||||
client = CordaRPCClient(node.configuration.rpcAddress!!)
|
client = CordaRPCClient(node.configuration.rpcAddress!!)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,4 +18,35 @@ val DUMMY_KEY_1: KeyPair by lazy { generateKeyPair() }
|
|||||||
val DUMMY_KEY_2: KeyPair by lazy { generateKeyPair() }
|
val DUMMY_KEY_2: KeyPair by lazy { generateKeyPair() }
|
||||||
|
|
||||||
val DUMMY_NOTARY_KEY: KeyPair by lazy { entropyToKeyPair(BigInteger.valueOf(20)) }
|
val DUMMY_NOTARY_KEY: KeyPair by lazy { entropyToKeyPair(BigInteger.valueOf(20)) }
|
||||||
|
/** Dummy notary identity for tests and simulations */
|
||||||
val DUMMY_NOTARY: Party get() = Party("Notary Service", DUMMY_NOTARY_KEY.public)
|
val DUMMY_NOTARY: Party get() = Party("Notary Service", DUMMY_NOTARY_KEY.public)
|
||||||
|
|
||||||
|
val DUMMY_MAP_KEY: KeyPair by lazy { entropyToKeyPair(BigInteger.valueOf(30)) }
|
||||||
|
/** Dummy network map service identity for tests and simulations */
|
||||||
|
val DUMMY_MAP: Party get() = Party("Network Map Service", DUMMY_MAP_KEY.public)
|
||||||
|
|
||||||
|
val DUMMY_BANK_A_KEY: KeyPair by lazy { entropyToKeyPair(BigInteger.valueOf(40)) }
|
||||||
|
/** Dummy bank identity for tests and simulations */
|
||||||
|
val DUMMY_BANK_A: Party get() = Party("Bank A", DUMMY_BANK_A_KEY.public)
|
||||||
|
|
||||||
|
val DUMMY_BANK_B_KEY: KeyPair by lazy { entropyToKeyPair(BigInteger.valueOf(50)) }
|
||||||
|
/** Dummy bank identity for tests and simulations */
|
||||||
|
val DUMMY_BANK_B: Party get() = Party("Bank B", DUMMY_BANK_B_KEY.public)
|
||||||
|
|
||||||
|
val DUMMY_BANK_C_KEY: KeyPair by lazy { entropyToKeyPair(BigInteger.valueOf(60)) }
|
||||||
|
/** Dummy bank identity for tests and simulations */
|
||||||
|
val DUMMY_BANK_C: Party get() = Party("Bank C", DUMMY_BANK_C_KEY.public)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val ALICE_KEY: KeyPair by lazy { entropyToKeyPair(BigInteger.valueOf(70)) }
|
||||||
|
/** Dummy individual identity for tests and simulations */
|
||||||
|
val ALICE: Party get() = Party("Alice", ALICE_KEY.public)
|
||||||
|
|
||||||
|
val BOB_KEY: KeyPair by lazy { entropyToKeyPair(BigInteger.valueOf(80)) }
|
||||||
|
/** Dummy individual identity for tests and simulations */
|
||||||
|
val BOB: Party get() = Party("Bob", BOB_KEY.public)
|
||||||
|
|
||||||
|
val CHARLIE_KEY: KeyPair by lazy { entropyToKeyPair(BigInteger.valueOf(90)) }
|
||||||
|
/** Dummy individual identity for tests and simulations */
|
||||||
|
val CHARLIE: Party get() = Party("Charlie", BOB_KEY.public)
|
@ -10,13 +10,13 @@ import net.corda.core.serialization.SerializedBytes
|
|||||||
import net.corda.core.transactions.LedgerTransaction
|
import net.corda.core.transactions.LedgerTransaction
|
||||||
import net.corda.core.transactions.SignedTransaction
|
import net.corda.core.transactions.SignedTransaction
|
||||||
import net.corda.core.transactions.WireTransaction
|
import net.corda.core.transactions.WireTransaction
|
||||||
|
import net.corda.core.utilities.ALICE
|
||||||
|
import net.corda.core.utilities.BOB
|
||||||
import net.corda.core.utilities.DUMMY_KEY_1
|
import net.corda.core.utilities.DUMMY_KEY_1
|
||||||
import net.corda.core.utilities.DUMMY_KEY_2
|
import net.corda.core.utilities.DUMMY_KEY_2
|
||||||
import net.corda.core.utilities.DUMMY_NOTARY
|
import net.corda.core.utilities.DUMMY_NOTARY
|
||||||
import net.corda.core.utilities.DUMMY_NOTARY_KEY
|
import net.corda.core.utilities.DUMMY_NOTARY_KEY
|
||||||
import net.corda.testing.ALICE
|
|
||||||
import net.corda.testing.ALICE_PUBKEY
|
import net.corda.testing.ALICE_PUBKEY
|
||||||
import net.corda.testing.BOB
|
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import java.security.KeyPair
|
import java.security.KeyPair
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package net.corda.core.flows
|
package net.corda.core.flows
|
||||||
|
|
||||||
import net.corda.core.crypto.Party
|
import net.corda.core.crypto.Party
|
||||||
|
import net.corda.core.utilities.ALICE
|
||||||
|
import net.corda.core.utilities.BOB
|
||||||
import net.corda.core.utilities.DUMMY_NOTARY
|
import net.corda.core.utilities.DUMMY_NOTARY
|
||||||
import net.corda.testing.ALICE
|
|
||||||
import net.corda.testing.BOB
|
|
||||||
import net.corda.testing.MOCK_IDENTITY_SERVICE
|
import net.corda.testing.MOCK_IDENTITY_SERVICE
|
||||||
import net.corda.testing.node.MockNetwork
|
import net.corda.testing.node.MockNetwork
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
|
@ -9,16 +9,16 @@ import net.corda.core.messaging.startFlow
|
|||||||
import net.corda.core.node.services.ServiceInfo
|
import net.corda.core.node.services.ServiceInfo
|
||||||
import net.corda.core.node.services.Vault
|
import net.corda.core.node.services.Vault
|
||||||
import net.corda.core.serialization.OpaqueBytes
|
import net.corda.core.serialization.OpaqueBytes
|
||||||
|
import net.corda.core.utilities.ALICE
|
||||||
|
import net.corda.core.utilities.BOB
|
||||||
|
import net.corda.core.utilities.DUMMY_NOTARY
|
||||||
import net.corda.flows.CashIssueFlow
|
import net.corda.flows.CashIssueFlow
|
||||||
import net.corda.flows.CashPaymentFlow
|
import net.corda.flows.CashPaymentFlow
|
||||||
import net.corda.node.driver.driver
|
import net.corda.node.driver.driver
|
||||||
import net.corda.node.services.startFlowPermission
|
import net.corda.node.services.startFlowPermission
|
||||||
import net.corda.node.services.transactions.ValidatingNotaryService
|
import net.corda.node.services.transactions.ValidatingNotaryService
|
||||||
import net.corda.nodeapi.User
|
import net.corda.nodeapi.User
|
||||||
import net.corda.testing.expect
|
import net.corda.testing.*
|
||||||
import net.corda.testing.expectEvents
|
|
||||||
import net.corda.testing.parallel
|
|
||||||
import net.corda.testing.sequence
|
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.concurrent.thread
|
import kotlin.concurrent.thread
|
||||||
@ -36,9 +36,9 @@ class IntegrationTestingTutorial {
|
|||||||
startFlowPermission<CashPaymentFlow>()
|
startFlowPermission<CashPaymentFlow>()
|
||||||
))
|
))
|
||||||
val (alice, bob, notary) = Futures.allAsList(
|
val (alice, bob, notary) = Futures.allAsList(
|
||||||
startNode("Alice", rpcUsers = listOf(aliceUser)),
|
startNode(ALICE.name, rpcUsers = listOf(aliceUser)),
|
||||||
startNode("Bob", rpcUsers = listOf(bobUser)),
|
startNode(BOB.name, rpcUsers = listOf(bobUser)),
|
||||||
startNode("Notary", advertisedServices = setOf(ServiceInfo(ValidatingNotaryService.type)))
|
startNode(DUMMY_NOTARY.name, advertisedServices = setOf(ServiceInfo(ValidatingNotaryService.type)))
|
||||||
).getOrThrow()
|
).getOrThrow()
|
||||||
// END 1
|
// END 1
|
||||||
|
|
||||||
|
@ -8,10 +8,7 @@ import net.corda.core.node.services.unconsumedStates
|
|||||||
import net.corda.core.serialization.OpaqueBytes
|
import net.corda.core.serialization.OpaqueBytes
|
||||||
import net.corda.core.transactions.SignedTransaction
|
import net.corda.core.transactions.SignedTransaction
|
||||||
import net.corda.core.transactions.WireTransaction
|
import net.corda.core.transactions.WireTransaction
|
||||||
import net.corda.core.utilities.DUMMY_NOTARY
|
import net.corda.core.utilities.*
|
||||||
import net.corda.core.utilities.DUMMY_PUBKEY_1
|
|
||||||
import net.corda.core.utilities.DUMMY_PUBKEY_2
|
|
||||||
import net.corda.core.utilities.LogHelper
|
|
||||||
import net.corda.node.services.vault.NodeVaultService
|
import net.corda.node.services.vault.NodeVaultService
|
||||||
import net.corda.node.utilities.configureDatabase
|
import net.corda.node.utilities.configureDatabase
|
||||||
import net.corda.node.utilities.databaseTransaction
|
import net.corda.node.utilities.databaseTransaction
|
||||||
|
@ -6,6 +6,8 @@ import net.corda.core.list
|
|||||||
import net.corda.core.node.NodeInfo
|
import net.corda.core.node.NodeInfo
|
||||||
import net.corda.core.node.services.ServiceInfo
|
import net.corda.core.node.services.ServiceInfo
|
||||||
import net.corda.core.readLines
|
import net.corda.core.readLines
|
||||||
|
import net.corda.core.utilities.DUMMY_BANK_A
|
||||||
|
import net.corda.core.utilities.DUMMY_NOTARY
|
||||||
import net.corda.node.LOGS_DIRECTORY_NAME
|
import net.corda.node.LOGS_DIRECTORY_NAME
|
||||||
import net.corda.node.services.api.RegulatorService
|
import net.corda.node.services.api.RegulatorService
|
||||||
import net.corda.node.services.transactions.SimpleNotaryService
|
import net.corda.node.services.transactions.SimpleNotaryService
|
||||||
@ -36,7 +38,7 @@ class DriverTests {
|
|||||||
@Test
|
@Test
|
||||||
fun `simple node startup and shutdown`() {
|
fun `simple node startup and shutdown`() {
|
||||||
val (notary, regulator) = driver {
|
val (notary, regulator) = driver {
|
||||||
val notary = startNode("TestNotary", setOf(ServiceInfo(SimpleNotaryService.type)))
|
val notary = startNode(DUMMY_NOTARY.name, setOf(ServiceInfo(SimpleNotaryService.type)))
|
||||||
val regulator = startNode("Regulator", setOf(ServiceInfo(RegulatorService.type)))
|
val regulator = startNode("Regulator", setOf(ServiceInfo(RegulatorService.type)))
|
||||||
|
|
||||||
nodeMustBeUp(notary.getOrThrow().nodeInfo)
|
nodeMustBeUp(notary.getOrThrow().nodeInfo)
|
||||||
@ -50,7 +52,7 @@ class DriverTests {
|
|||||||
@Test
|
@Test
|
||||||
fun `starting node with no services`() {
|
fun `starting node with no services`() {
|
||||||
val noService = driver {
|
val noService = driver {
|
||||||
val noService = startNode("NoService")
|
val noService = startNode(DUMMY_BANK_A.name)
|
||||||
nodeMustBeUp(noService.getOrThrow().nodeInfo)
|
nodeMustBeUp(noService.getOrThrow().nodeInfo)
|
||||||
noService.getOrThrow()
|
noService.getOrThrow()
|
||||||
}
|
}
|
||||||
@ -60,7 +62,7 @@ class DriverTests {
|
|||||||
@Test
|
@Test
|
||||||
fun `random free port allocation`() {
|
fun `random free port allocation`() {
|
||||||
val nodeHandle = driver(portAllocation = PortAllocation.RandomFree) {
|
val nodeHandle = driver(portAllocation = PortAllocation.RandomFree) {
|
||||||
val nodeInfo = startNode("NoService")
|
val nodeInfo = startNode(DUMMY_BANK_A.name)
|
||||||
nodeMustBeUp(nodeInfo.getOrThrow().nodeInfo)
|
nodeMustBeUp(nodeInfo.getOrThrow().nodeInfo)
|
||||||
nodeInfo.getOrThrow()
|
nodeInfo.getOrThrow()
|
||||||
}
|
}
|
||||||
@ -73,7 +75,7 @@ class DriverTests {
|
|||||||
val logConfigFile = Paths.get("..", "config", "dev", "log4j2.xml").toAbsolutePath()
|
val logConfigFile = Paths.get("..", "config", "dev", "log4j2.xml").toAbsolutePath()
|
||||||
assertThat(logConfigFile).isRegularFile()
|
assertThat(logConfigFile).isRegularFile()
|
||||||
driver(isDebug = true, systemProperties = mapOf("log4j.configurationFile" to logConfigFile.toString())) {
|
driver(isDebug = true, systemProperties = mapOf("log4j.configurationFile" to logConfigFile.toString())) {
|
||||||
val baseDirectory = startNode("Alice").getOrThrow().configuration.baseDirectory
|
val baseDirectory = startNode(DUMMY_BANK_A.name).getOrThrow().configuration.baseDirectory
|
||||||
val logFile = (baseDirectory / LOGS_DIRECTORY_NAME).list { it.sorted().findFirst().get() }
|
val logFile = (baseDirectory / LOGS_DIRECTORY_NAME).list { it.sorted().findFirst().get() }
|
||||||
val debugLinesPresent = logFile.readLines { lines -> lines.anyMatch { line -> line.startsWith("[DEBUG]") } }
|
val debugLinesPresent = logFile.readLines { lines -> lines.anyMatch { line -> line.startsWith("[DEBUG]") } }
|
||||||
assertThat(debugLinesPresent).isTrue()
|
assertThat(debugLinesPresent).isTrue()
|
||||||
|
@ -9,6 +9,7 @@ import net.corda.core.div
|
|||||||
import net.corda.core.getOrThrow
|
import net.corda.core.getOrThrow
|
||||||
import net.corda.core.node.services.ServiceInfo
|
import net.corda.core.node.services.ServiceInfo
|
||||||
import net.corda.core.node.services.ServiceType
|
import net.corda.core.node.services.ServiceType
|
||||||
|
import net.corda.core.utilities.ALICE
|
||||||
import net.corda.flows.NotaryError
|
import net.corda.flows.NotaryError
|
||||||
import net.corda.flows.NotaryException
|
import net.corda.flows.NotaryException
|
||||||
import net.corda.flows.NotaryFlow
|
import net.corda.flows.NotaryFlow
|
||||||
@ -30,7 +31,7 @@ class BFTNotaryServiceTests : NodeBasedTest() {
|
|||||||
@Test
|
@Test
|
||||||
fun `detect double spend`() {
|
fun `detect double spend`() {
|
||||||
val masterNode = startBFTNotaryCluster(notaryName, 4, BFTNonValidatingNotaryService.type).first()
|
val masterNode = startBFTNotaryCluster(notaryName, 4, BFTNonValidatingNotaryService.type).first()
|
||||||
val alice = startNode("Alice").getOrThrow()
|
val alice = startNode(ALICE.name).getOrThrow()
|
||||||
|
|
||||||
val notaryParty = alice.netMapCache.getNotary(notaryName)!!
|
val notaryParty = alice.netMapCache.getNotary(notaryName)!!
|
||||||
val notaryNodeKeyPair = databaseTransaction(masterNode.database) { masterNode.services.notaryIdentityKey }
|
val notaryNodeKeyPair = databaseTransaction(masterNode.database) { masterNode.services.notaryIdentityKey }
|
||||||
|
@ -10,6 +10,8 @@ import net.corda.core.messaging.StateMachineUpdate
|
|||||||
import net.corda.core.messaging.startFlow
|
import net.corda.core.messaging.startFlow
|
||||||
import net.corda.core.node.NodeInfo
|
import net.corda.core.node.NodeInfo
|
||||||
import net.corda.core.serialization.OpaqueBytes
|
import net.corda.core.serialization.OpaqueBytes
|
||||||
|
import net.corda.core.utilities.ALICE
|
||||||
|
import net.corda.core.utilities.DUMMY_NOTARY
|
||||||
import net.corda.flows.CashIssueFlow
|
import net.corda.flows.CashIssueFlow
|
||||||
import net.corda.flows.CashPaymentFlow
|
import net.corda.flows.CashPaymentFlow
|
||||||
import net.corda.node.driver.NodeHandle
|
import net.corda.node.driver.NodeHandle
|
||||||
@ -39,9 +41,9 @@ class DistributedServiceTests : DriverBasedTest() {
|
|||||||
startFlowPermission<CashIssueFlow>(),
|
startFlowPermission<CashIssueFlow>(),
|
||||||
startFlowPermission<CashPaymentFlow>())
|
startFlowPermission<CashPaymentFlow>())
|
||||||
)
|
)
|
||||||
val aliceFuture = startNode("Alice", rpcUsers = listOf(testUser))
|
val aliceFuture = startNode(ALICE.name, rpcUsers = listOf(testUser))
|
||||||
val notariesFuture = startNotaryCluster(
|
val notariesFuture = startNotaryCluster(
|
||||||
"Notary",
|
DUMMY_NOTARY.name,
|
||||||
rpcUsers = listOf(testUser),
|
rpcUsers = listOf(testUser),
|
||||||
clusterSize = clusterSize,
|
clusterSize = clusterSize,
|
||||||
type = RaftValidatingNotaryService.type
|
type = RaftValidatingNotaryService.type
|
||||||
|
@ -8,6 +8,7 @@ import net.corda.core.contracts.TransactionType
|
|||||||
import net.corda.core.crypto.Party
|
import net.corda.core.crypto.Party
|
||||||
import net.corda.core.getOrThrow
|
import net.corda.core.getOrThrow
|
||||||
import net.corda.core.map
|
import net.corda.core.map
|
||||||
|
import net.corda.core.utilities.DUMMY_BANK_A
|
||||||
import net.corda.flows.NotaryError
|
import net.corda.flows.NotaryError
|
||||||
import net.corda.flows.NotaryException
|
import net.corda.flows.NotaryException
|
||||||
import net.corda.flows.NotaryFlow
|
import net.corda.flows.NotaryFlow
|
||||||
@ -27,7 +28,7 @@ class RaftNotaryServiceTests : NodeBasedTest() {
|
|||||||
fun `detect double spend`() {
|
fun `detect double spend`() {
|
||||||
val (masterNode, alice) = Futures.allAsList(
|
val (masterNode, alice) = Futures.allAsList(
|
||||||
startNotaryCluster(notaryName, 3).map { it.first() },
|
startNotaryCluster(notaryName, 3).map { it.first() },
|
||||||
startNode("Alice")
|
startNode(DUMMY_BANK_A.name)
|
||||||
).getOrThrow()
|
).getOrThrow()
|
||||||
|
|
||||||
val notaryParty = alice.netMapCache.getNotary(notaryName)!!
|
val notaryParty = alice.netMapCache.getNotary(notaryName)!!
|
||||||
|
@ -11,6 +11,8 @@ import net.corda.core.getOrThrow
|
|||||||
import net.corda.core.messaging.CordaRPCOps
|
import net.corda.core.messaging.CordaRPCOps
|
||||||
import net.corda.core.random63BitValue
|
import net.corda.core.random63BitValue
|
||||||
import net.corda.core.seconds
|
import net.corda.core.seconds
|
||||||
|
import net.corda.core.utilities.ALICE
|
||||||
|
import net.corda.core.utilities.BOB
|
||||||
import net.corda.core.utilities.unwrap
|
import net.corda.core.utilities.unwrap
|
||||||
import net.corda.node.internal.Node
|
import net.corda.node.internal.Node
|
||||||
import net.corda.nodeapi.ArtemisMessagingComponent.Companion.CLIENTS_PREFIX
|
import net.corda.nodeapi.ArtemisMessagingComponent.Companion.CLIENTS_PREFIX
|
||||||
@ -49,7 +51,7 @@ abstract class MQSecurityTest : NodeBasedTest() {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun start() {
|
fun start() {
|
||||||
alice = startNode("Alice", rpcUsers = extraRPCUsers + rpcUser).getOrThrow()
|
alice = startNode(ALICE.name, rpcUsers = extraRPCUsers + rpcUser).getOrThrow()
|
||||||
attacker = createAttacker()
|
attacker = createAttacker()
|
||||||
startAttacker(attacker)
|
startAttacker(attacker)
|
||||||
}
|
}
|
||||||
@ -84,7 +86,7 @@ abstract class MQSecurityTest : NodeBasedTest() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `create queue for peer which has not been communicated with`() {
|
fun `create queue for peer which has not been communicated with`() {
|
||||||
val bob = startNode("Bob").getOrThrow()
|
val bob = startNode(BOB.name).getOrThrow()
|
||||||
assertAllQueueCreationAttacksFail("$PEERS_PREFIX${bob.info.legalIdentity.owningKey.toBase58String()}")
|
assertAllQueueCreationAttacksFail("$PEERS_PREFIX${bob.info.legalIdentity.owningKey.toBase58String()}")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,7 +229,7 @@ abstract class MQSecurityTest : NodeBasedTest() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun startBobAndCommunicateWithAlice(): Party {
|
private fun startBobAndCommunicateWithAlice(): Party {
|
||||||
val bob = startNode("Bob").getOrThrow()
|
val bob = startNode(BOB.name).getOrThrow()
|
||||||
bob.services.registerFlowInitiator(SendFlow::class.java, ::ReceiveFlow)
|
bob.services.registerFlowInitiator(SendFlow::class.java, ::ReceiveFlow)
|
||||||
val bobParty = bob.info.legalIdentity
|
val bobParty = bob.info.legalIdentity
|
||||||
// Perform a protocol exchange to force the peer queue to be created
|
// Perform a protocol exchange to force the peer queue to be created
|
||||||
|
@ -11,6 +11,7 @@ import net.corda.core.node.services.ServiceInfo
|
|||||||
import net.corda.core.serialization.CordaSerializable
|
import net.corda.core.serialization.CordaSerializable
|
||||||
import net.corda.core.serialization.deserialize
|
import net.corda.core.serialization.deserialize
|
||||||
import net.corda.core.serialization.serialize
|
import net.corda.core.serialization.serialize
|
||||||
|
import net.corda.core.utilities.*
|
||||||
import net.corda.flows.ServiceRequestMessage
|
import net.corda.flows.ServiceRequestMessage
|
||||||
import net.corda.flows.sendRequest
|
import net.corda.flows.sendRequest
|
||||||
import net.corda.node.internal.Node
|
import net.corda.node.internal.Node
|
||||||
@ -26,7 +27,8 @@ import java.util.*
|
|||||||
class P2PMessagingTest : NodeBasedTest() {
|
class P2PMessagingTest : NodeBasedTest() {
|
||||||
@Test
|
@Test
|
||||||
fun `network map will work after restart`() {
|
fun `network map will work after restart`() {
|
||||||
fun startNodes() = Futures.allAsList(startNode("NodeA"), startNode("NodeB"), startNode("Notary"))
|
val identities = listOf(DUMMY_BANK_A, DUMMY_BANK_B, DUMMY_NOTARY)
|
||||||
|
fun startNodes() = Futures.allAsList(identities.map { startNode(it.name) })
|
||||||
|
|
||||||
val startUpDuration = elapsedTime { startNodes().getOrThrow() }
|
val startUpDuration = elapsedTime { startNodes().getOrThrow() }
|
||||||
// Start the network map a second time - this will restore message queues from the journal.
|
// Start the network map a second time - this will restore message queues from the journal.
|
||||||
@ -40,7 +42,7 @@ class P2PMessagingTest : NodeBasedTest() {
|
|||||||
fun `communicating with a service running on the network map node`() {
|
fun `communicating with a service running on the network map node`() {
|
||||||
startNetworkMapNode(advertisedServices = setOf(ServiceInfo(SimpleNotaryService.type)))
|
startNetworkMapNode(advertisedServices = setOf(ServiceInfo(SimpleNotaryService.type)))
|
||||||
networkMapNode.respondWith("Hello")
|
networkMapNode.respondWith("Hello")
|
||||||
val alice = startNode("Alice").getOrThrow()
|
val alice = startNode(ALICE.name).getOrThrow()
|
||||||
val serviceAddress = alice.services.networkMapCache.run {
|
val serviceAddress = alice.services.networkMapCache.run {
|
||||||
alice.net.getAddressOfParty(getPartyInfo(getAnyNotary()!!)!!)
|
alice.net.getAddressOfParty(getPartyInfo(getAnyNotary()!!)!!)
|
||||||
}
|
}
|
||||||
@ -55,14 +57,14 @@ class P2PMessagingTest : NodeBasedTest() {
|
|||||||
|
|
||||||
val root = tempFolder.root.toPath()
|
val root = tempFolder.root.toPath()
|
||||||
ServiceIdentityGenerator.generateToDisk(
|
ServiceIdentityGenerator.generateToDisk(
|
||||||
listOf(root / "NetworkMap", root / "Service Node 2"),
|
listOf(root / DUMMY_MAP.name, root / "Service Node 2"),
|
||||||
RaftValidatingNotaryService.type.id,
|
RaftValidatingNotaryService.type.id,
|
||||||
serviceName)
|
serviceName)
|
||||||
|
|
||||||
val distributedService = ServiceInfo(RaftValidatingNotaryService.type, serviceName)
|
val distributedService = ServiceInfo(RaftValidatingNotaryService.type, serviceName)
|
||||||
val notaryClusterAddress = freeLocalHostAndPort()
|
val notaryClusterAddress = freeLocalHostAndPort()
|
||||||
startNetworkMapNode(
|
startNetworkMapNode(
|
||||||
"NetworkMap",
|
DUMMY_MAP.name,
|
||||||
advertisedServices = setOf(distributedService),
|
advertisedServices = setOf(distributedService),
|
||||||
configOverrides = mapOf("notaryNodeAddress" to notaryClusterAddress.toString()))
|
configOverrides = mapOf("notaryNodeAddress" to notaryClusterAddress.toString()))
|
||||||
val (serviceNode2, alice) = Futures.allAsList(
|
val (serviceNode2, alice) = Futures.allAsList(
|
||||||
@ -72,7 +74,7 @@ class P2PMessagingTest : NodeBasedTest() {
|
|||||||
configOverrides = mapOf(
|
configOverrides = mapOf(
|
||||||
"notaryNodeAddress" to freeLocalHostAndPort().toString(),
|
"notaryNodeAddress" to freeLocalHostAndPort().toString(),
|
||||||
"notaryClusterAddresses" to listOf(notaryClusterAddress.toString()))),
|
"notaryClusterAddresses" to listOf(notaryClusterAddress.toString()))),
|
||||||
startNode("Alice")
|
startNode(ALICE.name)
|
||||||
).getOrThrow()
|
).getOrThrow()
|
||||||
|
|
||||||
assertAllNodesAreUsed(listOf(networkMapNode, serviceNode2), serviceName, alice)
|
assertAllNodesAreUsed(listOf(networkMapNode, serviceNode2), serviceName, alice)
|
||||||
|
@ -7,6 +7,7 @@ import net.corda.core.getOrThrow
|
|||||||
import net.corda.core.node.NodeInfo
|
import net.corda.core.node.NodeInfo
|
||||||
import net.corda.core.random63BitValue
|
import net.corda.core.random63BitValue
|
||||||
import net.corda.core.seconds
|
import net.corda.core.seconds
|
||||||
|
import net.corda.core.utilities.BOB
|
||||||
import net.corda.flows.sendRequest
|
import net.corda.flows.sendRequest
|
||||||
import net.corda.node.internal.NetworkMapInfo
|
import net.corda.node.internal.NetworkMapInfo
|
||||||
import net.corda.node.services.config.configureWithDevSSLCertificate
|
import net.corda.node.services.config.configureWithDevSSLCertificate
|
||||||
@ -29,7 +30,7 @@ class P2PSecurityTest : NodeBasedTest() {
|
|||||||
@Test
|
@Test
|
||||||
fun `incorrect legal name for the network map service config`() {
|
fun `incorrect legal name for the network map service config`() {
|
||||||
val incorrectNetworkMapName = random63BitValue().toString()
|
val incorrectNetworkMapName = random63BitValue().toString()
|
||||||
val node = startNode("Bob", configOverrides = mapOf(
|
val node = startNode(BOB.name, configOverrides = mapOf(
|
||||||
"networkMapService" to mapOf(
|
"networkMapService" to mapOf(
|
||||||
"address" to networkMapNode.configuration.p2pAddress.toString(),
|
"address" to networkMapNode.configuration.p2pAddress.toString(),
|
||||||
"legalName" to incorrectNetworkMapName
|
"legalName" to incorrectNetworkMapName
|
||||||
|
@ -16,8 +16,7 @@ import net.corda.core.messaging.CordaRPCOps
|
|||||||
import net.corda.core.node.NodeInfo
|
import net.corda.core.node.NodeInfo
|
||||||
import net.corda.core.node.services.ServiceInfo
|
import net.corda.core.node.services.ServiceInfo
|
||||||
import net.corda.core.node.services.ServiceType
|
import net.corda.core.node.services.ServiceType
|
||||||
import net.corda.core.utilities.ProcessUtilities
|
import net.corda.core.utilities.*
|
||||||
import net.corda.core.utilities.loggerFor
|
|
||||||
import net.corda.node.LOGS_DIRECTORY_NAME
|
import net.corda.node.LOGS_DIRECTORY_NAME
|
||||||
import net.corda.node.services.config.ConfigHelper
|
import net.corda.node.services.config.ConfigHelper
|
||||||
import net.corda.node.services.config.FullNodeConfiguration
|
import net.corda.node.services.config.FullNodeConfiguration
|
||||||
@ -145,8 +144,8 @@ sealed class PortAllocation {
|
|||||||
/**
|
/**
|
||||||
* [driver] allows one to start up nodes like this:
|
* [driver] allows one to start up nodes like this:
|
||||||
* driver {
|
* driver {
|
||||||
* val noService = startNode("NoService")
|
* val noService = startNode(DUMMY_BANK_A.name)
|
||||||
* val notary = startNode("Notary")
|
* val notary = startNode(DUMMY_NOTARY.name)
|
||||||
*
|
*
|
||||||
* (...)
|
* (...)
|
||||||
* }
|
* }
|
||||||
@ -344,7 +343,7 @@ class DriverDSL(
|
|||||||
val isDebug: Boolean,
|
val isDebug: Boolean,
|
||||||
val automaticallyStartNetworkMap: Boolean
|
val automaticallyStartNetworkMap: Boolean
|
||||||
) : DriverDSLInternalInterface {
|
) : DriverDSLInternalInterface {
|
||||||
private val networkMapLegalName = "NetworkMapService"
|
private val networkMapLegalName = DUMMY_MAP.name
|
||||||
private val networkMapAddress = portAllocation.nextHostAndPort()
|
private val networkMapAddress = portAllocation.nextHostAndPort()
|
||||||
val executorService: ListeningScheduledExecutorService = MoreExecutors.listeningDecorator(Executors.newScheduledThreadPool(2))
|
val executorService: ListeningScheduledExecutorService = MoreExecutors.listeningDecorator(Executors.newScheduledThreadPool(2))
|
||||||
val shutdownManager = ShutdownManager(executorService)
|
val shutdownManager = ShutdownManager(executorService)
|
||||||
@ -458,7 +457,7 @@ class DriverDSL(
|
|||||||
verifierType: VerifierType,
|
verifierType: VerifierType,
|
||||||
rpcUsers: List<User>
|
rpcUsers: List<User>
|
||||||
): ListenableFuture<Pair<Party, List<NodeHandle>>> {
|
): ListenableFuture<Pair<Party, List<NodeHandle>>> {
|
||||||
val nodeNames = (1..clusterSize).map { "Notary Node $it" }
|
val nodeNames = (1..clusterSize).map { "${DUMMY_NOTARY.name} $it" }
|
||||||
val paths = nodeNames.map { driverDirectory / it }
|
val paths = nodeNames.map { driverDirectory / it }
|
||||||
ServiceIdentityGenerator.generateToDisk(paths, type.id, notaryName)
|
ServiceIdentityGenerator.generateToDisk(paths, type.id, notaryName)
|
||||||
|
|
||||||
@ -539,9 +538,9 @@ class DriverDSL(
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val name = arrayOf(
|
val name = arrayOf(
|
||||||
"Alice",
|
ALICE.name,
|
||||||
"Bob",
|
BOB.name,
|
||||||
"Bank"
|
DUMMY_BANK_A.name
|
||||||
)
|
)
|
||||||
|
|
||||||
fun <A> pickA(array: Array<A>): A = array[Math.abs(Random().nextInt()) % array.size]
|
fun <A> pickA(array: Array<A>): A = array[Math.abs(Random().nextInt()) % array.size]
|
||||||
|
@ -16,6 +16,8 @@ import net.corda.core.rootCause
|
|||||||
import net.corda.core.transactions.SignedTransaction
|
import net.corda.core.transactions.SignedTransaction
|
||||||
import net.corda.core.transactions.TransactionBuilder
|
import net.corda.core.transactions.TransactionBuilder
|
||||||
import net.corda.core.transactions.WireTransaction
|
import net.corda.core.transactions.WireTransaction
|
||||||
|
import net.corda.core.utilities.ALICE
|
||||||
|
import net.corda.core.utilities.BOB
|
||||||
import net.corda.core.utilities.DUMMY_NOTARY
|
import net.corda.core.utilities.DUMMY_NOTARY
|
||||||
import net.corda.core.utilities.LogHelper
|
import net.corda.core.utilities.LogHelper
|
||||||
import net.corda.core.utilities.TEST_TX_TIME
|
import net.corda.core.utilities.TEST_TX_TIME
|
||||||
|
@ -22,6 +22,8 @@ import net.corda.node.services.network.NetworkMapService.Companion.QUERY_TOPIC
|
|||||||
import net.corda.node.services.network.NetworkMapService.Companion.REGISTER_TOPIC
|
import net.corda.node.services.network.NetworkMapService.Companion.REGISTER_TOPIC
|
||||||
import net.corda.node.services.network.NetworkMapService.Companion.SUBSCRIPTION_TOPIC
|
import net.corda.node.services.network.NetworkMapService.Companion.SUBSCRIPTION_TOPIC
|
||||||
import net.corda.node.services.network.NodeRegistration
|
import net.corda.node.services.network.NodeRegistration
|
||||||
|
import net.corda.core.utilities.ALICE
|
||||||
|
import net.corda.core.utilities.BOB
|
||||||
import net.corda.node.utilities.AddOrRemove
|
import net.corda.node.utilities.AddOrRemove
|
||||||
import net.corda.node.utilities.AddOrRemove.ADD
|
import net.corda.node.utilities.AddOrRemove.ADD
|
||||||
import net.corda.node.utilities.AddOrRemove.REMOVE
|
import net.corda.node.utilities.AddOrRemove.REMOVE
|
||||||
@ -44,7 +46,7 @@ abstract class AbstractNetworkMapServiceTest<out S : AbstractNetworkMapService>
|
|||||||
@Before
|
@Before
|
||||||
fun setup() {
|
fun setup() {
|
||||||
network = MockNetwork(defaultFactory = nodeFactory)
|
network = MockNetwork(defaultFactory = nodeFactory)
|
||||||
network.createTwoNodes(firstNodeName = "map service", secondNodeName = "alice").apply {
|
network.createTwoNodes(firstNodeName = "map service", secondNodeName = ALICE.name).apply {
|
||||||
mapServiceNode = first
|
mapServiceNode = first
|
||||||
alice = second
|
alice = second
|
||||||
}
|
}
|
||||||
@ -110,7 +112,7 @@ abstract class AbstractNetworkMapServiceTest<out S : AbstractNetworkMapService>
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `de-register unknown node`() {
|
fun `de-register unknown node`() {
|
||||||
val bob = newNodeSeparateFromNetworkMap("Bob")
|
val bob = newNodeSeparateFromNetworkMap(BOB.name)
|
||||||
val response = bob.registration(REMOVE)
|
val response = bob.registration(REMOVE)
|
||||||
swizzle()
|
swizzle()
|
||||||
assertThat(response.getOrThrow().error).isNotNull() // Make sure send error message is sent back
|
assertThat(response.getOrThrow().error).isNotNull() // Make sure send error message is sent back
|
||||||
@ -121,7 +123,7 @@ abstract class AbstractNetworkMapServiceTest<out S : AbstractNetworkMapService>
|
|||||||
fun `subscribed while new node registers`() {
|
fun `subscribed while new node registers`() {
|
||||||
val updates = alice.subscribe()
|
val updates = alice.subscribe()
|
||||||
swizzle()
|
swizzle()
|
||||||
val bob = addNewNodeToNetworkMap("Bob")
|
val bob = addNewNodeToNetworkMap(BOB.name)
|
||||||
swizzle()
|
swizzle()
|
||||||
val update = updates.single()
|
val update = updates.single()
|
||||||
assertThat(update.mapVersion).isEqualTo(networkMapService.mapVersion)
|
assertThat(update.mapVersion).isEqualTo(networkMapService.mapVersion)
|
||||||
@ -130,7 +132,7 @@ abstract class AbstractNetworkMapServiceTest<out S : AbstractNetworkMapService>
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `subscribed while node de-registers`() {
|
fun `subscribed while node de-registers`() {
|
||||||
val bob = addNewNodeToNetworkMap("Bob")
|
val bob = addNewNodeToNetworkMap(BOB.name)
|
||||||
val updates = alice.subscribe()
|
val updates = alice.subscribe()
|
||||||
bob.registration(REMOVE)
|
bob.registration(REMOVE)
|
||||||
swizzle()
|
swizzle()
|
||||||
@ -140,7 +142,7 @@ abstract class AbstractNetworkMapServiceTest<out S : AbstractNetworkMapService>
|
|||||||
@Test
|
@Test
|
||||||
fun unsubscribe() {
|
fun unsubscribe() {
|
||||||
val updates = alice.subscribe()
|
val updates = alice.subscribe()
|
||||||
val bob = addNewNodeToNetworkMap("Bob")
|
val bob = addNewNodeToNetworkMap(BOB.name)
|
||||||
alice.unsubscribe()
|
alice.unsubscribe()
|
||||||
addNewNodeToNetworkMap("Charlie")
|
addNewNodeToNetworkMap("Charlie")
|
||||||
swizzle()
|
swizzle()
|
||||||
@ -151,7 +153,7 @@ abstract class AbstractNetworkMapServiceTest<out S : AbstractNetworkMapService>
|
|||||||
fun `surpass unacknowledged update limit`() {
|
fun `surpass unacknowledged update limit`() {
|
||||||
val subscriber = newNodeSeparateFromNetworkMap("Subscriber")
|
val subscriber = newNodeSeparateFromNetworkMap("Subscriber")
|
||||||
val updates = subscriber.subscribe()
|
val updates = subscriber.subscribe()
|
||||||
val bob = addNewNodeToNetworkMap("Bob")
|
val bob = addNewNodeToNetworkMap(BOB.name)
|
||||||
var serial = updates.first().wireReg.verified().serial
|
var serial = updates.first().wireReg.verified().serial
|
||||||
repeat(networkMapService.maxUnacknowledgedUpdates) {
|
repeat(networkMapService.maxUnacknowledgedUpdates) {
|
||||||
bob.registration(ADD, serial = ++serial)
|
bob.registration(ADD, serial = ++serial)
|
||||||
@ -165,7 +167,7 @@ abstract class AbstractNetworkMapServiceTest<out S : AbstractNetworkMapService>
|
|||||||
fun `delay sending update ack until just before unacknowledged update limit`() {
|
fun `delay sending update ack until just before unacknowledged update limit`() {
|
||||||
val subscriber = newNodeSeparateFromNetworkMap("Subscriber")
|
val subscriber = newNodeSeparateFromNetworkMap("Subscriber")
|
||||||
val updates = subscriber.subscribe()
|
val updates = subscriber.subscribe()
|
||||||
val bob = addNewNodeToNetworkMap("Bob")
|
val bob = addNewNodeToNetworkMap(BOB.name)
|
||||||
var serial = updates.first().wireReg.verified().serial
|
var serial = updates.first().wireReg.verified().serial
|
||||||
repeat(networkMapService.maxUnacknowledgedUpdates - 1) {
|
repeat(networkMapService.maxUnacknowledgedUpdates - 1) {
|
||||||
bob.registration(ADD, serial = ++serial)
|
bob.registration(ADD, serial = ++serial)
|
||||||
|
@ -3,9 +3,9 @@ package net.corda.node.services
|
|||||||
import net.corda.core.crypto.Party
|
import net.corda.core.crypto.Party
|
||||||
import net.corda.core.crypto.generateKeyPair
|
import net.corda.core.crypto.generateKeyPair
|
||||||
import net.corda.node.services.identity.InMemoryIdentityService
|
import net.corda.node.services.identity.InMemoryIdentityService
|
||||||
import net.corda.testing.ALICE
|
import net.corda.core.utilities.ALICE
|
||||||
|
import net.corda.core.utilities.BOB
|
||||||
import net.corda.testing.ALICE_PUBKEY
|
import net.corda.testing.ALICE_PUBKEY
|
||||||
import net.corda.testing.BOB
|
|
||||||
import net.corda.testing.BOB_PUBKEY
|
import net.corda.testing.BOB_PUBKEY
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
|
@ -13,11 +13,11 @@ import net.corda.node.services.events.NodeSchedulerService
|
|||||||
import net.corda.node.services.persistence.DBCheckpointStorage
|
import net.corda.node.services.persistence.DBCheckpointStorage
|
||||||
import net.corda.node.services.statemachine.StateMachineManager
|
import net.corda.node.services.statemachine.StateMachineManager
|
||||||
import net.corda.node.services.vault.NodeVaultService
|
import net.corda.node.services.vault.NodeVaultService
|
||||||
|
import net.corda.core.utilities.ALICE_KEY
|
||||||
import net.corda.node.utilities.AddOrRemove
|
import net.corda.node.utilities.AddOrRemove
|
||||||
import net.corda.node.utilities.AffinityExecutor
|
import net.corda.node.utilities.AffinityExecutor
|
||||||
import net.corda.node.utilities.configureDatabase
|
import net.corda.node.utilities.configureDatabase
|
||||||
import net.corda.node.utilities.databaseTransaction
|
import net.corda.node.utilities.databaseTransaction
|
||||||
import net.corda.testing.ALICE_KEY
|
|
||||||
import net.corda.testing.node.InMemoryMessagingNetwork
|
import net.corda.testing.node.InMemoryMessagingNetwork
|
||||||
import net.corda.testing.node.MockKeyManagementService
|
import net.corda.testing.node.MockKeyManagementService
|
||||||
import net.corda.testing.node.TestClock
|
import net.corda.testing.node.TestClock
|
||||||
|
@ -10,12 +10,12 @@ import net.corda.core.node.services.VaultService
|
|||||||
import net.corda.core.node.services.consumedStates
|
import net.corda.core.node.services.consumedStates
|
||||||
import net.corda.core.node.services.unconsumedStates
|
import net.corda.core.node.services.unconsumedStates
|
||||||
import net.corda.core.transactions.SignedTransaction
|
import net.corda.core.transactions.SignedTransaction
|
||||||
|
import net.corda.core.utilities.BOB_KEY
|
||||||
import net.corda.core.utilities.DUMMY_NOTARY
|
import net.corda.core.utilities.DUMMY_NOTARY
|
||||||
import net.corda.core.utilities.DUMMY_NOTARY_KEY
|
import net.corda.core.utilities.DUMMY_NOTARY_KEY
|
||||||
import net.corda.core.utilities.LogHelper
|
import net.corda.core.utilities.LogHelper
|
||||||
import net.corda.node.utilities.configureDatabase
|
import net.corda.node.utilities.configureDatabase
|
||||||
import net.corda.node.utilities.databaseTransaction
|
import net.corda.node.utilities.databaseTransaction
|
||||||
import net.corda.testing.BOB_KEY
|
|
||||||
import net.corda.testing.BOB_PUBKEY
|
import net.corda.testing.BOB_PUBKEY
|
||||||
import net.corda.testing.MEGA_CORP
|
import net.corda.testing.MEGA_CORP
|
||||||
import net.corda.testing.MEGA_CORP_KEY
|
import net.corda.testing.MEGA_CORP_KEY
|
||||||
|
@ -3,6 +3,9 @@ package net.corda.attachmentdemo
|
|||||||
import com.google.common.util.concurrent.Futures
|
import com.google.common.util.concurrent.Futures
|
||||||
import net.corda.core.getOrThrow
|
import net.corda.core.getOrThrow
|
||||||
import net.corda.core.node.services.ServiceInfo
|
import net.corda.core.node.services.ServiceInfo
|
||||||
|
import net.corda.core.utilities.DUMMY_BANK_A
|
||||||
|
import net.corda.core.utilities.DUMMY_BANK_B
|
||||||
|
import net.corda.core.utilities.DUMMY_NOTARY
|
||||||
import net.corda.node.driver.driver
|
import net.corda.node.driver.driver
|
||||||
import net.corda.node.services.transactions.SimpleNotaryService
|
import net.corda.node.services.transactions.SimpleNotaryService
|
||||||
import net.corda.nodeapi.User
|
import net.corda.nodeapi.User
|
||||||
@ -25,9 +28,9 @@ class AttachmentDemoTest {
|
|||||||
driver(dsl = {
|
driver(dsl = {
|
||||||
val demoUser = listOf(User("demo", "demo", setOf("StartFlow.net.corda.flows.FinalityFlow")))
|
val demoUser = listOf(User("demo", "demo", setOf("StartFlow.net.corda.flows.FinalityFlow")))
|
||||||
val (nodeA, nodeB) = Futures.allAsList(
|
val (nodeA, nodeB) = Futures.allAsList(
|
||||||
startNode("Bank A", rpcUsers = demoUser),
|
startNode(DUMMY_BANK_A.name, rpcUsers = demoUser),
|
||||||
startNode("Bank B", rpcUsers = demoUser),
|
startNode(DUMMY_BANK_B.name, rpcUsers = demoUser),
|
||||||
startNode("Notary", setOf(ServiceInfo(SimpleNotaryService.Companion.type)))
|
startNode(DUMMY_NOTARY.name, setOf(ServiceInfo(SimpleNotaryService.Companion.type)))
|
||||||
).getOrThrow()
|
).getOrThrow()
|
||||||
|
|
||||||
val senderThread = CompletableFuture.supplyAsync {
|
val senderThread = CompletableFuture.supplyAsync {
|
||||||
|
@ -11,10 +11,10 @@ import net.corda.core.getOrThrow
|
|||||||
import net.corda.core.messaging.CordaRPCOps
|
import net.corda.core.messaging.CordaRPCOps
|
||||||
import net.corda.core.messaging.startFlow
|
import net.corda.core.messaging.startFlow
|
||||||
import net.corda.core.sizedInputStreamAndHash
|
import net.corda.core.sizedInputStreamAndHash
|
||||||
|
import net.corda.core.utilities.ALICE_KEY
|
||||||
import net.corda.core.utilities.Emoji
|
import net.corda.core.utilities.Emoji
|
||||||
import net.corda.flows.FinalityFlow
|
import net.corda.flows.FinalityFlow
|
||||||
import net.corda.nodeapi.config.SSLConfiguration
|
import net.corda.nodeapi.config.SSLConfiguration
|
||||||
import net.corda.testing.ALICE_KEY
|
|
||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
import java.nio.file.Paths
|
import java.nio.file.Paths
|
||||||
|
@ -2,6 +2,9 @@ package net.corda.attachmentdemo
|
|||||||
|
|
||||||
import net.corda.core.div
|
import net.corda.core.div
|
||||||
import net.corda.core.node.services.ServiceInfo
|
import net.corda.core.node.services.ServiceInfo
|
||||||
|
import net.corda.core.utilities.DUMMY_BANK_A
|
||||||
|
import net.corda.core.utilities.DUMMY_BANK_B
|
||||||
|
import net.corda.core.utilities.DUMMY_NOTARY
|
||||||
import net.corda.node.driver.driver
|
import net.corda.node.driver.driver
|
||||||
import net.corda.node.services.transactions.SimpleNotaryService
|
import net.corda.node.services.transactions.SimpleNotaryService
|
||||||
import net.corda.nodeapi.User
|
import net.corda.nodeapi.User
|
||||||
@ -14,9 +17,9 @@ import java.nio.file.Paths
|
|||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
val demoUser = listOf(User("demo", "demo", setOf("StartFlow.net.corda.flows.FinalityFlow")))
|
val demoUser = listOf(User("demo", "demo", setOf("StartFlow.net.corda.flows.FinalityFlow")))
|
||||||
driver(isDebug = true, driverDirectory = Paths.get("build") / "attachment-demo-nodes") {
|
driver(isDebug = true, driverDirectory = Paths.get("build") / "attachment-demo-nodes") {
|
||||||
startNode("Controller", setOf(ServiceInfo(SimpleNotaryService.Companion.type)))
|
startNode(DUMMY_NOTARY.name, setOf(ServiceInfo(SimpleNotaryService.Companion.type)))
|
||||||
startNode("Bank A", rpcUsers = demoUser)
|
startNode(DUMMY_BANK_A.name, rpcUsers = demoUser)
|
||||||
startNode("Bank B", rpcUsers = demoUser)
|
startNode(DUMMY_BANK_B.name, rpcUsers = demoUser)
|
||||||
waitForAllNodesToFinish()
|
waitForAllNodesToFinish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import net.corda.core.getOrThrow
|
|||||||
import net.corda.core.node.services.ServiceInfo
|
import net.corda.core.node.services.ServiceInfo
|
||||||
import net.corda.node.driver.driver
|
import net.corda.node.driver.driver
|
||||||
import net.corda.node.services.transactions.SimpleNotaryService
|
import net.corda.node.services.transactions.SimpleNotaryService
|
||||||
|
import net.corda.testing.BOC
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class BankOfCordaHttpAPITest {
|
class BankOfCordaHttpAPITest {
|
||||||
@ -14,11 +15,11 @@ class BankOfCordaHttpAPITest {
|
|||||||
fun `issuer flow via Http`() {
|
fun `issuer flow via Http`() {
|
||||||
driver(dsl = {
|
driver(dsl = {
|
||||||
val (nodeBankOfCorda) = Futures.allAsList(
|
val (nodeBankOfCorda) = Futures.allAsList(
|
||||||
startNode("BankOfCorda", setOf(ServiceInfo(SimpleNotaryService.type))),
|
startNode(BOC.name, setOf(ServiceInfo(SimpleNotaryService.type))),
|
||||||
startNode("BigCorporation")
|
startNode("BigCorporation")
|
||||||
).getOrThrow()
|
).getOrThrow()
|
||||||
val nodeBankOfCordaApiAddr = startWebserver(nodeBankOfCorda).getOrThrow()
|
val nodeBankOfCordaApiAddr = startWebserver(nodeBankOfCorda).getOrThrow()
|
||||||
assert(BankOfCordaClientApi(nodeBankOfCordaApiAddr).requestWebIssue(IssueRequestParams(1000, "USD", "BigCorporation", "1", "BankOfCorda")))
|
assert(BankOfCordaClientApi(nodeBankOfCordaApiAddr).requestWebIssue(IssueRequestParams(1000, "USD", "BigCorporation", "1", BOC.name)))
|
||||||
}, isDebug = true)
|
}, isDebug = true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,10 +10,7 @@ import net.corda.node.driver.driver
|
|||||||
import net.corda.node.services.startFlowPermission
|
import net.corda.node.services.startFlowPermission
|
||||||
import net.corda.node.services.transactions.SimpleNotaryService
|
import net.corda.node.services.transactions.SimpleNotaryService
|
||||||
import net.corda.nodeapi.User
|
import net.corda.nodeapi.User
|
||||||
import net.corda.testing.BIG_CORP_PARTY_REF
|
import net.corda.testing.*
|
||||||
import net.corda.testing.expect
|
|
||||||
import net.corda.testing.expectEvents
|
|
||||||
import net.corda.testing.sequence
|
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class BankOfCordaRPCClientTest {
|
class BankOfCordaRPCClientTest {
|
||||||
@ -23,7 +20,7 @@ class BankOfCordaRPCClientTest {
|
|||||||
val bocManager = User("bocManager", "password1", permissions = setOf(startFlowPermission<IssuanceRequester>()))
|
val bocManager = User("bocManager", "password1", permissions = setOf(startFlowPermission<IssuanceRequester>()))
|
||||||
val bigCorpCFO = User("bigCorpCFO", "password2", permissions = emptySet())
|
val bigCorpCFO = User("bigCorpCFO", "password2", permissions = emptySet())
|
||||||
val (nodeBankOfCorda, nodeBigCorporation) = Futures.allAsList(
|
val (nodeBankOfCorda, nodeBigCorporation) = Futures.allAsList(
|
||||||
startNode("BankOfCorda", setOf(ServiceInfo(SimpleNotaryService.type)), listOf(bocManager)),
|
startNode(BOC.name, setOf(ServiceInfo(SimpleNotaryService.type)), listOf(bocManager)),
|
||||||
startNode("BigCorporation", rpcUsers = listOf(bigCorpCFO))
|
startNode("BigCorporation", rpcUsers = listOf(bigCorpCFO))
|
||||||
).getOrThrow()
|
).getOrThrow()
|
||||||
|
|
||||||
|
@ -7,12 +7,14 @@ import net.corda.bank.api.BankOfCordaWebApi.IssueRequestParams
|
|||||||
import net.corda.core.node.services.ServiceInfo
|
import net.corda.core.node.services.ServiceInfo
|
||||||
import net.corda.core.node.services.ServiceType
|
import net.corda.core.node.services.ServiceType
|
||||||
import net.corda.core.transactions.SignedTransaction
|
import net.corda.core.transactions.SignedTransaction
|
||||||
|
import net.corda.core.utilities.DUMMY_NOTARY
|
||||||
import net.corda.flows.CashPaymentFlow
|
import net.corda.flows.CashPaymentFlow
|
||||||
import net.corda.flows.IssuerFlow
|
import net.corda.flows.IssuerFlow
|
||||||
import net.corda.node.driver.driver
|
import net.corda.node.driver.driver
|
||||||
import net.corda.node.services.startFlowPermission
|
import net.corda.node.services.startFlowPermission
|
||||||
import net.corda.node.services.transactions.SimpleNotaryService
|
import net.corda.node.services.transactions.SimpleNotaryService
|
||||||
import net.corda.nodeapi.User
|
import net.corda.nodeapi.User
|
||||||
|
import net.corda.testing.BOC
|
||||||
import kotlin.system.exitProcess
|
import kotlin.system.exitProcess
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -53,8 +55,8 @@ private class BankOfCordaDriver {
|
|||||||
driver(dsl = {
|
driver(dsl = {
|
||||||
val bankUser = User(BANK_USERNAME, "test", permissions = setOf(startFlowPermission<CashPaymentFlow>(), startFlowPermission<IssuerFlow.IssuanceRequester>()))
|
val bankUser = User(BANK_USERNAME, "test", permissions = setOf(startFlowPermission<CashPaymentFlow>(), startFlowPermission<IssuerFlow.IssuanceRequester>()))
|
||||||
val bigCorpUser = User(BIGCORP_USERNAME, "test", permissions = setOf(startFlowPermission<CashPaymentFlow>()))
|
val bigCorpUser = User(BIGCORP_USERNAME, "test", permissions = setOf(startFlowPermission<CashPaymentFlow>()))
|
||||||
startNode("Notary", setOf(ServiceInfo(SimpleNotaryService.type)))
|
startNode(DUMMY_NOTARY.name, setOf(ServiceInfo(SimpleNotaryService.type)))
|
||||||
val bankOfCorda = startNode("BankOfCorda", rpcUsers = listOf(bankUser), advertisedServices = setOf(ServiceInfo(ServiceType.corda.getSubType("issuer.USD"))))
|
val bankOfCorda = startNode(BOC.name, rpcUsers = listOf(bankUser), advertisedServices = setOf(ServiceInfo(ServiceType.corda.getSubType("issuer.USD"))))
|
||||||
startNode("BigCorporation", rpcUsers = listOf(bigCorpUser))
|
startNode("BigCorporation", rpcUsers = listOf(bigCorpUser))
|
||||||
startWebserver(bankOfCorda.get())
|
startWebserver(bankOfCorda.get())
|
||||||
waitForAllNodesToFinish()
|
waitForAllNodesToFinish()
|
||||||
|
@ -6,6 +6,9 @@ import net.corda.client.rpc.CordaRPCClient
|
|||||||
import net.corda.core.crypto.toBase58String
|
import net.corda.core.crypto.toBase58String
|
||||||
import net.corda.core.getOrThrow
|
import net.corda.core.getOrThrow
|
||||||
import net.corda.core.node.services.ServiceInfo
|
import net.corda.core.node.services.ServiceInfo
|
||||||
|
import net.corda.core.utilities.DUMMY_BANK_A
|
||||||
|
import net.corda.core.utilities.DUMMY_BANK_B
|
||||||
|
import net.corda.core.utilities.DUMMY_NOTARY
|
||||||
import net.corda.irs.api.NodeInterestRates
|
import net.corda.irs.api.NodeInterestRates
|
||||||
import net.corda.irs.contract.InterestRateSwap
|
import net.corda.irs.contract.InterestRateSwap
|
||||||
import net.corda.irs.utilities.postJson
|
import net.corda.irs.utilities.postJson
|
||||||
@ -31,9 +34,9 @@ class IRSDemoTest : IntegrationTestCategory {
|
|||||||
fun `runs IRS demo`() {
|
fun `runs IRS demo`() {
|
||||||
driver(useTestClock = true, isDebug = true) {
|
driver(useTestClock = true, isDebug = true) {
|
||||||
val (controller, nodeA, nodeB) = Futures.allAsList(
|
val (controller, nodeA, nodeB) = Futures.allAsList(
|
||||||
startNode("Notary", setOf(ServiceInfo(SimpleNotaryService.type), ServiceInfo(NodeInterestRates.type))),
|
startNode(DUMMY_NOTARY.name, setOf(ServiceInfo(SimpleNotaryService.type), ServiceInfo(NodeInterestRates.type))),
|
||||||
startNode("Bank A", rpcUsers = listOf(rpcUser)),
|
startNode(DUMMY_BANK_A.name, rpcUsers = listOf(rpcUser)),
|
||||||
startNode("Bank B")
|
startNode(DUMMY_BANK_B.name)
|
||||||
).getOrThrow()
|
).getOrThrow()
|
||||||
|
|
||||||
val (controllerAddr, nodeAAddr, nodeBAddr) = Futures.allAsList(
|
val (controllerAddr, nodeAAddr, nodeBAddr) = Futures.allAsList(
|
||||||
|
@ -3,6 +3,9 @@ package net.corda.irs
|
|||||||
import com.google.common.util.concurrent.Futures
|
import com.google.common.util.concurrent.Futures
|
||||||
import net.corda.core.getOrThrow
|
import net.corda.core.getOrThrow
|
||||||
import net.corda.core.node.services.ServiceInfo
|
import net.corda.core.node.services.ServiceInfo
|
||||||
|
import net.corda.core.utilities.DUMMY_BANK_A
|
||||||
|
import net.corda.core.utilities.DUMMY_BANK_B
|
||||||
|
import net.corda.core.utilities.DUMMY_NOTARY
|
||||||
import net.corda.irs.api.NodeInterestRates
|
import net.corda.irs.api.NodeInterestRates
|
||||||
import net.corda.node.driver.driver
|
import net.corda.node.driver.driver
|
||||||
import net.corda.node.services.transactions.SimpleNotaryService
|
import net.corda.node.services.transactions.SimpleNotaryService
|
||||||
@ -14,9 +17,9 @@ import net.corda.node.services.transactions.SimpleNotaryService
|
|||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
driver(dsl = {
|
driver(dsl = {
|
||||||
val (controller, nodeA, nodeB) = Futures.allAsList(
|
val (controller, nodeA, nodeB) = Futures.allAsList(
|
||||||
startNode("Notary", setOf(ServiceInfo(SimpleNotaryService.type), ServiceInfo(NodeInterestRates.type))),
|
startNode(DUMMY_NOTARY.name, setOf(ServiceInfo(SimpleNotaryService.type), ServiceInfo(NodeInterestRates.type))),
|
||||||
startNode("Bank A"),
|
startNode(DUMMY_BANK_A.name),
|
||||||
startNode("Bank B")
|
startNode(DUMMY_BANK_B.name)
|
||||||
).getOrThrow()
|
).getOrThrow()
|
||||||
|
|
||||||
startWebserver(controller)
|
startWebserver(controller)
|
||||||
|
@ -10,6 +10,8 @@ import net.corda.core.node.PhysicalLocation
|
|||||||
import net.corda.core.node.services.ServiceInfo
|
import net.corda.core.node.services.ServiceInfo
|
||||||
import net.corda.core.node.services.containsType
|
import net.corda.core.node.services.containsType
|
||||||
import net.corda.core.then
|
import net.corda.core.then
|
||||||
|
import net.corda.core.utilities.DUMMY_MAP
|
||||||
|
import net.corda.core.utilities.DUMMY_NOTARY
|
||||||
import net.corda.core.utilities.ProgressTracker
|
import net.corda.core.utilities.ProgressTracker
|
||||||
import net.corda.irs.api.NodeInterestRates
|
import net.corda.irs.api.NodeInterestRates
|
||||||
import net.corda.node.services.config.NodeConfiguration
|
import net.corda.node.services.config.NodeConfiguration
|
||||||
@ -91,7 +93,7 @@ abstract class Simulation(val networkSendManuallyPumped: Boolean,
|
|||||||
require(advertisedServices.containsType(NetworkMapService.type))
|
require(advertisedServices.containsType(NetworkMapService.type))
|
||||||
val cfg = TestNodeConfiguration(
|
val cfg = TestNodeConfiguration(
|
||||||
baseDirectory = config.baseDirectory,
|
baseDirectory = config.baseDirectory,
|
||||||
myLegalName = "Network coordination center",
|
myLegalName = DUMMY_MAP.name,
|
||||||
nearestCity = "Amsterdam",
|
nearestCity = "Amsterdam",
|
||||||
networkMapService = null)
|
networkMapService = null)
|
||||||
return object : SimulatedNode(cfg, network, networkMapAddr, advertisedServices, id, overrideServices, entropyRoot) {}
|
return object : SimulatedNode(cfg, network, networkMapAddr, advertisedServices, id, overrideServices, entropyRoot) {}
|
||||||
@ -105,7 +107,7 @@ abstract class Simulation(val networkSendManuallyPumped: Boolean,
|
|||||||
require(advertisedServices.containsType(SimpleNotaryService.type))
|
require(advertisedServices.containsType(SimpleNotaryService.type))
|
||||||
val cfg = TestNodeConfiguration(
|
val cfg = TestNodeConfiguration(
|
||||||
baseDirectory = config.baseDirectory,
|
baseDirectory = config.baseDirectory,
|
||||||
myLegalName = "Notary Service",
|
myLegalName = DUMMY_NOTARY.name,
|
||||||
nearestCity = "Zurich",
|
nearestCity = "Zurich",
|
||||||
networkMapService = null)
|
networkMapService = null)
|
||||||
return SimulatedNode(cfg, network, networkMapAddr, advertisedServices, id, overrideServices, entropyRoot)
|
return SimulatedNode(cfg, network, networkMapAddr, advertisedServices, id, overrideServices, entropyRoot)
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
package net.corda.notarydemo
|
package net.corda.notarydemo
|
||||||
|
|
||||||
import net.corda.core.div
|
import net.corda.core.div
|
||||||
|
import net.corda.core.utilities.ALICE
|
||||||
|
import net.corda.core.utilities.BOB
|
||||||
|
import net.corda.core.utilities.DUMMY_NOTARY
|
||||||
import net.corda.node.driver.driver
|
import net.corda.node.driver.driver
|
||||||
import net.corda.node.services.transactions.RaftValidatingNotaryService
|
import net.corda.node.services.transactions.RaftValidatingNotaryService
|
||||||
import net.corda.nodeapi.User
|
import net.corda.nodeapi.User
|
||||||
@ -10,9 +13,9 @@ import java.nio.file.Paths
|
|||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
val demoUser = listOf(User("demo", "demo", setOf("StartFlow.net.corda.notarydemo.flows.DummyIssueAndMove", "StartFlow.net.corda.flows.NotaryFlow\$Client")))
|
val demoUser = listOf(User("demo", "demo", setOf("StartFlow.net.corda.notarydemo.flows.DummyIssueAndMove", "StartFlow.net.corda.flows.NotaryFlow\$Client")))
|
||||||
driver(isDebug = true, driverDirectory = Paths.get("build") / "notary-demo-nodes") {
|
driver(isDebug = true, driverDirectory = Paths.get("build") / "notary-demo-nodes") {
|
||||||
startNode("Party", rpcUsers = demoUser)
|
startNode(ALICE.name, rpcUsers = demoUser)
|
||||||
startNode("Counterparty")
|
startNode(BOB.name)
|
||||||
startNotaryCluster("Raft notary", clusterSize = 3, type = RaftValidatingNotaryService.type)
|
startNotaryCluster(DUMMY_NOTARY.name, clusterSize = 3, type = RaftValidatingNotaryService.type)
|
||||||
waitForAllNodesToFinish()
|
waitForAllNodesToFinish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import net.corda.core.getOrThrow
|
|||||||
import net.corda.core.messaging.CordaRPCOps
|
import net.corda.core.messaging.CordaRPCOps
|
||||||
import net.corda.core.messaging.startFlow
|
import net.corda.core.messaging.startFlow
|
||||||
import net.corda.core.transactions.SignedTransaction
|
import net.corda.core.transactions.SignedTransaction
|
||||||
|
import net.corda.core.utilities.BOB
|
||||||
import net.corda.flows.NotaryFlow
|
import net.corda.flows.NotaryFlow
|
||||||
import net.corda.nodeapi.config.SSLConfiguration
|
import net.corda.nodeapi.config.SSLConfiguration
|
||||||
import net.corda.notarydemo.flows.DummyIssueAndMove
|
import net.corda.notarydemo.flows.DummyIssueAndMove
|
||||||
@ -33,7 +34,7 @@ private class NotaryDemoClientApi(val rpc: CordaRPCOps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private val counterpartyNode by lazy {
|
private val counterpartyNode by lazy {
|
||||||
rpc.networkMapUpdates().first.first { it.legalIdentity.name == "Counterparty" }
|
rpc.networkMapUpdates().first.first { it.legalIdentity.name == BOB.name }
|
||||||
}
|
}
|
||||||
|
|
||||||
private companion object {
|
private companion object {
|
||||||
|
@ -4,6 +4,9 @@ import com.google.common.util.concurrent.Futures
|
|||||||
import com.opengamma.strata.product.common.BuySell
|
import com.opengamma.strata.product.common.BuySell
|
||||||
import net.corda.core.getOrThrow
|
import net.corda.core.getOrThrow
|
||||||
import net.corda.core.node.services.ServiceInfo
|
import net.corda.core.node.services.ServiceInfo
|
||||||
|
import net.corda.core.utilities.DUMMY_BANK_A
|
||||||
|
import net.corda.core.utilities.DUMMY_BANK_B
|
||||||
|
import net.corda.core.utilities.DUMMY_NOTARY
|
||||||
import net.corda.node.driver.driver
|
import net.corda.node.driver.driver
|
||||||
import net.corda.node.services.transactions.SimpleNotaryService
|
import net.corda.node.services.transactions.SimpleNotaryService
|
||||||
import net.corda.testing.IntegrationTestCategory
|
import net.corda.testing.IntegrationTestCategory
|
||||||
@ -20,14 +23,14 @@ class SimmValuationTest : IntegrationTestCategory {
|
|||||||
private companion object {
|
private companion object {
|
||||||
// SIMM demo can only currently handle one valuation date due to a lack of market data or a market data source.
|
// SIMM demo can only currently handle one valuation date due to a lack of market data or a market data source.
|
||||||
val valuationDate = LocalDate.parse("2016-06-06")
|
val valuationDate = LocalDate.parse("2016-06-06")
|
||||||
val nodeALegalName = "Bank A"
|
val nodeALegalName = DUMMY_BANK_A.name
|
||||||
val nodeBLegalName = "Bank B"
|
val nodeBLegalName = DUMMY_BANK_B.name
|
||||||
val testTradeId = "trade1"
|
val testTradeId = "trade1"
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun `runs SIMM valuation demo`() {
|
@Test fun `runs SIMM valuation demo`() {
|
||||||
driver(isDebug = true) {
|
driver(isDebug = true) {
|
||||||
startNode("Controller", setOf(ServiceInfo(SimpleNotaryService.type))).getOrThrow()
|
startNode(DUMMY_NOTARY.name, setOf(ServiceInfo(SimpleNotaryService.type))).getOrThrow()
|
||||||
val (nodeA, nodeB) = Futures.allAsList(startNode(nodeALegalName), startNode(nodeBLegalName)).getOrThrow()
|
val (nodeA, nodeB) = Futures.allAsList(startNode(nodeALegalName), startNode(nodeBLegalName)).getOrThrow()
|
||||||
val (nodeAApi, nodeBApi) = Futures.allAsList(startWebserver(nodeA), startWebserver(nodeB))
|
val (nodeAApi, nodeBApi) = Futures.allAsList(startWebserver(nodeA), startWebserver(nodeB))
|
||||||
.getOrThrow()
|
.getOrThrow()
|
||||||
|
@ -3,6 +3,9 @@ package net.corda.vega
|
|||||||
import com.google.common.util.concurrent.Futures
|
import com.google.common.util.concurrent.Futures
|
||||||
import net.corda.core.getOrThrow
|
import net.corda.core.getOrThrow
|
||||||
import net.corda.core.node.services.ServiceInfo
|
import net.corda.core.node.services.ServiceInfo
|
||||||
|
import net.corda.core.utilities.DUMMY_BANK_A
|
||||||
|
import net.corda.core.utilities.DUMMY_BANK_B
|
||||||
|
import net.corda.core.utilities.DUMMY_BANK_C
|
||||||
import net.corda.node.driver.driver
|
import net.corda.node.driver.driver
|
||||||
import net.corda.node.services.transactions.SimpleNotaryService
|
import net.corda.node.services.transactions.SimpleNotaryService
|
||||||
|
|
||||||
@ -15,9 +18,9 @@ fun main(args: Array<String>) {
|
|||||||
driver(dsl = {
|
driver(dsl = {
|
||||||
startNode("Controller", setOf(ServiceInfo(SimpleNotaryService.type)))
|
startNode("Controller", setOf(ServiceInfo(SimpleNotaryService.type)))
|
||||||
val (nodeA, nodeB, nodeC) = Futures.allAsList(
|
val (nodeA, nodeB, nodeC) = Futures.allAsList(
|
||||||
startNode("Bank A"),
|
startNode(DUMMY_BANK_A.name),
|
||||||
startNode("Bank B"),
|
startNode(DUMMY_BANK_B.name),
|
||||||
startNode("Bank C")
|
startNode(DUMMY_BANK_C.name)
|
||||||
).getOrThrow()
|
).getOrThrow()
|
||||||
|
|
||||||
startWebserver(nodeA)
|
startWebserver(nodeA)
|
||||||
|
@ -8,6 +8,8 @@ import net.corda.core.crypto.*
|
|||||||
import net.corda.core.getOrThrow
|
import net.corda.core.getOrThrow
|
||||||
import net.corda.core.messaging.CordaRPCOps
|
import net.corda.core.messaging.CordaRPCOps
|
||||||
import net.corda.core.messaging.startFlow
|
import net.corda.core.messaging.startFlow
|
||||||
|
import net.corda.core.utilities.DUMMY_MAP
|
||||||
|
import net.corda.core.utilities.DUMMY_NOTARY
|
||||||
import net.corda.vega.analytics.InitialMarginTriple
|
import net.corda.vega.analytics.InitialMarginTriple
|
||||||
import net.corda.vega.contracts.IRSState
|
import net.corda.vega.contracts.IRSState
|
||||||
import net.corda.vega.contracts.PortfolioState
|
import net.corda.vega.contracts.PortfolioState
|
||||||
@ -246,7 +248,9 @@ class PortfolioApi(val rpc: CordaRPCOps) {
|
|||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
fun getWhoAmI(): AvailableParties {
|
fun getWhoAmI(): AvailableParties {
|
||||||
val counterParties = rpc.networkMapUpdates().first.filter {
|
val counterParties = rpc.networkMapUpdates().first.filter {
|
||||||
it.legalIdentity.name != "NetworkMapService" && it.legalIdentity.name != "Notary" && it.legalIdentity.name != ownParty.name
|
it.legalIdentity.name != DUMMY_MAP.name
|
||||||
|
&& it.legalIdentity.name != DUMMY_NOTARY.name
|
||||||
|
&& it.legalIdentity.name != ownParty.name
|
||||||
}
|
}
|
||||||
|
|
||||||
return AvailableParties(
|
return AvailableParties(
|
||||||
|
@ -4,10 +4,14 @@ import com.google.common.util.concurrent.Futures
|
|||||||
import net.corda.client.rpc.CordaRPCClient
|
import net.corda.client.rpc.CordaRPCClient
|
||||||
import net.corda.core.getOrThrow
|
import net.corda.core.getOrThrow
|
||||||
import net.corda.core.node.services.ServiceInfo
|
import net.corda.core.node.services.ServiceInfo
|
||||||
|
import net.corda.core.utilities.DUMMY_BANK_A
|
||||||
|
import net.corda.core.utilities.DUMMY_BANK_B
|
||||||
|
import net.corda.core.utilities.DUMMY_NOTARY
|
||||||
import net.corda.flows.IssuerFlow
|
import net.corda.flows.IssuerFlow
|
||||||
import net.corda.node.services.startFlowPermission
|
import net.corda.node.services.startFlowPermission
|
||||||
import net.corda.node.services.transactions.SimpleNotaryService
|
import net.corda.node.services.transactions.SimpleNotaryService
|
||||||
import net.corda.nodeapi.User
|
import net.corda.nodeapi.User
|
||||||
|
import net.corda.testing.BOC
|
||||||
import net.corda.testing.node.NodeBasedTest
|
import net.corda.testing.node.NodeBasedTest
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
@ -20,10 +24,10 @@ class TraderDemoTest : NodeBasedTest() {
|
|||||||
val demoUser = listOf(User("demo", "demo", permissions))
|
val demoUser = listOf(User("demo", "demo", permissions))
|
||||||
val user = User("user1", "test", permissions = setOf(startFlowPermission<IssuerFlow.IssuanceRequester>()))
|
val user = User("user1", "test", permissions = setOf(startFlowPermission<IssuerFlow.IssuanceRequester>()))
|
||||||
val (nodeA, nodeB) = Futures.allAsList(
|
val (nodeA, nodeB) = Futures.allAsList(
|
||||||
startNode("Bank A", rpcUsers = demoUser),
|
startNode(DUMMY_BANK_A.name, rpcUsers = demoUser),
|
||||||
startNode("Bank B", rpcUsers = demoUser),
|
startNode(DUMMY_BANK_B.name, rpcUsers = demoUser),
|
||||||
startNode("BankOfCorda", rpcUsers = listOf(user)),
|
startNode(BOC.name, rpcUsers = listOf(user)),
|
||||||
startNode("Notary", setOf(ServiceInfo(SimpleNotaryService.type)))
|
startNode(DUMMY_NOTARY.name, setOf(ServiceInfo(SimpleNotaryService.type)))
|
||||||
).getOrThrow()
|
).getOrThrow()
|
||||||
|
|
||||||
val (nodeARpc, nodeBRpc) = listOf(nodeA, nodeB).map {
|
val (nodeARpc, nodeBRpc) = listOf(nodeA, nodeB).map {
|
||||||
|
@ -2,6 +2,7 @@ package net.corda.traderdemo
|
|||||||
|
|
||||||
import net.corda.core.div
|
import net.corda.core.div
|
||||||
import net.corda.core.node.services.ServiceInfo
|
import net.corda.core.node.services.ServiceInfo
|
||||||
|
import net.corda.core.utilities.DUMMY_NOTARY
|
||||||
import net.corda.flows.IssuerFlow
|
import net.corda.flows.IssuerFlow
|
||||||
import net.corda.node.driver.driver
|
import net.corda.node.driver.driver
|
||||||
import net.corda.node.services.startFlowPermission
|
import net.corda.node.services.startFlowPermission
|
||||||
@ -9,6 +10,9 @@ import net.corda.node.services.transactions.SimpleNotaryService
|
|||||||
import net.corda.nodeapi.User
|
import net.corda.nodeapi.User
|
||||||
import net.corda.testing.BOC
|
import net.corda.testing.BOC
|
||||||
import java.nio.file.Paths
|
import java.nio.file.Paths
|
||||||
|
import net.corda.core.utilities.DUMMY_BANK_A
|
||||||
|
import net.corda.core.utilities.DUMMY_BANK_B
|
||||||
|
import net.corda.core.utilities.DUMMY_NOTARY
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This file is exclusively for being able to run your nodes through an IDE (as opposed to running deployNodes)
|
* This file is exclusively for being able to run your nodes through an IDE (as opposed to running deployNodes)
|
||||||
@ -21,9 +25,9 @@ fun main(args: Array<String>) {
|
|||||||
val demoUser = listOf(User("demo", "demo", permissions))
|
val demoUser = listOf(User("demo", "demo", permissions))
|
||||||
driver(driverDirectory = Paths.get("build") / "trader-demo-nodes", isDebug = true) {
|
driver(driverDirectory = Paths.get("build") / "trader-demo-nodes", isDebug = true) {
|
||||||
val user = User("user1", "test", permissions = setOf(startFlowPermission<IssuerFlow.IssuanceRequester>()))
|
val user = User("user1", "test", permissions = setOf(startFlowPermission<IssuerFlow.IssuanceRequester>()))
|
||||||
startNode("Notary", setOf(ServiceInfo(SimpleNotaryService.type)))
|
startNode(DUMMY_NOTARY.name, setOf(ServiceInfo(SimpleNotaryService.type)))
|
||||||
startNode("Bank A", rpcUsers = demoUser)
|
startNode(DUMMY_BANK_A.name, rpcUsers = demoUser)
|
||||||
startNode("Bank B", rpcUsers = demoUser)
|
startNode(DUMMY_BANK_B.name, rpcUsers = demoUser)
|
||||||
startNode(BOC.name, rpcUsers = listOf(user))
|
startNode(BOC.name, rpcUsers = listOf(user))
|
||||||
waitForAllNodesToFinish()
|
waitForAllNodesToFinish()
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,7 @@ import net.corda.core.node.Version
|
|||||||
import net.corda.core.serialization.OpaqueBytes
|
import net.corda.core.serialization.OpaqueBytes
|
||||||
import net.corda.core.toFuture
|
import net.corda.core.toFuture
|
||||||
import net.corda.core.transactions.TransactionBuilder
|
import net.corda.core.transactions.TransactionBuilder
|
||||||
import net.corda.core.utilities.DUMMY_NOTARY
|
import net.corda.core.utilities.*
|
||||||
import net.corda.core.utilities.DUMMY_NOTARY_KEY
|
|
||||||
import net.corda.node.internal.AbstractNode
|
import net.corda.node.internal.AbstractNode
|
||||||
import net.corda.node.internal.NetworkMapInfo
|
import net.corda.node.internal.NetworkMapInfo
|
||||||
import net.corda.node.services.config.*
|
import net.corda.node.services.config.*
|
||||||
@ -63,17 +62,9 @@ val MINI_CORP_PUBKEY: PublicKey get() = MINI_CORP_KEY.public
|
|||||||
val ORACLE_KEY: KeyPair by lazy { generateKeyPair() }
|
val ORACLE_KEY: KeyPair by lazy { generateKeyPair() }
|
||||||
val ORACLE_PUBKEY: PublicKey get() = ORACLE_KEY.public
|
val ORACLE_PUBKEY: PublicKey get() = ORACLE_KEY.public
|
||||||
|
|
||||||
val ALICE_KEY: KeyPair by lazy { generateKeyPair() }
|
|
||||||
val ALICE_PUBKEY: PublicKey get() = ALICE_KEY.public
|
val ALICE_PUBKEY: PublicKey get() = ALICE_KEY.public
|
||||||
val ALICE: Party get() = Party("Alice", ALICE_PUBKEY)
|
|
||||||
|
|
||||||
val BOB_KEY: KeyPair by lazy { generateKeyPair() }
|
|
||||||
val BOB_PUBKEY: PublicKey get() = BOB_KEY.public
|
val BOB_PUBKEY: PublicKey get() = BOB_KEY.public
|
||||||
val BOB: Party get() = Party("Bob", BOB_PUBKEY)
|
|
||||||
|
|
||||||
val CHARLIE_KEY: KeyPair by lazy { generateKeyPair() }
|
|
||||||
val CHARLIE_PUBKEY: PublicKey get() = CHARLIE_KEY.public
|
val CHARLIE_PUBKEY: PublicKey get() = CHARLIE_KEY.public
|
||||||
val CHARLIE: Party get() = Party("Charlie", CHARLIE_PUBKEY)
|
|
||||||
|
|
||||||
val MEGA_CORP: Party get() = Party("MegaCorp", MEGA_CORP_PUBKEY)
|
val MEGA_CORP: Party get() = Party("MegaCorp", MEGA_CORP_PUBKEY)
|
||||||
val MINI_CORP: Party get() = Party("MiniCorp", MINI_CORP_PUBKEY)
|
val MINI_CORP: Party get() = Party("MiniCorp", MINI_CORP_PUBKEY)
|
||||||
|
@ -8,6 +8,7 @@ import net.corda.core.flatMap
|
|||||||
import net.corda.core.map
|
import net.corda.core.map
|
||||||
import net.corda.core.node.services.ServiceInfo
|
import net.corda.core.node.services.ServiceInfo
|
||||||
import net.corda.core.node.services.ServiceType
|
import net.corda.core.node.services.ServiceType
|
||||||
|
import net.corda.core.utilities.DUMMY_MAP
|
||||||
import net.corda.node.internal.Node
|
import net.corda.node.internal.Node
|
||||||
import net.corda.node.services.config.ConfigHelper
|
import net.corda.node.services.config.ConfigHelper
|
||||||
import net.corda.node.services.config.FullNodeConfiguration
|
import net.corda.node.services.config.FullNodeConfiguration
|
||||||
@ -53,7 +54,7 @@ abstract class NodeBasedTest {
|
|||||||
* You can use this method to start the network map node in a more customised manner. Otherwise it
|
* You can use this method to start the network map node in a more customised manner. Otherwise it
|
||||||
* will automatically be started with the default parameters.
|
* will automatically be started with the default parameters.
|
||||||
*/
|
*/
|
||||||
fun startNetworkMapNode(legalName: String = "Network Map",
|
fun startNetworkMapNode(legalName: String = DUMMY_MAP.name,
|
||||||
advertisedServices: Set<ServiceInfo> = emptySet(),
|
advertisedServices: Set<ServiceInfo> = emptySet(),
|
||||||
rpcUsers: List<User> = emptyList(),
|
rpcUsers: List<User> = emptyList(),
|
||||||
configOverrides: Map<String, Any> = emptyMap()): Node {
|
configOverrides: Map<String, Any> = emptyMap()): Node {
|
||||||
|
@ -6,6 +6,7 @@ import javafx.scene.input.KeyCode
|
|||||||
import javafx.scene.layout.Pane
|
import javafx.scene.layout.Pane
|
||||||
import javafx.stage.FileChooser
|
import javafx.stage.FileChooser
|
||||||
import javafx.util.converter.NumberStringConverter
|
import javafx.util.converter.NumberStringConverter
|
||||||
|
import net.corda.core.utilities.DUMMY_NOTARY
|
||||||
import net.corda.demobench.model.*
|
import net.corda.demobench.model.*
|
||||||
import net.corda.demobench.ui.CloseableTab
|
import net.corda.demobench.ui.CloseableTab
|
||||||
import tornadofx.*
|
import tornadofx.*
|
||||||
@ -115,7 +116,7 @@ class NodeTabView : Fragment() {
|
|||||||
root.add(nodeConfigView)
|
root.add(nodeConfigView)
|
||||||
root.add(nodeTerminalView)
|
root.add(nodeTerminalView)
|
||||||
|
|
||||||
model.legalName.value = if (nodeController.hasNetworkMap()) "" else "Notary"
|
model.legalName.value = if (nodeController.hasNetworkMap()) "" else DUMMY_NOTARY.name
|
||||||
model.p2pPort.value = nodeController.nextPort
|
model.p2pPort.value = nodeController.nextPort
|
||||||
model.rpcPort.value = nodeController.nextPort
|
model.rpcPort.value = nodeController.nextPort
|
||||||
model.webPort.value = nodeController.nextPort
|
model.webPort.value = nodeController.nextPort
|
||||||
|
@ -4,6 +4,7 @@ import com.google.common.net.HostAndPort
|
|||||||
import com.typesafe.config.ConfigFactory
|
import com.typesafe.config.ConfigFactory
|
||||||
import com.typesafe.config.ConfigValueFactory
|
import com.typesafe.config.ConfigValueFactory
|
||||||
import net.corda.core.div
|
import net.corda.core.div
|
||||||
|
import net.corda.core.utilities.DUMMY_NOTARY
|
||||||
import net.corda.node.internal.NetworkMapInfo
|
import net.corda.node.internal.NetworkMapInfo
|
||||||
import net.corda.node.services.config.FullNodeConfiguration
|
import net.corda.node.services.config.FullNodeConfiguration
|
||||||
import net.corda.nodeapi.User
|
import net.corda.nodeapi.User
|
||||||
@ -152,14 +153,14 @@ class NodeConfigTest {
|
|||||||
services = listOf("my.service"),
|
services = listOf("my.service"),
|
||||||
users = listOf(user("jenny"))
|
users = listOf(user("jenny"))
|
||||||
)
|
)
|
||||||
config.networkMap = NetworkMapConfig("Notary", 12345)
|
config.networkMap = NetworkMapConfig(DUMMY_NOTARY.name, 12345)
|
||||||
|
|
||||||
assertEquals("{"
|
assertEquals("{"
|
||||||
+ "\"extraAdvertisedServiceIds\":[\"my.service\"],"
|
+ "\"extraAdvertisedServiceIds\":[\"my.service\"],"
|
||||||
+ "\"h2port\":30001,"
|
+ "\"h2port\":30001,"
|
||||||
+ "\"myLegalName\":\"MyName\","
|
+ "\"myLegalName\":\"MyName\","
|
||||||
+ "\"nearestCity\":\"Stockholm\","
|
+ "\"nearestCity\":\"Stockholm\","
|
||||||
+ "\"networkMapService\":{\"address\":\"localhost:12345\",\"legalName\":\"Notary\"},"
|
+ "\"networkMapService\":{\"address\":\"localhost:12345\",\"legalName\":\"NotaryService\"},"
|
||||||
+ "\"p2pAddress\":\"localhost:10001\","
|
+ "\"p2pAddress\":\"localhost:10001\","
|
||||||
+ "\"rpcAddress\":\"localhost:40002\","
|
+ "\"rpcAddress\":\"localhost:40002\","
|
||||||
+ "\"rpcUsers\":["
|
+ "\"rpcUsers\":["
|
||||||
@ -182,7 +183,7 @@ class NodeConfigTest {
|
|||||||
services = listOf("my.service"),
|
services = listOf("my.service"),
|
||||||
users = listOf(user("jenny"))
|
users = listOf(user("jenny"))
|
||||||
)
|
)
|
||||||
config.networkMap = NetworkMapConfig("Notary", 12345)
|
config.networkMap = NetworkMapConfig(DUMMY_NOTARY.name, 12345)
|
||||||
|
|
||||||
val nodeConfig = config.toFileConfig()
|
val nodeConfig = config.toFileConfig()
|
||||||
.withValue("basedir", ConfigValueFactory.fromAnyRef(baseDir.toString()))
|
.withValue("basedir", ConfigValueFactory.fromAnyRef(baseDir.toString()))
|
||||||
@ -196,7 +197,7 @@ class NodeConfigTest {
|
|||||||
assertEquals(localPort(10001), fullConfig.p2pAddress)
|
assertEquals(localPort(10001), fullConfig.p2pAddress)
|
||||||
assertEquals(listOf("my.service"), fullConfig.extraAdvertisedServiceIds)
|
assertEquals(listOf("my.service"), fullConfig.extraAdvertisedServiceIds)
|
||||||
assertEquals(listOf(user("jenny")), fullConfig.rpcUsers)
|
assertEquals(listOf(user("jenny")), fullConfig.rpcUsers)
|
||||||
assertEquals(NetworkMapInfo(localPort(12345), "Notary"), fullConfig.networkMapService)
|
assertEquals(NetworkMapInfo(localPort(12345), DUMMY_NOTARY.name), fullConfig.networkMapService)
|
||||||
assertTrue((fullConfig.dataSourceProperties["dataSource.url"] as String).contains("AUTO_SERVER_PORT=30001"))
|
assertTrue((fullConfig.dataSourceProperties["dataSource.url"] as String).contains("AUTO_SERVER_PORT=30001"))
|
||||||
assertTrue(fullConfig.useTestClock)
|
assertTrue(fullConfig.useTestClock)
|
||||||
}
|
}
|
||||||
@ -213,7 +214,7 @@ class NodeConfigTest {
|
|||||||
services = listOf("my.service"),
|
services = listOf("my.service"),
|
||||||
users = listOf(user("jenny"))
|
users = listOf(user("jenny"))
|
||||||
)
|
)
|
||||||
config.networkMap = NetworkMapConfig("Notary", 12345)
|
config.networkMap = NetworkMapConfig(DUMMY_NOTARY.name, 12345)
|
||||||
|
|
||||||
val nodeConfig = config.toFileConfig()
|
val nodeConfig = config.toFileConfig()
|
||||||
.withValue("basedir", ConfigValueFactory.fromAnyRef(baseDir.toString()))
|
.withValue("basedir", ConfigValueFactory.fromAnyRef(baseDir.toString()))
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package net.corda.demobench.model
|
package net.corda.demobench.model
|
||||||
|
|
||||||
|
import net.corda.core.utilities.DUMMY_NOTARY
|
||||||
import net.corda.nodeapi.User
|
import net.corda.nodeapi.User
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
@ -96,7 +97,7 @@ class NodeControllerTest {
|
|||||||
@Test
|
@Test
|
||||||
fun `test register non-network-map node`() {
|
fun `test register non-network-map node`() {
|
||||||
val config = createConfig(legalName = "Node is not Network Map")
|
val config = createConfig(legalName = "Node is not Network Map")
|
||||||
config.networkMap = NetworkMapConfig("Notary", 10000)
|
config.networkMap = NetworkMapConfig(DUMMY_NOTARY.name, 10000)
|
||||||
assertFalse(config.isNetworkMap())
|
assertFalse(config.isNetworkMap())
|
||||||
|
|
||||||
assertFalse(controller.hasNetworkMap())
|
assertFalse(controller.hasNetworkMap())
|
||||||
|
@ -26,6 +26,9 @@ import net.corda.core.node.services.ServiceType
|
|||||||
import net.corda.core.serialization.OpaqueBytes
|
import net.corda.core.serialization.OpaqueBytes
|
||||||
import net.corda.core.success
|
import net.corda.core.success
|
||||||
import net.corda.core.transactions.SignedTransaction
|
import net.corda.core.transactions.SignedTransaction
|
||||||
|
import net.corda.core.utilities.ALICE
|
||||||
|
import net.corda.core.utilities.BOB
|
||||||
|
import net.corda.core.utilities.DUMMY_NOTARY
|
||||||
import net.corda.core.utilities.loggerFor
|
import net.corda.core.utilities.loggerFor
|
||||||
import net.corda.explorer.model.CordaViewModel
|
import net.corda.explorer.model.CordaViewModel
|
||||||
import net.corda.explorer.model.SettingsModel
|
import net.corda.explorer.model.SettingsModel
|
||||||
@ -162,12 +165,12 @@ fun main(args: Array<String>) {
|
|||||||
startFlowPermission<IssuanceRequester>())
|
startFlowPermission<IssuanceRequester>())
|
||||||
)
|
)
|
||||||
// TODO : Supported flow should be exposed somehow from the node instead of set of ServiceInfo.
|
// TODO : Supported flow should be exposed somehow from the node instead of set of ServiceInfo.
|
||||||
val notary = startNode("Notary", advertisedServices = setOf(ServiceInfo(SimpleNotaryService.type)),
|
val notary = startNode(DUMMY_NOTARY.name, advertisedServices = setOf(ServiceInfo(SimpleNotaryService.type)),
|
||||||
customOverrides = mapOf("nearestCity" to "Zurich"))
|
customOverrides = mapOf("nearestCity" to "Zurich"))
|
||||||
val alice = startNode("Alice", rpcUsers = arrayListOf(user),
|
val alice = startNode(ALICE.name, rpcUsers = arrayListOf(user),
|
||||||
advertisedServices = setOf(ServiceInfo(ServiceType.corda.getSubType("cash"))),
|
advertisedServices = setOf(ServiceInfo(ServiceType.corda.getSubType("cash"))),
|
||||||
customOverrides = mapOf("nearestCity" to "Milan"))
|
customOverrides = mapOf("nearestCity" to "Milan"))
|
||||||
val bob = startNode("Bob", rpcUsers = arrayListOf(user),
|
val bob = startNode(BOB.name, rpcUsers = arrayListOf(user),
|
||||||
advertisedServices = setOf(ServiceInfo(ServiceType.corda.getSubType("cash"))),
|
advertisedServices = setOf(ServiceInfo(ServiceType.corda.getSubType("cash"))),
|
||||||
customOverrides = mapOf("nearestCity" to "Madrid"))
|
customOverrides = mapOf("nearestCity" to "Madrid"))
|
||||||
val issuerGBP = startNode("UK Bank Plc", rpcUsers = arrayListOf(manager),
|
val issuerGBP = startNode("UK Bank Plc", rpcUsers = arrayListOf(manager),
|
||||||
|
@ -9,6 +9,8 @@ import net.corda.core.node.services.ServiceInfo
|
|||||||
import net.corda.core.serialization.OpaqueBytes
|
import net.corda.core.serialization.OpaqueBytes
|
||||||
import net.corda.core.transactions.LedgerTransaction
|
import net.corda.core.transactions.LedgerTransaction
|
||||||
import net.corda.core.transactions.WireTransaction
|
import net.corda.core.transactions.WireTransaction
|
||||||
|
import net.corda.core.utilities.ALICE
|
||||||
|
import net.corda.core.utilities.DUMMY_NOTARY
|
||||||
import net.corda.flows.CashIssueFlow
|
import net.corda.flows.CashIssueFlow
|
||||||
import net.corda.flows.CashPaymentFlow
|
import net.corda.flows.CashPaymentFlow
|
||||||
import net.corda.node.services.config.VerifierType
|
import net.corda.node.services.config.VerifierType
|
||||||
@ -33,7 +35,7 @@ class VerifierTests {
|
|||||||
@Test
|
@Test
|
||||||
fun `single verifier works with requestor`() {
|
fun `single verifier works with requestor`() {
|
||||||
verifierDriver(automaticallyStartNetworkMap = false) {
|
verifierDriver(automaticallyStartNetworkMap = false) {
|
||||||
val aliceFuture = startVerificationRequestor("Alice")
|
val aliceFuture = startVerificationRequestor(ALICE.name)
|
||||||
val transactions = generateTransactions(100)
|
val transactions = generateTransactions(100)
|
||||||
val alice = aliceFuture.get()
|
val alice = aliceFuture.get()
|
||||||
startVerifier(alice)
|
startVerifier(alice)
|
||||||
@ -50,7 +52,7 @@ class VerifierTests {
|
|||||||
@Test
|
@Test
|
||||||
fun `multiple verifiers work with requestor`() {
|
fun `multiple verifiers work with requestor`() {
|
||||||
verifierDriver(automaticallyStartNetworkMap = false) {
|
verifierDriver(automaticallyStartNetworkMap = false) {
|
||||||
val aliceFuture = startVerificationRequestor("Alice")
|
val aliceFuture = startVerificationRequestor(ALICE.name)
|
||||||
val transactions = generateTransactions(100)
|
val transactions = generateTransactions(100)
|
||||||
val alice = aliceFuture.get()
|
val alice = aliceFuture.get()
|
||||||
val numberOfVerifiers = 4
|
val numberOfVerifiers = 4
|
||||||
@ -70,7 +72,7 @@ class VerifierTests {
|
|||||||
@Test
|
@Test
|
||||||
fun `verification redistributes on verifier death`() {
|
fun `verification redistributes on verifier death`() {
|
||||||
verifierDriver(automaticallyStartNetworkMap = false) {
|
verifierDriver(automaticallyStartNetworkMap = false) {
|
||||||
val aliceFuture = startVerificationRequestor("Alice")
|
val aliceFuture = startVerificationRequestor(ALICE.name)
|
||||||
val numberOfTransactions = 100
|
val numberOfTransactions = 100
|
||||||
val transactions = generateTransactions(numberOfTransactions)
|
val transactions = generateTransactions(numberOfTransactions)
|
||||||
val alice = aliceFuture.get()
|
val alice = aliceFuture.get()
|
||||||
@ -98,7 +100,7 @@ class VerifierTests {
|
|||||||
@Test
|
@Test
|
||||||
fun `verification request waits until verifier comes online`() {
|
fun `verification request waits until verifier comes online`() {
|
||||||
verifierDriver(automaticallyStartNetworkMap = false) {
|
verifierDriver(automaticallyStartNetworkMap = false) {
|
||||||
val aliceFuture = startVerificationRequestor("Alice")
|
val aliceFuture = startVerificationRequestor(ALICE.name)
|
||||||
val transactions = generateTransactions(100)
|
val transactions = generateTransactions(100)
|
||||||
val alice = aliceFuture.get()
|
val alice = aliceFuture.get()
|
||||||
val futures = transactions.map { alice.verifyTransaction(it) }
|
val futures = transactions.map { alice.verifyTransaction(it) }
|
||||||
@ -110,8 +112,8 @@ class VerifierTests {
|
|||||||
@Test
|
@Test
|
||||||
fun `single verifier works with a node`() {
|
fun `single verifier works with a node`() {
|
||||||
verifierDriver {
|
verifierDriver {
|
||||||
val aliceFuture = startNode("Alice")
|
val aliceFuture = startNode(ALICE.name)
|
||||||
val notaryFuture = startNode("Notary", advertisedServices = setOf(ServiceInfo(ValidatingNotaryService.type)), verifierType = VerifierType.OutOfProcess)
|
val notaryFuture = startNode(DUMMY_NOTARY.name, advertisedServices = setOf(ServiceInfo(ValidatingNotaryService.type)), verifierType = VerifierType.OutOfProcess)
|
||||||
val alice = aliceFuture.get()
|
val alice = aliceFuture.get()
|
||||||
val notary = notaryFuture.get()
|
val notary = notaryFuture.get()
|
||||||
startVerifier(notary)
|
startVerifier(notary)
|
||||||
|
@ -2,6 +2,7 @@ package net.corda.webserver
|
|||||||
|
|
||||||
import com.google.common.net.HostAndPort
|
import com.google.common.net.HostAndPort
|
||||||
import net.corda.core.getOrThrow
|
import net.corda.core.getOrThrow
|
||||||
|
import net.corda.core.utilities.DUMMY_BANK_A
|
||||||
import net.corda.node.driver.addressMustBeBound
|
import net.corda.node.driver.addressMustBeBound
|
||||||
import net.corda.node.driver.addressMustNotBeBound
|
import net.corda.node.driver.addressMustNotBeBound
|
||||||
import net.corda.node.driver.driver
|
import net.corda.node.driver.driver
|
||||||
@ -24,7 +25,7 @@ class DriverTests {
|
|||||||
@Test
|
@Test
|
||||||
fun `starting a node and independent web server works`() {
|
fun `starting a node and independent web server works`() {
|
||||||
val addr = driver {
|
val addr = driver {
|
||||||
val node = startNode("test").getOrThrow()
|
val node = startNode(DUMMY_BANK_A.name).getOrThrow()
|
||||||
val webserverAddr = startWebserver(node).getOrThrow()
|
val webserverAddr = startWebserver(node).getOrThrow()
|
||||||
webserverMustBeUp(webserverAddr)
|
webserverMustBeUp(webserverAddr)
|
||||||
webserverAddr
|
webserverAddr
|
||||||
|
Loading…
x
Reference in New Issue
Block a user