mirror of
https://github.com/corda/corda.git
synced 2024-12-18 20:47:57 +00:00
Minor: run code cleanup inspections
This commit is contained in:
parent
e62250ff7b
commit
c097229935
@ -10,7 +10,7 @@ class StringToMethodCallParserTest {
|
||||
fun simple() = "simple"
|
||||
fun string(note: String) = note
|
||||
fun twoStrings(a: String, b: String) = a + b
|
||||
fun simpleObject(hash: SecureHash.SHA256) = hash.toString()!!
|
||||
fun simpleObject(hash: SecureHash.SHA256) = hash.toString()
|
||||
fun complexObject(pair: Pair<Int, String>) = pair
|
||||
|
||||
fun overload(a: String) = a
|
||||
|
@ -119,7 +119,7 @@ class CordaRPCClientImpl(private val session: ClientSession,
|
||||
|
||||
private var producer: ClientProducer? = null
|
||||
|
||||
class ObservableDeserializer() : Serializer<Observable<Any>>() {
|
||||
class ObservableDeserializer : Serializer<Observable<Any>>() {
|
||||
override fun read(kryo: Kryo, input: Input, type: Class<Observable<Any>>): Observable<Any> {
|
||||
val qName = kryo.context[RPCKryoQNameKey] as String
|
||||
val rpcName = kryo.context[RPCKryoMethodNameKey] as String
|
||||
|
@ -244,7 +244,7 @@ interface LinearState : ContractState {
|
||||
* Standard clause to verify the LinearState safety properties.
|
||||
*/
|
||||
@CordaSerializable
|
||||
class ClauseVerifier<S : LinearState, C : CommandData>() : Clause<S, C, Unit>() {
|
||||
class ClauseVerifier<S : LinearState, C : CommandData> : Clause<S, C, Unit>() {
|
||||
override fun verify(tx: TransactionForContract,
|
||||
inputs: List<S>,
|
||||
outputs: List<S>,
|
||||
|
@ -33,7 +33,7 @@ fun String.base58ToByteArray(): ByteArray = Base58.decode(this)
|
||||
fun String.base64ToByteArray(): ByteArray = Base64.getDecoder().decode(this)
|
||||
|
||||
/** Hex-String to [ByteArray]. Accept any hex form (capitalized, lowercase, mixed). */
|
||||
fun String.hexToByteArray(): ByteArray = DatatypeConverter.parseHexBinary(this);
|
||||
fun String.hexToByteArray(): ByteArray = DatatypeConverter.parseHexBinary(this)
|
||||
|
||||
|
||||
// Encoding changers
|
||||
|
@ -6,4 +6,4 @@ import net.corda.core.node.services.Vault
|
||||
/**
|
||||
* Converter which persists a [Vault.StateStatus] enum using its enum ordinal representation
|
||||
*/
|
||||
class VaultStateStatusConverter() : EnumOrdinalConverter<Vault.StateStatus>(Vault.StateStatus::class.java)
|
||||
class VaultStateStatusConverter : EnumOrdinalConverter<Vault.StateStatus>(Vault.StateStatus::class.java)
|
||||
|
@ -127,7 +127,7 @@ data class SingletonSerializationToken private constructor(private val className
|
||||
* A base class for implementing large objects / components / services that need to serialize themselves to a string token
|
||||
* to indicate which instance the token is a serialized form of.
|
||||
*/
|
||||
abstract class SingletonSerializeAsToken() : SerializeAsToken {
|
||||
abstract class SingletonSerializeAsToken : SerializeAsToken {
|
||||
@Suppress("LeakingThis")
|
||||
private val token = SingletonSerializationToken(this)
|
||||
|
||||
|
@ -69,7 +69,7 @@ class ResolveTransactionsFlow(private val txHashes: Set<SecureHash>,
|
||||
}
|
||||
|
||||
@CordaSerializable
|
||||
class ExcessivelyLargeTransactionGraph() : Exception()
|
||||
class ExcessivelyLargeTransactionGraph : Exception()
|
||||
|
||||
// Transactions to verify after the dependencies.
|
||||
private var stx: SignedTransaction? = null
|
||||
|
@ -37,7 +37,7 @@ class TransactionSerializationTests {
|
||||
}
|
||||
|
||||
interface Commands : CommandData {
|
||||
class Move() : TypeOnlyCommandData(), Commands
|
||||
class Move : TypeOnlyCommandData(), Commands
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ class AmountGenerator<T : Any>(val tokenGenerator: Generator<T>) : Generator<Amo
|
||||
}
|
||||
}
|
||||
|
||||
class CurrencyGenerator() : Generator<Currency>(Currency::class.java) {
|
||||
class CurrencyGenerator : Generator<Currency>(Currency::class.java) {
|
||||
companion object {
|
||||
val currencies = Currency.getAvailableCurrencies().toList()
|
||||
}
|
||||
|
@ -214,8 +214,6 @@ public class CandidacyStatus {
|
||||
return false;
|
||||
if (!Objects.equals(this.reason, other.reason))
|
||||
return false;
|
||||
if (this.recursiveDepth != other.recursiveDepth)
|
||||
return false;
|
||||
return true;
|
||||
return this.recursiveDepth == other.recursiveDepth;
|
||||
}
|
||||
}
|
||||
|
@ -178,11 +178,7 @@ public final class Utils {
|
||||
* @return
|
||||
*/
|
||||
public static boolean shouldAttemptToTransitivelyLoad(final String qualifiedClassName) {
|
||||
if (JAVA_PATTERN_QUALIFIED.asPredicate().test(qualifiedClassName)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return !JAVA_PATTERN_QUALIFIED.asPredicate().test(qualifiedClassName);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -200,11 +196,7 @@ public final class Utils {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (SANDBOX_PATTERN_INTERNAL.asPredicate().test(clazzName)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return !SANDBOX_PATTERN_INTERNAL.asPredicate().test(clazzName);
|
||||
}
|
||||
|
||||
|
||||
|
@ -62,7 +62,7 @@ public class TestUtils {
|
||||
assertEquals(throwCost, RuntimeCostAccounter.getThrowCost());
|
||||
}
|
||||
|
||||
public static Class<?> transformClass(final String classFName, final int originalLength, final int newLength) throws IOException, Exception {
|
||||
public static Class<?> transformClass(final String classFName, final int originalLength, final int newLength) throws Exception {
|
||||
byte[] basic = getBytes(classFName);
|
||||
assertEquals(originalLength, basic.length);
|
||||
final byte[] tfmd = instrumentWithCosts(basic, new HashSet<>());
|
||||
|
@ -11,7 +11,7 @@ import java.util.*
|
||||
interface Arrangement
|
||||
|
||||
// A base arrangement with no rights and no obligations. Contract cancellation/termination is a transition to ``Zero``.
|
||||
class Zero() : Arrangement {
|
||||
class Zero : Arrangement {
|
||||
override fun hashCode(): Int {
|
||||
return 0
|
||||
}
|
||||
@ -46,7 +46,7 @@ data class RollOut(val startDate: LocalDate, val endDate: LocalDate, val frequen
|
||||
|
||||
// Continuation of roll out
|
||||
// May only be used inside template for RollOut
|
||||
class Continuation() : Arrangement {
|
||||
class Continuation : Arrangement {
|
||||
override fun hashCode(): Int {
|
||||
return 1
|
||||
}
|
||||
|
@ -196,4 +196,4 @@ class RollOutBuilder<T>(val startDate: LocalDate, val endDate: LocalDate, val fr
|
||||
RollOut(startDate, endDate, frequency, super.final())
|
||||
}
|
||||
|
||||
class Dummy {}
|
||||
class Dummy
|
||||
|
@ -152,7 +152,7 @@ class CommercialPaper : Contract {
|
||||
}
|
||||
}
|
||||
|
||||
class Redeem() : Clause<State, Commands, Issued<Terms>>() {
|
||||
class Redeem : Clause<State, Commands, Issued<Terms>>() {
|
||||
override val requiredCommands: Set<Class<out CommandData>> = setOf(Commands.Redeem::class.java)
|
||||
|
||||
override fun verify(tx: TransactionForContract,
|
||||
|
@ -62,7 +62,7 @@ class KotlinCommercialPaperTest : ICommercialPaperTestTemplate {
|
||||
override fun getMoveCommand(): CommandData = CommercialPaper.Commands.Move()
|
||||
}
|
||||
|
||||
class KotlinCommercialPaperLegacyTest() : ICommercialPaperTestTemplate {
|
||||
class KotlinCommercialPaperLegacyTest : ICommercialPaperTestTemplate {
|
||||
override fun getPaper(): ICommercialPaperState = CommercialPaperLegacy.State(
|
||||
issuance = MEGA_CORP.ref(123),
|
||||
owner = MEGA_CORP_PUBKEY,
|
||||
|
@ -76,7 +76,7 @@ class VaultSchemaTest {
|
||||
data.close()
|
||||
}
|
||||
|
||||
private class VaultNoopContract() : Contract {
|
||||
private class VaultNoopContract : Contract {
|
||||
override val legalContractReference = SecureHash.sha256("")
|
||||
|
||||
data class VaultNoopState(override val owner: CompositeKey) : OwnableState {
|
||||
|
@ -202,12 +202,12 @@ abstract class MQSecurityTest : NodeBasedTest() {
|
||||
|
||||
fun assertSendAttackFails(address: String) {
|
||||
val message = attacker.createMessage()
|
||||
assertEquals(true, attacker.producer.isBlockOnNonDurableSend())
|
||||
assertEquals(true, attacker.producer.isBlockOnNonDurableSend)
|
||||
assertAttackFails(address, "SEND") {
|
||||
attacker.producer.send(address, message)
|
||||
}
|
||||
assertEquals(0, message.getDeliveryCount())
|
||||
assertEquals(0, message.getBodySize())
|
||||
assertEquals(0, message.deliveryCount)
|
||||
assertEquals(0, message.bodySize)
|
||||
}
|
||||
|
||||
fun assertConsumeAttackFails(queue: String) {
|
||||
|
@ -16,7 +16,7 @@ import javax.annotation.concurrent.ThreadSafe
|
||||
* Simple identity service which caches parties and provides functionality for efficient lookup.
|
||||
*/
|
||||
@ThreadSafe
|
||||
class InMemoryIdentityService() : SingletonSerializeAsToken(), IdentityService {
|
||||
class InMemoryIdentityService : SingletonSerializeAsToken(), IdentityService {
|
||||
companion object {
|
||||
private val log = loggerFor<InMemoryIdentityService>()
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ class NodeMessagingClient(override val config: NodeConfiguration,
|
||||
// TODO Add broker CN to config for host verification in case the embedded broker isn't used
|
||||
val tcpTransport = ArtemisTcpTransport.tcpTransport(ConnectionDirection.Outbound(), serverHostPort, config)
|
||||
val locator = ActiveMQClient.createServerLocatorWithoutHA(tcpTransport)
|
||||
locator.setMinLargeMessageSize(ArtemisMessagingServer.MAX_FILE_SIZE)
|
||||
locator.minLargeMessageSize = ArtemisMessagingServer.MAX_FILE_SIZE
|
||||
clientFactory = locator.createSessionFactory()
|
||||
|
||||
// Login using the node username. The broker will authentiate us as its node (as opposed to another peer)
|
||||
|
@ -52,7 +52,7 @@ abstract class RPCDispatcher(val ops: RPCOps, val userService: RPCUserService, v
|
||||
//
|
||||
// When the observables are deserialised on the client side, the handle is read from the byte stream and
|
||||
// the queue is filtered to extract just those observations.
|
||||
class ObservableSerializer() : Serializer<Observable<Any>>() {
|
||||
class ObservableSerializer : Serializer<Observable<Any>>() {
|
||||
private fun toQName(kryo: Kryo): String = kryo.context[RPCKryoQNameKey] as String
|
||||
private fun toDispatcher(kryo: Kryo): RPCDispatcher = kryo.context[RPCKryoDispatcherKey] as RPCDispatcher
|
||||
|
||||
|
@ -11,7 +11,7 @@ import javax.annotation.concurrent.ThreadSafe
|
||||
|
||||
/** A dummy Uniqueness provider that stores the whole history of consumed states in memory */
|
||||
@ThreadSafe
|
||||
class InMemoryUniquenessProvider() : UniquenessProvider {
|
||||
class InMemoryUniquenessProvider : UniquenessProvider {
|
||||
/** For each input state store the consuming transaction information */
|
||||
private val committedStates = ThreadBox(HashMap<StateRef, UniquenessProvider.ConsumingTx>())
|
||||
|
||||
|
@ -16,7 +16,7 @@ import javax.annotation.concurrent.ThreadSafe
|
||||
|
||||
/** A RDBMS backed Uniqueness provider */
|
||||
@ThreadSafe
|
||||
class PersistentUniquenessProvider() : UniquenessProvider, SingletonSerializeAsToken() {
|
||||
class PersistentUniquenessProvider : UniquenessProvider, SingletonSerializeAsToken() {
|
||||
companion object {
|
||||
private val TABLE_NAME = "${NODE_DATABASE_PREFIX}notary_commit_log"
|
||||
private val log = loggerFor<PersistentUniquenessProvider>()
|
||||
@ -66,7 +66,7 @@ class PersistentUniquenessProvider() : UniquenessProvider, SingletonSerializeAsT
|
||||
if (consumingTx != null) conflictingStates[inputState] = consumingTx
|
||||
}
|
||||
if (conflictingStates.isNotEmpty()) {
|
||||
log.debug("Failure, input states already committed: ${conflictingStates.keys.toString()}")
|
||||
log.debug("Failure, input states already committed: ${conflictingStates.keys}")
|
||||
UniquenessProvider.Conflict(conflictingStates)
|
||||
} else {
|
||||
states.forEachIndexed { i, stateRef ->
|
||||
|
@ -61,7 +61,7 @@ class HTTPNetworkRegistrationService(val server: URL) : NetworkRegistrationServi
|
||||
throw IOException("Unexpected response code ${connection.responseCode} - ${connection.errorMessage}")
|
||||
}
|
||||
|
||||
private val HttpURLConnection.charset: String get() = MediaType.parse(getContentType()).charset().or(Charsets.UTF_8).name()
|
||||
private val HttpURLConnection.charset: String get() = MediaType.parse(contentType).charset().or(Charsets.UTF_8).name()
|
||||
|
||||
private val HttpURLConnection.errorMessage: String get() = IOUtils.toString(errorStream, charset)
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ class TwoPartyTradeFlowTests {
|
||||
val bobTransactionsBeforeCrash = databaseTransaction(bobNode.database) {
|
||||
(storage as DBTransactionStorage).transactions
|
||||
}
|
||||
assertThat(bobTransactionsBeforeCrash).isNotEmpty()
|
||||
assertThat(bobTransactionsBeforeCrash).isNotEmpty
|
||||
|
||||
// .. and let's imagine that Bob's computer has a power cut. He now has nothing now beyond what was on disk.
|
||||
bobNode.stop()
|
||||
|
@ -106,7 +106,7 @@ class NodeAttachmentStorageTest {
|
||||
val id = testJar.read { storage.importAttachment(it) }
|
||||
|
||||
// Corrupt the file in the store.
|
||||
val bytes = testJar.readAll();
|
||||
val bytes = testJar.readAll()
|
||||
val corruptBytes = "arggghhhh".toByteArray()
|
||||
System.arraycopy(corruptBytes, 0, bytes, 0, corruptBytes.size)
|
||||
val corruptAttachment = AttachmentEntity()
|
||||
|
@ -139,7 +139,7 @@ object FixingFlow {
|
||||
constructor(ref: StateRef) : this(ref, tracker())
|
||||
|
||||
companion object {
|
||||
class LOADING() : ProgressTracker.Step("Loading state to decide fixing role")
|
||||
class LOADING : ProgressTracker.Step("Loading state to decide fixing role")
|
||||
|
||||
fun tracker() = ProgressTracker(LOADING())
|
||||
}
|
||||
|
@ -402,7 +402,7 @@ class IRSTests {
|
||||
fun `ensure failure occurs when there are inbound states for an agreement command`() {
|
||||
val irs = singleIRS()
|
||||
transaction {
|
||||
input() { irs }
|
||||
input { irs }
|
||||
output("irs post agreement") { irs }
|
||||
command(MEGA_CORP_PUBKEY) { InterestRateSwap.Commands.Agree() }
|
||||
timestamp(TEST_TX_TIME)
|
||||
@ -415,7 +415,7 @@ class IRSTests {
|
||||
val irs = singleIRS()
|
||||
val emptySchedule = mutableMapOf<LocalDate, FixedRatePaymentEvent>()
|
||||
transaction {
|
||||
output() {
|
||||
output {
|
||||
irs.copy(calculation = irs.calculation.copy(fixedLegPaymentSchedule = emptySchedule))
|
||||
}
|
||||
command(MEGA_CORP_PUBKEY) { InterestRateSwap.Commands.Agree() }
|
||||
@ -429,7 +429,7 @@ class IRSTests {
|
||||
val irs = singleIRS()
|
||||
val emptySchedule = mutableMapOf<LocalDate, FloatingRatePaymentEvent>()
|
||||
transaction {
|
||||
output() {
|
||||
output {
|
||||
irs.copy(calculation = irs.calculation.copy(floatingLegPaymentSchedule = emptySchedule))
|
||||
}
|
||||
command(MEGA_CORP_PUBKEY) { InterestRateSwap.Commands.Agree() }
|
||||
@ -442,7 +442,7 @@ class IRSTests {
|
||||
fun `ensure notionals are non zero`() {
|
||||
val irs = singleIRS()
|
||||
transaction {
|
||||
output() {
|
||||
output {
|
||||
irs.copy(irs.fixedLeg.copy(notional = irs.fixedLeg.notional.copy(quantity = 0)))
|
||||
}
|
||||
command(MEGA_CORP_PUBKEY) { InterestRateSwap.Commands.Agree() }
|
||||
@ -451,7 +451,7 @@ class IRSTests {
|
||||
}
|
||||
|
||||
transaction {
|
||||
output() {
|
||||
output {
|
||||
irs.copy(irs.fixedLeg.copy(notional = irs.floatingLeg.notional.copy(quantity = 0)))
|
||||
}
|
||||
command(MEGA_CORP_PUBKEY) { InterestRateSwap.Commands.Agree() }
|
||||
@ -465,7 +465,7 @@ class IRSTests {
|
||||
val irs = singleIRS()
|
||||
val modifiedIRS = irs.copy(fixedLeg = irs.fixedLeg.copy(fixedRate = FixedRate(PercentageRatioUnit("-0.1"))))
|
||||
transaction {
|
||||
output() {
|
||||
output {
|
||||
modifiedIRS
|
||||
}
|
||||
command(MEGA_CORP_PUBKEY) { InterestRateSwap.Commands.Agree() }
|
||||
@ -482,7 +482,7 @@ class IRSTests {
|
||||
val irs = singleIRS()
|
||||
val modifiedIRS = irs.copy(fixedLeg = irs.fixedLeg.copy(notional = Amount(irs.fixedLeg.notional.quantity, Currency.getInstance("JPY"))))
|
||||
transaction {
|
||||
output() {
|
||||
output {
|
||||
modifiedIRS
|
||||
}
|
||||
command(MEGA_CORP_PUBKEY) { InterestRateSwap.Commands.Agree() }
|
||||
@ -496,7 +496,7 @@ class IRSTests {
|
||||
val irs = singleIRS()
|
||||
val modifiedIRS = irs.copy(fixedLeg = irs.fixedLeg.copy(notional = Amount(irs.floatingLeg.notional.quantity + 1, irs.floatingLeg.notional.token)))
|
||||
transaction {
|
||||
output() {
|
||||
output {
|
||||
modifiedIRS
|
||||
}
|
||||
command(MEGA_CORP_PUBKEY) { InterestRateSwap.Commands.Agree() }
|
||||
@ -510,7 +510,7 @@ class IRSTests {
|
||||
val irs = singleIRS()
|
||||
val modifiedIRS1 = irs.copy(fixedLeg = irs.fixedLeg.copy(terminationDate = irs.fixedLeg.effectiveDate.minusDays(1)))
|
||||
transaction {
|
||||
output() {
|
||||
output {
|
||||
modifiedIRS1
|
||||
}
|
||||
command(MEGA_CORP_PUBKEY) { InterestRateSwap.Commands.Agree() }
|
||||
@ -520,7 +520,7 @@ class IRSTests {
|
||||
|
||||
val modifiedIRS2 = irs.copy(floatingLeg = irs.floatingLeg.copy(terminationDate = irs.floatingLeg.effectiveDate.minusDays(1)))
|
||||
transaction {
|
||||
output() {
|
||||
output {
|
||||
modifiedIRS2
|
||||
}
|
||||
command(MEGA_CORP_PUBKEY) { InterestRateSwap.Commands.Agree() }
|
||||
@ -535,7 +535,7 @@ class IRSTests {
|
||||
|
||||
val modifiedIRS3 = irs.copy(floatingLeg = irs.floatingLeg.copy(terminationDate = irs.fixedLeg.terminationDate.minusDays(1)))
|
||||
transaction {
|
||||
output() {
|
||||
output {
|
||||
modifiedIRS3
|
||||
}
|
||||
command(MEGA_CORP_PUBKEY) { InterestRateSwap.Commands.Agree() }
|
||||
@ -546,7 +546,7 @@ class IRSTests {
|
||||
|
||||
val modifiedIRS4 = irs.copy(floatingLeg = irs.floatingLeg.copy(effectiveDate = irs.fixedLeg.effectiveDate.minusDays(1)))
|
||||
transaction {
|
||||
output() {
|
||||
output {
|
||||
modifiedIRS4
|
||||
}
|
||||
command(MEGA_CORP_PUBKEY) { InterestRateSwap.Commands.Agree() }
|
||||
@ -575,7 +575,7 @@ class IRSTests {
|
||||
oldIRS.common)
|
||||
|
||||
transaction {
|
||||
input() {
|
||||
input {
|
||||
oldIRS
|
||||
|
||||
}
|
||||
@ -586,7 +586,7 @@ class IRSTests {
|
||||
InterestRateSwap.Commands.Refix(Fix(FixOf("ICE LIBOR", ld, Tenor("3M")), bd))
|
||||
}
|
||||
timestamp(TEST_TX_TIME)
|
||||
output() { newIRS }
|
||||
output { newIRS }
|
||||
this.verifies()
|
||||
}
|
||||
|
||||
@ -594,7 +594,7 @@ class IRSTests {
|
||||
tweak {
|
||||
command(ORACLE_PUBKEY) { InterestRateSwap.Commands.Refix(Fix(FixOf("ICE LIBOR", ld, Tenor("3M")), bd)) }
|
||||
timestamp(TEST_TX_TIME)
|
||||
output() { oldIRS }
|
||||
output { oldIRS }
|
||||
this `fails with` "There is at least one difference in the IRS floating leg payment schedules"
|
||||
}
|
||||
|
||||
@ -607,7 +607,7 @@ class IRSTests {
|
||||
val firstResetValue = newIRS.calculation.floatingLegPaymentSchedule[firstResetKey]
|
||||
val modifiedFirstResetValue = firstResetValue!!.copy(notional = Amount(firstResetValue.notional.quantity, Currency.getInstance("JPY")))
|
||||
|
||||
output() {
|
||||
output {
|
||||
newIRS.copy(
|
||||
newIRS.fixedLeg,
|
||||
newIRS.floatingLeg,
|
||||
@ -627,7 +627,7 @@ class IRSTests {
|
||||
val latestReset = newIRS.calculation.floatingLegPaymentSchedule.filter { it.value.rate is FixedRate }.maxBy { it.key }
|
||||
val modifiedLatestResetValue = latestReset!!.value.copy(notional = Amount(latestReset.value.notional.quantity, Currency.getInstance("JPY")))
|
||||
|
||||
output() {
|
||||
output {
|
||||
newIRS.copy(
|
||||
newIRS.fixedLeg,
|
||||
newIRS.floatingLeg,
|
||||
|
@ -52,7 +52,7 @@ class NetworkMapVisualiser : Application() {
|
||||
|
||||
sealed class RunningPausedState {
|
||||
class Running(val tickTimer: TimerTask) : RunningPausedState()
|
||||
class Paused() : RunningPausedState()
|
||||
class Paused : RunningPausedState()
|
||||
|
||||
val buttonLabel: RunPauseButtonLabel
|
||||
get() {
|
||||
|
@ -25,7 +25,7 @@ import net.corda.netmap.VisualiserViewModel.Style
|
||||
|
||||
data class TrackerWidget(val vbox: VBox, val cursorBox: Pane, val label: Label, val cursor: Polygon)
|
||||
|
||||
internal class VisualiserView() {
|
||||
internal class VisualiserView {
|
||||
lateinit var root: Pane
|
||||
lateinit var stage: Stage
|
||||
lateinit var splitter: SplitPane
|
||||
@ -70,7 +70,7 @@ internal class VisualiserView() {
|
||||
//repositionNodes()
|
||||
}
|
||||
}
|
||||
scaleMap(displayStyle);
|
||||
scaleMap(displayStyle)
|
||||
root = Pane(mapImage)
|
||||
root.background = Background(BackgroundFill(backgroundColor, CornerRadii.EMPTY, Insets.EMPTY))
|
||||
scrollPane = buildScrollPane(backgroundColor, displayStyle)
|
||||
|
@ -105,8 +105,8 @@ class VisualiserViewModel {
|
||||
val yOffset = -80
|
||||
val circleX = view.stageWidth / 2 + xOffset
|
||||
val circleY = view.stageHeight / 2 + yOffset
|
||||
val x: Double = radius * Math.cos(tangentRad) + circleX;
|
||||
val y: Double = radius * Math.sin(tangentRad) + circleY;
|
||||
val x: Double = radius * Math.cos(tangentRad) + circleX
|
||||
val y: Double = radius * Math.sin(tangentRad) + circleY
|
||||
return Pair(x, y)
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ class OGSIMMAnalyticsEngine : AnalyticsEngine() {
|
||||
var totalSensitivities = CurrencyParameterSensitivities.empty()
|
||||
var totalCurrencyExposure = MultiCurrencyAmount.empty()
|
||||
for (resolvedTrade in trades) {
|
||||
val swap = resolvedTrade.getProduct()
|
||||
val swap = resolvedTrade.product
|
||||
|
||||
val pointSensitivities = pricer.presentValueSensitivity(swap, combinedRatesProvider).build()
|
||||
val sensitivities = combinedRatesProvider.parameterSensitivity(pointSensitivities)
|
||||
|
@ -11,20 +11,20 @@ import com.opengamma.strata.pricer.rate.ImmutableRatesProvider
|
||||
*/
|
||||
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
class PortfolioNormalizer(eur: Currency?, combinedRatesProvider: ImmutableRatesProvider?) {}
|
||||
class PortfolioNormalizer(eur: Currency?, combinedRatesProvider: ImmutableRatesProvider?)
|
||||
|
||||
/**
|
||||
* Stub class for the real BIMM implementation
|
||||
*/
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
class RwamBimmNotProductClassesCalculator(fxRateProvider: MarketDataFxRateProvider?, eur: Currency?, instance: Any) {}
|
||||
class RwamBimmNotProductClassesCalculator(fxRateProvider: MarketDataFxRateProvider?, eur: Currency?, instance: Any)
|
||||
|
||||
/**
|
||||
* Stub class for the real BIMM implementation
|
||||
*/
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
class IsdaConfiguration {
|
||||
object INSTANCE {}
|
||||
object INSTANCE
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -24,8 +24,7 @@ data class SwapDataView(
|
||||
var IM: Double? = null,
|
||||
var MTM: Double? = null,
|
||||
var margined: Boolean = false,
|
||||
var marginedText: String = "❌️") {
|
||||
}
|
||||
var marginedText: String = "❌️")
|
||||
|
||||
fun SwapData.toView(viewingParty: Party, portfolio: Portfolio? = null,
|
||||
presentValue: MultiCurrencyAmount? = null,
|
||||
|
@ -31,7 +31,7 @@ data class OGTrade(override val legalContractReference: SecureHash = SecureHash.
|
||||
class Group : GroupClauseVerifier<IRSState, Commands, UniqueIdentifier>(AnyOf(Agree())) {
|
||||
override fun groupStates(tx: TransactionForContract): List<TransactionForContract.InOutGroup<IRSState, UniqueIdentifier>>
|
||||
// Group by Trade ID for in / out states
|
||||
= tx.groupStates() { state -> state.linearId }
|
||||
= tx.groupStates { state -> state.linearId }
|
||||
}
|
||||
|
||||
class Agree : Clause<IRSState, Commands, UniqueIdentifier>() {
|
||||
|
@ -33,7 +33,7 @@ data class PortfolioSwap(override val legalContractReference: SecureHash = Secur
|
||||
class Group : GroupClauseVerifier<PortfolioState, Commands, UniqueIdentifier>(FirstOf(Agree(), Update())) {
|
||||
override fun groupStates(tx: TransactionForContract): List<TransactionForContract.InOutGroup<PortfolioState, UniqueIdentifier>>
|
||||
// Group by Trade ID for in / out states
|
||||
= tx.groupStates() { state -> state.linearId }
|
||||
= tx.groupStates { state -> state.linearId }
|
||||
}
|
||||
|
||||
class Update : Clause<PortfolioState, Commands, UniqueIdentifier>() {
|
||||
|
@ -29,7 +29,7 @@ class NodeApi {
|
||||
}
|
||||
|
||||
private fun waitForNodeStartup(nodeWebserverAddr: HostAndPort) {
|
||||
val url = URL("http://${nodeWebserverAddr.toString()}/api/status")
|
||||
val url = URL("http://$nodeWebserverAddr/api/status")
|
||||
var retries = 0
|
||||
var respCode: Int
|
||||
do {
|
||||
@ -45,10 +45,10 @@ class NodeApi {
|
||||
"Node hasn't started"
|
||||
} catch(e: SocketException) {
|
||||
respCode = -1
|
||||
"Could not connect: ${e.toString()}"
|
||||
"Could not connect: $e"
|
||||
} catch (e: IOException) {
|
||||
respCode = -1
|
||||
"IOException: ${e.toString()}"
|
||||
"IOException: $e"
|
||||
}
|
||||
|
||||
if (retries > NODE_WAIT_RETRY_COUNT) {
|
||||
|
@ -3,7 +3,7 @@ package net.corda.demobench.ui
|
||||
import javafx.scene.control.Label
|
||||
import javafx.scene.layout.HBox
|
||||
|
||||
class PropertyLabel() : HBox() {
|
||||
class PropertyLabel : HBox() {
|
||||
|
||||
val nameLabel = Label()
|
||||
val valueLabel = Label()
|
||||
|
@ -12,7 +12,7 @@ class LocalWebServer : WebServer() {
|
||||
@Throws(SQLException::class)
|
||||
override fun addSession(conn: Connection): String {
|
||||
val session = createNewSession("local")
|
||||
session.setConnection(conn)
|
||||
session.connection = conn
|
||||
session.put("url", conn.metaData.url)
|
||||
val s = session.get("sessionId") as String
|
||||
return url + "/frame.jsp?jsessionid=" + s
|
||||
|
@ -156,7 +156,7 @@ class TransactionViewer : CordaView("Transactions") {
|
||||
private fun ObservableList<StateAndRef<ContractState>>.getParties() = map { it.state.data.participants.map { getModel<NetworkIdentityModel>().lookup(it) } }
|
||||
private fun ObservableList<StateAndRef<ContractState>>.toText() = map { it.contract().javaClass.simpleName }.groupBy { it }.map { "${it.key} (${it.value.size})" }.joinToString()
|
||||
|
||||
private class TransactionWidget() : BorderPane() {
|
||||
private class TransactionWidget : BorderPane() {
|
||||
private val partiallyResolvedTransactions by observableListReadOnly(TransactionDataModel::partiallyResolvedTransactions)
|
||||
|
||||
// TODO : Add a scrolling table to show latest transaction.
|
||||
|
@ -213,7 +213,7 @@ class CashViewer : CordaView("Cash") {
|
||||
treeItem
|
||||
}
|
||||
|
||||
cashViewerTable.apply() {
|
||||
cashViewerTable.apply {
|
||||
root = TreeItem()
|
||||
val children: List<TreeItem<out ViewerNode>> = root.children
|
||||
Bindings.bindContent(children, cashViewerIssueNodes)
|
||||
@ -280,7 +280,7 @@ class CashViewer : CordaView("Cash") {
|
||||
}
|
||||
}
|
||||
|
||||
private class CashWidget() : VBox() {
|
||||
private class CashWidget : VBox() {
|
||||
// Inject data.
|
||||
private val reportingCurrency by observableValue(SettingsModel::reportingCurrencyProperty)
|
||||
private val cashStates by observableList(ContractStateModel::cashStates)
|
||||
|
Loading…
Reference in New Issue
Block a user