Remote JMeter working from single JAR.

This commit is contained in:
rick.parker 2017-11-02 11:44:27 +00:00
parent ce184b6603
commit 6b0291d420
3 changed files with 27 additions and 21 deletions

View File

@ -1,7 +1,5 @@
apply plugin: 'kotlin'
apply plugin: 'application'
//apply plugin: 'net.corda.plugins.cordapp'
//apply plugin: 'net.corda.plugins.cordformation'
mainClassName = 'net.corda.jmeter.Launcher'
@ -29,17 +27,21 @@ dependencies {
runtime group: 'org.apache.jmeter', name: 'ApacheJMeter', version: "$jmVersion"
runtime group: 'org.apache.jmeter', name: 'jorphan', version: "$jmVersion"
compile project(":test-utils")
//compile project(":test-utils")
compile project(":finance")
//cordapp project(':finance')
//cordapp project(':samples:bank-of-corda-demo')
}
//jmeter {
// testFileDir = file("src/main/resources/jmeter")
//}
task(runServer, dependsOn: 'classes', type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = 'net.corda.jmeter.Launcher'
systemProperty "search_paths", project(':tools:jmeter').configurations.runtime.files.join(";")
systemProperty "java.rmi.server.hostname", InetAddress.getLocalHost().getHostName()
//jvmArgs += "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"
args+= [ "-p", sourceSets.main.resources.getSrcDirs().first().getPath()+"/jmeter.properties",
"-d", sourceSets.main.resources.getSrcDirs().first().getPath(),
"-j", buildDir.getPath()+"/jmeter.log",
"-s" ]
}
run {
systemProperty "search_paths", project(':tools:jmeter').configurations.runtime.files.join(";")
@ -50,9 +52,16 @@ run {
}
jar {
from(configurations.runtime.collect { it.isDirectory() ? it : zipTree(it) }) {
exclude "META-INF/*.SF"
exclude "META-INF/*.DSA"
exclude "META-INF/*.RSA"
}
manifest {
attributes(
'Automatic-Module-Name': 'net.corda.tools.jmeter'
'Automatic-Module-Name': 'net.corda.tools.jmeter',
'Main-Class': mainClassName
)
}
zip64 = true
}

View File

@ -1,18 +1,13 @@
package net.corda.jmeter
import net.corda.core.identity.CordaX500Name
import net.corda.core.identity.Party
import net.corda.core.messaging.CordaRPCOps
import net.corda.core.messaging.startFlow
import net.corda.core.utilities.OpaqueBytes
import net.corda.core.utilities.getOrThrow
import net.corda.finance.DOLLARS
import net.corda.finance.flows.CashIssueFlow
import net.corda.jmeter.CordaRPCSampler.FlowInvoke
import net.corda.testing.DUMMY_BANK_A
import net.corda.testing.DUMMY_BANK_B
import net.corda.testing.contracts.calculateRandomlySizedAmounts
import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext
import java.util.*
abstract class AsbtractTraderDemoPlugin : CordaRPCSampler.Plugin {
@ -21,12 +16,14 @@ abstract class AsbtractTraderDemoPlugin : CordaRPCSampler.Plugin {
lateinit var seller: Party
lateinit var notary: Party
val bankA = CordaX500Name(organisation = "Bank A", locality = "London", country = "GB")
val bankB = CordaX500Name(organisation = "Bank B", locality = "New York", country = "US")
protected fun getIdentities(rpc: CordaRPCOps) {
buyer = rpc.wellKnownPartyFromX500Name(DUMMY_BANK_A.name) ?: throw IllegalStateException("Don't know ${DUMMY_BANK_A.name}")
seller = rpc.wellKnownPartyFromX500Name(DUMMY_BANK_B.name) ?: throw IllegalStateException("Don't know ${DUMMY_BANK_B.name}")
buyer = rpc.wellKnownPartyFromX500Name(bankA) ?: throw IllegalStateException("Don't know $bankA")
seller = rpc.wellKnownPartyFromX500Name(bankB) ?: throw IllegalStateException("Don't know $bankB")
notary = rpc.notaryIdentities().first()
}
}
class CashIssuerPlugin : AsbtractTraderDemoPlugin() {

View File

@ -695,7 +695,7 @@ wmlParser.types=text/vnd.wap.wml
# default queue size
#asynch.batch.queue.size=100
# Same as Asynch but strips response data from SampleResult
#mode=StrippedAsynch
mode=StrippedAsynch
#
# DiskStore: as for Hold mode, but serialises the samples to disk, rather than saving in memory
#mode=DiskStore