CORDA-553 - Review comments

This commit is contained in:
Katelyn Baker 2017-10-30 11:15:05 +00:00
parent 3350605536
commit ecbb4330da
21 changed files with 18 additions and 24 deletions

View File

@ -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.

View File

@ -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.

View File

@ -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<TransformTypes> {
val DESCRIPTOR = AMQPDescriptorRegistry.TRANSFORM_ELEMENT_KEY.amqpDescriptor

View File

@ -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"

View File

@ -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) {