mirror of
https://github.com/corda/corda.git
synced 2024-12-27 08:22:35 +00:00
Full config of capsule launched JMeter server (was missing functions previously).
This commit is contained in:
parent
029cc1c2f0
commit
3b565f52f7
@ -1,7 +1,11 @@
|
||||
package net.corda.jmeter
|
||||
|
||||
import net.corda.core.internal.div
|
||||
import org.apache.jmeter.JMeter
|
||||
import org.slf4j.LoggerFactory
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Paths
|
||||
import kotlin.streams.asSequence
|
||||
|
||||
class Launcher {
|
||||
companion object {
|
||||
@ -11,10 +15,22 @@ class Launcher {
|
||||
val jmeter = JMeter()
|
||||
val capsuleDir = System.getProperty("capsule.dir")
|
||||
if (capsuleDir != null) {
|
||||
// We are running under Capsule, so assume we want a JMeter distributed server to be controlled from
|
||||
// We are running under Capsule, so assume we want a JMeter slave server to be controlled from
|
||||
// elsewhere.
|
||||
logger.info("Starting JMeter in server mode from $capsuleDir")
|
||||
jmeter.start(arrayOf("-s", "-d", capsuleDir, "-p", "$capsuleDir/jmeter.properties") + args)
|
||||
// Add all JMeter and Corda jars onto the JMeter search_paths
|
||||
val searchPath = Files.list(Paths.get(capsuleDir)).asSequence().filter {
|
||||
val filename = it.fileName.toString()
|
||||
filename.endsWith(".jar") && (filename.contains("corda") || filename.contains("jmeter", true))
|
||||
}.joinToString(";")
|
||||
logger.info("search_paths = $searchPath")
|
||||
System.setProperty("search_paths", searchPath)
|
||||
// Set the JMeter home as a property rather than command line arg, due to inconsistent code in JMeter.
|
||||
System.setProperty("jmeter.home", capsuleDir)
|
||||
// Create two dirs that JMeter expects, if they don't already exist.
|
||||
Files.createDirectories(Paths.get(capsuleDir) / "lib" / "ext")
|
||||
Files.createDirectories(Paths.get(capsuleDir) / "lib" / "junit")
|
||||
jmeter.start(arrayOf("-s", "-p", "$capsuleDir/jmeter.properties") + args)
|
||||
} else {
|
||||
jmeter.start(args)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user