mirror of
https://github.com/corda/corda.git
synced 2025-04-18 08:10:47 +00:00
Added correct json support fields to allow deserialisation of IRS data via Jackson.
This commit is contained in:
parent
5fdd57ec48
commit
fffcfff269
client/jackson/src/main/kotlin/net/corda/jackson
samples/irs-demo/src
integration-test/kotlin/net/corda/irs
main/kotlin/net/corda/irs/contract
@ -251,7 +251,6 @@ object JacksonSupport {
|
||||
|
||||
object CalendarSerializer : JsonSerializer<BusinessCalendar>() {
|
||||
override fun serialize(obj: BusinessCalendar, generator: JsonGenerator, context: SerializerProvider) {
|
||||
println(obj)
|
||||
val calendarName = BusinessCalendar.calendars.find { BusinessCalendar.getInstance(it) == obj }
|
||||
if(calendarName != null) {
|
||||
generator.writeString(calendarName)
|
||||
|
@ -69,16 +69,19 @@ class IRSDemoTest : IntegrationTestCategory {
|
||||
|
||||
assertThat(getTradeCount(nodeAApi)).isEqualTo(numADeals + 1)
|
||||
assertThat(getTradeCount(nodeBApi)).isEqualTo(numBDeals + 1)
|
||||
assertThat(getFloatingLegFixCount(nodeAApi) == 0)
|
||||
|
||||
// Wait until the initial trade and all scheduled fixings up to the current date have finished
|
||||
nextFixingDates.firstWithTimeout(maxWaitTime){ it == null || it > currentDate }
|
||||
runDateChange(nodeBApi)
|
||||
nextFixingDates.firstWithTimeout(maxWaitTime) { it == null || it > futureDate }
|
||||
|
||||
assertThat(getTrades(nodeAApi)[0])
|
||||
assertThat(getFloatingLegFixCount(nodeAApi) > 0)
|
||||
}
|
||||
}
|
||||
|
||||
fun getFloatingLegFixCount(nodeApi: HttpApi) = getTrades(nodeApi)[0].calculation.floatingLegPaymentSchedule.count { it.value.rate.ratioUnit != null }
|
||||
|
||||
fun getFixingDateObservable(config: FullNodeConfiguration): Observable<LocalDate?> {
|
||||
val client = CordaRPCClient(config.rpcAddress!!)
|
||||
val proxy = client.start("user", "password").proxy
|
||||
|
@ -109,6 +109,7 @@ abstract class RatePaymentEvent(date: LocalDate,
|
||||
* Assumes that the rate is valid.
|
||||
*/
|
||||
@CordaSerializable
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
class FixedRatePaymentEvent(date: LocalDate,
|
||||
accrualStartDate: LocalDate,
|
||||
accrualEndDate: LocalDate,
|
||||
@ -655,6 +656,7 @@ class InterestRateSwap : Contract {
|
||||
/**
|
||||
* The state class contains the 4 major data classes.
|
||||
*/
|
||||
@JsonIgnoreProperties("parties", "participants", ignoreUnknown = true)
|
||||
data class State(
|
||||
val fixedLeg: FixedLeg,
|
||||
val floatingLeg: FloatingLeg,
|
||||
|
@ -1,6 +1,7 @@
|
||||
package net.corda.irs.contract
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
|
||||
import net.corda.core.contracts.Amount
|
||||
import net.corda.core.contracts.Tenor
|
||||
import net.corda.core.serialization.CordaSerializable
|
||||
@ -37,6 +38,7 @@ val String.percent: PercentageRatioUnit get() = PercentageRatioUnit(this)
|
||||
/**
|
||||
* Parent of the Rate family. Used to denote fixed rates, floating rates, reference rates etc.
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
open class Rate(val ratioUnit: RatioUnit? = null) {
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
|
Loading…
x
Reference in New Issue
Block a user