Code clean-up run

This commit is contained in:
Tommy Lillehagen
2017-10-06 16:22:38 +01:00
parent f9dc331551
commit 14f959b4af
21 changed files with 33 additions and 38 deletions

View File

@ -35,7 +35,7 @@ class NodeInfoWatcherTest : NodeBasedTest() {
lateinit var keyManagementService: KeyManagementService
lateinit var nodeInfoPath: Path
val scheduler = TestScheduler();
val scheduler = TestScheduler()
val testSubscriber = TestSubscriber<NodeInfo>()
// Object under test

View File

@ -265,7 +265,7 @@ class FlowStateMachineImpl<R>(override val id: StateMachineRunId,
// This is a hack to allow cash app access list of permitted issuer currency.
// TODO: replace this with cordapp configuration.
val config = serviceHub.configuration as? FullNodeConfiguration
val permissionGranted = config?.extraAdvertisedServiceIds?.contains(permissionName) ?: true
val permissionGranted = config?.extraAdvertisedServiceIds?.contains(permissionName) != false
val checkPermissionEvent = FlowPermissionAuditEvent(
serviceHub.clock.instant(),
flowInitiator,

View File

@ -27,8 +27,5 @@ class NonInvalidatingCache<K, V> private constructor(
}
override fun load(key: K) = loadFunction(key)
override fun loadAll(keys: Iterable<K>): MutableMap<K, V> {
return super.loadAll(keys)
}
}
}

View File

@ -29,8 +29,5 @@ class NonInvalidatingUnboundCache<K, V> private constructor(
}
override fun load(key: K) = loadFunction(key)
override fun loadAll(keys: Iterable<K>): MutableMap<K, V> {
return super.loadAll(keys)
}
}
}

View File

@ -11,5 +11,5 @@ Useful commands include 'help' to see what is available, and 'bye' to shut down
"""
prompt = { ->
return "${new Date()}>>> ";
return "${new Date()}>>> "
}

View File

@ -20,6 +20,7 @@ import net.corda.core.utilities.OpaqueBytes
import net.corda.core.utilities.toNonEmptySet
import net.corda.finance.*
import net.corda.finance.contracts.asset.Cash
import net.corda.finance.contracts.asset.Cash.Companion.generateSpend
import net.corda.finance.contracts.asset.DUMMY_CASH_ISSUER
import net.corda.finance.contracts.asset.DUMMY_CASH_ISSUER_KEY
import net.corda.finance.contracts.getCashBalance
@ -515,7 +516,7 @@ class NodeVaultServiceTest : TestDependencyInjectionBase() {
database.transaction {
val moveTx = TransactionBuilder(services.myInfo.chooseIdentity()).apply {
Cash.generateSpend(services, this, Amount(1000, GBP), thirdPartyIdentity)
generateSpend(services, this, Amount(1000, GBP), thirdPartyIdentity, ourIdentity, emptySet())
}.toWireTransaction(services)
service.notify(moveTx)
}
@ -560,7 +561,7 @@ class NodeVaultServiceTest : TestDependencyInjectionBase() {
// Move cash
val moveTx = database.transaction {
TransactionBuilder(newNotary).apply {
Cash.generateSpend(services, this, Amount(1000, GBP), thirdPartyIdentity)
generateSpend(services, this, Amount(1000, GBP), thirdPartyIdentity, ourIdentity, emptySet())
}.toWireTransaction(services)
}

View File

@ -12,6 +12,7 @@ import net.corda.core.node.services.vault.QueryCriteria.VaultQueryCriteria
import net.corda.core.transactions.TransactionBuilder
import net.corda.finance.*
import net.corda.finance.contracts.asset.Cash
import net.corda.finance.contracts.asset.Cash.Companion.generateSpend
import net.corda.finance.contracts.asset.DUMMY_CASH_ISSUER
import net.corda.finance.contracts.asset.DUMMY_CASH_ISSUER_KEY
import net.corda.finance.contracts.getCashBalance
@ -99,7 +100,7 @@ class VaultWithCashTest : TestDependencyInjectionBase() {
database.transaction {
// A tx that spends our money.
val spendTXBuilder = TransactionBuilder(DUMMY_NOTARY)
Cash.generateSpend(services, spendTXBuilder, 80.DOLLARS, BOB)
generateSpend(services, spendTXBuilder, 80.DOLLARS, BOB, ourIdentity, emptySet())
val spendPTX = services.signInitialTransaction(spendTXBuilder, freshKey)
notaryServices.addSignature(spendPTX)
}
@ -151,7 +152,7 @@ class VaultWithCashTest : TestDependencyInjectionBase() {
database.transaction {
try {
val txn1Builder = TransactionBuilder(DUMMY_NOTARY)
Cash.generateSpend(services, txn1Builder, 60.DOLLARS, BOB)
generateSpend(services, txn1Builder, 60.DOLLARS, BOB, ourIdentity, emptySet())
val ptxn1 = notaryServices.signInitialTransaction(txn1Builder)
val txn1 = services.addSignature(ptxn1, freshKey)
println("txn1: ${txn1.id} spent ${((txn1.tx.outputs[0].data) as Cash.State).amount}")
@ -187,7 +188,7 @@ class VaultWithCashTest : TestDependencyInjectionBase() {
database.transaction {
try {
val txn2Builder = TransactionBuilder(DUMMY_NOTARY)
Cash.generateSpend(services, txn2Builder, 80.DOLLARS, BOB)
generateSpend(services, txn2Builder, 80.DOLLARS, BOB, ourIdentity, emptySet())
val ptxn2 = notaryServices.signInitialTransaction(txn2Builder)
val txn2 = services.addSignature(ptxn2, freshKey)
println("txn2: ${txn2.id} spent ${((txn2.tx.outputs[0].data) as Cash.State).amount}")
@ -311,7 +312,7 @@ class VaultWithCashTest : TestDependencyInjectionBase() {
database.transaction {
// A tx that spends our money.
val spendTXBuilder = TransactionBuilder(DUMMY_NOTARY)
Cash.generateSpend(services, spendTXBuilder, 80.DOLLARS, BOB)
generateSpend(services, spendTXBuilder, 80.DOLLARS, BOB, ourIdentity, emptySet())
val spendPTX = notaryServices.signInitialTransaction(spendTXBuilder)
val spendTX = services.addSignature(spendPTX, freshKey)
services.recordTransactions(spendTX)