diff --git a/core/src/test/kotlin/net/corda/core/crypto/CompositeKeyTests.kt b/core/src/test/kotlin/net/corda/core/crypto/CompositeKeyTests.kt index 62169f8c21..40c07f5063 100644 --- a/core/src/test/kotlin/net/corda/core/crypto/CompositeKeyTests.kt +++ b/core/src/test/kotlin/net/corda/core/crypto/CompositeKeyTests.kt @@ -10,6 +10,7 @@ import net.corda.core.serialization.serialize import net.corda.core.utilities.OpaqueBytes import net.corda.node.utilities.* import net.corda.testing.TestDependencyInjectionBase +import net.corda.testing.kryoSpecific import org.bouncycastle.asn1.x500.X500Name import org.junit.Rule import org.junit.Test @@ -216,7 +217,7 @@ class CompositeKeyTests : TestDependencyInjectionBase() { } @Test() - fun `composite key validation with graph cycle detection`() { + fun `composite key validation with graph cycle detection`() = kryoSpecific { val key1 = CompositeKey.Builder().addKeys(alicePublicKey, bobPublicKey).build() as CompositeKey val key2 = CompositeKey.Builder().addKeys(alicePublicKey, key1).build() as CompositeKey val key3 = CompositeKey.Builder().addKeys(alicePublicKey, key2).build() as CompositeKey diff --git a/node-api/src/main/kotlin/net/corda/nodeapi/internal/serialization/AMQPSerializationScheme.kt b/node-api/src/main/kotlin/net/corda/nodeapi/internal/serialization/AMQPSerializationScheme.kt index d4a38efe6a..965755d253 100644 --- a/node-api/src/main/kotlin/net/corda/nodeapi/internal/serialization/AMQPSerializationScheme.kt +++ b/node-api/src/main/kotlin/net/corda/nodeapi/internal/serialization/AMQPSerializationScheme.kt @@ -11,7 +11,7 @@ import net.corda.nodeapi.internal.serialization.amqp.SerializationOutput import net.corda.nodeapi.internal.serialization.amqp.SerializerFactory import java.util.concurrent.ConcurrentHashMap -internal val AMQP_ENABLED get() = SerializationDefaults.P2P_CONTEXT.preferredSerializationVersion == AmqpHeaderV1_0 +val AMQP_ENABLED get() = SerializationDefaults.P2P_CONTEXT.preferredSerializationVersion == AmqpHeaderV1_0 abstract class AbstractAMQPSerializationScheme : SerializationScheme { internal companion object { diff --git a/node-api/src/test/kotlin/net/corda/nodeapi/AttachmentClassLoaderTests.kt b/node-api/src/test/kotlin/net/corda/nodeapi/AttachmentClassLoaderTests.kt index 3773a0dee6..093479b20b 100644 --- a/node-api/src/test/kotlin/net/corda/nodeapi/AttachmentClassLoaderTests.kt +++ b/node-api/src/test/kotlin/net/corda/nodeapi/AttachmentClassLoaderTests.kt @@ -15,14 +15,13 @@ import net.corda.core.transactions.LedgerTransaction import net.corda.core.transactions.TransactionBuilder import net.corda.core.utilities.ByteSequence import net.corda.core.utilities.OpaqueBytes -import net.corda.core.utilities.loggerFor -import net.corda.nodeapi.internal.serialization.AMQP_ENABLED import net.corda.nodeapi.internal.serialization.SerializeAsTokenContextImpl import net.corda.nodeapi.internal.serialization.WireTransactionSerializer import net.corda.nodeapi.internal.serialization.withTokenContext import net.corda.testing.DUMMY_NOTARY import net.corda.testing.MEGA_CORP import net.corda.testing.TestDependencyInjectionBase +import net.corda.testing.kryoSpecific import net.corda.testing.node.MockAttachmentStorage import org.apache.commons.io.IOUtils import org.junit.Assert @@ -333,7 +332,7 @@ class AttachmentClassLoaderTests : TestDependencyInjectionBase() { @Test // Kryo verifies/loads attachments on deserialization, whereas AMQP currently does not - fun `test deserialize of WireTransaction where contract cannot be found`() = kryoSpecific { + fun `test deserialize of WireTransaction where contract cannot be found`() = kryoSpecific { val child = ClassLoaderForTests() val contractClass = Class.forName("net.corda.contracts.isolated.AnotherDummyContract", true, child) val contract = contractClass.newInstance() as DummyContractBackdoor @@ -362,10 +361,4 @@ class AttachmentClassLoaderTests : TestDependencyInjectionBase() { } assertEquals(attachmentRef, e.ids.single()) } - - private fun kryoSpecific(function: () -> Unit) = if(!AMQP_ENABLED) { - function() - } else { - loggerFor().info("Ignoring Kryo specific test") - } } \ No newline at end of file diff --git a/test-utils/src/main/kotlin/net/corda/testing/CoreTestUtils.kt b/test-utils/src/main/kotlin/net/corda/testing/CoreTestUtils.kt index 59adf96b04..f8416266c3 100644 --- a/test-utils/src/main/kotlin/net/corda/testing/CoreTestUtils.kt +++ b/test-utils/src/main/kotlin/net/corda/testing/CoreTestUtils.kt @@ -14,6 +14,7 @@ import net.corda.core.node.services.IdentityService import net.corda.core.transactions.TransactionBuilder import net.corda.core.utilities.NetworkHostAndPort import net.corda.core.utilities.OpaqueBytes +import net.corda.core.utilities.loggerFor import net.corda.finance.contracts.asset.DUMMY_CASH_ISSUER import net.corda.node.services.config.NodeConfiguration import net.corda.node.services.config.VerifierType @@ -22,6 +23,7 @@ import net.corda.node.services.identity.InMemoryIdentityService import net.corda.node.utilities.CertificateType import net.corda.node.utilities.X509Utilities import net.corda.nodeapi.config.SSLConfiguration +import net.corda.nodeapi.internal.serialization.AMQP_ENABLED import net.corda.testing.node.MockServices import net.corda.testing.node.makeTestDataSourceProperties import net.corda.testing.node.makeTestDatabaseProperties @@ -220,4 +222,10 @@ fun getTestPartyAndCertificate(party: Party, trustRoot: CertificateAndKeyPair = */ fun getTestPartyAndCertificate(name: X500Name, publicKey: PublicKey, trustRoot: CertificateAndKeyPair = DUMMY_CA): PartyAndCertificate { return getTestPartyAndCertificate(Party(name, publicKey), trustRoot) +} + +inline fun kryoSpecific(function: () -> Unit) = if(!AMQP_ENABLED) { + function() +} else { + loggerFor().info("Ignoring Kryo specific test") } \ No newline at end of file