From ecbb4330da9d9cc087abbdb204b2d136618b7d28 Mon Sep 17 00:00:00 2001 From: Katelyn Baker Date: Mon, 30 Oct 2017 11:15:05 +0000 Subject: [PATCH] CORDA-553 - Review comments --- .../amqp/AMQPDescriptorRegistry.kt | 2 +- .../serialization/amqp/SupportedTransforms.kt | 6 ++--- .../serialization/amqp/TansformTypes.kt | 7 +++--- .../amqp/EnumEvolvabilityTests.kt | 4 +-- .../serialization/amqp/EvolvabilityTests.kt | 23 ++++++------------ ...EnumEvolvabilityTests.testUnknownTransform | Bin 785 -> 785 bytes ...bilityTests.addAdditionalParamNotMandatory | Bin 292 -> 292 bytes .../EvolvabilityTests.addAndRemoveParameters | Bin 403 -> 403 bytes ...yTests.addMandatoryFieldWithAltConstructor | Bin 298 -> 298 bytes ...dMandatoryFieldWithAltReorderedConstructor | Bin 400 -> 400 bytes ...FieldWithAltReorderedConstructorAndRemoval | Bin 416 -> 416 bytes .../amqp/EvolvabilityTests.changeSubType | Bin 629 -> 629 bytes .../amqp/EvolvabilityTests.multiVersion.1 | Bin 307 -> 307 bytes .../amqp/EvolvabilityTests.multiVersion.2 | Bin 340 -> 340 bytes .../amqp/EvolvabilityTests.multiVersion.3 | Bin 385 -> 385 bytes ...volvabilityTests.multiVersionWithRemoval.1 | Bin 351 -> 351 bytes ...volvabilityTests.multiVersionWithRemoval.2 | Bin 405 -> 405 bytes ...volvabilityTests.multiVersionWithRemoval.3 | Bin 438 -> 438 bytes .../amqp/EvolvabilityTests.removeParameters | Bin 391 -> 391 bytes ...vabilityTests.simpleOrderSwapDifferentType | Bin 324 -> 324 bytes .../EvolvabilityTests.simpleOrderSwapSameType | Bin 315 -> 315 bytes 21 files changed, 18 insertions(+), 24 deletions(-) diff --git a/node-api/src/main/kotlin/net/corda/nodeapi/internal/serialization/amqp/AMQPDescriptorRegistry.kt b/node-api/src/main/kotlin/net/corda/nodeapi/internal/serialization/amqp/AMQPDescriptorRegistry.kt index 0c9a06b8fd..78ef9dc52a 100644 --- a/node-api/src/main/kotlin/net/corda/nodeapi/internal/serialization/amqp/AMQPDescriptorRegistry.kt +++ b/node-api/src/main/kotlin/net/corda/nodeapi/internal/serialization/amqp/AMQPDescriptorRegistry.kt @@ -10,7 +10,7 @@ import org.apache.qpid.proton.amqp.UnsignedLong * Repeated here for brevity: * 50530 - R3 - Mike Hearn - mike&r3.com */ -const val DESCRIPTOR_TOP_32BITS: Long = 0xc562 shl(32 + 16) +const val DESCRIPTOR_TOP_32BITS: Long = 0xc562L shl(32 + 16) /** * AMQP desriptor ID's for our custom types. diff --git a/node-api/src/main/kotlin/net/corda/nodeapi/internal/serialization/amqp/SupportedTransforms.kt b/node-api/src/main/kotlin/net/corda/nodeapi/internal/serialization/amqp/SupportedTransforms.kt index df3f4f8d45..b785d0e8c6 100644 --- a/node-api/src/main/kotlin/net/corda/nodeapi/internal/serialization/amqp/SupportedTransforms.kt +++ b/node-api/src/main/kotlin/net/corda/nodeapi/internal/serialization/amqp/SupportedTransforms.kt @@ -38,9 +38,9 @@ private val singleExtract = { x: Annotation -> listOf(x) } // Transform annotation used to test the handling of transforms the de-serialising node doesn't understand. At // some point test cases will have been created with this transform applied. -//@Target(AnnotationTarget.CLASS) -//@Retention(AnnotationRetention.RUNTIME) -//annotation class UnknownTransformAnnotation(val a: Int, val b: Int, val c: Int) +// @Target(AnnotationTarget.CLASS) +// @Retention(AnnotationRetention.RUNTIME) +// annotation class UnknownTransformAnnotation(val a: Int, val b: Int, val c: Int) /** * Utility list of all transforms we support that simplifies our generation code. diff --git a/node-api/src/main/kotlin/net/corda/nodeapi/internal/serialization/amqp/TansformTypes.kt b/node-api/src/main/kotlin/net/corda/nodeapi/internal/serialization/amqp/TansformTypes.kt index de4f2d8703..5bb6fc05d5 100644 --- a/node-api/src/main/kotlin/net/corda/nodeapi/internal/serialization/amqp/TansformTypes.kt +++ b/node-api/src/main/kotlin/net/corda/nodeapi/internal/serialization/amqp/TansformTypes.kt @@ -35,14 +35,15 @@ enum class TransformTypes(val build: (Annotation) -> Transform) : DescribedType Rename({ a -> RenameSchemaTransform((a as CordaSerializationTransformRename).from, a.to) }) { override fun getDescriptor(): Any = DESCRIPTOR override fun getDescribed(): Any = ordinal - }; + } // Transform used to test the unknown handler, leave this at as the final constant, uncomment // when regenerating test cases - if Java had a pre-processor this would be much neater // - //UnknownTest({ a -> UnknownTestTransform((a as UnknownTransformAnnotation).a, a.b, a.c)}) { + //,UnknownTest({ a -> UnknownTestTransform((a as UnknownTransformAnnotation).a, a.b, a.c)}) { // override fun getDescriptor(): Any = DESCRIPTOR // override fun getDescribed(): Any = ordinal - //}; + //} + ; companion object : DescribedTypeConstructor { val DESCRIPTOR = AMQPDescriptorRegistry.TRANSFORM_ELEMENT_KEY.amqpDescriptor diff --git a/node-api/src/test/kotlin/net/corda/nodeapi/internal/serialization/amqp/EnumEvolvabilityTests.kt b/node-api/src/test/kotlin/net/corda/nodeapi/internal/serialization/amqp/EnumEvolvabilityTests.kt index 2fffc13b28..6626f558b9 100644 --- a/node-api/src/test/kotlin/net/corda/nodeapi/internal/serialization/amqp/EnumEvolvabilityTests.kt +++ b/node-api/src/test/kotlin/net/corda/nodeapi/internal/serialization/amqp/EnumEvolvabilityTests.kt @@ -10,7 +10,6 @@ import kotlin.test.assertEquals import kotlin.test.assertTrue class EnumEvolvabilityTests { -// var localPath = "file:///Users/katelynbaker/srcs-ide/corda/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp" var localPath = "file:///home/katelyn/srcs/corda/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp" @@ -408,7 +407,7 @@ class EnumEvolvabilityTests { } - // @UnknownTransformAnnotation (10, 20, 30) + //@UnknownTransformAnnotation (10, 20, 30) enum class WithUnknownTest { A, B, C, D } @@ -417,6 +416,7 @@ class EnumEvolvabilityTests { // To regenerate the types for this test uncomment the UnknownTransformAnnotation from // TransformTypes.kt and SupportedTransforms.kt + // ALSO: remember to re-annotate the enum WithUnkownTest above @Test fun testUnknownTransform() { val resource = "EnumEvolvabilityTests.testUnknownTransform" diff --git a/node-api/src/test/kotlin/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.kt b/node-api/src/test/kotlin/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.kt index f5ab608e44..173e7fd87c 100644 --- a/node-api/src/test/kotlin/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.kt +++ b/node-api/src/test/kotlin/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.kt @@ -30,8 +30,7 @@ class EvolvabilityTests { // Original version of the class for the serialised version of this class // data class C (val a: Int, val b: Int) - // val sc = SerializationOutput(sf).serialize(C(A, B)) - // File(URI("$localPath/$resource")).writeBytes(sc.bytes) + // File(URI("$localPath/$resource")).writeBytes(SerializationOutput(sf).serialize(C(A, B)).bytes) // new version of the class, in this case the order of the parameters has been swapped data class C(val b: Int, val a: Int) @@ -55,8 +54,7 @@ class EvolvabilityTests { // Original version of the class as it was serialised // data class C (val a: Int, val b: String) - // val sc = SerializationOutput(sf).serialize(C(A, B)) - // File(URI("$localPath/$resource")).writeBytes(sc.bytes) + // File(URI("$localPath/$resource")).writeBytes(SerializationOutput(sf).serialize(C(A, B)).bytes) // new version of the class, in this case the order of the parameters has been swapped data class C(val b: String, val a: Int) @@ -78,8 +76,7 @@ class EvolvabilityTests { // Original version of the class as it was serialised // data class C(val a: Int) - // val sc = SerializationOutput(sf).serialize(C(A)) - // File(URI("$localPath/$resource")).writeBytes(sc.bytes) + // File(URI("$localPath/$resource")).writeBytes(SerializationOutput(sf).serialize(C(A)).bytes) data class C(val a: Int, val b: Int?) @@ -90,7 +87,7 @@ class EvolvabilityTests { assertEquals(A, deserializedC.a) assertEquals(null, deserializedC.b) - } + } @Test(expected = NotSerializableException::class) fun addAdditionalParam() { @@ -130,8 +127,7 @@ class EvolvabilityTests { // Original version of the class as it was serialised // data class CC(val a: Int, val b: String, val c: String, val d: Int) - // val scc = SerializationOutput(sf).serialize(CC(A, B, C, D)) - // File(URI("$localPath/$resource")).writeBytes(scc.bytes) + // File(URI("$localPath/$resource")).writeBytes(SerializationOutput(sf).serialize(CC(A, B, C, D)).bytes) data class CC(val b: String, val d: Int) @@ -158,8 +154,7 @@ class EvolvabilityTests { // Original version of the class as it was serialised // data class CC(val a: Int, val b: String, val c: String, val d: Int) - // val scc = SerializationOutput(sf).serialize(CC(A, B, C, D)) - // File(URI("$localPath/$resource")).writeBytes(scc.bytes) + // File(URI("$localPath/$resource")).writeBytes(SerializationOutput(sf).serialize(CC(A, B, C, D)).bytes) data class CC(val a: Int, val e: Boolean?, val d: Int) @@ -181,8 +176,7 @@ class EvolvabilityTests { // Original version of the class as it was serialised // data class CC(val a: Int) - // val scc = SerializationOutput(sf).serialize(CC(A)) - // File(URI("$localPath/$resource")).writeBytes(scc.bytes) + // File(URI("$localPath/$resource")).writeBytes(SerializationOutput(sf).serialize(CC(A)).bytes) @Suppress("UNUSED") data class CC(val a: Int, val b: String) { @@ -236,8 +230,7 @@ class EvolvabilityTests { // Original version of the class as it was serialised // data class CC(val a: Int, val b: Int, val c: String) - // val scc = SerializationOutput(sf).serialize(CC(A, B, C)) - // File(URI("$localPath/$resource")).writeBytes(scc.bytes) + // File(URI("$localPath/$resource")).writeBytes(SerializationOutput(sf).serialize(CC(A, B, C)).bytes) @Suppress("UNUSED") data class CC(val a: Int, val b: Int, val c: String, val d: String) { diff --git a/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EnumEvolvabilityTests.testUnknownTransform b/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EnumEvolvabilityTests.testUnknownTransform index 74c557f8841e8ae8104dd447af0628e58fc06bd7..2916621d548edd3e0443ad168e191bc6391e2800 100644 GIT binary patch delta 267 zcmbQpHjzyrIlm|+k&%Icq2Xu}kYt!BkfaG=F)&?VU|{?Q6k`N2z5*FcFjWk!2Y#_G z44Ax-(RJbjer~7+<^yU>6J=B;%Q3RCL4+o2F=oM-vlvrgOco~naHt;k1MEx-866ig z8oIv~Qb XkUKOlJ1@UHFC?|NB!nwOBt#AXV7xyD delta 267 zcmbQpHjzyrIlm|+k&%Icq2WIe98H=ikfaG=F)&?VU|{?Qlwt%iz5*FcFjWk!2Y#_G z44Ax-(RJbjer~7+<^yU>6J=B;%Q3RCL4+o2F=oM-vlvrgOco~naHt;k1MEx-866ig z8oIv~Qb XkUKOlJ1@UHFC?|NB!nwOBt#AXpIUa# diff --git a/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.addAdditionalParamNotMandatory b/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.addAdditionalParamNotMandatory index 7892b7f89b2195eab0d703c515fd399b6dbf28f7..3eb318bb7e9978619d29b517830c28722d805357 100644 GIT binary patch delta 100 zcmZ3&w1i0@Ilm|+k&%Icq2Xu}kYt!BU@it>F)$rC#(3Z`BU~mnn+>YwoW43#4a)%m c_Jxdz3z;+XN?aE*8aOyQ!PGNw9%N(y03zZUQUCw| delta 100 zcmZ3&w1i0@Ilm|+k&%Icq2WIe98H=iU@it>F)$rC#(3Z`BU~mnn+>YwoW43#4a)%m c_Jxdz3z;+XN?aE*8aOyQ!PGNw9%N(y0M?>0IsgCw diff --git a/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.addAndRemoveParameters b/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.addAndRemoveParameters index d92fd43a0389b705fb7185aa77bac8f253056354..52f755150520b7ec758078c3a2522f158cf471ce 100644 GIT binary patch delta 198 zcmbQtJegS_Ilm|+k&%Icq2Xu}kYt!B;Hm^+F)&?VU|>`MiZOy1(jW$0Re2U0RQ+@P zTBv%K0|M*|850*WXXcf-E@U)taCCyHXJ9!X2$V}&$W~lZl$n?A>VPSkj7t(^Y6@0U JIS(>2008G^Fc<&; delta 198 zcmbQtJegS_Ilm|+k&%Icq2WIe98H=i;Hm^+F)&?VU|>`MN-=^M(jW$0Re2U0RQ+@P zTBv%K0|M*|850*WXXcf-E@U)taCCyHXJ9!X2$V}&$W~lZl$n?A>VPSkj7t(^Y6@0U JIS(>2006ncQ}h4; diff --git a/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.addMandatoryFieldWithAltConstructor b/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.addMandatoryFieldWithAltConstructor index 43d786ee3df01a947174bab0dba886a8c53cc59d..f6cb7d74d4c9cabc27c359d6ac9c756992bb8f7f 100644 GIT binary patch delta 111 zcmZ3*w2Da}Ilm|+k&%Icq2Xu}kYt!BU@it>F)$rC!+78%BU~o7kQ*w)d_aw9qKt~J l!vR^iGy}^40rrKAi3^!C^GaM7G8#BII>EFua2{l2001cx8%F>D delta 111 zcmZ3*w2Da}Ilm|+k&%Icq2WIe98H=iU@it>F)$rC!+78%BU~o7kQ*w)d_aw9qKt~J l!vR^iGy}^40rrKAi3^!C^GaM7G8#BII>EFua2{l2004|JGcN!D diff --git a/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.addMandatoryFieldWithAltReorderedConstructor b/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.addMandatoryFieldWithAltReorderedConstructor index b51b42dd55f90f11e5f1313280acb92eb9eeac43..584aef76d73795a61ea36fa961ca83a4b598122d 100644 GIT binary patch delta 152 zcmbQhJb_stIlm|+k&%Icq2Xu}kYt!B;I9N>F)&?VU|{r~Rbv$!MAc+Q wMtwV|29^T?>F)&?VU|{r~Rbv$!MAc+Q wMtwV|29^T?>F)&?VU|>`SiZOy1av%m=Rbv+$MAc+L wMtwV|29^T?>F)&?VU|>`SN-=^Mav%m=Rbv+$MAc+L wMtwV|29^T?>6k`N2?g1H0a8=V%*dVGV zG3vwAvm6j$U&xrakU2B2#C0K~frFzHO#S3Q#uP57v8)GHPFxT;S%8TXYQ$uDCVh3N NBpx#uI1e&1002TADzyLr delta 180 zcmey$@|8s(Ilm|+k&%Icq2WIe98H=ikfH=(F)&?VU|@U>lwt%i?g1H0a8=V%*dVGV zG3vwAvm6j$U&xrakU2B2#C0K~frFzHO#S3Q#uP57v8)GHPFxT;S%8TXYQ$uDCVh3N NBpx#uI1e&1001JpQjGur diff --git a/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.multiVersion.1 b/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.multiVersion.1 index 667eb7472c0b559ac22f4b8f5f6ae2ea1e991017..a7da3eeda3a6c6d33c63be16d2a32e1fbc01661f 100644 GIT binary patch delta 128 zcmdnYw3$gDIlm|+k&%Icq2Xu}kYt!BU?T=$F)$stzIlm|+k&%Icq2Xu}kYt!B;K>GM#f!mM)mbpsYkeqdvI3)6JVYS_%K-uQ ig^bAynKScBTo*DLI5;}NjDyOh;E_wkD#v+{kpTdkJ14~e delta 161 zcmbQrJe64>Ilm|+k&%Icq2WIe98H=i;K>GM#f!mM)mbpsYkeqdvI3)6JVYS_%K-uQ ig^bAynKScBTo*DLI5;}NjDyOh;E_wkD#v+{kpTc#kV~Ne diff --git a/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.multiVersionWithRemoval.3 b/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.multiVersionWithRemoval.3 index 2c3b1ce9eb0bd50812abb242891940aba8d41857..c00a28213633119c60fb277f46a022fe507f7a9c 100644 GIT binary patch delta 207 zcmdnSyp35PIlm|+k&%Icq2Xu}kYt!B;HLy(F)&?VU|_TZiZOy1rXU7fRYMjVRQ(5i zn0l520_+PJlNK^(=9RcEWHfMabb_g$?8qn<4>cB|ECrh~28diL9=SBEa-0Vl831}| BF-`yg delta 207 zcmdnSyp35PIlm|+k&%Icq2WIe98H=i;HLy(F)&?VU|_TZN-=^MrXU7fRYMjVRQ(5i zn0l520_+PJlNK^(=9RcEWHfMabb_g$?8qn<4>cB|ECrh~28diL9=SBEa-0Vl832#` BStbAg diff --git a/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.removeParameters b/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.removeParameters index 926661d87b79097940bd60201fd8b13576e1b4c0..37c419f0765fcc4bba5b63dc15a500b085729edb 100644 GIT binary patch delta 181 zcmZo?Zf6!q&M!(yWMp7qXgHb#BpD_OxGF(d3``do7#JmhVvHaLKZpTWRUXF%RexI_ z%9<>|D3%D-%5p%EeIaAgLbl?PqRhN>R|f}2CzxIah-5M@NdchFl!eThc_pq384Zv% Javo%4002j8Dop?Y delta 181 zcmZo?Zf6!q&M!(yWMp7qX!s8VN0TNBxGF(d3``do7#JmhQj8!5KZpTWRUXF%RexI_ z%9<>|D3%D-%5p%EeIaAgLbl?PqRhN>R|f}2CzxIah-5M@NdchFl!eThc_pq384Zv% Javo%40074PPALEY diff --git a/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.simpleOrderSwapDifferentType b/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.simpleOrderSwapDifferentType index 61da589b24be6143afd29d2feaf3b3ddbc092d65..cc726a13fd0728a971e5e1e3d13ab3428b19690d 100644 GIT binary patch delta 129 zcmX@Ybc9JDIlm|+k&%Icq2Xu}kYt!BU?T=$F)$r?$avr$BU~malMSloqP`1M4a)%m u_Jxdz3z;+XN?aE*8aOyQ!PGOb91sM`B`sttE-A{)OLuiZmgGFh$N&J*ZXx{u delta 129 zcmX@Ybc9JDIlm|+k&%Icq2WIe98H=iU?T=$F)$r?$avr$BU~malMSloqP`1M4a)%m u_Jxdz3z;+XN?aE*8aOyQ!PGOb91sM`B`sttE-A{)OLuiZmgGFh$N&Ia@IB!G diff --git a/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.simpleOrderSwapSameType b/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.simpleOrderSwapSameType index 377e82d50e84774271bdecccc9fd376139dd9ea2..dc9fae7152dcf5d7e8a9b33918cad39be6c2a4ad 100644 GIT binary patch delta 110 zcmdnZw3|sFIlm|+k&%Icq2Xu}kYt!BU?~P+F)$st&3NDjBU~mvg$=6aq&|%GPfQ)E gn&p51`$EQ~h0K|GC9Vq@4ICVuU^*E%4>B?U0AEoYbpQYW delta 110 zcmdnZw3|sFIlm|+k&%Icq2WIe98H=iU?~P+F)$st&3NDjBU~mvg$=6aq&|%GPfQ)E gn&p51`$EQ~h0K|GC9Vq@4ICVuU^*E%4>B?U0BbckSpWb4