From 308d70c0d1c43125c4ff302d4a210306c6540a31 Mon Sep 17 00:00:00 2001 From: Anthony Keenan Date: Thu, 15 Feb 2018 13:21:20 +0000 Subject: [PATCH] CORDA-939 One last internal exposure (#2537) * One last internal exposure * Fix api-current.txt * Reformat class --- .ci/api-current.txt | 7 ++++--- .../corda/testing/services/MockAttachmentStorage.kt | 10 ++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.ci/api-current.txt b/.ci/api-current.txt index b4c94505e9..18a44b7a84 100644 --- a/.ci/api-current.txt +++ b/.ci/api-current.txt @@ -1369,6 +1369,10 @@ public final class net.corda.core.flows.NotaryFlow extends java.lang.Object public (net.corda.core.transactions.SignedTransaction, net.corda.core.utilities.ProgressTracker) @co.paralleluniverse.fibers.Suspendable @org.jetbrains.annotations.NotNull public List call() @org.jetbrains.annotations.NotNull public net.corda.core.utilities.ProgressTracker getProgressTracker() + @co.paralleluniverse.fibers.Suspendable @org.jetbrains.annotations.NotNull protected final net.corda.core.utilities.UntrustworthyData notarise(net.corda.core.identity.Party) + @co.paralleluniverse.fibers.Suspendable @org.jetbrains.annotations.NotNull protected net.corda.core.utilities.UntrustworthyData sendAndReceiveNonValidating(net.corda.core.identity.Party, net.corda.core.flows.FlowSession) + @co.paralleluniverse.fibers.Suspendable @org.jetbrains.annotations.NotNull protected net.corda.core.utilities.UntrustworthyData sendAndReceiveValidating(net.corda.core.flows.FlowSession) + @org.jetbrains.annotations.NotNull protected final List validateResponse(net.corda.core.utilities.UntrustworthyData, net.corda.core.identity.Party) public static final net.corda.core.flows.NotaryFlow$Client$Companion Companion ## public static final class net.corda.core.flows.NotaryFlow$Client$Companion extends java.lang.Object @@ -4652,6 +4656,3 @@ public final class net.corda.testing.services.MockAttachmentStorage extends net. public static final class net.corda.testing.services.MockAttachmentStorage$Companion extends java.lang.Object public final byte[] getBytes(java.io.InputStream) ## -public static final class net.corda.testing.services.MockAttachmentStorage$openAttachment$1 extends net.corda.core.internal.AbstractAttachment - @org.jetbrains.annotations.NotNull public net.corda.core.crypto.SecureHash getId() -## diff --git a/testing/test-utils/src/main/kotlin/net/corda/testing/services/MockAttachmentStorage.kt b/testing/test-utils/src/main/kotlin/net/corda/testing/services/MockAttachmentStorage.kt index 8cf1a9ccf2..f827efb39d 100644 --- a/testing/test-utils/src/main/kotlin/net/corda/testing/services/MockAttachmentStorage.kt +++ b/testing/test-utils/src/main/kotlin/net/corda/testing/services/MockAttachmentStorage.kt @@ -43,11 +43,11 @@ class MockAttachmentStorage : AttachmentStorage, SingletonSerializeAsToken() { val files = HashMap() + private class MockAttachment(dataLoader: () -> ByteArray, override val id: SecureHash) : AbstractAttachment(dataLoader) + override fun openAttachment(id: SecureHash): Attachment? { val f = files[id] ?: return null - return object : AbstractAttachment({ f }) { - override val id = id - } + return MockAttachment({ f }, id) } override fun queryAttachments(criteria: AttachmentQueryCriteria, sorting: AttachmentSort?): List { @@ -64,10 +64,8 @@ class MockAttachmentStorage : AttachmentStorage, SingletonSerializeAsToken() { override fun importOrGetAttachment(jar: InputStream): AttachmentId { try { return importAttachment(jar) - } - catch (faee: java.nio.file.FileAlreadyExistsException) { + } catch (faee: java.nio.file.FileAlreadyExistsException) { return AttachmentId.parse(faee.message!!) } } - }