Skip to content

Commit

Permalink
Fixing Bank-Of-Corda Demo in master (corda#1922)
Browse files Browse the repository at this point in the history
* Fix-up: Bank Of Corda sample

Use correct CorDapp packages to scan

(cherry picked from commit 2caa134)

* Set adequate permissions for the nodes such that NodeExplorer can connect

(cherry picked from commit ae88242)

* Set adequate permissions for the nodes such that NodeExplorer can connect

(cherry picked from commit ae88242)

* Correct run configuration

* Fix-up port numbers
  • Loading branch information
vkolomeyko authored Oct 23, 2017
1 parent 931ab12 commit cbb5135
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 9 deletions.
15 changes: 15 additions & 0 deletions .idea/runConfigurations/BankOfCordaDriverKt___Issue_Web.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions .idea/runConfigurations/BankOfCordaDriverKt___Run_Stack.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -57,36 +58,41 @@ 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,
"1", BOC.name, DUMMY_NOTARY.name.copy(commonName = ValidatingNotaryService.id))
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")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit cbb5135

Please sign in to comment.