mirror of
https://github.com/corda/corda.git
synced 2024-12-29 17:28:56 +00:00
Replaced all uses of assert with require (#3309)
JVM assertions have to be enabled with the -ea flag so it's possible for these checks to be ignored.
This commit is contained in:
parent
75f2c4a0a4
commit
d620e71bb6
@ -106,7 +106,7 @@ class FlattenedList<A>(val sourceList: ObservableList<out ObservableValue<out A>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
endChange()
|
endChange()
|
||||||
assert(sourceList.size == indexMap.size)
|
require(sourceList.size == indexMap.size)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun get(index: Int): A = sourceList[index].value
|
override fun get(index: Int): A = sourceList[index].value
|
||||||
|
@ -91,7 +91,7 @@ class RPCStabilityTests {
|
|||||||
// This is a less than check because threads from other tests may be shutting down while this test is running.
|
// This is a less than check because threads from other tests may be shutting down while this test is running.
|
||||||
// This is therefore a "best effort" check. When this test is run on its own this should be a strict equality.
|
// This is therefore a "best effort" check. When this test is run on its own this should be a strict equality.
|
||||||
// In case of failure we output the threads along with their stacktraces to get an idea what was running at a time.
|
// In case of failure we output the threads along with their stacktraces to get an idea what was running at a time.
|
||||||
assert(threadsBefore.keys.size >= threadsAfter.keys.size, { "threadsBefore: $threadsBefore\nthreadsAfter: $threadsAfter" })
|
require(threadsBefore.keys.size >= threadsAfter.keys.size, { "threadsBefore: $threadsBefore\nthreadsAfter: $threadsAfter" })
|
||||||
} finally {
|
} finally {
|
||||||
executor.shutdownNow()
|
executor.shutdownNow()
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
import static net.corda.core.contracts.ContractsDSL.requireThat;
|
import static net.corda.core.contracts.ContractsDSL.requireThat;
|
||||||
import static net.corda.core.crypto.Crypto.generateKeyPair;
|
import static net.corda.core.crypto.Crypto.generateKeyPair;
|
||||||
|
|
||||||
@ -662,7 +663,7 @@ public class FlowCookbookJava {
|
|||||||
requireThat(require -> {
|
requireThat(require -> {
|
||||||
// Any additional checking we see fit...
|
// Any additional checking we see fit...
|
||||||
DummyState outputState = (DummyState) stx.getTx().getOutputs().get(0).getData();
|
DummyState outputState = (DummyState) stx.getTx().getOutputs().get(0).getData();
|
||||||
assert (outputState.getMagicNumber() == 777);
|
checkArgument(outputState.getMagicNumber() == 777);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -642,7 +642,7 @@ class ResponderFlow(val counterpartySession: FlowSession) : FlowLogic<Unit>() {
|
|||||||
override fun checkTransaction(stx: SignedTransaction) = requireThat {
|
override fun checkTransaction(stx: SignedTransaction) = requireThat {
|
||||||
// Any additional checking we see fit...
|
// Any additional checking we see fit...
|
||||||
val outputState = stx.tx.outputsOfType<DummyState>().single()
|
val outputState = stx.tx.outputsOfType<DummyState>().single()
|
||||||
assert(outputState.magicNumber == 777)
|
require(outputState.magicNumber == 777)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ class StatusTransitions<out S, in R, T : StatusTrackingContractState<S, R>>(priv
|
|||||||
// for each combination of in x out which should normally be at most 1...
|
// for each combination of in x out which should normally be at most 1...
|
||||||
inputStates.forEach { inp ->
|
inputStates.forEach { inp ->
|
||||||
outputStates.forEach { outp ->
|
outputStates.forEach { outp ->
|
||||||
assert((inp != null) || (outp != null))
|
require(inp != null || outp != null)
|
||||||
val options = matchingTransitions(inp?.status, outp?.status, cmd.value)
|
val options = matchingTransitions(inp?.status, outp?.status, cmd.value)
|
||||||
|
|
||||||
val signerGroup = options.groupBy { it.signer }.entries.singleOrNull()
|
val signerGroup = options.groupBy { it.signer }.entries.singleOrNull()
|
||||||
|
@ -204,7 +204,7 @@ class UniversalContract : Contract {
|
|||||||
val rest = extractRemainder(arr, action)
|
val rest = extractRemainder(arr, action)
|
||||||
|
|
||||||
// for now - let's assume not
|
// for now - let's assume not
|
||||||
assert(rest is Zero)
|
require(rest is Zero)
|
||||||
|
|
||||||
requireThat {
|
requireThat {
|
||||||
"action must have a time-window" using (tx.timeWindow != null)
|
"action must have a time-window" using (tx.timeWindow != null)
|
||||||
|
@ -125,7 +125,7 @@ fun actions(arrangement: Arrangement): Map<String, Action> = when (arrangement)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun debugCompare(left: String, right: String) {
|
fun debugCompare(left: String, right: String) {
|
||||||
assert(left == right)
|
require(left == right)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun <T> debugCompare(perLeft: Perceivable<T>, perRight: Perceivable<T>) {
|
fun <T> debugCompare(perLeft: Perceivable<T>, perRight: Perceivable<T>) {
|
||||||
@ -142,7 +142,7 @@ fun <T> debugCompare(perLeft: Perceivable<T>, perRight: Perceivable<T>) {
|
|||||||
if (perRight is PerceivableOperation) {
|
if (perRight is PerceivableOperation) {
|
||||||
debugCompare(perLeft.left, perRight.left)
|
debugCompare(perLeft.left, perRight.left)
|
||||||
debugCompare(perLeft.right, perRight.right)
|
debugCompare(perLeft.right, perRight.right)
|
||||||
assert(perLeft.op == perRight.op)
|
require(perLeft.op == perRight.op)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -152,7 +152,7 @@ fun <T> debugCompare(perLeft: Perceivable<T>, perRight: Perceivable<T>) {
|
|||||||
debugCompare(perLeft.interest, perRight.interest)
|
debugCompare(perLeft.interest, perRight.interest)
|
||||||
debugCompare(perLeft.start, perRight.start)
|
debugCompare(perLeft.start, perRight.start)
|
||||||
debugCompare(perLeft.end, perRight.end)
|
debugCompare(perLeft.end, perRight.end)
|
||||||
assert(perLeft.dayCountConvention == perRight.dayCountConvention)
|
require(perLeft.dayCountConvention == perRight.dayCountConvention)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -166,25 +166,25 @@ fun <T> debugCompare(perLeft: Perceivable<T>, perRight: Perceivable<T>) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(false)
|
require(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun debugCompare(parLeft: Party, parRight: Party) {
|
fun debugCompare(parLeft: Party, parRight: Party) {
|
||||||
assert(parLeft == parRight)
|
require(parLeft == parRight)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun debugCompare(left: Frequency, right: Frequency) {
|
fun debugCompare(left: Frequency, right: Frequency) {
|
||||||
assert(left == right)
|
require(left == right)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun debugCompare(left: LocalDate, right: LocalDate) {
|
fun debugCompare(left: LocalDate, right: LocalDate) {
|
||||||
assert(left == right)
|
require(left == right)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun debugCompare(parLeft: Set<Party>, parRight: Set<Party>) {
|
fun debugCompare(parLeft: Set<Party>, parRight: Set<Party>) {
|
||||||
if (parLeft == parRight) return
|
if (parLeft == parRight) return
|
||||||
|
|
||||||
assert(parLeft == parRight)
|
require(parLeft == parRight)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun debugCompare(arrLeft: Arrangement, arrRight: Arrangement) {
|
fun debugCompare(arrLeft: Arrangement, arrRight: Arrangement) {
|
||||||
@ -229,5 +229,5 @@ fun debugCompare(arrLeft: Arrangement, arrRight: Arrangement) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(false)
|
require(false)
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ class ImmutableClassSerializer<T : Any>(val klass: KClass<T>) : Serializer<T>()
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
// Verify that this class is immutable (all properties are final)
|
// Verify that this class is immutable (all properties are final)
|
||||||
assert(props.none { it is KMutableProperty<*> })
|
require(props.none { it is KMutableProperty<*> })
|
||||||
}
|
}
|
||||||
|
|
||||||
// Just a utility to help us catch cases where nodes are running out of sync versions.
|
// Just a utility to help us catch cases where nodes are running out of sync versions.
|
||||||
@ -109,7 +109,7 @@ class ImmutableClassSerializer<T : Any>(val klass: KClass<T>) : Serializer<T>()
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun read(kryo: Kryo, input: Input, type: Class<T>): T {
|
override fun read(kryo: Kryo, input: Input, type: Class<T>): T {
|
||||||
assert(type.kotlin == klass)
|
require(type.kotlin == klass)
|
||||||
val numFields = input.readVarInt(true)
|
val numFields = input.readVarInt(true)
|
||||||
val fieldTypeHash = input.readInt()
|
val fieldTypeHash = input.readInt()
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ class RPCSecurityManagerTest {
|
|||||||
id = AuthServiceId("TEST"))
|
id = AuthServiceId("TEST"))
|
||||||
val subject = userRealm.buildSubject("foo")
|
val subject = userRealm.buildSubject("foo")
|
||||||
for (action in allActions) {
|
for (action in allActions) {
|
||||||
assert(!subject.isPermitted(action)) {
|
require(!subject.isPermitted(action)) {
|
||||||
"Invalid subject should not be allowed to call $action"
|
"Invalid subject should not be allowed to call $action"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -143,24 +143,24 @@ class RPCSecurityManagerTest {
|
|||||||
for (request in permitted) {
|
for (request in permitted) {
|
||||||
val call = request.first()
|
val call = request.first()
|
||||||
val args = request.drop(1).toTypedArray()
|
val args = request.drop(1).toTypedArray()
|
||||||
assert(subject.isPermitted(request.first(), *args)) {
|
require(subject.isPermitted(request.first(), *args)) {
|
||||||
"User ${subject.principal} should be permitted $call with target '${request.toList()}'"
|
"User ${subject.principal} should be permitted $call with target '${request.toList()}'"
|
||||||
}
|
}
|
||||||
if (args.isEmpty()) {
|
if (args.isEmpty()) {
|
||||||
assert(subject.isPermitted(request.first(), "XXX")) {
|
require(subject.isPermitted(request.first(), "XXX")) {
|
||||||
"User ${subject.principal} should be permitted $call with any target"
|
"User ${subject.principal} should be permitted $call with any target"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
disabled.forEach {
|
disabled.forEach {
|
||||||
assert(!subject.isPermitted(it)) {
|
require(!subject.isPermitted(it)) {
|
||||||
"Permissions $permissions should not allow to call $it"
|
"Permissions $permissions should not allow to call $it"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
disabled.filter { !permitted.contains(listOf(it, "foo")) }.forEach {
|
disabled.filter { !permitted.contains(listOf(it, "foo")) }.forEach {
|
||||||
assert(!subject.isPermitted(it, "foo")) {
|
require(!subject.isPermitted(it, "foo")) {
|
||||||
"Permissions $permissions should not allow to call $it with argument 'foo'"
|
"Permissions $permissions should not allow to call $it with argument 'foo'"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ class ClassCarpenterImpl(cl: ClassLoader, override val whitelist: ClassWhitelist
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(schema.name in _loaded)
|
require(schema.name in _loaded)
|
||||||
|
|
||||||
return _loaded[schema.name]!!
|
return _loaded[schema.name]!!
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ abstract class MetaCarpenterBase(val schemas: CarpenterMetaSchema, val cc: Class
|
|||||||
// carpented class existing and remove it from their dependency list, If that
|
// carpented class existing and remove it from their dependency list, If that
|
||||||
// list is now empty we have no impediment to carpenting that class up
|
// list is now empty we have no impediment to carpenting that class up
|
||||||
schemas.dependsOn.remove(newObject.name)?.forEach { dependent ->
|
schemas.dependsOn.remove(newObject.name)?.forEach { dependent ->
|
||||||
assert(newObject.name in schemas.dependencies[dependent]!!.second)
|
require(newObject.name in schemas.dependencies[dependent]!!.second)
|
||||||
|
|
||||||
schemas.dependencies[dependent]?.second?.remove(newObject.name)
|
schemas.dependencies[dependent]?.second?.remove(newObject.name)
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ open class NonNullableField(field: Class<out Any?>) : ClassField(field) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun nullTest(mv: MethodVisitor, slot: Int) {
|
override fun nullTest(mv: MethodVisitor, slot: Int) {
|
||||||
assert(name != unsetName)
|
require(name != unsetName)
|
||||||
|
|
||||||
if (!field.isPrimitive) {
|
if (!field.isPrimitive) {
|
||||||
with(mv) {
|
with(mv) {
|
||||||
@ -103,7 +103,7 @@ class NullableField(field: Class<out Any?>) : ClassField(field) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun nullTest(mv: MethodVisitor, slot: Int) {
|
override fun nullTest(mv: MethodVisitor, slot: Int) {
|
||||||
assert(name != unsetName)
|
require(name != unsetName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,8 +170,8 @@ class ClassCarpenterTest {
|
|||||||
|
|
||||||
val iface = cc.build(schema1)
|
val iface = cc.build(schema1)
|
||||||
|
|
||||||
assert(iface.isInterface)
|
require(iface.isInterface)
|
||||||
assert(iface.constructors.isEmpty())
|
require(iface.constructors.isEmpty())
|
||||||
assertEquals(iface.declaredMethods.size, 1)
|
assertEquals(iface.declaredMethods.size, 1)
|
||||||
assertEquals(iface.declaredMethods[0].name, "getA")
|
assertEquals(iface.declaredMethods[0].name, "getA")
|
||||||
|
|
||||||
|
@ -30,15 +30,15 @@ class CompositeMembers : AmqpCarpenterBase(AllWhitelist) {
|
|||||||
val b = B(A(testA), testB)
|
val b = B(A(testA), testB)
|
||||||
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(b))
|
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(b))
|
||||||
|
|
||||||
assert(obj.obj is B)
|
require(obj.obj is B)
|
||||||
|
|
||||||
val amqpObj = obj.obj as B
|
val amqpObj = obj.obj as B
|
||||||
|
|
||||||
assertEquals(testB, amqpObj.b)
|
assertEquals(testB, amqpObj.b)
|
||||||
assertEquals(testA, amqpObj.a.a)
|
assertEquals(testA, amqpObj.a.a)
|
||||||
assertEquals(2, obj.envelope.schema.types.size)
|
assertEquals(2, obj.envelope.schema.types.size)
|
||||||
assert(obj.envelope.schema.types[0] is CompositeType)
|
require(obj.envelope.schema.types[0] is CompositeType)
|
||||||
assert(obj.envelope.schema.types[1] is CompositeType)
|
require(obj.envelope.schema.types[1] is CompositeType)
|
||||||
|
|
||||||
var amqpSchemaA: CompositeType? = null
|
var amqpSchemaA: CompositeType? = null
|
||||||
var amqpSchemaB: CompositeType? = null
|
var amqpSchemaB: CompositeType? = null
|
||||||
@ -50,8 +50,8 @@ class CompositeMembers : AmqpCarpenterBase(AllWhitelist) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(amqpSchemaA != null)
|
require(amqpSchemaA != null)
|
||||||
assert(amqpSchemaB != null)
|
require(amqpSchemaB != null)
|
||||||
|
|
||||||
// Just ensure the amqp schema matches what we want before we go messing
|
// Just ensure the amqp schema matches what we want before we go messing
|
||||||
// around with the internals
|
// around with the internals
|
||||||
@ -68,9 +68,9 @@ class CompositeMembers : AmqpCarpenterBase(AllWhitelist) {
|
|||||||
val metaSchema = obj.envelope.schema.carpenterSchema(ClassLoader.getSystemClassLoader())
|
val metaSchema = obj.envelope.schema.carpenterSchema(ClassLoader.getSystemClassLoader())
|
||||||
|
|
||||||
// if we know all the classes there is nothing to really achieve here
|
// if we know all the classes there is nothing to really achieve here
|
||||||
assert(metaSchema.carpenterSchemas.isEmpty())
|
require(metaSchema.carpenterSchemas.isEmpty())
|
||||||
assert(metaSchema.dependsOn.isEmpty())
|
require(metaSchema.dependsOn.isEmpty())
|
||||||
assert(metaSchema.dependencies.isEmpty())
|
require(metaSchema.dependencies.isEmpty())
|
||||||
}
|
}
|
||||||
|
|
||||||
// you cannot have an element of a composite class we know about
|
// you cannot have an element of a composite class we know about
|
||||||
@ -92,7 +92,7 @@ class CompositeMembers : AmqpCarpenterBase(AllWhitelist) {
|
|||||||
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(b))
|
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(b))
|
||||||
val amqpSchema = obj.envelope.schema.mangleNames(listOf(classTestName("A")))
|
val amqpSchema = obj.envelope.schema.mangleNames(listOf(classTestName("A")))
|
||||||
|
|
||||||
assert(obj.obj is B)
|
require(obj.obj is B)
|
||||||
|
|
||||||
amqpSchema.carpenterSchema(ClassLoader.getSystemClassLoader())
|
amqpSchema.carpenterSchema(ClassLoader.getSystemClassLoader())
|
||||||
}
|
}
|
||||||
@ -111,7 +111,7 @@ class CompositeMembers : AmqpCarpenterBase(AllWhitelist) {
|
|||||||
val b = B(A(testA), testB)
|
val b = B(A(testA), testB)
|
||||||
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(b))
|
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(b))
|
||||||
|
|
||||||
assert(obj.obj is B)
|
require(obj.obj is B)
|
||||||
|
|
||||||
val amqpSchema = obj.envelope.schema.mangleNames(listOf(classTestName("B")))
|
val amqpSchema = obj.envelope.schema.mangleNames(listOf(classTestName("B")))
|
||||||
val carpenterSchema = amqpSchema.carpenterSchema(ClassLoader.getSystemClassLoader())
|
val carpenterSchema = amqpSchema.carpenterSchema(ClassLoader.getSystemClassLoader())
|
||||||
@ -122,7 +122,7 @@ class CompositeMembers : AmqpCarpenterBase(AllWhitelist) {
|
|||||||
|
|
||||||
metaCarpenter.build()
|
metaCarpenter.build()
|
||||||
|
|
||||||
assert(mangleName(classTestName("B")) in metaCarpenter.objects)
|
require(mangleName(classTestName("B")) in metaCarpenter.objects)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -139,7 +139,7 @@ class CompositeMembers : AmqpCarpenterBase(AllWhitelist) {
|
|||||||
val b = B(A(testA), testB)
|
val b = B(A(testA), testB)
|
||||||
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(b))
|
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(b))
|
||||||
|
|
||||||
assert(obj.obj is B)
|
require(obj.obj is B)
|
||||||
|
|
||||||
val amqpSchema = obj.envelope.schema.mangleNames(listOf(classTestName("A"), classTestName("B")))
|
val amqpSchema = obj.envelope.schema.mangleNames(listOf(classTestName("A"), classTestName("B")))
|
||||||
val carpenterSchema = amqpSchema.carpenterSchema(ClassLoader.getSystemClassLoader())
|
val carpenterSchema = amqpSchema.carpenterSchema(ClassLoader.getSystemClassLoader())
|
||||||
@ -149,9 +149,9 @@ class CompositeMembers : AmqpCarpenterBase(AllWhitelist) {
|
|||||||
assertEquals(1, carpenterSchema.size)
|
assertEquals(1, carpenterSchema.size)
|
||||||
assertEquals(mangleName(classTestName("A")), carpenterSchema.carpenterSchemas.first().name)
|
assertEquals(mangleName(classTestName("A")), carpenterSchema.carpenterSchemas.first().name)
|
||||||
assertEquals(1, carpenterSchema.dependencies.size)
|
assertEquals(1, carpenterSchema.dependencies.size)
|
||||||
assert(mangleName(classTestName("B")) in carpenterSchema.dependencies)
|
require(mangleName(classTestName("B")) in carpenterSchema.dependencies)
|
||||||
assertEquals(1, carpenterSchema.dependsOn.size)
|
assertEquals(1, carpenterSchema.dependsOn.size)
|
||||||
assert(mangleName(classTestName("A")) in carpenterSchema.dependsOn)
|
require(mangleName(classTestName("A")) in carpenterSchema.dependsOn)
|
||||||
|
|
||||||
val metaCarpenter = TestMetaCarpenter(carpenterSchema, ClassCarpenterImpl(whitelist = AllWhitelist))
|
val metaCarpenter = TestMetaCarpenter(carpenterSchema, ClassCarpenterImpl(whitelist = AllWhitelist))
|
||||||
|
|
||||||
@ -172,8 +172,8 @@ class CompositeMembers : AmqpCarpenterBase(AllWhitelist) {
|
|||||||
|
|
||||||
// second manual iteration, will carpent B
|
// second manual iteration, will carpent B
|
||||||
metaCarpenter.build()
|
metaCarpenter.build()
|
||||||
assert(mangleName(classTestName("A")) in metaCarpenter.objects)
|
require(mangleName(classTestName("A")) in metaCarpenter.objects)
|
||||||
assert(mangleName(classTestName("B")) in metaCarpenter.objects)
|
require(mangleName(classTestName("B")) in metaCarpenter.objects)
|
||||||
|
|
||||||
// and we must be finished
|
// and we must be finished
|
||||||
assertTrue(carpenterSchema.carpenterSchemas.isEmpty())
|
assertTrue(carpenterSchema.carpenterSchemas.isEmpty())
|
||||||
@ -198,7 +198,7 @@ class CompositeMembers : AmqpCarpenterBase(AllWhitelist) {
|
|||||||
val c = C(B(testA, testB), testC)
|
val c = C(B(testA, testB), testC)
|
||||||
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(c))
|
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(c))
|
||||||
|
|
||||||
assert(obj.obj is C)
|
require(obj.obj is C)
|
||||||
|
|
||||||
val amqpSchema = obj.envelope.schema.mangleNames(listOf(classTestName("A"), classTestName("B")))
|
val amqpSchema = obj.envelope.schema.mangleNames(listOf(classTestName("A"), classTestName("B")))
|
||||||
|
|
||||||
@ -224,7 +224,7 @@ class CompositeMembers : AmqpCarpenterBase(AllWhitelist) {
|
|||||||
val c = C(B(testA, testB), testC)
|
val c = C(B(testA, testB), testC)
|
||||||
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(c))
|
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(c))
|
||||||
|
|
||||||
assert(obj.obj is C)
|
require(obj.obj is C)
|
||||||
|
|
||||||
val amqpSchema = obj.envelope.schema.mangleNames(listOf(classTestName("A"), classTestName("B")))
|
val amqpSchema = obj.envelope.schema.mangleNames(listOf(classTestName("A"), classTestName("B")))
|
||||||
|
|
||||||
@ -250,7 +250,7 @@ class CompositeMembers : AmqpCarpenterBase(AllWhitelist) {
|
|||||||
val c = C(B(testA, testB), testC)
|
val c = C(B(testA, testB), testC)
|
||||||
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(c))
|
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(c))
|
||||||
|
|
||||||
assert(obj.obj is C)
|
require(obj.obj is C)
|
||||||
|
|
||||||
val carpenterSchema = obj.envelope.schema.mangleNames(listOf(classTestName("A"), classTestName("B")))
|
val carpenterSchema = obj.envelope.schema.mangleNames(listOf(classTestName("A"), classTestName("B")))
|
||||||
TestMetaCarpenter(carpenterSchema.carpenterSchema(
|
TestMetaCarpenter(carpenterSchema.carpenterSchema(
|
||||||
@ -273,7 +273,7 @@ class CompositeMembers : AmqpCarpenterBase(AllWhitelist) {
|
|||||||
val b = B(testA, testB)
|
val b = B(testA, testB)
|
||||||
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(b))
|
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(b))
|
||||||
|
|
||||||
assert(obj.obj is B)
|
require(obj.obj is B)
|
||||||
|
|
||||||
val carpenterSchema = obj.envelope.schema.mangleNames(listOf(classTestName("A"), classTestName("B")))
|
val carpenterSchema = obj.envelope.schema.mangleNames(listOf(classTestName("A"), classTestName("B")))
|
||||||
val metaCarpenter = TestMetaCarpenter(carpenterSchema.carpenterSchema())
|
val metaCarpenter = TestMetaCarpenter(carpenterSchema.carpenterSchema())
|
||||||
|
@ -21,13 +21,13 @@ class MultiMemberCompositeSchemaToClassCarpenterTests : AmqpCarpenterBase(AllWhi
|
|||||||
val a = A(testA, testB)
|
val a = A(testA, testB)
|
||||||
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(a))
|
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(a))
|
||||||
|
|
||||||
assert(obj.obj is A)
|
require(obj.obj is A)
|
||||||
val amqpObj = obj.obj as A
|
val amqpObj = obj.obj as A
|
||||||
|
|
||||||
assertEquals(testA, amqpObj.a)
|
assertEquals(testA, amqpObj.a)
|
||||||
assertEquals(testB, amqpObj.b)
|
assertEquals(testB, amqpObj.b)
|
||||||
assertEquals(1, obj.envelope.schema.types.size)
|
assertEquals(1, obj.envelope.schema.types.size)
|
||||||
assert(obj.envelope.schema.types[0] is CompositeType)
|
require(obj.envelope.schema.types[0] is CompositeType)
|
||||||
|
|
||||||
val amqpSchema = obj.envelope.schema.types[0] as CompositeType
|
val amqpSchema = obj.envelope.schema.types[0] as CompositeType
|
||||||
|
|
||||||
@ -65,13 +65,13 @@ class MultiMemberCompositeSchemaToClassCarpenterTests : AmqpCarpenterBase(AllWhi
|
|||||||
val a = A(testA, testB)
|
val a = A(testA, testB)
|
||||||
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(a))
|
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(a))
|
||||||
|
|
||||||
assert(obj.obj is A)
|
require(obj.obj is A)
|
||||||
val amqpObj = obj.obj as A
|
val amqpObj = obj.obj as A
|
||||||
|
|
||||||
assertEquals(testA, amqpObj.a)
|
assertEquals(testA, amqpObj.a)
|
||||||
assertEquals(testB, amqpObj.b)
|
assertEquals(testB, amqpObj.b)
|
||||||
assertEquals(1, obj.envelope.schema.types.size)
|
assertEquals(1, obj.envelope.schema.types.size)
|
||||||
assert(obj.envelope.schema.types[0] is CompositeType)
|
require(obj.envelope.schema.types[0] is CompositeType)
|
||||||
|
|
||||||
val amqpSchema = obj.envelope.schema.types[0] as CompositeType
|
val amqpSchema = obj.envelope.schema.types[0] as CompositeType
|
||||||
|
|
||||||
|
@ -18,12 +18,12 @@ class SingleMemberCompositeSchemaToClassCarpenterTests : AmqpCarpenterBase(AllWh
|
|||||||
val a = A(test)
|
val a = A(test)
|
||||||
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(a))
|
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(a))
|
||||||
|
|
||||||
assert(obj.obj is A)
|
require(obj.obj is A)
|
||||||
val amqpObj = obj.obj as A
|
val amqpObj = obj.obj as A
|
||||||
|
|
||||||
assertEquals(test, amqpObj.a)
|
assertEquals(test, amqpObj.a)
|
||||||
assertEquals(1, obj.envelope.schema.types.size)
|
assertEquals(1, obj.envelope.schema.types.size)
|
||||||
assert(obj.envelope.schema.types[0] is CompositeType)
|
require(obj.envelope.schema.types[0] is CompositeType)
|
||||||
|
|
||||||
val amqpSchema = obj.envelope.schema.types[0] as CompositeType
|
val amqpSchema = obj.envelope.schema.types[0] as CompositeType
|
||||||
|
|
||||||
@ -54,12 +54,12 @@ class SingleMemberCompositeSchemaToClassCarpenterTests : AmqpCarpenterBase(AllWh
|
|||||||
|
|
||||||
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(a))
|
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(a))
|
||||||
|
|
||||||
assert(obj.obj is A)
|
require(obj.obj is A)
|
||||||
val amqpObj = obj.obj as A
|
val amqpObj = obj.obj as A
|
||||||
|
|
||||||
assertEquals(test, amqpObj.a)
|
assertEquals(test, amqpObj.a)
|
||||||
assertEquals(1, obj.envelope.schema.types.size)
|
assertEquals(1, obj.envelope.schema.types.size)
|
||||||
assert(obj.envelope.schema.types[0] is CompositeType)
|
require(obj.envelope.schema.types[0] is CompositeType)
|
||||||
|
|
||||||
val amqpSchema = obj.envelope.schema.types[0] as CompositeType
|
val amqpSchema = obj.envelope.schema.types[0] as CompositeType
|
||||||
val carpenterSchema = CarpenterMetaSchema.newInstance()
|
val carpenterSchema = CarpenterMetaSchema.newInstance()
|
||||||
@ -84,12 +84,12 @@ class SingleMemberCompositeSchemaToClassCarpenterTests : AmqpCarpenterBase(AllWh
|
|||||||
val a = A(test)
|
val a = A(test)
|
||||||
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(a))
|
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(a))
|
||||||
|
|
||||||
assert(obj.obj is A)
|
require(obj.obj is A)
|
||||||
val amqpObj = obj.obj as A
|
val amqpObj = obj.obj as A
|
||||||
|
|
||||||
assertEquals(test, amqpObj.a)
|
assertEquals(test, amqpObj.a)
|
||||||
assertEquals(1, obj.envelope.schema.types.size)
|
assertEquals(1, obj.envelope.schema.types.size)
|
||||||
assert(obj.envelope.schema.types[0] is CompositeType)
|
require(obj.envelope.schema.types[0] is CompositeType)
|
||||||
|
|
||||||
val amqpSchema = obj.envelope.schema.types[0] as CompositeType
|
val amqpSchema = obj.envelope.schema.types[0] as CompositeType
|
||||||
|
|
||||||
@ -119,12 +119,12 @@ class SingleMemberCompositeSchemaToClassCarpenterTests : AmqpCarpenterBase(AllWh
|
|||||||
val a = A(test)
|
val a = A(test)
|
||||||
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(a))
|
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(a))
|
||||||
|
|
||||||
assert(obj.obj is A)
|
require(obj.obj is A)
|
||||||
val amqpObj = obj.obj as A
|
val amqpObj = obj.obj as A
|
||||||
|
|
||||||
assertEquals(test, amqpObj.a)
|
assertEquals(test, amqpObj.a)
|
||||||
assertEquals(1, obj.envelope.schema.types.size)
|
assertEquals(1, obj.envelope.schema.types.size)
|
||||||
assert(obj.envelope.schema.types[0] is CompositeType)
|
require(obj.envelope.schema.types[0] is CompositeType)
|
||||||
|
|
||||||
val amqpSchema = obj.envelope.schema.types[0] as CompositeType
|
val amqpSchema = obj.envelope.schema.types[0] as CompositeType
|
||||||
|
|
||||||
@ -154,12 +154,12 @@ class SingleMemberCompositeSchemaToClassCarpenterTests : AmqpCarpenterBase(AllWh
|
|||||||
val a = A(test)
|
val a = A(test)
|
||||||
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(a))
|
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(a))
|
||||||
|
|
||||||
assert(obj.obj is A)
|
require(obj.obj is A)
|
||||||
val amqpObj = obj.obj as A
|
val amqpObj = obj.obj as A
|
||||||
|
|
||||||
assertEquals(test, amqpObj.a)
|
assertEquals(test, amqpObj.a)
|
||||||
assertEquals(1, obj.envelope.schema.types.size)
|
assertEquals(1, obj.envelope.schema.types.size)
|
||||||
assert(obj.envelope.schema.types[0] is CompositeType)
|
require(obj.envelope.schema.types[0] is CompositeType)
|
||||||
|
|
||||||
val amqpSchema = obj.envelope.schema.types[0] as CompositeType
|
val amqpSchema = obj.envelope.schema.types[0] as CompositeType
|
||||||
|
|
||||||
@ -189,12 +189,12 @@ class SingleMemberCompositeSchemaToClassCarpenterTests : AmqpCarpenterBase(AllWh
|
|||||||
val a = A(test)
|
val a = A(test)
|
||||||
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(a))
|
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(a))
|
||||||
|
|
||||||
assert(obj.obj is A)
|
require(obj.obj is A)
|
||||||
val amqpObj = obj.obj as A
|
val amqpObj = obj.obj as A
|
||||||
|
|
||||||
assertEquals(test, amqpObj.a)
|
assertEquals(test, amqpObj.a)
|
||||||
assertEquals(1, obj.envelope.schema.types.size)
|
assertEquals(1, obj.envelope.schema.types.size)
|
||||||
assert(obj.envelope.schema.types[0] is CompositeType)
|
require(obj.envelope.schema.types[0] is CompositeType)
|
||||||
|
|
||||||
val amqpSchema = obj.envelope.schema.types[0] as CompositeType
|
val amqpSchema = obj.envelope.schema.types[0] as CompositeType
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user