2017-10-31 17:22:58 +00:00
|
|
|
apply plugin: 'kotlin'
|
2017-11-02 14:58:47 +00:00
|
|
|
apply plugin: 'us.kirchmeier.capsule'
|
2017-10-31 17:22:58 +00:00
|
|
|
apply plugin: 'application'
|
|
|
|
|
2017-11-14 13:48:35 +00:00
|
|
|
mainClassName = 'com.r3.corda.jmeter.Launcher'
|
2017-10-31 17:22:58 +00:00
|
|
|
|
|
|
|
dependencies {
|
|
|
|
compile project(':client:rpc')
|
2017-11-23 12:03:17 +00:00
|
|
|
compile project(':perftestcordapp')
|
2017-11-20 17:09:59 +00:00
|
|
|
|
|
|
|
// https://mvnrepository.com/artifact/com.jcraft/jsch
|
|
|
|
compile group: 'com.jcraft', name: 'jsch', version: '0.1.54'
|
|
|
|
compile group: 'com.jcraft', name: 'jsch.agentproxy.core', version: '0.0.9'
|
|
|
|
compile group: 'com.jcraft', name: 'jsch.agentproxy.sshagent', version: '0.0.9'
|
|
|
|
compile group: 'com.jcraft', name: 'jsch.agentproxy.usocket-jna', version: '0.0.9'
|
2017-11-23 10:06:39 +00:00
|
|
|
compile group: 'com.jcraft', name: 'jsch.agentproxy.pageant', version: '0.0.9'
|
2017-11-20 17:09:59 +00:00
|
|
|
|
|
|
|
// Log4J: logging framework (with SLF4J bindings)
|
|
|
|
compile "org.apache.logging.log4j:log4j-slf4j-impl:$log4j_version"
|
|
|
|
compile "org.apache.logging.log4j:log4j-core:$log4j_version"
|
2017-10-31 17:22:58 +00:00
|
|
|
|
|
|
|
// JMeter
|
|
|
|
ext.jmVersion = "3.3"
|
|
|
|
|
|
|
|
runtime group: 'org.apache.jmeter', name: 'ApacheJMeter_components', version: "$jmVersion"
|
|
|
|
runtime group: 'org.apache.jmeter', name: 'ApacheJMeter_core', version: "$jmVersion"
|
|
|
|
runtime group: 'org.apache.jmeter', name: 'ApacheJMeter_ftp', version: "$jmVersion"
|
|
|
|
runtime group: 'org.apache.jmeter', name: 'ApacheJMeter_functions', version: "$jmVersion"
|
|
|
|
runtime group: 'org.apache.jmeter', name: 'ApacheJMeter_http', version: "$jmVersion"
|
2017-11-02 14:58:47 +00:00
|
|
|
compile group: 'org.apache.jmeter', name: 'ApacheJMeter_java', version: "$jmVersion" // 'compile' because we extend Java sampler.
|
2017-10-31 17:22:58 +00:00
|
|
|
runtime group: 'org.apache.jmeter', name: 'ApacheJMeter_jdbc', version: "$jmVersion"
|
|
|
|
runtime group: 'org.apache.jmeter', name: 'ApacheJMeter_jms', version: "$jmVersion"
|
|
|
|
runtime group: 'org.apache.jmeter', name: 'ApacheJMeter_junit', version: "$jmVersion"
|
|
|
|
runtime group: 'org.apache.jmeter', name: 'ApacheJMeter_ldap', version: "$jmVersion"
|
|
|
|
runtime group: 'org.apache.jmeter', name: 'ApacheJMeter_mail', version: "$jmVersion"
|
|
|
|
runtime group: 'org.apache.jmeter', name: 'ApacheJMeter_mongodb', version: "$jmVersion"
|
|
|
|
runtime group: 'org.apache.jmeter', name: 'ApacheJMeter_native', version: "$jmVersion"
|
|
|
|
runtime group: 'org.apache.jmeter', name: 'ApacheJMeter_tcp', version: "$jmVersion"
|
|
|
|
runtime group: 'org.apache.jmeter', name: 'ApacheJMeter_config', version: "$jmVersion"
|
|
|
|
runtime group: 'org.apache.jmeter', name: 'ApacheJMeter', version: "$jmVersion"
|
|
|
|
runtime group: 'org.apache.jmeter', name: 'jorphan', version: "$jmVersion"
|
2017-12-18 09:44:38 +00:00
|
|
|
//For Azure SQL and SQL Server support in persistence
|
|
|
|
runtime group: 'com.microsoft.sqlserver', name: 'mssql-jdbc', version: '6.2.1.jre8'
|
|
|
|
|
2017-12-05 15:39:08 +00:00
|
|
|
|
|
|
|
testCompile project(':test-utils')
|
|
|
|
testCompile project(':node-driver')
|
2017-10-31 17:22:58 +00:00
|
|
|
}
|
|
|
|
|
2017-11-15 13:30:56 +00:00
|
|
|
// Run JMeter as server process/agent on current host.
|
2017-11-02 11:44:27 +00:00
|
|
|
task(runServer, dependsOn: 'classes', type: JavaExec) {
|
|
|
|
classpath = sourceSets.main.runtimeClasspath
|
2017-11-14 13:48:35 +00:00
|
|
|
main = 'com.r3.corda.jmeter.Launcher'
|
2017-11-20 17:09:25 +00:00
|
|
|
def file = new File("$rootDir/build/search_paths.txt")
|
|
|
|
file.createNewFile()
|
|
|
|
file.text = "${project(':tools:jmeter').configurations.runtime.files.join(";")}"
|
2017-11-20 17:52:15 +00:00
|
|
|
systemProperty "search_paths_file", file.toString()
|
|
|
|
systemProperty "java.rmi.server.hostname", "0.0.0.0"
|
2017-11-02 14:58:47 +00:00
|
|
|
systemProperty "jmeter.home", sourceSets.main.resources.getSrcDirs().first().getPath()
|
|
|
|
// If you want to debug: jvmArgs += "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"
|
2017-11-02 11:44:27 +00:00
|
|
|
args+= [ "-p", sourceSets.main.resources.getSrcDirs().first().getPath()+"/jmeter.properties",
|
|
|
|
"-d", sourceSets.main.resources.getSrcDirs().first().getPath(),
|
|
|
|
"-s" ]
|
|
|
|
}
|
2017-10-31 17:22:58 +00:00
|
|
|
|
2017-11-15 13:30:56 +00:00
|
|
|
// Just start ssh tunnels, without JMeter.
|
2017-11-10 08:33:55 +00:00
|
|
|
task(runSsh, dependsOn: 'classes', type: JavaExec) {
|
|
|
|
classpath = sourceSets.main.runtimeClasspath
|
2017-11-14 13:48:35 +00:00
|
|
|
main = 'com.r3.corda.jmeter.Ssh'
|
2017-11-23 10:06:39 +00:00
|
|
|
if ( project.hasProperty("sshUser") ){
|
|
|
|
args+= "-XsshUser"
|
|
|
|
args+= Eval.me(sshUser)
|
|
|
|
}
|
2017-11-10 08:33:55 +00:00
|
|
|
if ( project.hasProperty("jmeterHosts") ) {
|
2017-11-23 10:06:39 +00:00
|
|
|
args+= "-Xssh"
|
|
|
|
args+= Eval.me(jmeterHosts)
|
2017-11-10 08:33:55 +00:00
|
|
|
}
|
|
|
|
standardInput = System.in
|
|
|
|
}
|
|
|
|
|
2017-12-05 15:39:08 +00:00
|
|
|
// Use the driver to launch 2 local nodes and the notary running the perftestcordapp.
|
|
|
|
// To use for development of samplers and flows locally.
|
|
|
|
task(runDriver, dependsOn: 'classes', type: JavaExec) {
|
|
|
|
classpath = sourceSets.test.runtimeClasspath
|
|
|
|
main = 'com.r3.corda.jmeter.StartLocalPerfCorDapp'
|
|
|
|
standardInput = System.in
|
|
|
|
}
|
|
|
|
|
2017-11-15 13:30:56 +00:00
|
|
|
// Run JMeter (by default the UI).
|
|
|
|
// Extra args can be passed by setting jmeterArgs (e.g. -n to run in non-UI mode).
|
2017-11-17 17:38:18 +00:00
|
|
|
// e.g. ./gradlew tools:jmeter:run -PjmeterArgs="['-n']"
|
2017-11-15 13:30:56 +00:00
|
|
|
// ssh tunnels will be built from local host to remote hosts by specifying jmeterHosts
|
|
|
|
// e.g. ./gradlew tools:jmeter:run -PjmeterHosts="['perf-notary.corda.r3cev.com', 'perf-node-1.corda.r3cev.com']"
|
|
|
|
// Each host is paired with local host ports listed in remote_hosts of jmeter.properties
|
2017-10-31 17:22:58 +00:00
|
|
|
run {
|
2017-11-20 17:09:25 +00:00
|
|
|
def file = new File("$rootDir/build/search_paths.txt")
|
|
|
|
file.createNewFile()
|
|
|
|
file.text = "${project(':tools:jmeter').configurations.runtime.files.join(";")}"
|
|
|
|
systemProperty "search_paths_file", file.toString()
|
2017-11-10 08:33:55 +00:00
|
|
|
systemProperty "java.rmi.server.hostname", "localhost"
|
2017-11-02 14:58:47 +00:00
|
|
|
systemProperty "jmeter.home", sourceSets.main.resources.getSrcDirs().first().getPath()
|
|
|
|
// If you want to debug: jvmArgs += "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"
|
2017-10-31 17:22:58 +00:00
|
|
|
args+= [ "-p", sourceSets.main.resources.getSrcDirs().first().getPath()+"/jmeter.properties",
|
2017-11-02 14:58:47 +00:00
|
|
|
"-d", sourceSets.main.resources.getSrcDirs().first().getPath() ]
|
2017-11-15 13:30:56 +00:00
|
|
|
if ( project.hasProperty("jmeterArgs") ) {
|
2017-12-14 17:01:57 +00:00
|
|
|
args+= Eval.me(jmeterArgs)
|
2017-11-15 13:30:56 +00:00
|
|
|
}
|
2017-11-23 10:06:39 +00:00
|
|
|
if ( project.hasProperty("sshUser") ){
|
|
|
|
args+= "-XsshUser"
|
|
|
|
args+= Eval.me(sshUser)
|
|
|
|
}
|
2017-11-10 11:40:12 +00:00
|
|
|
if ( project.hasProperty("jmeterHosts") ) {
|
|
|
|
args+= "-Xssh"
|
|
|
|
args+= Eval.me(jmeterHosts)
|
|
|
|
}
|
2017-10-31 17:22:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
jar {
|
|
|
|
manifest {
|
|
|
|
attributes(
|
2017-11-02 11:44:27 +00:00
|
|
|
'Automatic-Module-Name': 'net.corda.tools.jmeter',
|
|
|
|
'Main-Class': mainClassName
|
2017-10-31 17:22:58 +00:00
|
|
|
)
|
|
|
|
}
|
2017-11-02 11:44:27 +00:00
|
|
|
zip64 = true
|
2017-11-02 14:58:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// For building a runnable jar with no other dependencies for remote JMeter slave server, that has Corda code on classpath.
|
2017-11-15 13:30:56 +00:00
|
|
|
// Run with: java -jar jmeter-corda-<version>.jar
|
2017-11-02 14:58:47 +00:00
|
|
|
// No additional args required but will be passed if specified.
|
|
|
|
task buildJMeterJAR(type: FatCapsule, dependsOn: 'jar') {
|
2017-11-14 13:48:35 +00:00
|
|
|
applicationClass 'com.r3.corda.jmeter.Launcher'
|
2017-11-10 09:56:25 +00:00
|
|
|
archiveName "jmeter-corda-${corda_release_version}.jar"
|
2017-11-02 14:58:47 +00:00
|
|
|
applicationSource = files(
|
|
|
|
project(':tools:jmeter').jar
|
|
|
|
)
|
|
|
|
from 'NOTICE' // Copy CDDL notice
|
2017-11-10 08:33:55 +00:00
|
|
|
from("$rootDir/tools/jmeter/build/resources/main") {
|
|
|
|
include "log4j2.xml"
|
|
|
|
include "*.properties"
|
|
|
|
}
|
2017-11-02 14:58:47 +00:00
|
|
|
|
|
|
|
capsuleManifest {
|
|
|
|
applicationVersion = corda_release_version
|
2017-11-10 08:33:55 +00:00
|
|
|
systemProperties['java.rmi.server.hostname'] = 'localhost'
|
2017-11-02 14:58:47 +00:00
|
|
|
minJavaVersion = '1.8.0'
|
|
|
|
minUpdateVersion['1.8'] = java8_minUpdateVersion
|
|
|
|
|
|
|
|
// JVM configuration. Can be overridden on java command line.
|
|
|
|
jvmArgs = ['-Xms512m', '-Xmx512m', '-XX:+UseG1GC']
|
|
|
|
}
|
|
|
|
}
|