Revert code transformation; use of deprecated method

This commit is contained in:
Tommy Lillehagen 2017-10-09 10:20:20 +01:00
parent 14f959b4af
commit e1458a40cb
4 changed files with 10 additions and 14 deletions

View File

@ -12,7 +12,6 @@ import net.corda.core.utilities.seconds
import net.corda.finance.DOLLARS import net.corda.finance.DOLLARS
import net.corda.finance.`issued by` import net.corda.finance.`issued by`
import net.corda.finance.contracts.asset.* import net.corda.finance.contracts.asset.*
import net.corda.finance.contracts.asset.Cash.Companion.generateSpend
import net.corda.testing.* import net.corda.testing.*
import net.corda.testing.contracts.fillWithSomeTestCash import net.corda.testing.contracts.fillWithSomeTestCash
import net.corda.testing.node.MockServices import net.corda.testing.node.MockServices
@ -270,7 +269,7 @@ class CommercialPaperTestsGeneric {
// Alice pays $9000 to BigCorp to own some of their debt. // Alice pays $9000 to BigCorp to own some of their debt.
moveTX = run { moveTX = run {
val builder = TransactionBuilder(DUMMY_NOTARY) val builder = TransactionBuilder(DUMMY_NOTARY)
generateSpend(aliceServices, builder, 9000.DOLLARS, AnonymousParty(bigCorpServices.key.public), ourIdentity, emptySet()) Cash.generateSpend(aliceServices, builder, 9000.DOLLARS, AnonymousParty(bigCorpServices.key.public))
CommercialPaper().generateMove(builder, issueTx.tx.outRef(0), AnonymousParty(aliceServices.key.public)) CommercialPaper().generateMove(builder, issueTx.tx.outRef(0), AnonymousParty(aliceServices.key.public))
val ptx = aliceServices.signInitialTransaction(builder) val ptx = aliceServices.signInitialTransaction(builder)
val ptx2 = bigCorpServices.addSignature(ptx) val ptx2 = bigCorpServices.addSignature(ptx)

View File

@ -12,7 +12,6 @@ import net.corda.core.transactions.TransactionBuilder
import net.corda.core.transactions.WireTransaction import net.corda.core.transactions.WireTransaction
import net.corda.core.utilities.OpaqueBytes import net.corda.core.utilities.OpaqueBytes
import net.corda.finance.* import net.corda.finance.*
import net.corda.finance.contracts.asset.Cash.Companion.generateSpend
import net.corda.finance.utils.sumCash import net.corda.finance.utils.sumCash
import net.corda.finance.utils.sumCashBy import net.corda.finance.utils.sumCashBy
import net.corda.finance.utils.sumCashOrNull import net.corda.finance.utils.sumCashOrNull
@ -506,7 +505,7 @@ class CashTests : TestDependencyInjectionBase() {
private fun makeSpend(amount: Amount<Currency>, dest: AbstractParty): WireTransaction { private fun makeSpend(amount: Amount<Currency>, dest: AbstractParty): WireTransaction {
val tx = TransactionBuilder(DUMMY_NOTARY) val tx = TransactionBuilder(DUMMY_NOTARY)
database.transaction { database.transaction {
generateSpend(miniCorpServices, tx, amount, dest, ourIdentity, emptySet()) Cash.generateSpend(miniCorpServices, tx, amount, dest)
} }
return tx.toWireTransaction(miniCorpServices) return tx.toWireTransaction(miniCorpServices)
} }
@ -608,7 +607,7 @@ class CashTests : TestDependencyInjectionBase() {
database.transaction { database.transaction {
val tx = TransactionBuilder(DUMMY_NOTARY) val tx = TransactionBuilder(DUMMY_NOTARY)
generateSpend(miniCorpServices, tx, 80.DOLLARS, ALICE, ourIdentity, setOf(MINI_CORP)) Cash.generateSpend(miniCorpServices, tx, 80.DOLLARS, ALICE, setOf(MINI_CORP))
assertEquals(vaultStatesUnconsumed.elementAt(2).ref, tx.inputStates()[0]) assertEquals(vaultStatesUnconsumed.elementAt(2).ref, tx.inputStates()[0])
} }
@ -827,7 +826,7 @@ class CashTests : TestDependencyInjectionBase() {
PartyAndAmount(THEIR_IDENTITY_1, 400.DOLLARS), PartyAndAmount(THEIR_IDENTITY_1, 400.DOLLARS),
PartyAndAmount(THEIR_IDENTITY_2, 150.DOLLARS) PartyAndAmount(THEIR_IDENTITY_2, 150.DOLLARS)
) )
generateSpend(miniCorpServices, tx, amount, to, ourIdentity, emptySet()) Cash.generateSpend(miniCorpServices, tx, payments)
} }
val wtx = tx.toWireTransaction(miniCorpServices) val wtx = tx.toWireTransaction(miniCorpServices)
fun out(i: Int) = wtx.getOutput(i) as Cash.State fun out(i: Int) = wtx.getOutput(i) as Cash.State

View File

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

View File

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