com.r3corda.core.testing / TransactionDSLInterpreter

TransactionDSLInterpreter

interface TransactionDSLInterpreter : Verifies, OutputStateLookup

This interface defines the bare bone functionality that a Transaction DSL interpreter should implement.

Parameters



Properties

ledgerInterpreter abstract val ledgerInterpreter: LedgerDSLInterpreter<TransactionDSLInterpreter>

A reference to the enclosing ledger{..}s interpreter.

Functions

_command abstract fun _command(signers: List<PublicKey>, commandData: CommandData): Unit

Adds a command to the transaction.

_output abstract fun _output(label: String?, notary: Party, contractState: ContractState): Unit

Adds an output to the transaction.

attachment abstract fun attachment(attachmentId: SecureHash): Unit

Adds an Attachment reference to the transaction.

input abstract fun input(stateRef: StateRef): Unit

Adds an input reference to the transaction. Note that verifies will resolve this reference.

timestamp abstract fun timestamp(data: Timestamp): Unit

Adds a timestamp to the transaction.

tweak abstract fun tweak(dsl: TransactionDSL<TransactionDSLInterpreter>.() -> EnforceVerifyOrFail): EnforceVerifyOrFail

Creates a local scoped copy of the transaction.

Inherited Functions

fails open fun fails(): EnforceVerifyOrFail

Asserts that verifies throws, with no condition on the exception message.

fails with open infix fun fails with(msg: String): EnforceVerifyOrFail
failsWith open fun failsWith(expectedMessage: String?): EnforceVerifyOrFail

Asserts that verifies() throws.

retrieveOutputStateAndRef abstract fun <S : ContractState> retrieveOutputStateAndRef(clazz: Class<S>, label: String): StateAndRef<S>

Retrieves an output previously defined by TransactionDSLInterpreter._output with a label passed in.

verifies abstract fun verifies(): EnforceVerifyOrFail

Verifies the ledger/transaction, throws if the verification fails.

Extension Functions

ledger fun TransactionDSLInterpreter.ledger(dsl: LedgerDSL<TestTransactionDSLInterpreter, TestLedgerDSLInterpreter>.() -> Unit): Unit

Here follows implementations of the LedgerDSLInterpreter and TransactionDSLInterpreter interfaces to be used in tests. Top level primitives ledger and transaction that bind the interpreter types are also defined here.

transaction fun TransactionDSLInterpreter.transaction(dsl: TransactionDSL<TransactionDSLInterpreter>.() -> EnforceVerifyOrFail): Unit

Inheritors

TestTransactionDSLInterpreter data class TestTransactionDSLInterpreter : TransactionDSLInterpreter, OutputStateLookup

This interpreter builds a transaction, and TransactionDSL.verifies that the resolved transaction is correct. Note that transactions corresponding to input states are not verified. Use LedgerDSL.verifies for that.

TransactionDSL class TransactionDSL<out T : TransactionDSLInterpreter> : TransactionDSLInterpreter