From f0d530ab8bab069f0effa762c490421a4d67f802 Mon Sep 17 00:00:00 2001 From: Chris Cochrane Date: Wed, 8 Jun 2022 16:30:06 +0100 Subject: [PATCH] Post review updates; renamed tests/files, neater Kotlin test code --- .../node/jmx/{NodeStatus.kt => NodeStatusTest.kt} | 12 ++---------- .../corda/node/jmx/{Publish.kt => PublishTest.kt} | 6 +----- 2 files changed, 3 insertions(+), 15 deletions(-) rename node/src/integration-test/kotlin/net/corda/node/jmx/{NodeStatus.kt => NodeStatusTest.kt} (77%) rename node/src/integration-test/kotlin/net/corda/node/jmx/{Publish.kt => PublishTest.kt} (75%) diff --git a/node/src/integration-test/kotlin/net/corda/node/jmx/NodeStatus.kt b/node/src/integration-test/kotlin/net/corda/node/jmx/NodeStatusTest.kt similarity index 77% rename from node/src/integration-test/kotlin/net/corda/node/jmx/NodeStatus.kt rename to node/src/integration-test/kotlin/net/corda/node/jmx/NodeStatusTest.kt index c889c1e14d..6e3850bffc 100644 --- a/node/src/integration-test/kotlin/net/corda/node/jmx/NodeStatus.kt +++ b/node/src/integration-test/kotlin/net/corda/node/jmx/NodeStatusTest.kt @@ -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() } diff --git a/node/src/integration-test/kotlin/net/corda/node/jmx/Publish.kt b/node/src/integration-test/kotlin/net/corda/node/jmx/PublishTest.kt similarity index 75% rename from node/src/integration-test/kotlin/net/corda/node/jmx/Publish.kt rename to node/src/integration-test/kotlin/net/corda/node/jmx/PublishTest.kt index cf899e2ea7..f51e08a2c0 100644 --- a/node/src/integration-test/kotlin/net/corda/node/jmx/Publish.kt +++ b/node/src/integration-test/kotlin/net/corda/node/jmx/PublishTest.kt @@ -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