mirror of
https://github.com/corda/corda.git
synced 2025-04-06 19:07:08 +00:00
Post review updates; renamed tests/files, neater Kotlin test code
This commit is contained in:
parent
4b1aabb164
commit
f0d530ab8b
@ -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()
|
||||
}
|
@ -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
|
Loading…
x
Reference in New Issue
Block a user