diff --git a/tools/jmeter/src/main/kotlin/com/r3/corda/jmeter/FlowSampler.kt b/tools/jmeter/src/main/kotlin/com/r3/corda/jmeter/FlowSampler.kt
deleted file mode 100644
index 206937da97..0000000000
--- a/tools/jmeter/src/main/kotlin/com/r3/corda/jmeter/FlowSampler.kt
+++ /dev/null
@@ -1,85 +0,0 @@
-package com.r3.corda.jmeter
-
-import net.corda.client.rpc.CordaRPCClient
-import net.corda.client.rpc.CordaRPCConnection
-import net.corda.core.flows.FlowLogic
-import net.corda.core.messaging.CordaRPCOps
-import net.corda.core.utilities.NetworkHostAndPort
-import org.apache.jmeter.config.Argument
-import org.apache.jmeter.config.Arguments
-import org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient
-import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext
-import org.apache.jmeter.samplers.SampleResult
-
-
-abstract class FlowSampler() : AbstractJavaSamplerClient() {
- companion object {
- val host = Argument("host", "localhost", "", "The remote network address (hostname or IP address) to connect to for RPC.")
- val port = Argument("port", "10000", "", "The remote port to connect to for RPC.")
- val username = Argument("username", "corda", "", "The RPC user to connect to connect as.")
- val password = Argument("password", "corda_is_awesome", "", "The password for the RPC user.")
-
- val allArgs = setOf(host, port, username, password)
- }
-
- var rpcClient: CordaRPCClient? = null
- var rpcConnection: CordaRPCConnection? = null
- var rpcProxy: CordaRPCOps? = null
-
- override fun getDefaultParameters(): Arguments {
- // Add copies of all args, since they seem to be mutable.
- return Arguments().apply {
- for (arg in allArgs) {
- addArgument(arg.clone() as Argument)
- }
- for (arg in additionalArgs) {
- addArgument(arg.clone() as Argument)
- }
- }
- }
-
- override fun setupTest(context: JavaSamplerContext) {
- super.setupTest(context)
- rpcClient = CordaRPCClient(NetworkHostAndPort(context.getParameter(host.name), context.getIntParameter(port.name)))
- rpcConnection = rpcClient!!.start(context.getParameter(username.name), context.getParameter(password.name))
- rpcProxy = rpcConnection!!.proxy
- setupTest(rpcProxy!!, context)
- }
-
- override fun runTest(context: JavaSamplerContext): SampleResult {
- val flowInvoke = createFlowInvoke(rpcProxy!!, context)
- val result = SampleResult()
- result.sampleStart()
- val handle = rpcProxy!!.startFlowDynamic(flowInvoke!!.flowLogicClass, *(flowInvoke!!.args))
- result.sampleLabel = handle.id.toString()
- result.latencyEnd()
- try {
- val flowResult = handle.returnValue.get()
- result.sampleEnd()
- return result.apply {
- isSuccessful = true
- }
- } catch (e: Exception) {
- result.sampleEnd()
- return result.apply {
- isSuccessful = false
- }
- }
- }
-
- override fun teardownTest(context: JavaSamplerContext) {
- teardownTest(rpcProxy!!, context)
- rpcProxy = null
- rpcConnection!!.close()
- rpcConnection = null
- rpcClient = null
- super.teardownTest(context)
- }
-
- abstract val additionalArgs: Set
- abstract fun setupTest(rpcProxy: CordaRPCOps, testContext: JavaSamplerContext)
- abstract fun createFlowInvoke(rpcProxy: CordaRPCOps, testContext: JavaSamplerContext): FlowInvoke<*>
- abstract fun teardownTest(rpcProxy: CordaRPCOps, testContext: JavaSamplerContext)
-
- class FlowInvoke>(val flowLogicClass: Class, val args: Array)
-}
\ No newline at end of file
diff --git a/tools/jmeter/src/main/kotlin/com/r3/corda/jmeter/Ssh.kt b/tools/jmeter/src/main/kotlin/com/r3/corda/jmeter/Ssh.kt
index 3c4a38391a..93cc88cd7c 100644
--- a/tools/jmeter/src/main/kotlin/com/r3/corda/jmeter/Ssh.kt
+++ b/tools/jmeter/src/main/kotlin/com/r3/corda/jmeter/Ssh.kt
@@ -10,7 +10,9 @@ import java.io.BufferedReader
import java.io.InputStreamReader
import java.util.*
-
+/**
+ * Creates SSH tunnels for remote controlling SSH servers/agents from the local host (via UI or headless).
+ */
class Ssh {
companion object {
val log = LoggerFactory.getLogger(this::class.java)
@@ -28,7 +30,7 @@ class Ssh {
val jmeterProps = loadProps("/jmeter.properties")
// The port the JMeter remote agents call back to on this client host.
val clientRmiLocalPort = jmeterProps.getProperty("client.rmi.localport").toInt()
- // TODO: Where is this value used? Just on the remote agent to set up the RMI registry?
+ // Remote RMI registry port.
val serverRmiPort = jmeterProps.getProperty("server.rmi.port", "1099").toInt()
// Where JMeter driver will try to connect for remote agents (should all be localhost so can ssh tunnel).
@@ -47,7 +49,6 @@ class Ssh {
val session = connectToHost(jsch, remoteHost, userName)
sessions += session
- // TODO: maybe check the local host is actually "localhost"?
// For tunnelling the RMI registry on the remote agent
// ssh ${remoteHostAndPort.host} -L 0.0.0.0:${localHostAndPort.port}:localhost:$serverRmiPort -N
createOutboundTunnel(session, NetworkHostAndPort("0.0.0.0", localHostAndPort.port), NetworkHostAndPort("localhost", serverRmiPort))