Fixed a merge error and parameterised host for upload rates.

This commit is contained in:
Clinton Alexander 2016-06-06 15:55:15 +01:00 committed by Andras Slemmer
parent 9fc89fc4a2
commit 5de855e045
2 changed files with 5 additions and 4 deletions

View File

@ -153,7 +153,7 @@ fun runIRSDemo(args: Array<String>, useInMemoryMessaging: Boolean = false): Int
"http://localhost:" + (Node.DEFAULT_PORT + 1)
}
if(!runDateChange(dateStr)) {
if(!runDateChange(dateStr, host)) {
return 1
}
} else {
@ -267,7 +267,7 @@ private fun runNode(nodeParams : NodeParams, useInMemoryMessaging: Boolean) : Un
ExitServerProtocol.Handler.register(node)
if(nodeParams.uploadRates) {
runUploadRates()
runUploadRates("http://localhost:31341")
}
try {
@ -277,12 +277,12 @@ private fun runNode(nodeParams : NodeParams, useInMemoryMessaging: Boolean) : Un
}
}
private fun runUploadRates() {
private fun runUploadRates(host) {
val fileContents = IOUtils.toString(NodeParams::class.java.getResource("example.rates.txt"))
var timer : Timer? = null
timer = fixedRateTimer("upload-rates", false, 0, 5000, {
try {
val url = URL("http://localhost:31341/upload/interest-rates")
val url = URL(host + "/upload/interest-rates")
if(uploadFile(url, fileContents)) {
timer!!.cancel()
println("Rates uploaded successfully")

View File

@ -34,6 +34,7 @@ private fun setupNodeA(dir: Path) {
private fun setupNodeB(dir: Path) {
runIRSDemo(arrayOf("--role", "SetupNodeB", "--dir", dir.toString()))
}
private fun startNodeA(dir: Path) {
thread(true, false, null, "NodeA", -1, { runIRSDemo(arrayOf("--role", "NodeA", "--dir", dir.toString()), true) })
Thread.sleep(15000)