mirror of
https://github.com/corda/corda.git
synced 2025-06-15 21:58:17 +00:00
Resolved all non-deprecation warnings
This commit is contained in:
@ -23,13 +23,14 @@ object AmountBindings {
|
|||||||
) { sum -> Amount(sum.toLong(), token) }
|
) { sum -> Amount(sum.toLong(), token) }
|
||||||
|
|
||||||
fun exchange(
|
fun exchange(
|
||||||
currency: ObservableValue<Currency>,
|
observableCurrency: ObservableValue<Currency>,
|
||||||
exchangeRate: ObservableValue<ExchangeRate>
|
observableExchangeRate: ObservableValue<ExchangeRate>
|
||||||
): ObservableValue<Pair<Currency, (Amount<Currency>) -> Long>> {
|
): ObservableValue<Pair<Currency, (Amount<Currency>) -> Long>> {
|
||||||
return EasyBind.combine(currency, exchangeRate) { currency, exchangeRate ->
|
return EasyBind.combine(observableCurrency, observableExchangeRate) { currency, exchangeRate ->
|
||||||
Pair(currency) { amount: Amount<Currency> ->
|
Pair<Currency, (Amount<Currency>) -> Long>(
|
||||||
(exchangeRate.rate(amount.token, currency) * amount.quantity).toLong()
|
currency,
|
||||||
}
|
{ (quantity, _, token) -> (exchangeRate.rate(token, currency) * quantity).toLong() }
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ fun <A> Generator.Companion.replicatePoisson(meanSize: Double, generator: Genera
|
|||||||
val result = mutableListOf<A>()
|
val result = mutableListOf<A>()
|
||||||
var finish = false
|
var finish = false
|
||||||
while (!finish) {
|
while (!finish) {
|
||||||
val result = Generator.doubleRange(0.0, 1.0).generate(it).flatMap { value ->
|
val res = Generator.doubleRange(0.0, 1.0).generate(it).flatMap { value ->
|
||||||
if (value < chance) {
|
if (value < chance) {
|
||||||
generator.generate(it).map { result.add(it) }
|
generator.generate(it).map { result.add(it) }
|
||||||
} else {
|
} else {
|
||||||
@ -180,8 +180,8 @@ fun <A> Generator.Companion.replicatePoisson(meanSize: Double, generator: Genera
|
|||||||
Try.Success(Unit)
|
Try.Success(Unit)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (result is Try.Failure) {
|
if (res is Try.Failure) {
|
||||||
return@Generator result
|
return@Generator res
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Try.Success(result)
|
Try.Success(result)
|
||||||
|
@ -10,7 +10,7 @@ import java.lang.reflect.Type
|
|||||||
open class ArraySerializer(override val type: Type, factory: SerializerFactory) : AMQPSerializer<Any> {
|
open class ArraySerializer(override val type: Type, factory: SerializerFactory) : AMQPSerializer<Any> {
|
||||||
companion object {
|
companion object {
|
||||||
fun make(type: Type, factory: SerializerFactory) = when (type) {
|
fun make(type: Type, factory: SerializerFactory) = when (type) {
|
||||||
Array<Character>::class.java -> CharArraySerializer(factory)
|
Array<Char>::class.java -> CharArraySerializer(factory)
|
||||||
else -> ArraySerializer(type, factory)
|
else -> ArraySerializer(type, factory)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -73,7 +73,7 @@ open class ArraySerializer(override val type: Type, factory: SerializerFactory)
|
|||||||
|
|
||||||
// Boxed Character arrays required a specialisation to handle the type conversion properly when populating
|
// Boxed Character arrays required a specialisation to handle the type conversion properly when populating
|
||||||
// the array since Kotlin won't allow an implicit cast from Int (as they're stored as 16bit ints) to Char
|
// the array since Kotlin won't allow an implicit cast from Int (as they're stored as 16bit ints) to Char
|
||||||
class CharArraySerializer(factory: SerializerFactory) : ArraySerializer(Array<Character>::class.java, factory) {
|
class CharArraySerializer(factory: SerializerFactory) : ArraySerializer(Array<Char>::class.java, factory) {
|
||||||
override fun <T> List<T>.toArrayOfType(type: Type): Any {
|
override fun <T> List<T>.toArrayOfType(type: Type): Any {
|
||||||
val elementType = type.asClass() ?: throw NotSerializableException("Unexpected array element type $type")
|
val elementType = type.asClass() ?: throw NotSerializableException("Unexpected array element type $type")
|
||||||
val list = this
|
val list = this
|
||||||
|
@ -11,7 +11,7 @@ import java.lang.reflect.Type
|
|||||||
import java.nio.ByteBuffer
|
import java.nio.ByteBuffer
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
data class objectAndEnvelope<T>(val obj: T, val envelope: Envelope)
|
data class ObjectAndEnvelope<out T>(val obj: T, val envelope: Envelope)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main entry point for deserializing an AMQP encoded object.
|
* Main entry point for deserializing an AMQP encoded object.
|
||||||
@ -64,7 +64,7 @@ class DeserializationInput(internal val serializerFactory: SerializerFactory = S
|
|||||||
|
|
||||||
|
|
||||||
@Throws(NotSerializableException::class)
|
@Throws(NotSerializableException::class)
|
||||||
inline internal fun <reified T : Any> deserializeAndReturnEnvelope(bytes: SerializedBytes<T>): objectAndEnvelope<T> =
|
inline internal fun <reified T : Any> deserializeAndReturnEnvelope(bytes: SerializedBytes<T>): ObjectAndEnvelope<T> =
|
||||||
deserializeAndReturnEnvelope(bytes, T::class.java)
|
deserializeAndReturnEnvelope(bytes, T::class.java)
|
||||||
|
|
||||||
|
|
||||||
@ -84,11 +84,10 @@ class DeserializationInput(internal val serializerFactory: SerializerFactory = S
|
|||||||
return Envelope.get(data)
|
return Envelope.get(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Throws(NotSerializableException::class)
|
@Throws(NotSerializableException::class)
|
||||||
private fun <T : Any, R> des(bytes: SerializedBytes<T>, clazz: Class<T>, generator: (SerializedBytes<T>, Class<T>) -> R): R {
|
private fun <R> des(generator: () -> R): R {
|
||||||
try {
|
try {
|
||||||
return generator(bytes, clazz)
|
return generator()
|
||||||
} catch(nse: NotSerializableException) {
|
} catch(nse: NotSerializableException) {
|
||||||
throw nse
|
throw nse
|
||||||
} catch(t: Throwable) {
|
} catch(t: Throwable) {
|
||||||
@ -105,27 +104,23 @@ class DeserializationInput(internal val serializerFactory: SerializerFactory = S
|
|||||||
*/
|
*/
|
||||||
@Throws(NotSerializableException::class)
|
@Throws(NotSerializableException::class)
|
||||||
fun <T : Any> deserialize(bytes: SerializedBytes<T>, clazz: Class<T>): T {
|
fun <T : Any> deserialize(bytes: SerializedBytes<T>, clazz: Class<T>): T {
|
||||||
return des<T, T>(bytes, clazz) { bytes, clazz ->
|
return des {
|
||||||
var envelope = getEnvelope(bytes)
|
val envelope = getEnvelope(bytes)
|
||||||
clazz.cast(readObjectOrNull(envelope.obj, envelope.schema, clazz))
|
clazz.cast(readObjectOrNull(envelope.obj, envelope.schema, clazz))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Throws(NotSerializableException::class)
|
@Throws(NotSerializableException::class)
|
||||||
internal fun <T : Any> deserializeAndReturnEnvelope(bytes: SerializedBytes<T>, clazz: Class<T>): objectAndEnvelope<T> {
|
internal fun <T : Any> deserializeAndReturnEnvelope(bytes: SerializedBytes<T>, clazz: Class<T>): ObjectAndEnvelope<T> {
|
||||||
return des<T, objectAndEnvelope<T>>(bytes, clazz) { bytes, clazz ->
|
return des {
|
||||||
val envelope = getEnvelope(bytes)
|
val envelope = getEnvelope(bytes)
|
||||||
// Now pick out the obj and schema from the envelope.
|
// Now pick out the obj and schema from the envelope.
|
||||||
objectAndEnvelope(clazz.cast(readObjectOrNull(envelope.obj, envelope.schema, clazz)), envelope)
|
ObjectAndEnvelope(clazz.cast(readObjectOrNull(envelope.obj, envelope.schema, clazz)), envelope)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun readObjectOrNull(obj: Any?, schema: Schema, type: Type): Any? {
|
internal fun readObjectOrNull(obj: Any?, schema: Schema, type: Type): Any? {
|
||||||
if (obj == null) {
|
return if (obj == null) null else readObject(obj, schema, type)
|
||||||
return null
|
|
||||||
} else {
|
|
||||||
return readObject(obj, schema, type)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun readObject(obj: Any, schema: Schema, type: Type): Any {
|
internal fun readObject(obj: Any, schema: Schema, type: Type): Any {
|
||||||
|
@ -112,7 +112,7 @@ internal fun interfacesForSerialization(type: Type): List<Type> {
|
|||||||
private fun exploreType(type: Type?, interfaces: MutableSet<Type>) {
|
private fun exploreType(type: Type?, interfaces: MutableSet<Type>) {
|
||||||
val clazz = type?.asClass()
|
val clazz = type?.asClass()
|
||||||
if (clazz != null) {
|
if (clazz != null) {
|
||||||
if (clazz.isInterface) interfaces += type!!
|
if (clazz.isInterface) interfaces += type
|
||||||
for (newInterface in clazz.genericInterfaces) {
|
for (newInterface in clazz.genericInterfaces) {
|
||||||
if (newInterface !in interfaces) {
|
if (newInterface !in interfaces) {
|
||||||
exploreType(resolveTypeVariables(newInterface, type), interfaces)
|
exploreType(resolveTypeVariables(newInterface, type), interfaces)
|
||||||
|
@ -121,7 +121,7 @@ data class WireTransaction(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun<T : Any> filterAndNoncesUpdate(filtering: Predicate<Any>, t: T, index: Int): Boolean {
|
fun <T : Any> filterAndNoncesUpdate(t: T, index: Int): Boolean {
|
||||||
return if (filtering.test(t)) {
|
return if (filtering.test(t)) {
|
||||||
nonces.add(computeNonce(privacySalt, index))
|
nonces.add(computeNonce(privacySalt, index))
|
||||||
true
|
true
|
||||||
@ -129,14 +129,15 @@ data class WireTransaction(
|
|||||||
false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: We should have a warning (require) if all leaves (excluding salt) are visible after filtering.
|
// TODO: We should have a warning (require) if all leaves (excluding salt) are visible after filtering.
|
||||||
// Consider the above after refactoring FilteredTransaction to implement TraversableTransaction,
|
// Consider the above after refactoring FilteredTransaction to implement TraversableTransaction,
|
||||||
// so that a WireTransaction can be used when required to send a full tx (e.g. RatesFixFlow in Oracles).
|
// so that a WireTransaction can be used when required to send a full tx (e.g. RatesFixFlow in Oracles).
|
||||||
return FilteredLeaves(
|
return FilteredLeaves(
|
||||||
inputs.filterIndexed { index, it -> filterAndNoncesUpdate(filtering, it, index) },
|
inputs.filterIndexed { index, it -> filterAndNoncesUpdate(it, index) },
|
||||||
attachments.filterIndexed { index, it -> filterAndNoncesUpdate(filtering, it, index + offsets[0]) },
|
attachments.filterIndexed { index, it -> filterAndNoncesUpdate(it, index + offsets[0]) },
|
||||||
outputs.filterIndexed { index, it -> filterAndNoncesUpdate(filtering, it, index + offsets[1]) },
|
outputs.filterIndexed { index, it -> filterAndNoncesUpdate(it, index + offsets[1]) },
|
||||||
commands.filterIndexed { index, it -> filterAndNoncesUpdate(filtering, it, index + offsets[2]) },
|
commands.filterIndexed { index, it -> filterAndNoncesUpdate(it, index + offsets[2]) },
|
||||||
notNullFalseAndNoncesUpdate(notary, offsets[3]) as Party?,
|
notNullFalseAndNoncesUpdate(notary, offsets[3]) as Party?,
|
||||||
notNullFalseAndNoncesUpdate(timeWindow, offsets[4]) as TimeWindow?,
|
notNullFalseAndNoncesUpdate(timeWindow, offsets[4]) as TimeWindow?,
|
||||||
nonces
|
nonces
|
||||||
|
@ -110,11 +110,10 @@ class SerializationTokenTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class WrongTypeSerializeAsToken : SerializeAsToken {
|
private class WrongTypeSerializeAsToken : SerializeAsToken {
|
||||||
override fun toToken(context: SerializeAsTokenContext): SerializationToken {
|
object UnitSerializationToken : SerializationToken {
|
||||||
return object : SerializationToken {
|
|
||||||
override fun fromToken(context: SerializeAsTokenContext): Any = UnitSerializeAsToken()
|
override fun fromToken(context: SerializeAsTokenContext): Any = UnitSerializeAsToken()
|
||||||
}
|
}
|
||||||
}
|
override fun toToken(context: SerializeAsTokenContext): SerializationToken = UnitSerializationToken
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = KryoException::class)
|
@Test(expected = KryoException::class)
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
package net.corda.core.serialization.amqp
|
package net.corda.core.serialization.amqp
|
||||||
|
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import kotlin.test.*
|
import kotlin.test.assertEquals
|
||||||
|
import kotlin.test.assertNotEquals
|
||||||
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
class DeserializeAndReturnEnvelopeTests {
|
class DeserializeAndReturnEnvelopeTests {
|
||||||
|
|
||||||
fun testName() = Thread.currentThread().stackTrace[2].methodName
|
fun testName(): String = Thread.currentThread().stackTrace[2].methodName
|
||||||
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
inline fun classTestName(clazz: String) = "${this.javaClass.name}\$${testName()}\$$clazz"
|
inline fun classTestName(clazz: String) = "${this.javaClass.name}\$${testName()}\$$clazz"
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -14,7 +17,7 @@ class DeserializeAndReturnEnvelopeTests {
|
|||||||
|
|
||||||
val a = A(10, "20")
|
val a = A(10, "20")
|
||||||
|
|
||||||
var factory = SerializerFactory()
|
val factory = SerializerFactory()
|
||||||
fun serialise(clazz: Any) = SerializationOutput(factory).serialize(clazz)
|
fun serialise(clazz: Any) = SerializationOutput(factory).serialize(clazz)
|
||||||
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(a))
|
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(a))
|
||||||
|
|
||||||
@ -30,7 +33,7 @@ class DeserializeAndReturnEnvelopeTests {
|
|||||||
|
|
||||||
val b = B(A(10, "20"), 30.0F)
|
val b = B(A(10, "20"), 30.0F)
|
||||||
|
|
||||||
var factory = SerializerFactory()
|
val factory = SerializerFactory()
|
||||||
fun serialise(clazz: Any) = SerializationOutput(factory).serialize(clazz)
|
fun serialise(clazz: Any) = SerializationOutput(factory).serialize(clazz)
|
||||||
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(b))
|
val obj = DeserializationInput(factory).deserializeAndReturnEnvelope(serialise(b))
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package net.corda.core.serialization.amqp
|
package net.corda.core.serialization.amqp
|
||||||
|
|
||||||
|
import org.apache.qpid.proton.codec.Data
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
import org.apache.qpid.proton.codec.Data
|
|
||||||
|
|
||||||
// Prior to certain fixes being made within the [PropertySerializaer] classes these simple
|
// Prior to certain fixes being made within the [PropertySerializaer] classes these simple
|
||||||
// deserialization operations would've blown up with type mismatch errors where the deserlized
|
// deserialization operations would've blown up with type mismatch errors where the deserlized
|
||||||
@ -52,6 +52,7 @@ class DeserializeSimpleTypesTests {
|
|||||||
assertEquals('আ', deserializedC.c)
|
assertEquals('আ', deserializedC.c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")
|
||||||
@Test
|
@Test
|
||||||
fun testCharacter() {
|
fun testCharacter() {
|
||||||
data class C(val c: Character)
|
data class C(val c: Character)
|
||||||
@ -92,6 +93,7 @@ class DeserializeSimpleTypesTests {
|
|||||||
assertEquals(ia.ia[2], deserializedIA.ia[2])
|
assertEquals(ia.ia[2], deserializedIA.ia[2])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")
|
||||||
@Test
|
@Test
|
||||||
fun testArrayOfInteger() {
|
fun testArrayOfInteger() {
|
||||||
class IA(val ia: Array<Integer>)
|
class IA(val ia: Array<Integer>)
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
package net.corda.core.serialization.carpenter.test
|
package net.corda.core.serialization.carpenter
|
||||||
|
|
||||||
import net.corda.core.serialization.amqp.CompositeType
|
import net.corda.core.serialization.amqp.*
|
||||||
import net.corda.core.serialization.amqp.Field
|
import net.corda.core.serialization.amqp.Field
|
||||||
import net.corda.core.serialization.amqp.Schema
|
import net.corda.core.serialization.amqp.Schema
|
||||||
import net.corda.core.serialization.amqp.TypeNotation
|
|
||||||
import net.corda.core.serialization.amqp.SerializerFactory
|
|
||||||
import net.corda.core.serialization.amqp.SerializationOutput
|
|
||||||
|
|
||||||
fun mangleName(name: String) = "${name}__carpenter"
|
fun mangleName(name: String) = "${name}__carpenter"
|
||||||
|
|
||||||
@ -18,7 +15,7 @@ fun Schema.mangleNames(names: List<String>): Schema {
|
|||||||
|
|
||||||
for (type in types) {
|
for (type in types) {
|
||||||
val newName = if (type.name in names) mangleName(type.name) else type.name
|
val newName = if (type.name in names) mangleName(type.name) else type.name
|
||||||
val newProvides = type.provides.map { it -> if (it in names) mangleName(it) else it }
|
val newProvides = type.provides.map { if (it in names) mangleName(it) else it }
|
||||||
val newFields = mutableListOf<Field>()
|
val newFields = mutableListOf<Field>()
|
||||||
|
|
||||||
(type as CompositeType).fields.forEach {
|
(type as CompositeType).fields.forEach {
|
||||||
@ -40,6 +37,7 @@ open class AmqpCarpenterBase {
|
|||||||
var factory = SerializerFactory()
|
var factory = SerializerFactory()
|
||||||
|
|
||||||
fun serialise(clazz: Any) = SerializationOutput(factory).serialize(clazz)
|
fun serialise(clazz: Any) = SerializationOutput(factory).serialize(clazz)
|
||||||
fun testName() = Thread.currentThread().stackTrace[2].methodName
|
fun testName(): String = Thread.currentThread().stackTrace[2].methodName
|
||||||
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
inline fun classTestName(clazz: String) = "${this.javaClass.name}\$${testName()}\$$clazz"
|
inline fun classTestName(clazz: String) = "${this.javaClass.name}\$${testName()}\$$clazz"
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package net.corda.core.serialization.carpenter
|
package net.corda.core.serialization.carpenter
|
||||||
|
|
||||||
import net.corda.core.serialization.carpenter.test.*
|
|
||||||
import net.corda.core.serialization.CordaSerializable
|
import net.corda.core.serialization.CordaSerializable
|
||||||
import net.corda.core.serialization.amqp.*
|
import net.corda.core.serialization.amqp.*
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package net.corda.core.serialization.carpenter
|
package net.corda.core.serialization.carpenter
|
||||||
|
|
||||||
import net.corda.core.serialization.CordaSerializable
|
import net.corda.core.serialization.CordaSerializable
|
||||||
import net.corda.core.serialization.carpenter.test.*
|
|
||||||
import net.corda.core.serialization.amqp.*
|
import net.corda.core.serialization.amqp.*
|
||||||
|
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package net.corda.core.serialization.carpenter
|
package net.corda.core.serialization.carpenter
|
||||||
|
|
||||||
import net.corda.core.serialization.carpenter.test.AmqpCarpenterBase
|
|
||||||
import net.corda.core.serialization.CordaSerializable
|
import net.corda.core.serialization.CordaSerializable
|
||||||
import net.corda.core.serialization.amqp.*
|
import net.corda.core.serialization.amqp.*
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package net.corda.core.serialization.carpenter
|
package net.corda.core.serialization.carpenter
|
||||||
|
|
||||||
import net.corda.core.serialization.carpenter.test.AmqpCarpenterBase
|
|
||||||
import net.corda.core.serialization.CordaSerializable
|
import net.corda.core.serialization.CordaSerializable
|
||||||
import net.corda.core.serialization.amqp.*
|
import net.corda.core.serialization.amqp.*
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
@file:Suppress("UNUSED_VARIABLE", "unused")
|
||||||
|
|
||||||
package net.corda.docs
|
package net.corda.docs
|
||||||
|
|
||||||
import co.paralleluniverse.fibers.Suspendable
|
import co.paralleluniverse.fibers.Suspendable
|
||||||
@ -83,6 +85,7 @@ object FlowCookbook {
|
|||||||
|
|
||||||
override val progressTracker: ProgressTracker = tracker()
|
override val progressTracker: ProgressTracker = tracker()
|
||||||
|
|
||||||
|
@Suppress("RemoveExplicitTypeArguments")
|
||||||
@Suspendable
|
@Suspendable
|
||||||
override fun call() {
|
override fun call() {
|
||||||
// We'll be using a dummy public key for demonstration purposes.
|
// We'll be using a dummy public key for demonstration purposes.
|
||||||
|
@ -32,7 +32,6 @@ import java.util.stream.Collectors;
|
|||||||
import static net.corda.core.contracts.ContractsDSL.requireSingleCommand;
|
import static net.corda.core.contracts.ContractsDSL.requireSingleCommand;
|
||||||
import static net.corda.core.contracts.ContractsDSL.requireThat;
|
import static net.corda.core.contracts.ContractsDSL.requireThat;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a Java version of the CommercialPaper contract (chosen because it's simple). This demonstrates how the
|
* This is a Java version of the CommercialPaper contract (chosen because it's simple). This demonstrates how the
|
||||||
* use of Kotlin for implementation of the framework does not impose the same language choice on contract developers.
|
* use of Kotlin for implementation of the framework does not impose the same language choice on contract developers.
|
||||||
@ -105,16 +104,17 @@ public class JavaCommercialPaper implements Contract {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object that) {
|
||||||
if (this == o) return true;
|
if (this == that) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if (that == null || getClass() != that.getClass()) return false;
|
||||||
|
|
||||||
State state = (State) o;
|
State state = (State) that;
|
||||||
|
|
||||||
if (issuance != null ? !issuance.equals(state.issuance) : state.issuance != null) return false;
|
if (issuance != null ? !issuance.equals(state.issuance) : state.issuance != null) return false;
|
||||||
if (owner != null ? !owner.equals(state.owner) : state.owner != null) return false;
|
if (owner != null ? !owner.equals(state.owner) : state.owner != null) return false;
|
||||||
if (faceValue != null ? !faceValue.equals(state.faceValue) : state.faceValue != null) return false;
|
if (faceValue != null ? !faceValue.equals(state.faceValue) : state.faceValue != null) return false;
|
||||||
return !(maturityDate != null ? !maturityDate.equals(state.maturityDate) : state.maturityDate != null);
|
if (maturityDate != null ? !maturityDate.equals(state.maturityDate) : state.maturityDate != null) return false;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -316,7 +316,7 @@ public class JavaCommercialPaper implements Contract {
|
|||||||
public TransactionBuilder generateIssue(@NotNull PartyAndReference issuance, @NotNull Amount<Issued<Currency>> faceValue, @Nullable Instant maturityDate, @NotNull Party notary, Integer encumbrance) {
|
public TransactionBuilder generateIssue(@NotNull PartyAndReference issuance, @NotNull Amount<Issued<Currency>> faceValue, @Nullable Instant maturityDate, @NotNull Party notary, Integer encumbrance) {
|
||||||
State state = new State(issuance, issuance.getParty(), faceValue, maturityDate);
|
State state = new State(issuance, issuance.getParty(), faceValue, maturityDate);
|
||||||
TransactionState output = new TransactionState<>(state, notary, encumbrance);
|
TransactionState output = new TransactionState<>(state, notary, encumbrance);
|
||||||
return new TransactionBuilder(notary).withItems(output, new Command(new Commands.Issue(), issuance.getParty().getOwningKey()));
|
return new TransactionBuilder(notary).withItems(output, new Command<>(new Commands.Issue(), issuance.getParty().getOwningKey()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public TransactionBuilder generateIssue(@NotNull PartyAndReference issuance, @NotNull Amount<Issued<Currency>> faceValue, @Nullable Instant maturityDate, @NotNull Party notary) {
|
public TransactionBuilder generateIssue(@NotNull PartyAndReference issuance, @NotNull Amount<Issued<Currency>> faceValue, @Nullable Instant maturityDate, @NotNull Party notary) {
|
||||||
@ -327,12 +327,12 @@ public class JavaCommercialPaper implements Contract {
|
|||||||
public void generateRedeem(TransactionBuilder tx, StateAndRef<State> paper, VaultService vault) throws InsufficientBalanceException {
|
public void generateRedeem(TransactionBuilder tx, StateAndRef<State> paper, VaultService vault) throws InsufficientBalanceException {
|
||||||
vault.generateSpend(tx, StructuresKt.withoutIssuer(paper.getState().getData().getFaceValue()), paper.getState().getData().getOwner(), null);
|
vault.generateSpend(tx, StructuresKt.withoutIssuer(paper.getState().getData().getFaceValue()), paper.getState().getData().getOwner(), null);
|
||||||
tx.addInputState(paper);
|
tx.addInputState(paper);
|
||||||
tx.addCommand(new Command(new Commands.Redeem(), paper.getState().getData().getOwner().getOwningKey()));
|
tx.addCommand(new Command<>(new Commands.Redeem(), paper.getState().getData().getOwner().getOwningKey()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void generateMove(TransactionBuilder tx, StateAndRef<State> paper, AbstractParty newOwner) {
|
public void generateMove(TransactionBuilder tx, StateAndRef<State> paper, AbstractParty newOwner) {
|
||||||
tx.addInputState(paper);
|
tx.addInputState(paper);
|
||||||
tx.addOutputState(new TransactionState<>(new State(paper.getState().getData().getIssuance(), newOwner, paper.getState().getData().getFaceValue(), paper.getState().getData().getMaturityDate()), paper.getState().getNotary(), paper.getState().getEncumbrance()));
|
tx.addOutputState(new TransactionState<>(new State(paper.getState().getData().getIssuance(), newOwner, paper.getState().getData().getFaceValue(), paper.getState().getData().getMaturityDate()), paper.getState().getNotary(), paper.getState().getEncumbrance()));
|
||||||
tx.addCommand(new Command(new Commands.Move(), paper.getState().getData().getOwner().getOwningKey()));
|
tx.addCommand(new Command<>(new Commands.Move(), paper.getState().getData().getOwner().getOwningKey()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ import com.fasterxml.jackson.databind.JsonSerializer
|
|||||||
import com.fasterxml.jackson.databind.SerializerProvider
|
import com.fasterxml.jackson.databind.SerializerProvider
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
|
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize
|
||||||
|
import net.corda.contracts.asset.CommodityContract
|
||||||
import net.corda.core.contracts.CommandData
|
import net.corda.core.contracts.CommandData
|
||||||
import net.corda.core.contracts.LinearState
|
import net.corda.core.contracts.LinearState
|
||||||
import net.corda.core.contracts.StateAndRef
|
import net.corda.core.contracts.StateAndRef
|
||||||
@ -25,7 +26,6 @@ import java.time.LocalDate
|
|||||||
import java.time.format.DateTimeFormatter
|
import java.time.format.DateTimeFormatter
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Interest rate fixes
|
// Interest rate fixes
|
||||||
@ -83,7 +83,6 @@ data class Tenor(val name: String) {
|
|||||||
TimeUnit.Week -> startDate.plusWeeks(amount.toLong())
|
TimeUnit.Week -> startDate.plusWeeks(amount.toLong())
|
||||||
TimeUnit.Month -> startDate.plusMonths(amount.toLong())
|
TimeUnit.Month -> startDate.plusMonths(amount.toLong())
|
||||||
TimeUnit.Year -> startDate.plusYears(amount.toLong())
|
TimeUnit.Year -> startDate.plusYears(amount.toLong())
|
||||||
else -> throw IllegalStateException("Invalid tenor time unit: $unit")
|
|
||||||
}
|
}
|
||||||
// Move date to the closest business day when it falls on a weekend/holiday
|
// Move date to the closest business day when it falls on a weekend/holiday
|
||||||
val adjustedMaturityDate = calendar.applyRollConvention(maturityDate, DateRollConvention.ModifiedFollowing)
|
val adjustedMaturityDate = calendar.applyRollConvention(maturityDate, DateRollConvention.ModifiedFollowing)
|
||||||
|
@ -72,17 +72,17 @@ class CashPaymentFlowTests {
|
|||||||
expect { update ->
|
expect { update ->
|
||||||
require(update.consumed.size == 1) { "Expected 1 consumed states, actual: $update" }
|
require(update.consumed.size == 1) { "Expected 1 consumed states, actual: $update" }
|
||||||
require(update.produced.size == 1) { "Expected 1 produced states, actual: $update" }
|
require(update.produced.size == 1) { "Expected 1 produced states, actual: $update" }
|
||||||
val changeState = update.produced.single().state.data as Cash.State
|
val changeState = update.produced.single().state.data
|
||||||
assertEquals(expectedChange.`issued by`(bankOfCorda.ref(ref)), changeState.amount)
|
assertEquals(expectedChange.`issued by`(bankOfCorda.ref(ref)), changeState.amount)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check notary node vault updates
|
// Check notary node vault updates
|
||||||
vaultUpdatesBankClient.expectEvents {
|
vaultUpdatesBankClient.expectEvents {
|
||||||
expect { update ->
|
expect { (consumed, produced) ->
|
||||||
require(update.consumed.isEmpty()) { update.consumed.size }
|
require(consumed.isEmpty()) { consumed.size }
|
||||||
require(update.produced.size == 1) { update.produced.size }
|
require(produced.size == 1) { produced.size }
|
||||||
val paymentState = update.produced.single().state.data as Cash.State
|
val paymentState = produced.single().state.data
|
||||||
assertEquals(expectedPayment.`issued by`(bankOfCorda.ref(ref)), paymentState.amount)
|
assertEquals(expectedPayment.`issued by`(bankOfCorda.ref(ref)), paymentState.amount)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,10 +14,12 @@ import net.corda.core.node.services.vault.QueryCriteria
|
|||||||
import net.corda.core.transactions.SignedTransaction
|
import net.corda.core.transactions.SignedTransaction
|
||||||
import net.corda.core.utilities.OpaqueBytes
|
import net.corda.core.utilities.OpaqueBytes
|
||||||
import net.corda.flows.IssuerFlow.IssuanceRequester
|
import net.corda.flows.IssuerFlow.IssuanceRequester
|
||||||
import net.corda.testing.*
|
|
||||||
import net.corda.testing.contracts.calculateRandomlySizedAmounts
|
import net.corda.testing.contracts.calculateRandomlySizedAmounts
|
||||||
|
import net.corda.testing.expect
|
||||||
|
import net.corda.testing.expectEvents
|
||||||
import net.corda.testing.node.MockNetwork
|
import net.corda.testing.node.MockNetwork
|
||||||
import net.corda.testing.node.MockNetwork.MockNode
|
import net.corda.testing.node.MockNetwork.MockNode
|
||||||
|
import net.corda.testing.sequence
|
||||||
import org.junit.After
|
import org.junit.After
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
@ -79,7 +81,7 @@ class IssuerFlowTest(val anonymous: Boolean) {
|
|||||||
expect { update ->
|
expect { update ->
|
||||||
require(update.consumed.isEmpty()) { "Expected 0 consumed states, actual: $update" }
|
require(update.consumed.isEmpty()) { "Expected 0 consumed states, actual: $update" }
|
||||||
require(update.produced.size == 1) { "Expected 1 produced states, actual: $update" }
|
require(update.produced.size == 1) { "Expected 1 produced states, actual: $update" }
|
||||||
val issued = update.produced.single().state.data as Cash.State
|
val issued = update.produced.single().state.data
|
||||||
require(issued.owner.owningKey in bankOfCordaNode.services.keyManagementService.keys)
|
require(issued.owner.owningKey in bankOfCordaNode.services.keyManagementService.keys)
|
||||||
},
|
},
|
||||||
// MOVE
|
// MOVE
|
||||||
@ -93,10 +95,10 @@ class IssuerFlowTest(val anonymous: Boolean) {
|
|||||||
// Check Bank Client Vault Updates
|
// Check Bank Client Vault Updates
|
||||||
vaultUpdatesBankClient.expectEvents {
|
vaultUpdatesBankClient.expectEvents {
|
||||||
// MOVE
|
// MOVE
|
||||||
expect { update ->
|
expect { (consumed, produced) ->
|
||||||
require(update.consumed.isEmpty()) { update.consumed.size }
|
require(consumed.isEmpty()) { consumed.size }
|
||||||
require(update.produced.size == 1) { update.produced.size }
|
require(produced.size == 1) { produced.size }
|
||||||
val paidState = update.produced.single().state.data as Cash.State
|
val paidState = produced.single().state.data
|
||||||
require(paidState.owner.owningKey in bankClientNode.services.keyManagementService.keys)
|
require(paidState.owner.owningKey in bankClientNode.services.keyManagementService.keys)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -464,12 +464,12 @@ class VaultSchemaTest : TestDependencyInjectionBase() {
|
|||||||
fun testInsert() {
|
fun testInsert() {
|
||||||
val stateEntity = createStateEntity(transaction!!.inputs[0])
|
val stateEntity = createStateEntity(transaction!!.inputs[0])
|
||||||
val latch = CountDownLatch(1)
|
val latch = CountDownLatch(1)
|
||||||
odata.insert(stateEntity).subscribe { stateEntity ->
|
odata.insert(stateEntity).subscribe {
|
||||||
Assert.assertNotNull(stateEntity.txId)
|
Assert.assertNotNull(it.txId)
|
||||||
Assert.assertTrue(stateEntity.txId.isNotEmpty())
|
Assert.assertTrue(it.txId.isNotEmpty())
|
||||||
val cached = data.select(VaultSchema.VaultStates::class)
|
val cached = data.select(VaultSchema.VaultStates::class)
|
||||||
.where(VaultSchema.VaultStates::txId.eq(stateEntity.txId)).get().first()
|
.where(VaultSchema.VaultStates::txId.eq(it.txId)).get().first()
|
||||||
Assert.assertSame(cached, stateEntity)
|
Assert.assertSame(cached, it)
|
||||||
latch.countDown()
|
latch.countDown()
|
||||||
}
|
}
|
||||||
latch.await()
|
latch.await()
|
||||||
|
@ -21,10 +21,9 @@ class AdvertisedServiceTests {
|
|||||||
|
|
||||||
@StartableByRPC
|
@StartableByRPC
|
||||||
class ServiceTypeCheckingFlow : FlowLogic<Boolean>() {
|
class ServiceTypeCheckingFlow : FlowLogic<Boolean>() {
|
||||||
|
|
||||||
@Suspendable
|
@Suspendable
|
||||||
override fun call(): Boolean {
|
override fun call(): Boolean {
|
||||||
return serviceHub.networkMapCache.getAnyServiceOfType(ServiceType.corda.getSubType("custom")) != null;
|
return serviceHub.networkMapCache.getAnyServiceOfType(ServiceType.corda.getSubType("custom")) != null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,7 +31,7 @@ class AdvertisedServiceTests {
|
|||||||
fun `service is accessible through getAnyServiceOfType`() {
|
fun `service is accessible through getAnyServiceOfType`() {
|
||||||
driver(startNodesInProcess = true) {
|
driver(startNodesInProcess = true) {
|
||||||
val bankA = startNode(rpcUsers = listOf(User(user, pass, setOf(startFlowPermission<ServiceTypeCheckingFlow>())))).get()
|
val bankA = startNode(rpcUsers = listOf(User(user, pass, setOf(startFlowPermission<ServiceTypeCheckingFlow>())))).get()
|
||||||
val bankB = startNode(advertisedServices = setOf(ServiceInfo(serviceType, serviceName))).get()
|
startNode(advertisedServices = setOf(ServiceInfo(serviceType, serviceName))).get()
|
||||||
bankA.rpcClientToNode().use(user, pass) { connection ->
|
bankA.rpcClientToNode().use(user, pass) { connection ->
|
||||||
val result = connection.proxy.startFlow(::ServiceTypeCheckingFlow).returnValue.get()
|
val result = connection.proxy.startFlow(::ServiceTypeCheckingFlow).returnValue.get()
|
||||||
assertTrue(result)
|
assertTrue(result)
|
||||||
|
@ -54,7 +54,7 @@ class DistributedImmutableMap<K : Any, V : Any>(val db: CordaPersistence, tableN
|
|||||||
* @return map containing conflicting entries
|
* @return map containing conflicting entries
|
||||||
*/
|
*/
|
||||||
fun put(commit: Commit<Commands.PutAll<K, V>>): Map<K, V> {
|
fun put(commit: Commit<Commands.PutAll<K, V>>): Map<K, V> {
|
||||||
commit.use { commit ->
|
commit.use {
|
||||||
val conflicts = LinkedHashMap<K, V>()
|
val conflicts = LinkedHashMap<K, V>()
|
||||||
db.transaction {
|
db.transaction {
|
||||||
val entries = commit.operation().entries
|
val entries = commit.operation().entries
|
||||||
|
@ -9,13 +9,12 @@ import com.fasterxml.jackson.dataformat.yaml.YAMLFactory
|
|||||||
import com.google.common.io.Closeables
|
import com.google.common.io.Closeables
|
||||||
import com.google.common.util.concurrent.ListenableFuture
|
import com.google.common.util.concurrent.ListenableFuture
|
||||||
import com.google.common.util.concurrent.SettableFuture
|
import com.google.common.util.concurrent.SettableFuture
|
||||||
import net.corda.core.*
|
|
||||||
import net.corda.core.flows.FlowInitiator
|
import net.corda.core.flows.FlowInitiator
|
||||||
import net.corda.core.flows.FlowLogic
|
import net.corda.core.flows.FlowLogic
|
||||||
import net.corda.core.internal.*
|
import net.corda.core.internal.*
|
||||||
import net.corda.core.messaging.CordaRPCOps
|
import net.corda.core.messaging.CordaRPCOps
|
||||||
import net.corda.core.messaging.StateMachineUpdate
|
import net.corda.core.messaging.StateMachineUpdate
|
||||||
import net.corda.core.internal.Emoji
|
import net.corda.core.then
|
||||||
import net.corda.core.utilities.loggerFor
|
import net.corda.core.utilities.loggerFor
|
||||||
import net.corda.jackson.JacksonSupport
|
import net.corda.jackson.JacksonSupport
|
||||||
import net.corda.jackson.StringToMethodCallParser
|
import net.corda.jackson.StringToMethodCallParser
|
||||||
@ -48,7 +47,6 @@ import org.crsh.vfs.spi.url.ClassPathMountFactory
|
|||||||
import rx.Observable
|
import rx.Observable
|
||||||
import rx.Subscriber
|
import rx.Subscriber
|
||||||
import java.io.*
|
import java.io.*
|
||||||
import java.lang.reflect.Constructor
|
|
||||||
import java.lang.reflect.InvocationTargetException
|
import java.lang.reflect.InvocationTargetException
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
@ -274,25 +272,25 @@ object InteractiveShell {
|
|||||||
val errors = ArrayList<String>()
|
val errors = ArrayList<String>()
|
||||||
for (ctor in clazz.constructors) {
|
for (ctor in clazz.constructors) {
|
||||||
var paramNamesFromConstructor: List<String>? = null
|
var paramNamesFromConstructor: List<String>? = null
|
||||||
fun getPrototype(ctor: Constructor<*>): List<String> {
|
fun getPrototype(): List<String> {
|
||||||
val argTypes = ctor.parameterTypes.map { it.simpleName }
|
val argTypes = ctor.parameterTypes.map { it.simpleName }
|
||||||
val prototype = paramNamesFromConstructor!!.zip(argTypes).map { (name, type) -> "$name: $type" }
|
return paramNamesFromConstructor!!.zip(argTypes).map { (name, type) -> "$name: $type" }
|
||||||
return prototype
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Attempt construction with the given arguments.
|
// Attempt construction with the given arguments.
|
||||||
paramNamesFromConstructor = parser.paramNamesFromConstructor(ctor)
|
paramNamesFromConstructor = parser.paramNamesFromConstructor(ctor)
|
||||||
val args = parser.parseArguments(clazz.name, paramNamesFromConstructor.zip(ctor.parameterTypes), inputData)
|
val args = parser.parseArguments(clazz.name, paramNamesFromConstructor.zip(ctor.parameterTypes), inputData)
|
||||||
if (args.size != ctor.parameterTypes.size) {
|
if (args.size != ctor.parameterTypes.size) {
|
||||||
errors.add("${getPrototype(ctor)}: Wrong number of arguments (${args.size} provided, ${ctor.parameterTypes.size} needed)")
|
errors.add("${getPrototype()}: Wrong number of arguments (${args.size} provided, ${ctor.parameterTypes.size} needed)")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
val flow = ctor.newInstance(*args) as FlowLogic<*>
|
val flow = ctor.newInstance(*args) as FlowLogic<*>
|
||||||
return invoke(flow)
|
return invoke(flow)
|
||||||
} catch(e: StringToMethodCallParser.UnparseableCallException.MissingParameter) {
|
} catch(e: StringToMethodCallParser.UnparseableCallException.MissingParameter) {
|
||||||
errors.add("${getPrototype(ctor)}: missing parameter ${e.paramName}")
|
errors.add("${getPrototype()}: missing parameter ${e.paramName}")
|
||||||
} catch(e: StringToMethodCallParser.UnparseableCallException.TooManyParameters) {
|
} catch(e: StringToMethodCallParser.UnparseableCallException.TooManyParameters) {
|
||||||
errors.add("${getPrototype(ctor)}: too many parameters")
|
errors.add("${getPrototype()}: too many parameters")
|
||||||
} catch(e: StringToMethodCallParser.UnparseableCallException.ReflectionDataMissing) {
|
} catch(e: StringToMethodCallParser.UnparseableCallException.ReflectionDataMissing) {
|
||||||
val argTypes = ctor.parameterTypes.map { it.simpleName }
|
val argTypes = ctor.parameterTypes.map { it.simpleName }
|
||||||
errors.add("$argTypes: <constructor missing parameter reflection data>")
|
errors.add("$argTypes: <constructor missing parameter reflection data>")
|
||||||
|
@ -173,7 +173,7 @@ class CordaRPCOpsImplTest {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val tx = result.returnValue.getOrThrow()
|
result.returnValue.getOrThrow()
|
||||||
transactions.expectEvents {
|
transactions.expectEvents {
|
||||||
sequence(
|
sequence(
|
||||||
// ISSUE
|
// ISSUE
|
||||||
|
@ -203,7 +203,7 @@ class TwoPartyTradeFlowTests {
|
|||||||
bobNode.disableDBCloseOnStop()
|
bobNode.disableDBCloseOnStop()
|
||||||
|
|
||||||
val bobAddr = bobNode.network.myAddress as InMemoryMessagingNetwork.PeerHandle
|
val bobAddr = bobNode.network.myAddress as InMemoryMessagingNetwork.PeerHandle
|
||||||
val networkMapAddr = notaryNode.network.myAddress
|
val networkMapAddress = notaryNode.network.myAddress
|
||||||
|
|
||||||
mockNet.runNetwork() // Clear network map registration messages
|
mockNet.runNetwork() // Clear network map registration messages
|
||||||
|
|
||||||
@ -249,7 +249,7 @@ class TwoPartyTradeFlowTests {
|
|||||||
|
|
||||||
// ... bring the node back up ... the act of constructing the SMM will re-register the message handlers
|
// ... bring the node back up ... the act of constructing the SMM will re-register the message handlers
|
||||||
// that Bob was waiting on before the reboot occurred.
|
// that Bob was waiting on before the reboot occurred.
|
||||||
bobNode = mockNet.createNode(networkMapAddr, bobAddr.id, object : MockNetwork.Factory {
|
bobNode = mockNet.createNode(networkMapAddress, bobAddr.id, object : MockNetwork.Factory {
|
||||||
override fun create(config: NodeConfiguration, network: MockNetwork, networkMapAddr: SingleMessageRecipient?,
|
override fun create(config: NodeConfiguration, network: MockNetwork, networkMapAddr: SingleMessageRecipient?,
|
||||||
advertisedServices: Set<ServiceInfo>, id: Int, overrideServices: Map<ServiceInfo, KeyPair>?,
|
advertisedServices: Set<ServiceInfo>, id: Int, overrideServices: Map<ServiceInfo, KeyPair>?,
|
||||||
entropyRoot: BigInteger): MockNetwork.MockNode {
|
entropyRoot: BigInteger): MockNetwork.MockNode {
|
||||||
@ -289,11 +289,11 @@ class TwoPartyTradeFlowTests {
|
|||||||
// Creates a mock node with an overridden storage service that uses a RecordingMap, that lets us test the order
|
// Creates a mock node with an overridden storage service that uses a RecordingMap, that lets us test the order
|
||||||
// of gets and puts.
|
// of gets and puts.
|
||||||
private fun makeNodeWithTracking(
|
private fun makeNodeWithTracking(
|
||||||
networkMapAddr: SingleMessageRecipient?,
|
networkMapAddress: SingleMessageRecipient?,
|
||||||
name: X500Name,
|
name: X500Name,
|
||||||
overrideServices: Map<ServiceInfo, KeyPair>? = null): MockNetwork.MockNode {
|
overridenServices: Map<ServiceInfo, KeyPair>? = null): MockNetwork.MockNode {
|
||||||
// Create a node in the mock network ...
|
// Create a node in the mock network ...
|
||||||
return mockNet.createNode(networkMapAddr, -1, object : MockNetwork.Factory {
|
return mockNet.createNode(networkMapAddress, -1, object : MockNetwork.Factory {
|
||||||
override fun create(config: NodeConfiguration,
|
override fun create(config: NodeConfiguration,
|
||||||
network: MockNetwork,
|
network: MockNetwork,
|
||||||
networkMapAddr: SingleMessageRecipient?,
|
networkMapAddr: SingleMessageRecipient?,
|
||||||
@ -307,7 +307,7 @@ class TwoPartyTradeFlowTests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, true, name, overrideServices)
|
}, true, name, overridenServices)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -7,15 +7,15 @@ import net.corda.core.node.services.ServiceInfo
|
|||||||
import net.corda.core.node.services.ServiceType
|
import net.corda.core.node.services.ServiceType
|
||||||
import net.corda.core.transactions.SignedTransaction
|
import net.corda.core.transactions.SignedTransaction
|
||||||
import net.corda.core.utilities.NetworkHostAndPort
|
import net.corda.core.utilities.NetworkHostAndPort
|
||||||
import net.corda.testing.DUMMY_NOTARY
|
|
||||||
import net.corda.flows.CashExitFlow
|
import net.corda.flows.CashExitFlow
|
||||||
import net.corda.flows.CashPaymentFlow
|
import net.corda.flows.CashPaymentFlow
|
||||||
import net.corda.flows.IssuerFlow
|
import net.corda.flows.IssuerFlow
|
||||||
import net.corda.testing.driver.driver
|
|
||||||
import net.corda.node.services.startFlowPermission
|
import net.corda.node.services.startFlowPermission
|
||||||
import net.corda.node.services.transactions.SimpleNotaryService
|
import net.corda.node.services.transactions.SimpleNotaryService
|
||||||
import net.corda.nodeapi.User
|
import net.corda.nodeapi.User
|
||||||
import net.corda.testing.BOC
|
import net.corda.testing.BOC
|
||||||
|
import net.corda.testing.DUMMY_NOTARY
|
||||||
|
import net.corda.testing.driver.driver
|
||||||
import org.bouncycastle.asn1.x500.X500Name
|
import org.bouncycastle.asn1.x500.X500Name
|
||||||
import kotlin.system.exitProcess
|
import kotlin.system.exitProcess
|
||||||
|
|
||||||
@ -55,21 +55,32 @@ private class BankOfCordaDriver {
|
|||||||
// The ISSUER will launch a Bank of Corda node
|
// The ISSUER will launch a Bank of Corda node
|
||||||
// The ISSUE_CASH will request some Cash from the ISSUER on behalf of Big Corporation node
|
// The ISSUE_CASH will request some Cash from the ISSUER on behalf of Big Corporation node
|
||||||
val role = options.valueOf(roleArg)!!
|
val role = options.valueOf(roleArg)!!
|
||||||
if (role == Role.ISSUER) {
|
|
||||||
|
val anonymous = true
|
||||||
|
val requestParams = IssueRequestParams(options.valueOf(quantity), options.valueOf(currency), BIGCORP_LEGAL_NAME, "1", BOC.name, DUMMY_NOTARY.name, anonymous)
|
||||||
|
|
||||||
|
try {
|
||||||
|
when (role) {
|
||||||
|
Role.ISSUER -> {
|
||||||
driver(dsl = {
|
driver(dsl = {
|
||||||
val bankUser = User(BANK_USERNAME, "test", permissions = setOf(startFlowPermission<CashPaymentFlow>(), startFlowPermission<IssuerFlow.IssuanceRequester>(), startFlowPermission<CashExitFlow>()))
|
val bankUser = User(
|
||||||
|
BANK_USERNAME,
|
||||||
|
"test",
|
||||||
|
permissions = setOf(
|
||||||
|
startFlowPermission<CashPaymentFlow>(),
|
||||||
|
startFlowPermission<IssuerFlow.IssuanceRequester>(),
|
||||||
|
startFlowPermission<CashExitFlow>()))
|
||||||
val bigCorpUser = User(BIGCORP_USERNAME, "test", permissions = setOf(startFlowPermission<CashPaymentFlow>()))
|
val bigCorpUser = User(BIGCORP_USERNAME, "test", permissions = setOf(startFlowPermission<CashPaymentFlow>()))
|
||||||
startNode(DUMMY_NOTARY.name, setOf(ServiceInfo(SimpleNotaryService.type)))
|
startNode(DUMMY_NOTARY.name, setOf(ServiceInfo(SimpleNotaryService.type)))
|
||||||
val bankOfCorda = startNode(BOC.name, rpcUsers = listOf(bankUser), advertisedServices = setOf(ServiceInfo(ServiceType.corda.getSubType("issuer.USD"))))
|
val bankOfCorda = startNode(
|
||||||
|
BOC.name,
|
||||||
|
rpcUsers = listOf(bankUser),
|
||||||
|
advertisedServices = setOf(ServiceInfo(ServiceType.corda.getSubType("issuer.USD"))))
|
||||||
startNode(BIGCORP_LEGAL_NAME, rpcUsers = listOf(bigCorpUser))
|
startNode(BIGCORP_LEGAL_NAME, rpcUsers = listOf(bigCorpUser))
|
||||||
startWebserver(bankOfCorda.get())
|
startWebserver(bankOfCorda.get())
|
||||||
waitForAllNodesToFinish()
|
waitForAllNodesToFinish()
|
||||||
}, isDebug = true)
|
}, isDebug = true)
|
||||||
} else {
|
}
|
||||||
try {
|
|
||||||
val anonymous = true
|
|
||||||
val requestParams = IssueRequestParams(options.valueOf(quantity), options.valueOf(currency), BIGCORP_LEGAL_NAME, "1", BOC.name, DUMMY_NOTARY.name, anonymous)
|
|
||||||
when (role) {
|
|
||||||
Role.ISSUE_CASH_RPC -> {
|
Role.ISSUE_CASH_RPC -> {
|
||||||
println("Requesting Cash via RPC ...")
|
println("Requesting Cash via RPC ...")
|
||||||
val result = BankOfCordaClientApi(NetworkHostAndPort("localhost", 10006)).requestRPCIssue(requestParams)
|
val result = BankOfCordaClientApi(NetworkHostAndPort("localhost", 10006)).requestRPCIssue(requestParams)
|
||||||
@ -88,7 +99,6 @@ private class BankOfCordaDriver {
|
|||||||
exitProcess(1)
|
exitProcess(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fun printHelp(parser: OptionParser) {
|
fun printHelp(parser: OptionParser) {
|
||||||
println("""
|
println("""
|
||||||
|
@ -26,8 +26,8 @@ class VisualiserViewModel {
|
|||||||
inner class NodeWidget(val node: MockNetwork.MockNode, val innerDot: Circle, val outerDot: Circle, val longPulseDot: Circle,
|
inner class NodeWidget(val node: MockNetwork.MockNode, val innerDot: Circle, val outerDot: Circle, val longPulseDot: Circle,
|
||||||
val pulseAnim: Animation, val longPulseAnim: Animation,
|
val pulseAnim: Animation, val longPulseAnim: Animation,
|
||||||
val nameLabel: Label, val statusLabel: Label) {
|
val nameLabel: Label, val statusLabel: Label) {
|
||||||
fun position(index: Int, nodeCoords: (node: MockNetwork.MockNode, index: Int) -> Pair<Double, Double>) {
|
fun position(nodeCoords: (node: MockNetwork.MockNode) -> Pair<Double, Double>) {
|
||||||
val (x, y) = nodeCoords(node, index)
|
val (x, y) = nodeCoords(node)
|
||||||
innerDot.centerX = x
|
innerDot.centerX = x
|
||||||
innerDot.centerY = y
|
innerDot.centerY = y
|
||||||
outerDot.centerX = x
|
outerDot.centerX = x
|
||||||
@ -63,15 +63,15 @@ class VisualiserViewModel {
|
|||||||
|
|
||||||
fun repositionNodes() {
|
fun repositionNodes() {
|
||||||
for ((index, bank) in simulation.banks.withIndex()) {
|
for ((index, bank) in simulation.banks.withIndex()) {
|
||||||
nodesToWidgets[bank]!!.position(index, when (displayStyle) {
|
nodesToWidgets[bank]!!.position(when (displayStyle) {
|
||||||
Style.MAP -> { node, _ -> nodeMapCoords(node) }
|
Style.MAP -> { node -> nodeMapCoords(node) }
|
||||||
Style.CIRCLE -> { _, index -> nodeCircleCoords(NetworkMapVisualiser.NodeType.BANK, index) }
|
Style.CIRCLE -> { _ -> nodeCircleCoords(NetworkMapVisualiser.NodeType.BANK, index) }
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
for ((index, serviceProvider) in (simulation.serviceProviders + simulation.regulators).withIndex()) {
|
for ((index, serviceProvider) in (simulation.serviceProviders + simulation.regulators).withIndex()) {
|
||||||
nodesToWidgets[serviceProvider]!!.position(index, when (displayStyle) {
|
nodesToWidgets[serviceProvider]!!.position(when (displayStyle) {
|
||||||
Style.MAP -> { node, _ -> nodeMapCoords(node) }
|
Style.MAP -> { node -> nodeMapCoords(node) }
|
||||||
Style.CIRCLE -> { _, index -> nodeCircleCoords(NetworkMapVisualiser.NodeType.SERVICE, index) }
|
Style.CIRCLE -> { _ -> nodeCircleCoords(NetworkMapVisualiser.NodeType.SERVICE, index) }
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -172,8 +172,8 @@ class VisualiserViewModel {
|
|||||||
|
|
||||||
val widget = NodeWidget(forNode, innerDot, outerDot, longPulseOuterDot, pulseAnim, longPulseAnim, nameLabel, statusLabel)
|
val widget = NodeWidget(forNode, innerDot, outerDot, longPulseOuterDot, pulseAnim, longPulseAnim, nameLabel, statusLabel)
|
||||||
when (displayStyle) {
|
when (displayStyle) {
|
||||||
Style.CIRCLE -> widget.position(index, { _, index -> nodeCircleCoords(nodeType, index) })
|
Style.CIRCLE -> widget.position { _ -> nodeCircleCoords(nodeType, index) }
|
||||||
Style.MAP -> widget.position(index, { node, _ -> nodeMapCoords(node) })
|
Style.MAP -> widget.position { node -> nodeMapCoords(node) }
|
||||||
}
|
}
|
||||||
return widget
|
return widget
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package net.corda.notarydemo.flows
|
package net.corda.notarydemo.flows
|
||||||
|
|
||||||
import co.paralleluniverse.fibers.Suspendable
|
import co.paralleluniverse.fibers.Suspendable
|
||||||
import net.corda.testing.contracts.DummyContract
|
|
||||||
import net.corda.core.flows.FlowLogic
|
import net.corda.core.flows.FlowLogic
|
||||||
import net.corda.core.flows.StartableByRPC
|
import net.corda.core.flows.StartableByRPC
|
||||||
import net.corda.core.identity.Party
|
import net.corda.core.identity.Party
|
||||||
import net.corda.core.transactions.SignedTransaction
|
import net.corda.core.transactions.SignedTransaction
|
||||||
|
import net.corda.testing.contracts.DummyContract
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
@StartableByRPC
|
@StartableByRPC
|
||||||
@ -18,7 +18,6 @@ class DummyIssueAndMove(private val notary: Party, private val counterpartyNode:
|
|||||||
val issueTx = serviceHub.signInitialTransaction(issueTxBuilder)
|
val issueTx = serviceHub.signInitialTransaction(issueTxBuilder)
|
||||||
serviceHub.recordTransactions(issueTx)
|
serviceHub.recordTransactions(issueTx)
|
||||||
// Move ownership of the asset to the counterparty
|
// Move ownership of the asset to the counterparty
|
||||||
val counterPartyKey = counterpartyNode.owningKey
|
|
||||||
val asset = issueTx.tx.outRef<DummyContract.SingleOwnerState>(0)
|
val asset = issueTx.tx.outRef<DummyContract.SingleOwnerState>(0)
|
||||||
val moveTxBuilder = DummyContract.move(asset, counterpartyNode)
|
val moveTxBuilder = DummyContract.move(asset, counterpartyNode)
|
||||||
val moveTx = serviceHub.signInitialTransaction(moveTxBuilder)
|
val moveTx = serviceHub.signInitialTransaction(moveTxBuilder)
|
||||||
|
@ -56,12 +56,12 @@ fun InitialMarginTriple.toCordaCompatible() = InitialMarginTriple(twoDecimalPlac
|
|||||||
* Utility function to ensure that [CurrencyParameterSensitivities] can be sent over corda and compared
|
* Utility function to ensure that [CurrencyParameterSensitivities] can be sent over corda and compared
|
||||||
*/
|
*/
|
||||||
fun CurrencyParameterSensitivities.toCordaCompatible(): CurrencyParameterSensitivities {
|
fun CurrencyParameterSensitivities.toCordaCompatible(): CurrencyParameterSensitivities {
|
||||||
return CurrencyParameterSensitivities.of(this.sensitivities.map {
|
return CurrencyParameterSensitivities.of(this.sensitivities.map { sensitivity ->
|
||||||
it.metaBean().builder()
|
sensitivity.metaBean().builder()
|
||||||
.set("marketDataName", it.marketDataName)
|
.set("marketDataName", sensitivity.marketDataName)
|
||||||
.set("parameterMetadata", it.parameterMetadata)
|
.set("parameterMetadata", sensitivity.parameterMetadata)
|
||||||
.set("currency", Currency.of(it.currency.code).serialize().deserialize())
|
.set("currency", Currency.of(sensitivity.currency.code).serialize().deserialize())
|
||||||
.set("sensitivity", it.sensitivity.map { it -> twoDecimalPlaces(it) })
|
.set("sensitivity", sensitivity.sensitivity.map { twoDecimalPlaces(it) })
|
||||||
.build()
|
.build()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -211,10 +211,10 @@ class Network : CordaView() {
|
|||||||
private fun List<ContractState>.getParties() = map { it.participants.map { getModel<NetworkIdentityModel>().lookup(it.owningKey) } }.flatten()
|
private fun List<ContractState>.getParties() = map { it.participants.map { getModel<NetworkIdentityModel>().lookup(it.owningKey) } }.flatten()
|
||||||
|
|
||||||
private fun fireBulletBetweenNodes(senderNode: Party, destNode: Party, startType: String, endType: String) {
|
private fun fireBulletBetweenNodes(senderNode: Party, destNode: Party, startType: String, endType: String) {
|
||||||
allComponentMap[senderNode]?.let { senderNode ->
|
val senderNodeComp = allComponentMap[senderNode] ?: return
|
||||||
allComponentMap[destNode]?.let { destNode ->
|
val destNodeComp = allComponentMap[destNode] ?: return
|
||||||
val sender = senderNode.label.boundsInParentProperty().map { Point2D(it.width / 2 + it.minX, it.height / 4 - 2.5 + it.minY) }
|
val sender = senderNodeComp.label.boundsInParentProperty().map { Point2D(it.width / 2 + it.minX, it.height / 4 - 2.5 + it.minY) }
|
||||||
val receiver = destNode.label.boundsInParentProperty().map { Point2D(it.width / 2 + it.minX, it.height / 4 - 2.5 + it.minY) }
|
val receiver = destNodeComp.label.boundsInParentProperty().map { Point2D(it.width / 2 + it.minX, it.height / 4 - 2.5 + it.minY) }
|
||||||
val bullet = Circle(3.0)
|
val bullet = Circle(3.0)
|
||||||
bullet.styleClass += "bullet"
|
bullet.styleClass += "bullet"
|
||||||
bullet.styleClass += "connection-$startType-to-$endType"
|
bullet.styleClass += "connection-$startType-to-$endType"
|
||||||
@ -251,5 +251,3 @@ class Network : CordaView() {
|
|||||||
mapPane.children.add(bullet)
|
mapPane.children.add(bullet)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -22,13 +22,12 @@ import net.corda.core.contracts.sumOrNull
|
|||||||
import net.corda.core.contracts.withoutIssuer
|
import net.corda.core.contracts.withoutIssuer
|
||||||
import net.corda.core.flows.FlowException
|
import net.corda.core.flows.FlowException
|
||||||
import net.corda.core.getOrThrow
|
import net.corda.core.getOrThrow
|
||||||
import net.corda.core.identity.AbstractParty
|
|
||||||
import net.corda.core.identity.Party
|
import net.corda.core.identity.Party
|
||||||
import net.corda.core.messaging.FlowHandle
|
import net.corda.core.messaging.FlowHandle
|
||||||
import net.corda.core.messaging.startFlow
|
import net.corda.core.messaging.startFlow
|
||||||
import net.corda.core.node.NodeInfo
|
import net.corda.core.node.NodeInfo
|
||||||
import net.corda.core.utilities.OpaqueBytes
|
|
||||||
import net.corda.core.transactions.SignedTransaction
|
import net.corda.core.transactions.SignedTransaction
|
||||||
|
import net.corda.core.utilities.OpaqueBytes
|
||||||
import net.corda.explorer.formatters.PartyNameFormatter
|
import net.corda.explorer.formatters.PartyNameFormatter
|
||||||
import net.corda.explorer.model.CashTransaction
|
import net.corda.explorer.model.CashTransaction
|
||||||
import net.corda.explorer.model.IssuerModel
|
import net.corda.explorer.model.IssuerModel
|
||||||
@ -111,7 +110,7 @@ class NewTransaction : Fragment() {
|
|||||||
} finally {
|
} finally {
|
||||||
dialog.dialogPane.isDisable = false
|
dialog.dialogPane.isDisable = false
|
||||||
}
|
}
|
||||||
}.ui { it ->
|
}.ui {
|
||||||
val stx: SignedTransaction = it.stx
|
val stx: SignedTransaction = it.stx
|
||||||
val type = when (command) {
|
val type = when (command) {
|
||||||
is CashFlowCommand.IssueCash -> "Cash Issued"
|
is CashFlowCommand.IssueCash -> "Cash Issued"
|
||||||
@ -193,7 +192,7 @@ class NewTransaction : Fragment() {
|
|||||||
// Issuer
|
// Issuer
|
||||||
issuerLabel.visibleProperty().bind(transactionTypeCB.valueProperty().isNotNull)
|
issuerLabel.visibleProperty().bind(transactionTypeCB.valueProperty().isNotNull)
|
||||||
issuerChoiceBox.apply {
|
issuerChoiceBox.apply {
|
||||||
items = issuers.map { it.legalIdentity as Party }.unique().sorted()
|
items = issuers.map { it.legalIdentity }.unique().sorted()
|
||||||
converter = stringConverter { PartyNameFormatter.short.format(it.name) }
|
converter = stringConverter { PartyNameFormatter.short.format(it.name) }
|
||||||
visibleProperty().bind(transactionTypeCB.valueProperty().map { it == CashTransaction.Pay })
|
visibleProperty().bind(transactionTypeCB.valueProperty().map { it == CashTransaction.Pay })
|
||||||
}
|
}
|
||||||
@ -220,7 +219,7 @@ class NewTransaction : Fragment() {
|
|||||||
)
|
)
|
||||||
availableAmount.textProperty()
|
availableAmount.textProperty()
|
||||||
.bind(Bindings.createStringBinding({
|
.bind(Bindings.createStringBinding({
|
||||||
val filteredCash = cash.filtered { it.token.issuer.party as AbstractParty == issuer.value && it.token.product == currencyChoiceBox.value }
|
val filteredCash = cash.filtered { it.token.issuer.party == issuer.value && it.token.product == currencyChoiceBox.value }
|
||||||
.map { it.withoutIssuer() }.sumOrNull()
|
.map { it.withoutIssuer() }.sumOrNull()
|
||||||
"${filteredCash ?: "None"} Available"
|
"${filteredCash ?: "None"} Available"
|
||||||
}, arrayOf(currencyChoiceBox.valueProperty(), issuerChoiceBox.valueProperty())))
|
}, arrayOf(currencyChoiceBox.valueProperty(), issuerChoiceBox.valueProperty())))
|
||||||
|
@ -40,13 +40,12 @@ fun setupJSchWithSshAgent(): JSch {
|
|||||||
override fun getName() = connector.name
|
override fun getName() = connector.name
|
||||||
override fun getIdentities(): Vector<Identity> = Vector(listOf(
|
override fun getIdentities(): Vector<Identity> = Vector(listOf(
|
||||||
object : Identity {
|
object : Identity {
|
||||||
override fun clear() {
|
override fun clear() {}
|
||||||
}
|
|
||||||
|
|
||||||
override fun getAlgName() = String(Buffer(identity.blob).string)
|
override fun getAlgName() = String(Buffer(identity.blob).string)
|
||||||
override fun getName() = String(identity.comment)
|
override fun getName() = String(identity.comment)
|
||||||
override fun isEncrypted() = false
|
override fun isEncrypted() = false
|
||||||
override fun getSignature(data: ByteArray?) = agentProxy.sign(identity.blob, data)
|
override fun getSignature(data: ByteArray?) = agentProxy.sign(identity.blob, data)
|
||||||
|
@Suppress("OverridingDeprecatedMember")
|
||||||
override fun decrypt() = true
|
override fun decrypt() = true
|
||||||
override fun getPublicKeyBlob() = identity.blob
|
override fun getPublicKeyBlob() = identity.blob
|
||||||
override fun setPassphrase(passphrase: ByteArray?) = true
|
override fun setPassphrase(passphrase: ByteArray?) = true
|
||||||
@ -55,7 +54,7 @@ fun setupJSchWithSshAgent(): JSch {
|
|||||||
|
|
||||||
override fun remove(blob: ByteArray?) = throw UnsupportedOperationException()
|
override fun remove(blob: ByteArray?) = throw UnsupportedOperationException()
|
||||||
override fun removeAll() = throw UnsupportedOperationException()
|
override fun removeAll() = throw UnsupportedOperationException()
|
||||||
override fun add(identity: ByteArray?) = throw UnsupportedOperationException()
|
override fun add(bytes: ByteArray?) = throw UnsupportedOperationException()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -85,9 +84,6 @@ class ConnectionManager(private val jSch: JSch) {
|
|||||||
* Connects to a list of nodes and executes the passed in action with the connections as parameter. The connections are
|
* Connects to a list of nodes and executes the passed in action with the connections as parameter. The connections are
|
||||||
* safely cleaned up if an exception is thrown.
|
* safely cleaned up if an exception is thrown.
|
||||||
*
|
*
|
||||||
* @param username The UNIX username to use for SSH authentication.
|
|
||||||
* @param nodeHosts The list of hosts.
|
|
||||||
* @param remoteMessagingPort The Artemis messaging port nodes are listening on.
|
|
||||||
* @param tunnelPortAllocation A local port allocation strategy for creating SSH tunnels.
|
* @param tunnelPortAllocation A local port allocation strategy for creating SSH tunnels.
|
||||||
* @param withConnections An action to run once we're connected to the nodes.
|
* @param withConnections An action to run once we're connected to the nodes.
|
||||||
* @return The return value of [withConnections]
|
* @return The return value of [withConnections]
|
||||||
|
@ -257,9 +257,7 @@ val crossCashTest = LoadTest<CrossCashCommand, CrossCashState>(
|
|||||||
if (minimum == null) {
|
if (minimum == null) {
|
||||||
HashMap(next)
|
HashMap(next)
|
||||||
} else {
|
} else {
|
||||||
next.forEach { entry ->
|
next.forEach { minimum.merge(it.key, it.value, Math::min) }
|
||||||
minimum.merge(entry.key, entry.value, Math::min)
|
|
||||||
}
|
|
||||||
minimum
|
minimum
|
||||||
}
|
}
|
||||||
}!!
|
}!!
|
||||||
|
@ -43,7 +43,7 @@ val dummyNotarisationTest = LoadTest<NotariseCommand, Unit>(
|
|||||||
val proxy = node.proxy
|
val proxy = node.proxy
|
||||||
val issueFlow = proxy.startFlow(::FinalityFlow, issueTx)
|
val issueFlow = proxy.startFlow(::FinalityFlow, issueTx)
|
||||||
issueFlow.returnValue.thenMatch({
|
issueFlow.returnValue.thenMatch({
|
||||||
val moveFlow = proxy.startFlow(::FinalityFlow, moveTx)
|
proxy.startFlow(::FinalityFlow, moveTx)
|
||||||
}, {})
|
}, {})
|
||||||
} catch (e: FlowException) {
|
} catch (e: FlowException) {
|
||||||
log.error("Failure", e)
|
log.error("Failure", e)
|
||||||
|
Reference in New Issue
Block a user