Post review updates; renamed tests/files, neater Kotlin test code

This commit is contained in:
Chris Cochrane 2022-06-08 16:30:06 +01:00
parent 4b1aabb164
commit f0d530ab8b
No known key found for this signature in database
GPG Key ID: 4D4602B5BBC63950
2 changed files with 3 additions and 15 deletions

View File

@ -9,6 +9,7 @@ import org.junit.Test
import java.net.HttpURLConnection
import java.net.HttpURLConnection.HTTP_OK
import java.net.URL
import java.util.stream.Collectors
import kotlin.test.assertEquals
import kotlin.test.assertTrue
@ -19,22 +20,13 @@ class NodeStatusTest {
driver(DriverParameters(notarySpecs = emptyList(), jmxPolicy = JmxPolicy.defaultEnabled())) {
val jmxAddress = startNode().get().jmxAddress.toString()
val nodeStatusURL = URL("http://$jmxAddress/jolokia/read/net.corda:name=Status,type=Node")
val jmxInfo = with(nodeStatusURL.openConnection() as HttpURLConnection) {
val jmxInfo = with(nodeStatusURL.openConnection() as HttpURLConnection) {
requestMethod = "GET"
inputStream.bufferedReader().use {
it.lines().collect(Collectors.toList()).joinToString()
}
}
with(nodeStatusURL.openConnection() as HttpURLConnection) {
requestMethod = "GET"
inputStream.bufferedReader().use {
it.lines().forEach { line ->
jmxInfo += line
}
}
}
assertTrue {
jmxInfo.isNotEmpty()
}

View File

@ -15,14 +15,10 @@ class PublishTest {
driver(DriverParameters(notarySpecs = emptyList(), jmxPolicy = JmxPolicy.defaultEnabled())) {
val jmxAddress = startNode().get().jmxAddress.toString()
val nodeStatusURL = URL("http://$jmxAddress/jolokia/read/net.corda:*")
val httpResponse = with(nodeStatusURL.openConnection() as HttpURLConnection) {
val httpResponse = with(nodeStatusURL.openConnection() as HttpURLConnection) {
requestMethod = "GET"
responseCode
}
with(nodeStatusURL.openConnection() as HttpURLConnection) {
requestMethod = "GET"
httpResponse = responseCode
}
assertTrue {
httpResponse == HttpURLConnection.HTTP_OK