mirror of
https://github.com/corda/corda.git
synced 2024-12-18 20:47:57 +00:00
Fixing Bank-Of-Corda Demo in master
(#1922)
* Fix-up: Bank Of Corda sample Use correct CorDapp packages to scan (cherry picked from commit2caa134
) * Set adequate permissions for the nodes such that NodeExplorer can connect (cherry picked from commitae88242
) * Set adequate permissions for the nodes such that NodeExplorer can connect (cherry picked from commitae88242
) * Correct run configuration * Fix-up port numbers
This commit is contained in:
parent
931ab120fc
commit
cbb5135097
15
.idea/runConfigurations/BankOfCordaDriverKt___Issue_Web.xml
generated
Normal file
15
.idea/runConfigurations/BankOfCordaDriverKt___Issue_Web.xml
generated
Normal file
@ -0,0 +1,15 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="BankOfCordaDriverKt - Issue Web" type="JetRunConfigurationType" factoryName="Kotlin">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<option name="MAIN_CLASS_NAME" value="net.corda.bank.BankOfCordaDriverKt" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="--role ISSUE_CASH_WEB --quantity 100 --currency USD" />
|
||||
<option name="WORKING_DIRECTORY" value="" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<module name="bank-of-corda-demo_main" />
|
||||
<envs />
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
15
.idea/runConfigurations/BankOfCordaDriverKt___Run_Stack.xml
generated
Normal file
15
.idea/runConfigurations/BankOfCordaDriverKt___Run_Stack.xml
generated
Normal file
@ -0,0 +1,15 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="BankOfCordaDriverKt - Run Stack" type="JetRunConfigurationType" factoryName="Kotlin">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<option name="MAIN_CLASS_NAME" value="net.corda.bank.BankOfCordaDriverKt" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="--role ISSUER" />
|
||||
<option name="WORKING_DIRECTORY" value="" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<module name="bank-of-corda-demo_main" />
|
||||
<envs />
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
@ -5,6 +5,7 @@ import net.corda.bank.api.BankOfCordaClientApi
|
||||
import net.corda.bank.api.BankOfCordaWebApi.IssueRequestParams
|
||||
import net.corda.core.identity.CordaX500Name
|
||||
import net.corda.core.utilities.NetworkHostAndPort
|
||||
import net.corda.finance.flows.CashConfigDataFlow
|
||||
import net.corda.finance.flows.CashExitFlow
|
||||
import net.corda.finance.flows.CashIssueAndPaymentFlow
|
||||
import net.corda.finance.flows.CashPaymentFlow
|
||||
@ -57,23 +58,28 @@ private class BankOfCordaDriver {
|
||||
when (role) {
|
||||
Role.ISSUER -> {
|
||||
driver(dsl = {
|
||||
startNotaryNode(providedName = DUMMY_NOTARY.name, validating = true)
|
||||
val bankUser = User(
|
||||
BANK_USERNAME,
|
||||
"test",
|
||||
permissions = setOf(
|
||||
startFlowPermission<CashPaymentFlow>(),
|
||||
startFlowPermission<CashConfigDataFlow>(),
|
||||
startFlowPermission<CashExitFlow>(),
|
||||
startFlowPermission<CashIssueAndPaymentFlow>(),
|
||||
startFlowPermission<CashExitFlow>()))
|
||||
val bigCorpUser = User(BIGCORP_USERNAME, "test",
|
||||
permissions = setOf(
|
||||
startFlowPermission<CashPaymentFlow>()))
|
||||
startNotaryNode(DUMMY_NOTARY.name, validating = true)
|
||||
startFlowPermission<CashConfigDataFlow>()
|
||||
))
|
||||
val bankOfCorda = startNode(
|
||||
providedName = BOC.name,
|
||||
rpcUsers = listOf(bankUser))
|
||||
val bigCorpUser = User(BIGCORP_USERNAME, "test",
|
||||
permissions = setOf(
|
||||
startFlowPermission<CashPaymentFlow>(),
|
||||
startFlowPermission<CashConfigDataFlow>()))
|
||||
startNode(providedName = BIGCORP_LEGAL_NAME, rpcUsers = listOf(bigCorpUser))
|
||||
startWebserver(bankOfCorda.get())
|
||||
waitForAllNodesToFinish()
|
||||
}, isDebug = true)
|
||||
}, isDebug = true, extraCordappPackagesToScan = listOf("net.corda.finance.contracts.asset"))
|
||||
}
|
||||
else -> {
|
||||
val requestParams = IssueRequestParams(options.valueOf(quantity), options.valueOf(currency), BIGCORP_LEGAL_NAME,
|
||||
@ -81,12 +87,12 @@ private class BankOfCordaDriver {
|
||||
when(role) {
|
||||
Role.ISSUE_CASH_RPC -> {
|
||||
println("Requesting Cash via RPC ...")
|
||||
val result = BankOfCordaClientApi(NetworkHostAndPort("localhost", 10006)).requestRPCIssue(requestParams)
|
||||
val result = BankOfCordaClientApi(NetworkHostAndPort("localhost", 10004)).requestRPCIssue(requestParams)
|
||||
println("Success!! You transaction receipt is ${result.tx.id}")
|
||||
}
|
||||
Role.ISSUE_CASH_WEB -> {
|
||||
println("Requesting Cash via Web ...")
|
||||
val result = BankOfCordaClientApi(NetworkHostAndPort("localhost", 10007)).requestWebIssue(requestParams)
|
||||
val result = BankOfCordaClientApi(NetworkHostAndPort("localhost", 10005)).requestWebIssue(requestParams)
|
||||
if (result)
|
||||
println("Successfully processed Cash Issue request")
|
||||
}
|
||||
|
@ -961,7 +961,7 @@ class DriverDSL(
|
||||
maximumHeapSize: String
|
||||
): CordaFuture<Process> {
|
||||
val processFuture = executorService.fork {
|
||||
log.info("Starting out-of-process Node ${nodeConf.myLegalName.organisation}")
|
||||
log.info("Starting out-of-process Node ${nodeConf.myLegalName.organisation}, debug port is " + debugPort ?: "not enabled")
|
||||
// Write node.conf
|
||||
writeConfig(nodeConf.baseDirectory, "node.conf", config)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user