Merge pull request #936 from corda/os-merge-d620e71

O/S merge from d620e71
This commit is contained in:
Shams Asari 2018-06-06 13:27:03 +01:00 committed by GitHub
commit 11b78296eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 97 additions and 150 deletions

View File

@ -116,7 +116,7 @@ class FlattenedList<A>(val sourceList: ObservableList<out ObservableValue<out A>
}
}
endChange()
assert(sourceList.size == indexMap.size)
require(sourceList.size == indexMap.size)
}
override fun get(index: Int): A = sourceList[index].value

View File

@ -101,7 +101,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 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.
assert(threadsBefore.keys.size >= threadsAfter.keys.size, { "threadsBefore: $threadsBefore\nthreadsAfter: $threadsAfter" })
require(threadsBefore.keys.size >= threadsAfter.keys.size, { "threadsBefore: $threadsBefore\nthreadsAfter: $threadsAfter" })
} finally {
executor.shutdownNow()
}

View File

@ -60,12 +60,12 @@ class PluginRegistrationTest {
val classpath = outputLines.filter { it.contains(" classpath:") }.last()
// If DummyJdbcDriver has been registered it should have printed a message
assert(outputLines.count { it.contains("[DummyJDBCDriver] hello") } > 0) {
require(outputLines.count { it.contains("[DummyJDBCDriver] hello") } > 0) {
"Cannot find registration message from installed jdbc driver"
}
// Check the printed classpath contains 'nodeJarDir'
assert(classpath.contains(jarDir)) {
require(classpath.contains(jarDir)) {
"Expected to find $jarDir in printed classpath"
}
}

View File

@ -540,7 +540,7 @@ transaction ourselves, we can automatically gather the signatures of the other r
:dedent: 12
Each required signer will need to respond by invoking its own ``SignTransactionFlow`` subclass to check the
transaction and provide their signature if they are satisfied:
transaction (by implementing the ``checkTransaction`` method) and provide their signature if they are satisfied:
.. container:: codeset
@ -556,6 +556,14 @@ transaction and provide their signature if they are satisfied:
:end-before: DOCEND 16
:dedent: 12
Types of things to check include:
* Ensuring that the transaction received is the expected type, i.e. has the expected type of inputs and outputs
* Checking that the properties of the outputs are expected, this is in the absence of integrating reference
data sources to facilitate this
* Checking that the transaction is not incorrectly spending (perhaps maliciously) asset states, as potentially
the transaction creator has access to some of signer's state references
SendTransactionFlow/ReceiveTransactionFlow
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Verifying a transaction received from a counterparty also requires verification of every transaction in its

View File

@ -4,7 +4,6 @@ Component library
.. toctree::
:maxdepth: 1
flow-library
contract-catalogue
financial-model
contract-irs

View File

@ -42,6 +42,7 @@ import java.util.Collections;
import java.util.List;
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.crypto.Crypto.generateKeyPair;
@ -665,7 +666,7 @@ public class FlowCookbookJava {
requireThat(require -> {
// Any additional checking we see fit...
DummyState outputState = (DummyState) stx.getTx().getOutputs().get(0).getData();
assert (outputState.getMagicNumber() == 777);
checkArgument(outputState.getMagicNumber() == 777);
return null;
});
}

View File

@ -645,7 +645,7 @@ class ResponderFlow(val counterpartySession: FlowSession) : FlowLogic<Unit>() {
override fun checkTransaction(stx: SignedTransaction) = requireThat {
// Any additional checking we see fit...
val outputState = stx.tx.outputsOfType<DummyState>().single()
assert(outputState.magicNumber == 777)
require(outputState.magicNumber == 777)
}
}

View File

@ -1,61 +0,0 @@
Flow library
============
There are a number of built-in flows supplied with Corda, which cover some core functionality.
FinalityFlow
------------
The ``FinalityFlow`` verifies the given transactions, then sends them to the specified notary.
If the notary agrees that the transactions are acceptable then they are from that point onwards committed to the ledger,
and will be written through to the vault. Additionally they will be distributed to the parties reflected in the participants
list of the states.
The transactions will be topologically sorted before commitment to ensure that dependencies are committed before
dependers, so you don't need to do this yourself.
The transactions are expected to have already been resolved: if their dependencies are not available in local storage or
within the given set, verification will fail. They must have signatures from all necessary parties other than the notary.
If specified, the extra recipients are sent all the given transactions. The base set of parties to inform of each
transaction are calculated on a per transaction basis from the contract-given set of participants.
The flow returns the same transactions, in the same order, with the additional signatures.
CollectSignaturesFlow
---------------------
The ``CollectSignaturesFlow`` is used to automate the collection of signatures from the counterparties to a transaction.
You use the ``CollectSignaturesFlow`` by passing it a ``SignedTransaction`` which has at least been signed by yourself.
The flow will handle the resolution of the counterparty identities and request a signature from each counterparty.
Finally, the flow will verify all the signatures and return a ``SignedTransaction`` with all the collected signatures.
When using this flow on the responding side you will have to subclass the ``AbstractCollectSignaturesFlowResponder`` and
provide your own implementation of the ``checkTransaction`` method. This is to add additional verification logic on the
responder side. Types of things you will need to check include:
* Ensuring that the transaction you are receiving is the transaction you *EXPECT* to receive. I.e. is has the expected
type of inputs and outputs
* Checking that the properties of the outputs are as you would expect, this is in the absence of integrating reference
data sources to facilitate this for us
* Checking that the transaction is not incorrectly spending (perhaps maliciously) one of your asset states, as potentially
the transaction creator has access to some of your state references
Typically after calling the ``CollectSignaturesFlow`` you then called the ``FinalityFlow``.
SendTransactionFlow/ReceiveTransactionFlow
------------------------------------------
The ``SendTransactionFlow`` and ``ReceiveTransactionFlow`` are used to automate the verification of the transaction by
recursively checking the validity of all the dependencies. Once a transaction is received and checked it's inserted into
local storage so it can be relayed and won't be checked again.
The ``SendTransactionFlow`` sends the transaction to the counterparty and listen for data request as the counterparty
validating the transaction, extra checks can be implemented to restrict data access by overriding the ``verifyDataRequest``
method inside ``SendTransactionFlow``.
The ``ReceiveTransactionFlow`` returns a verified ``SignedTransaction``.

View File

@ -76,7 +76,7 @@ logic behind common processes such as:
* Gathering signatures from counterparty nodes
* Verifying a chain of transactions
Further information on the available built-in flows can be found in :doc:`flow-library`.
Further information on the available built-in flows can be found in :doc:`api-flows`.
Concurrency
-----------

View File

@ -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...
inputStates.forEach { inp ->
outputStates.forEach { outp ->
assert((inp != null) || (outp != null))
require(inp != null || outp != null)
val options = matchingTransitions(inp?.status, outp?.status, cmd.value)
val signerGroup = options.groupBy { it.signer }.entries.singleOrNull()

View File

@ -59,7 +59,7 @@ class CashScenarioRunner(options: OptionSet) : AbstractScenarioRunner(options),
}
// Verify
assert(allPayments.size == (iterCount * 2)) { "Expected number of payments is ${iterCount * 2}, actual number of payments: ${allPayments.size}" }
require(allPayments.size == (iterCount * 2)) { "Expected number of payments is ${iterCount * 2}, actual number of payments: ${allPayments.size}" }
val criteria = QueryCriteria.VaultQueryCriteria(status = Vault.StateStatus.ALL)
// TODO: Potentially implement paging validation logic for bigger data sets.
val pageSpecification = PageSpecification(pageNumber = 1, pageSize = Int.MAX_VALUE)
@ -83,7 +83,7 @@ class CashScenarioRunner(options: OptionSet) : AbstractScenarioRunner(options),
val allStatesForParty = hashesByParty[recipient] ?: throw IllegalArgumentException("Cannot find states for party: $recipient in transaction: $transactionId")
// Recipient definitely should have hash of a transaction in its states.
assert(transactionId in allStatesForParty) { "States for party: $recipient should contain reference: $transactionId" }
require(transactionId in allStatesForParty) { "States for party: $recipient should contain reference: $transactionId" }
}
return true

View File

@ -31,7 +31,7 @@ class LinearStateScenarioRunner(options: OptionSet) : AbstractScenarioRunner(opt
}
// Verify
assert(results.size == iterCount) { "Expected number of results is $iterCount, actual number of payments: ${results.size}" }
require(results.size == iterCount) { "Expected number of results is $iterCount, actual number of payments: ${results.size}" }
val criteria = QueryCriteria.VaultQueryCriteria(status = Vault.StateStatus.ALL)
// TODO: Potentially implement paging validation logic for bigger data sets.
val pageSpecification = PageSpecification(pageNumber = 1, pageSize = Int.MAX_VALUE)

View File

@ -214,7 +214,7 @@ class UniversalContract : Contract {
val rest = extractRemainder(arr, action)
// for now - let's assume not
assert(rest is Zero)
require(rest is Zero)
requireThat {
"action must have a time-window" using (tx.timeWindow != null)

View File

@ -135,7 +135,7 @@ fun actions(arrangement: Arrangement): Map<String, Action> = when (arrangement)
}
fun debugCompare(left: String, right: String) {
assert(left == right)
require(left == right)
}
fun <T> debugCompare(perLeft: Perceivable<T>, perRight: Perceivable<T>) {
@ -152,7 +152,7 @@ fun <T> debugCompare(perLeft: Perceivable<T>, perRight: Perceivable<T>) {
if (perRight is PerceivableOperation) {
debugCompare(perLeft.left, perRight.left)
debugCompare(perLeft.right, perRight.right)
assert(perLeft.op == perRight.op)
require(perLeft.op == perRight.op)
return
}
}
@ -162,7 +162,7 @@ fun <T> debugCompare(perLeft: Perceivable<T>, perRight: Perceivable<T>) {
debugCompare(perLeft.interest, perRight.interest)
debugCompare(perLeft.start, perRight.start)
debugCompare(perLeft.end, perRight.end)
assert(perLeft.dayCountConvention == perRight.dayCountConvention)
require(perLeft.dayCountConvention == perRight.dayCountConvention)
return
}
}
@ -176,25 +176,25 @@ fun <T> debugCompare(perLeft: Perceivable<T>, perRight: Perceivable<T>) {
}
}
assert(false)
require(false)
}
fun debugCompare(parLeft: Party, parRight: Party) {
assert(parLeft == parRight)
require(parLeft == parRight)
}
fun debugCompare(left: Frequency, right: Frequency) {
assert(left == right)
require(left == right)
}
fun debugCompare(left: LocalDate, right: LocalDate) {
assert(left == right)
require(left == right)
}
fun debugCompare(parLeft: Set<Party>, parRight: Set<Party>) {
if (parLeft == parRight) return
assert(parLeft == parRight)
require(parLeft == parRight)
}
fun debugCompare(arrLeft: Arrangement, arrRight: Arrangement) {
@ -239,5 +239,5 @@ fun debugCompare(arrLeft: Arrangement, arrRight: Arrangement) {
}
}
assert(false)
require(false)
}

View File

@ -69,7 +69,7 @@ class ZkClientTests {
}
leaderGain.await(ELECTION_TIMEOUT, TimeUnit.MILLISECONDS)
assert(client.isLeader())
require(client.isLeader())
client.close()
}
@ -86,7 +86,7 @@ class ZkClientTests {
}
leaderGain.await(ELECTION_TIMEOUT, TimeUnit.MILLISECONDS)
assert(client.isLeader())
require(client.isLeader())
client.relinquishLeadership()
leaderLoss.await(ELECTION_TIMEOUT, TimeUnit.MILLISECONDS)
assertFalse(client.isLeader())
@ -117,7 +117,7 @@ class ZkClientTests {
}
aliceLeaderGain.await(ELECTION_TIMEOUT, TimeUnit.MILLISECONDS)
assert(alice.isLeader())
require(alice.isLeader())
if (bobLeaderGain.count == 0L) //wait to lose leadership if leader at some point
bobLeaderLoss.await(ELECTION_TIMEOUT, TimeUnit.MILLISECONDS)
assertFalse(bob.isLeader())
@ -152,7 +152,7 @@ class ZkClientTests {
}
aliceLeaderGain.await(ELECTION_TIMEOUT, TimeUnit.MILLISECONDS)
assert(alice.isLeader())
require(alice.isLeader())
if (bobLeaderGain.count == 0L) //wait to lose leadership if leader at some point
bobLeaderLoss.await(ELECTION_TIMEOUT, TimeUnit.MILLISECONDS)
assertFalse(bob.isLeader())
@ -167,7 +167,7 @@ class ZkClientTests {
bobLeaderGain2.await(ELECTION_TIMEOUT, TimeUnit.MILLISECONDS) // wait for bob to become leader
assertFalse(alice.isLeader())
assert(bob.isLeader())
require(bob.isLeader())
assertFalse(chip.isLeader())
val chipLeaderGain2 = CountDownLatch(1)
@ -178,7 +178,7 @@ class ZkClientTests {
assertFalse(alice.isLeader())
assertFalse(bob.isLeader())
assert(chip.isLeader())
require(chip.isLeader())
listOf(alice, bob, chip).forEach { client -> client.close() }
}
@ -199,7 +199,7 @@ class ZkClientTests {
chip.requestLeadership()
chipLeaderGain.await(ELECTION_TIMEOUT, TimeUnit.MILLISECONDS)
assert(chip.isLeader())
require(chip.isLeader())
bob.start()
bob.addLeadershipListener(SyncHelperListener(bob.nodeId, bobLeaderGain, bobLeaderLoss))
@ -207,7 +207,7 @@ class ZkClientTests {
chipLeaderLoss.await(ELECTION_TIMEOUT, TimeUnit.MILLISECONDS)
bobLeaderGain.await(ELECTION_TIMEOUT, TimeUnit.MILLISECONDS)
assert(bob.isLeader())
require(bob.isLeader())
assertFalse(chip.isLeader())
alice.start()
@ -217,7 +217,7 @@ class ZkClientTests {
bobLeaderLoss.await(ELECTION_TIMEOUT, TimeUnit.MILLISECONDS)
aliceLeaderGain.await(ELECTION_TIMEOUT, TimeUnit.MILLISECONDS)
assert(alice.isLeader())
require(alice.isLeader())
assertFalse(bob.isLeader())
assertFalse(chip.isLeader())
@ -249,14 +249,14 @@ class ZkClientTests {
aliceLeaderGain.await(ELECTION_TIMEOUT, TimeUnit.MILLISECONDS)
if (chipLeaderGain.count == 0L) //wait to lose leadership if leader at some point
chipLeaderLoss.await(ELECTION_TIMEOUT, TimeUnit.MILLISECONDS)
assert(alice.isLeader())
require(alice.isLeader())
assertFalse(chip.isLeader())
bob.start()
bob.addLeadershipListener(SyncHelperListener(bob.nodeId, bobLeaderGain))
bob.requestLeadership()
assert(alice.isLeader())
require(alice.isLeader())
assertFalse(bob.isLeader())
assertFalse(chip.isLeader())
@ -270,7 +270,7 @@ class ZkClientTests {
chipLeaderLoss2.await(ELECTION_TIMEOUT, TimeUnit.MILLISECONDS)
assertFalse(alice.isLeader())
assert(bob.isLeader())
require(bob.isLeader())
assertFalse(chip.isLeader())
listOf(alice, bob, chip).forEach { client -> client.close() }
@ -318,8 +318,8 @@ class ZkClientTests {
}
}
assert(leaderCount <= 1)
assert(leaderBuffer.size <= 1)
require(leaderCount <= 1)
require(leaderBuffer.size <= 1)
if (leaderBuffer.size == 1) {
println(leaderBuffer)
assertEquals(leaderBuffer.first(), leaderId)

View File

@ -194,7 +194,7 @@ class MySQLNotaryServiceTests : IntegrationTest() {
val transactionCount = 100
val results = notaryNode.services.startFlow(RequestGenerationFlow(notaryService, transactionCount)).resultFuture.get()
assertEquals(transactionCount, results.size)
assert(results.all { it === Result.Success })
require(results.all { it === Result.Success })
}
@Test
@ -203,7 +203,7 @@ class MySQLNotaryServiceTests : IntegrationTest() {
val transactionCount = 10
val results = notaryNode.services.startFlow(RequestGenerationFlow(notaryService, transactionCount, 50)).resultFuture.get()
assertEquals(transactionCount, results.size)
assert(results.all { it === Result.Success })
require(results.all { it === Result.Success })
}
private class RequestGenerationFlow(

View File

@ -87,7 +87,7 @@ class ImmutableClassSerializer<T : Any>(val klass: KClass<T>) : Serializer<T>()
// Verify that this class is immutable (all properties are final).
// We disable this check inside SGX as the reflection blows up.
if (!SgxSupport.isInsideEnclave) {
assert(props.none { it is KMutableProperty<*> })
require(props.none { it is KMutableProperty<*> })
}
}
@ -123,7 +123,7 @@ class ImmutableClassSerializer<T : Any>(val klass: KClass<T>) : Serializer<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 fieldTypeHash = input.readInt()

View File

@ -34,6 +34,6 @@ class EnterpriseNodeTest {
val expectedPattern = if (custom == null) "${expectedName}_London_GB_\\d+_\\d+_\\d+_\\d+" else expectedName
val createdName = EnterpriseNode.getGraphitePrefix(nodeConfig)
assert(Regex(expectedPattern).matches(createdName), { "${createdName} did not match ${expectedPattern}" })
require(Regex(expectedPattern).matches(createdName), { "${createdName} did not match ${expectedPattern}" })
}
}

View File

@ -131,7 +131,7 @@ class RPCSecurityManagerTest {
id = AuthServiceId("TEST"))
val subject = userRealm.buildSubject("foo")
for (action in allActions) {
assert(!subject.isPermitted(action)) {
require(!subject.isPermitted(action)) {
"Invalid subject should not be allowed to call $action"
}
}
@ -153,24 +153,24 @@ class RPCSecurityManagerTest {
for (request in permitted) {
val call = request.first()
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()}'"
}
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"
}
}
}
disabled.forEach {
assert(!subject.isPermitted(it)) {
require(!subject.isPermitted(it)) {
"Permissions $permissions should not allow to call $it"
}
}
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'"
}
}

View File

@ -149,7 +149,7 @@ class ClassCarpenterImpl(cl: ClassLoader, override val whitelist: ClassWhitelist
}
}
assert(schema.name in _loaded)
require(schema.name in _loaded)
return _loaded[schema.name]!!
}

View File

@ -82,7 +82,7 @@ abstract class MetaCarpenterBase(val schemas: CarpenterMetaSchema, val cc: Class
// 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
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)

View File

@ -77,7 +77,7 @@ open class NonNullableField(field: Class<out Any?>) : ClassField(field) {
}
override fun nullTest(mv: MethodVisitor, slot: Int) {
assert(name != unsetName)
require(name != unsetName)
if (!field.isPrimitive) {
with(mv) {
@ -113,7 +113,7 @@ class NullableField(field: Class<out Any?>) : ClassField(field) {
}
override fun nullTest(mv: MethodVisitor, slot: Int) {
assert(name != unsetName)
require(name != unsetName)
}
}

View File

@ -180,8 +180,8 @@ class ClassCarpenterTest {
val iface = cc.build(schema1)
assert(iface.isInterface)
assert(iface.constructors.isEmpty())
require(iface.isInterface)
require(iface.constructors.isEmpty())
assertEquals(iface.declaredMethods.size, 1)
assertEquals(iface.declaredMethods[0].name, "getA")

View File

@ -40,15 +40,15 @@ class CompositeMembers : AmqpCarpenterBase(AllWhitelist) {
val b = B(A(testA), testB)
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(b))
assert(obj.obj is B)
require(obj.obj is B)
val amqpObj = obj.obj as B
assertEquals(testB, amqpObj.b)
assertEquals(testA, amqpObj.a.a)
assertEquals(2, obj.envelope.schema.types.size)
assert(obj.envelope.schema.types[0] is CompositeType)
assert(obj.envelope.schema.types[1] is CompositeType)
require(obj.envelope.schema.types[0] is CompositeType)
require(obj.envelope.schema.types[1] is CompositeType)
var amqpSchemaA: CompositeType? = null
var amqpSchemaB: CompositeType? = null
@ -60,8 +60,8 @@ class CompositeMembers : AmqpCarpenterBase(AllWhitelist) {
}
}
assert(amqpSchemaA != null)
assert(amqpSchemaB != null)
require(amqpSchemaA != null)
require(amqpSchemaB != null)
// Just ensure the amqp schema matches what we want before we go messing
// around with the internals
@ -78,9 +78,9 @@ class CompositeMembers : AmqpCarpenterBase(AllWhitelist) {
val metaSchema = obj.envelope.schema.carpenterSchema(ClassLoader.getSystemClassLoader())
// if we know all the classes there is nothing to really achieve here
assert(metaSchema.carpenterSchemas.isEmpty())
assert(metaSchema.dependsOn.isEmpty())
assert(metaSchema.dependencies.isEmpty())
require(metaSchema.carpenterSchemas.isEmpty())
require(metaSchema.dependsOn.isEmpty())
require(metaSchema.dependencies.isEmpty())
}
// you cannot have an element of a composite class we know about
@ -102,7 +102,7 @@ class CompositeMembers : AmqpCarpenterBase(AllWhitelist) {
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(b))
val amqpSchema = obj.envelope.schema.mangleNames(listOf(classTestName("A")))
assert(obj.obj is B)
require(obj.obj is B)
amqpSchema.carpenterSchema(ClassLoader.getSystemClassLoader())
}
@ -121,7 +121,7 @@ class CompositeMembers : AmqpCarpenterBase(AllWhitelist) {
val b = B(A(testA), testB)
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 carpenterSchema = amqpSchema.carpenterSchema(ClassLoader.getSystemClassLoader())
@ -132,7 +132,7 @@ class CompositeMembers : AmqpCarpenterBase(AllWhitelist) {
metaCarpenter.build()
assert(mangleName(classTestName("B")) in metaCarpenter.objects)
require(mangleName(classTestName("B")) in metaCarpenter.objects)
}
@Test
@ -149,7 +149,7 @@ class CompositeMembers : AmqpCarpenterBase(AllWhitelist) {
val b = B(A(testA), testB)
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 carpenterSchema = amqpSchema.carpenterSchema(ClassLoader.getSystemClassLoader())
@ -159,9 +159,9 @@ class CompositeMembers : AmqpCarpenterBase(AllWhitelist) {
assertEquals(1, carpenterSchema.size)
assertEquals(mangleName(classTestName("A")), carpenterSchema.carpenterSchemas.first().name)
assertEquals(1, carpenterSchema.dependencies.size)
assert(mangleName(classTestName("B")) in carpenterSchema.dependencies)
require(mangleName(classTestName("B")) in carpenterSchema.dependencies)
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))
@ -182,8 +182,8 @@ class CompositeMembers : AmqpCarpenterBase(AllWhitelist) {
// second manual iteration, will carpent B
metaCarpenter.build()
assert(mangleName(classTestName("A")) in metaCarpenter.objects)
assert(mangleName(classTestName("B")) in metaCarpenter.objects)
require(mangleName(classTestName("A")) in metaCarpenter.objects)
require(mangleName(classTestName("B")) in metaCarpenter.objects)
// and we must be finished
assertTrue(carpenterSchema.carpenterSchemas.isEmpty())
@ -208,7 +208,7 @@ class CompositeMembers : AmqpCarpenterBase(AllWhitelist) {
val c = C(B(testA, testB), testC)
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")))
@ -234,7 +234,7 @@ class CompositeMembers : AmqpCarpenterBase(AllWhitelist) {
val c = C(B(testA, testB), testC)
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")))
@ -260,7 +260,7 @@ class CompositeMembers : AmqpCarpenterBase(AllWhitelist) {
val c = C(B(testA, testB), testC)
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")))
TestMetaCarpenter(carpenterSchema.carpenterSchema(
@ -283,7 +283,7 @@ class CompositeMembers : AmqpCarpenterBase(AllWhitelist) {
val b = B(testA, testB)
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 metaCarpenter = TestMetaCarpenter(carpenterSchema.carpenterSchema())

View File

@ -31,13 +31,13 @@ class MultiMemberCompositeSchemaToClassCarpenterTests : AmqpCarpenterBase(AllWhi
val a = A(testA, testB)
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(a))
assert(obj.obj is A)
require(obj.obj is A)
val amqpObj = obj.obj as A
assertEquals(testA, amqpObj.a)
assertEquals(testB, amqpObj.b)
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
@ -75,13 +75,13 @@ class MultiMemberCompositeSchemaToClassCarpenterTests : AmqpCarpenterBase(AllWhi
val a = A(testA, testB)
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(a))
assert(obj.obj is A)
require(obj.obj is A)
val amqpObj = obj.obj as A
assertEquals(testA, amqpObj.a)
assertEquals(testB, amqpObj.b)
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

View File

@ -28,12 +28,12 @@ class SingleMemberCompositeSchemaToClassCarpenterTests : AmqpCarpenterBase(AllWh
val a = A(test)
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(a))
assert(obj.obj is A)
require(obj.obj is A)
val amqpObj = obj.obj as A
assertEquals(test, amqpObj.a)
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
@ -64,12 +64,12 @@ class SingleMemberCompositeSchemaToClassCarpenterTests : AmqpCarpenterBase(AllWh
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(a))
assert(obj.obj is A)
require(obj.obj is A)
val amqpObj = obj.obj as A
assertEquals(test, amqpObj.a)
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 carpenterSchema = CarpenterMetaSchema.newInstance()
@ -94,12 +94,12 @@ class SingleMemberCompositeSchemaToClassCarpenterTests : AmqpCarpenterBase(AllWh
val a = A(test)
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(a))
assert(obj.obj is A)
require(obj.obj is A)
val amqpObj = obj.obj as A
assertEquals(test, amqpObj.a)
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
@ -129,12 +129,12 @@ class SingleMemberCompositeSchemaToClassCarpenterTests : AmqpCarpenterBase(AllWh
val a = A(test)
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(a))
assert(obj.obj is A)
require(obj.obj is A)
val amqpObj = obj.obj as A
assertEquals(test, amqpObj.a)
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
@ -164,12 +164,12 @@ class SingleMemberCompositeSchemaToClassCarpenterTests : AmqpCarpenterBase(AllWh
val a = A(test)
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(a))
assert(obj.obj is A)
require(obj.obj is A)
val amqpObj = obj.obj as A
assertEquals(test, amqpObj.a)
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
@ -199,12 +199,12 @@ class SingleMemberCompositeSchemaToClassCarpenterTests : AmqpCarpenterBase(AllWh
val a = A(test)
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(a))
assert(obj.obj is A)
require(obj.obj is A)
val amqpObj = obj.obj as A
assertEquals(test, amqpObj.a)
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