public class TestTransactionDSLInterpreter implements 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.
Verifies.DefaultImpls
Constructor and Description |
---|
TestTransactionDSLInterpreter(TestLedgerDSLInterpreter ledgerInterpreter,
TransactionBuilder transactionBuilder) |
Modifier and Type | Method and Description |
---|---|
void |
_attachment(java.lang.String contractClassName)
Attaches an attachment containing the named contract to the transaction
|
void |
_attachment(java.lang.String contractClassName,
SecureHash attachmentId,
java.util.List<? extends java.security.PublicKey> signers)
Attaches an attachment containing the named contract to the transaction
|
void |
_attachment(java.lang.String contractClassName,
SecureHash attachmentId,
java.util.List<? extends java.security.PublicKey> signers,
java.util.Map<java.lang.String,java.lang.String> jarManifestAttributes)
Attaches an attachment containing the named contract to the transaction.
|
EnforceVerifyOrFail |
_tweak(Function1<? super net.corda.testing.dsl.TransactionDSLInterpreter,? extends net.corda.testing.dsl.EnforceVerifyOrFail> dsl)
Creates a local scoped copy of the transaction.
|
void |
attachment(SecureHash attachmentId)
Adds an
interface Attachment reference to the transaction. |
void |
command(java.util.List<? extends java.security.PublicKey> signers,
CommandData commandData)
Adds a command to the transaction.
|
TestLedgerDSLInterpreter |
component1()
A reference to the enclosing ledger{..}
|
TransactionBuilder |
component2() |
TestTransactionDSLInterpreter |
copy(TestLedgerDSLInterpreter ledgerInterpreter,
TransactionBuilder transactionBuilder,
java.util.HashMap<java.lang.String,java.lang.Integer> labelToIndexMap)
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.
|
boolean |
equals(java.lang.Object p) |
TestLedgerDSLInterpreter |
getLedgerInterpreter()
A reference to the enclosing ledger{..}
|
ServicesForResolution |
getServices() |
TransactionBuilder |
getTransactionBuilder() |
int |
hashCode() |
void |
input(StateRef stateRef)
Adds an input reference to the transaction. Note that
Verifies.verifies will resolve this reference. |
void |
output(java.lang.String contractClassName,
java.lang.String label,
Party notary,
java.lang.Integer encumbrance,
AttachmentConstraint attachmentConstraint,
ContractState contractState)
Adds an output to the transaction.
|
void |
reference(StateRef stateRef)
Add a reference input state to the transaction. Note that
Verifies.verifies will resolve this reference. |
<S extends ContractState> |
retrieveOutputStateAndRef(java.lang.Class<S> clazz,
java.lang.String label)
Retrieves an output previously defined by
TransactionDSLInterpreter.output with a label passed in. |
void |
timeWindow(TimeWindow data)
Sets the time-window of the transaction.
|
java.lang.String |
toString() |
EnforceVerifyOrFail |
verifies()
Verifies the ledger/transaction, throws if the verification fails.
|
_attachment, _attachment, _attachment, _tweak, attachment, command, getLedgerInterpreter, input, output, reference, timeWindow
fails, fails with, failsWith, verifies
retrieveOutputStateAndRef
public TestTransactionDSLInterpreter(TestLedgerDSLInterpreter ledgerInterpreter, TransactionBuilder transactionBuilder)
public ServicesForResolution getServices()
public void input(StateRef stateRef)
Adds an input reference to the transaction. Note that Verifies.verifies
will resolve this reference.
stateRef
- The input class StateRef
.Verifies.verifies
public void reference(StateRef stateRef)
Add a reference input state to the transaction. Note that Verifies.verifies
will resolve this reference.
stateRef
- The input class StateRef
.Verifies.verifies
public void output(java.lang.String contractClassName, java.lang.String label, Party notary, java.lang.Integer encumbrance, AttachmentConstraint attachmentConstraint, ContractState contractState)
Adds an output to the transaction.
label
- An optional label that may be later used to retrieve the output probably in other transactions.notary
- The associated notary.encumbrance
- The position of the encumbrance state.attachmentConstraint
- The attachment constraintcontractState
- The state itself.contractClassName
- The class name of the contract that verifies this state.public void attachment(SecureHash attachmentId)
Adds an interface Attachment
reference to the transaction.
attachmentId
- The hash of the attachment, possibly returned by LedgerDSLInterpreter.attachment
.interface Attachment
public void command(java.util.List<? extends java.security.PublicKey> signers, CommandData commandData)
Adds a command to the transaction.
signers
- The signer public keys.commandData
- The contents of the command.public EnforceVerifyOrFail verifies()
Verifies the ledger/transaction, throws if the verification fails.
public void timeWindow(TimeWindow data)
Sets the time-window of the transaction.
data
- the class TimeWindow
(validation window).public EnforceVerifyOrFail _tweak(Function1<? super net.corda.testing.dsl.TransactionDSLInterpreter,? extends net.corda.testing.dsl.EnforceVerifyOrFail> dsl)
Creates a local scoped copy of the transaction.
dsl
- The transaction DSL to be interpreted using the copy.public void _attachment(java.lang.String contractClassName)
Attaches an attachment containing the named contract to the transaction
contractClassName
- The contract class to attachpublic void _attachment(java.lang.String contractClassName, SecureHash attachmentId, java.util.List<? extends java.security.PublicKey> signers)
Attaches an attachment containing the named contract to the transaction
contractClassName
- The contract class to attachattachmentId
- The attachmentpublic void _attachment(java.lang.String contractClassName, SecureHash attachmentId, java.util.List<? extends java.security.PublicKey> signers, java.util.Map<java.lang.String,java.lang.String> jarManifestAttributes)
Attaches an attachment containing the named contract to the transaction.
contractClassName
- The contract class to attach.attachmentId
- The attachment.signers
- The signers.jarManifestAttributes
- The JAR manifest file attributes.public TestLedgerDSLInterpreter getLedgerInterpreter()
A reference to the enclosing ledger{..}
's interpreter.
public TransactionBuilder getTransactionBuilder()
public <S extends ContractState> StateAndRef<S> retrieveOutputStateAndRef(java.lang.Class<S> clazz, java.lang.String label)
Retrieves an output previously defined by TransactionDSLInterpreter.output
with a label passed in.
clazz
- The class object holding the type of the output state expected.label
- The label of the to-be-retrieved output state.class StateAndRef
.TransactionDSLInterpreter.output
public TestLedgerDSLInterpreter component1()
A reference to the enclosing ledger{..}
's interpreter.
public TransactionBuilder component2()
public TestTransactionDSLInterpreter copy(TestLedgerDSLInterpreter ledgerInterpreter, TransactionBuilder transactionBuilder, java.util.HashMap<java.lang.String,java.lang.Integer> labelToIndexMap)
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.
public java.lang.String toString()
public int hashCode()
public boolean equals(java.lang.Object p)