From 534f60dc578480fec39e39d088a9f9d1e4144c02 Mon Sep 17 00:00:00 2001 From: Katelyn Baker Date: Wed, 12 Jul 2017 14:37:02 +0100 Subject: [PATCH 1/2] Make serialise putObject function an open function For testing I need to be able to mess with the schema before it gets added to the envelope, extract the function where that happens and make it open so the tests can do what they want --- .../corda/core/serialization/amqp/SerializationOutput.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/main/kotlin/net/corda/core/serialization/amqp/SerializationOutput.kt b/core/src/main/kotlin/net/corda/core/serialization/amqp/SerializationOutput.kt index 3cbfad41ba..cef69a03d6 100644 --- a/core/src/main/kotlin/net/corda/core/serialization/amqp/SerializationOutput.kt +++ b/core/src/main/kotlin/net/corda/core/serialization/amqp/SerializationOutput.kt @@ -34,7 +34,7 @@ open class SerializationOutput(internal val serializerFactory: SerializerFactory // Our object writeObject(obj, this) // The schema - putObject(Schema(schemaHistory.toList())) + putObject(Schema(schemaHistory.toList()), this) } } val bytes = ByteArray(data.encodedSize().toInt() + 8) @@ -53,6 +53,10 @@ open class SerializationOutput(internal val serializerFactory: SerializerFactory writeObject(obj, data, obj.javaClass) } + open fun putObject(schema: Schema, data: Data) { + data.putObject(schema) + } + internal fun writeObjectOrNull(obj: Any?, data: Data, type: Type) { if (obj == null) { data.putNull() From 056811845bb1c3dd6917894a481bbc4a21766a18 Mon Sep 17 00:00:00 2001 From: Katelyn Baker Date: Thu, 13 Jul 2017 14:23:08 +0100 Subject: [PATCH 2/2] Review Comments - rename putObject to writeSchema --- .../net/corda/core/serialization/amqp/SerializationOutput.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/kotlin/net/corda/core/serialization/amqp/SerializationOutput.kt b/core/src/main/kotlin/net/corda/core/serialization/amqp/SerializationOutput.kt index cef69a03d6..41575ac377 100644 --- a/core/src/main/kotlin/net/corda/core/serialization/amqp/SerializationOutput.kt +++ b/core/src/main/kotlin/net/corda/core/serialization/amqp/SerializationOutput.kt @@ -34,7 +34,7 @@ open class SerializationOutput(internal val serializerFactory: SerializerFactory // Our object writeObject(obj, this) // The schema - putObject(Schema(schemaHistory.toList()), this) + writeSchema(Schema(schemaHistory.toList()), this) } } val bytes = ByteArray(data.encodedSize().toInt() + 8) @@ -53,7 +53,7 @@ open class SerializationOutput(internal val serializerFactory: SerializerFactory writeObject(obj, data, obj.javaClass) } - open fun putObject(schema: Schema, data: Data) { + open fun writeSchema(schema: Schema, data: Data) { data.putObject(schema) }