class MockAttachmentStorage : AttachmentStorage, SingletonSerializeAsToken
A mock implementation of AttachmentStorage for use within tests
<init> |
A mock implementation of AttachmentStorage for use within tests MockAttachmentStorage() |
files |
A map of the currently stored files by their SecureHash val files: Map<SecureHash, Pair<Attachment, ByteArray>> |
getAttachmentIdAndBytes |
fun getAttachmentIdAndBytes(jar: InputStream): Pair<AttachmentId, ByteArray> |
getLatestContractAttachments |
Find the Attachment Id(s) of the contract attachments with the highest version for a given contract class name from trusted upload sources. Return highest version of both signed and unsigned attachment ids (signed first, unsigned second), otherwise return a single signed or unsigned version id, or an empty list if none meet the criteria. fun getLatestContractAttachments(contractClassName: String, minContractVersion: Int): List<AttachmentId> |
hasAttachment |
Searches for an attachment already in the store fun hasAttachment(attachmentId: AttachmentId): Boolean |
importAttachment |
Inserts the given attachment into the store, does not close the input stream. This can be an intensive operation due to the need to copy the bytes to disk and hash them along the way. fun importAttachment(jar: InputStream): AttachmentId
Inserts the given attachment with additional metadata, see importAttachment for input stream handling Extra parameters: fun importAttachment(jar: InputStream, uploader: String, filename: String?): AttachmentId |
importContractAttachment |
fun importContractAttachment(contractClassNames: List<ContractClassName>, uploader: String, jar: InputStream, attachmentId: AttachmentId? = null, signers: List<PublicKey> = emptyList()): AttachmentId fun importContractAttachment(attachmentId: AttachmentId, contractAttachment: ContractAttachment): Unit |
importOrGetAttachment |
Inserts or returns Attachment Id of attachment. Does not throw an exception if already uploaded. fun importOrGetAttachment(jar: InputStream): AttachmentId |
openAttachment |
Returns a handle to a locally stored attachment, or null if it's not known. The handle can be used to open a stream for the data, which will be a zip/jar file. fun openAttachment(id: SecureHash): Attachment? |
queryAttachments |
Searches attachment using given criteria and optional sort rules fun queryAttachments(criteria: AttachmentQueryCriteria, sorting: AttachmentSort?): List<AttachmentId> |