Extract jackson dependency from finance-workflows (#5163)

Extract jackson dependency from finance-workflows and move it to IRS Demo where it is actually needed
This commit is contained in:
fowlerrr 2019-05-23 18:22:56 +01:00 committed by Shams Asari
parent d6ac4e2393
commit f273d894ef
11 changed files with 21 additions and 15 deletions

View File

@ -4,6 +4,14 @@ Changelog
Here's a summary of what's changed in each Corda release. For guidance on how to upgrade code from the previous Here's a summary of what's changed in each Corda release. For guidance on how to upgrade code from the previous
release, see :doc:`app-upgrade-notes`. release, see :doc:`app-upgrade-notes`.
.. _changelog_v5.0:
Version 5.0
-----------
* Removed ``finance-workflows`` dependency on jackson library. The functions that used jackson (e.g. ``FinanceJSONSupport``) have been moved
into IRS Demo.
.. _changelog_v4.2: .. _changelog_v4.2:
Version 4.2 Version 4.2

View File

@ -1,6 +1,6 @@
package net.corda.finance.contracts package net.corda.finance.contracts
import loadTestCalendar import net.corda.finance.workflows.utils.loadTestCalendar
import org.junit.Test import org.junit.Test
import java.time.LocalDate import java.time.LocalDate
import kotlin.test.assertEquals import kotlin.test.assertEquals

View File

@ -37,9 +37,6 @@ dependencies {
cordapp project(':finance:contracts') cordapp project(':finance:contracts')
// For JSON
compile "com.fasterxml.jackson.core:jackson-databind:${jackson_version}"
testCompile project(':test-utils') testCompile project(':test-utils')
testCompile project(path: ':core', configuration: 'testArtifacts') testCompile project(path: ':core', configuration: 'testArtifacts')

View File

@ -1,3 +1,5 @@
package net.corda.finance.workflows.utils
import net.corda.core.flows.FlowException import net.corda.core.flows.FlowException
import net.corda.core.serialization.CordaSerializable import net.corda.core.serialization.CordaSerializable
import net.corda.finance.contracts.BusinessCalendar import net.corda.finance.contracts.BusinessCalendar
@ -5,7 +7,7 @@ import net.corda.finance.contracts.BusinessCalendar
val TEST_CALENDAR_NAMES = listOf("London", "NewYork") val TEST_CALENDAR_NAMES = listOf("London", "NewYork")
fun loadTestCalendar(name: String): BusinessCalendar { fun loadTestCalendar(name: String): BusinessCalendar {
val stream = UnknownCalendar::class.java.getResourceAsStream("net/corda/finance/workflows/utils/${name}HolidayCalendar.txt") ?: throw UnknownCalendar(name) val stream = UnknownCalendar::class.java.getResourceAsStream("/net/corda/finance/workflows/utils/${name}HolidayCalendar.txt") ?: throw UnknownCalendar(name)
return stream.use { return stream.use {
BusinessCalendar(stream.reader().readText().split(",").map { BusinessCalendar.parseDateFromString(it) }.toSortedSet()) BusinessCalendar(stream.reader().readText().split(",").map { BusinessCalendar.parseDateFromString(it) }.toSortedSet())
} }

View File

@ -3,7 +3,6 @@ package net.corda.irs.contract
import com.nhaarman.mockito_kotlin.doReturn import com.nhaarman.mockito_kotlin.doReturn
import com.nhaarman.mockito_kotlin.mock import com.nhaarman.mockito_kotlin.mock
import com.nhaarman.mockito_kotlin.whenever import com.nhaarman.mockito_kotlin.whenever
import loadTestCalendar
import net.corda.core.contracts.Amount import net.corda.core.contracts.Amount
import net.corda.core.contracts.UniqueIdentifier import net.corda.core.contracts.UniqueIdentifier
import net.corda.core.crypto.generateKeyPair import net.corda.core.crypto.generateKeyPair
@ -15,6 +14,7 @@ import net.corda.core.utilities.seconds
import net.corda.finance.DOLLARS import net.corda.finance.DOLLARS
import net.corda.finance.EUR import net.corda.finance.EUR
import net.corda.finance.contracts.* import net.corda.finance.contracts.*
import net.corda.finance.workflows.utils.loadTestCalendar
import net.corda.node.services.api.IdentityServiceInternal import net.corda.node.services.api.IdentityServiceInternal
import net.corda.testing.common.internal.addNotary import net.corda.testing.common.internal.addNotary
import net.corda.testing.common.internal.testNetworkParameters import net.corda.testing.common.internal.testNetworkParameters

View File

@ -15,6 +15,8 @@ dependencies {
// Corda integration dependencies // Corda integration dependencies
cordaCompile project(':core') cordaCompile project(':core')
compile("com.fasterxml.jackson.module:jackson-module-kotlin:$jackson_version")
// only included to control the `DemoClock` as part of the demo application // only included to control the `DemoClock` as part of the demo application
// normally `:node` should not be depended on in any CorDapps // normally `:node` should not be depended on in any CorDapps
compileOnly project(':node') compileOnly project(':node')

View File

@ -1,7 +1,6 @@
package net.corda.irs.api package net.corda.irs.api
import co.paralleluniverse.fibers.Suspendable import co.paralleluniverse.fibers.Suspendable
import loadTestCalendar
import net.corda.core.contracts.Command import net.corda.core.contracts.Command
import net.corda.core.crypto.TransactionSignature import net.corda.core.crypto.TransactionSignature
import net.corda.core.flows.* import net.corda.core.flows.*
@ -16,6 +15,7 @@ import net.corda.finance.contracts.BusinessCalendar
import net.corda.finance.contracts.Fix import net.corda.finance.contracts.Fix
import net.corda.finance.contracts.FixOf import net.corda.finance.contracts.FixOf
import net.corda.finance.contracts.Tenor import net.corda.finance.contracts.Tenor
import net.corda.finance.workflows.utils.loadTestCalendar
import net.corda.irs.flows.RatesFixFlow import net.corda.irs.flows.RatesFixFlow
import net.corda.irs.math.CubicSplineInterpolator import net.corda.irs.math.CubicSplineInterpolator
import net.corda.irs.math.Interpolator import net.corda.irs.math.Interpolator

View File

@ -1,17 +1,17 @@
@file:JvmName("FinanceJSONSupport") @file:JvmName("FinanceJSONSupport")
package net.corda.finance.workflows.plugin package net.corda.irs.flows.plugin
import TEST_CALENDAR_NAMES
import com.fasterxml.jackson.core.JsonGenerator import com.fasterxml.jackson.core.JsonGenerator
import com.fasterxml.jackson.core.JsonParseException import com.fasterxml.jackson.core.JsonParseException
import com.fasterxml.jackson.core.JsonParser import com.fasterxml.jackson.core.JsonParser
import com.fasterxml.jackson.databind.* import com.fasterxml.jackson.databind.*
import com.fasterxml.jackson.databind.deser.std.StringArrayDeserializer import com.fasterxml.jackson.databind.deser.std.StringArrayDeserializer
import com.fasterxml.jackson.databind.module.SimpleModule import com.fasterxml.jackson.databind.module.SimpleModule
import loadTestCalendar
import net.corda.finance.contracts.BusinessCalendar import net.corda.finance.contracts.BusinessCalendar
import net.corda.finance.contracts.Expression import net.corda.finance.contracts.Expression
import net.corda.finance.workflows.utils.TEST_CALENDAR_NAMES
import net.corda.finance.workflows.utils.loadTestCalendar
import java.time.LocalDate import java.time.LocalDate
import java.util.* import java.util.*

View File

@ -19,7 +19,7 @@ import net.corda.core.utilities.NetworkHostAndPort
import net.corda.core.utilities.contextLogger import net.corda.core.utilities.contextLogger
import net.corda.core.utilities.getOrThrow import net.corda.core.utilities.getOrThrow
import net.corda.core.utilities.seconds import net.corda.core.utilities.seconds
import net.corda.finance.workflows.plugin.registerFinanceJSONMappers import net.corda.irs.flows.plugin.registerFinanceJSONMappers
import net.corda.irs.contract.InterestRateSwap import net.corda.irs.contract.InterestRateSwap
import net.corda.irs.web.IrsDemoWebApplication import net.corda.irs.web.IrsDemoWebApplication
import net.corda.test.spring.springDriver import net.corda.test.spring.springDriver

View File

@ -6,7 +6,7 @@ import net.corda.client.rpc.CordaRPCClient
import net.corda.client.rpc.RPCException import net.corda.client.rpc.RPCException
import net.corda.core.messaging.CordaRPCOps import net.corda.core.messaging.CordaRPCOps
import net.corda.core.utilities.NetworkHostAndPort import net.corda.core.utilities.NetworkHostAndPort
import net.corda.finance.workflows.plugin.registerFinanceJSONMappers import net.corda.irs.flows.plugin.registerFinanceJSONMappers
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired import org.springframework.beans.factory.annotation.Autowired
import org.springframework.beans.factory.annotation.Value import org.springframework.beans.factory.annotation.Value

View File

@ -1,8 +1,6 @@
package net.corda.vega.webplugin package net.corda.vega.webplugin
import com.fasterxml.jackson.databind.ObjectMapper
import net.corda.core.serialization.SerializationWhitelist import net.corda.core.serialization.SerializationWhitelist
import net.corda.finance.workflows.plugin.registerFinanceJSONMappers
import net.corda.vega.api.PortfolioApi import net.corda.vega.api.PortfolioApi
import net.corda.webserver.services.WebServerPluginRegistry import net.corda.webserver.services.WebServerPluginRegistry
import java.util.function.Function import java.util.function.Function
@ -16,5 +14,4 @@ import java.util.function.Function
class SimmPlugin : WebServerPluginRegistry { class SimmPlugin : WebServerPluginRegistry {
override val webApis = listOf(Function(::PortfolioApi)) override val webApis = listOf(Function(::PortfolioApi))
override val staticServeDirs: Map<String, String> = emptyMap() override val staticServeDirs: Map<String, String> = emptyMap()
override fun customizeJSONSerialization(om: ObjectMapper): Unit = registerFinanceJSONMappers(om)
} }