mirror of
https://github.com/corda/corda.git
synced 2025-01-29 15:43:55 +00:00
Fix IRSSimulationTest
test (#2821)
* Fix `IRSSimulationTest` test Since prod class `IRSSimulation` loading `trade.json` as resource, `trade.json` should be located in prod resources folder of a dependant project to be successfully loaded. Also improve error reporting. * Change of Json trades samples locations
This commit is contained in:
parent
e31d2b0cad
commit
64871ac024
@ -12,7 +12,7 @@ class IRSDemoClientApi(hostAndPort: NetworkHostAndPort) {
|
||||
private val api = HttpApi.fromHostAndPort(hostAndPort, apiRoot)
|
||||
|
||||
fun runTrade(tradeId: String, oracleName: CordaX500Name) {
|
||||
val fileContents = IOUtils.toString(javaClass.classLoader.getResourceAsStream("net/corda/irs/simulation/example-irs-trade.json"), Charsets.UTF_8.name())
|
||||
val fileContents = IOUtils.toString(javaClass.classLoader.getResourceAsStream("net/corda/irs/web/simulation/example-irs-trade.json"), Charsets.UTF_8.name())
|
||||
val tradeFile = fileContents.replace("tradeXXX", tradeId).replace("oracleXXX", oracleName.toString())
|
||||
api.postJson("deals", tradeFile)
|
||||
}
|
||||
|
@ -129,7 +129,9 @@ class IRSSimulation(networkSendManuallyPumped: Boolean, runAsync: Boolean, laten
|
||||
// have the convenient copy() method that'd let us make small adjustments. Instead they're partly mutable.
|
||||
// TODO: We should revisit this in post-Excalibur cleanup and fix, e.g. by introducing an interface.
|
||||
|
||||
val irs = om.readValue<InterestRateSwap.State>(javaClass.classLoader.getResourceAsStream("net/corda/irs/web/simulation/trade.json")
|
||||
val resourceAsStream = javaClass.classLoader.getResourceAsStream("net/corda/irs/web/simulation/trade.json")
|
||||
?: error("Trade representation cannot be loaded.")
|
||||
val irs = om.readValue<InterestRateSwap.State>(resourceAsStream
|
||||
.reader()
|
||||
.readText()
|
||||
.replace("oracleXXX", RatesOracleNode.RATES_SERVICE_NAME.toString()))
|
||||
|
Loading…
x
Reference in New Issue
Block a user