Re-enable perftestcordapp and jmeter - fix compilation errors caused by MockServices and DriverDSL refactoring.

This commit is contained in:
josecoll 2017-12-11 11:42:53 +00:00
parent da4d64048f
commit d984b4722e
8 changed files with 22 additions and 13 deletions

View File

@ -210,8 +210,8 @@ class CommercialPaperTestsGeneric {
private lateinit var aliceVaultService: VaultService private lateinit var aliceVaultService: VaultService
private lateinit var alicesVault: Vault<ContractState> private lateinit var alicesVault: Vault<ContractState>
private val notaryServices = MockServices(DUMMY_NOTARY_KEY) private val notaryServices = MockServices(rigorousMock(), MEGA_CORP.name, DUMMY_NOTARY_KEY)
private val issuerServices = MockServices(DUMMY_CASH_ISSUER_KEY) private val issuerServices = MockServices(rigorousMock(), MEGA_CORP.name, DUMMY_CASH_ISSUER_KEY)
private lateinit var moveTX: SignedTransaction private lateinit var moveTX: SignedTransaction

View File

@ -104,7 +104,7 @@ class CashTests {
@Before @Before
fun setUp() = withTestSerialization { fun setUp() = withTestSerialization {
LogHelper.setLevel(NodeVaultService::class) LogHelper.setLevel(NodeVaultService::class)
megaCorpServices = MockServices(listOf("com.r3.corda.enterprise.perftestcordapp.contracts.asset","com.r3.corda.enterprise.perftestcordapp.schemas"), MEGA_CORP.name, MEGA_CORP_KEY) megaCorpServices = MockServices(listOf("com.r3.corda.enterprise.perftestcordapp.contracts.asset","com.r3.corda.enterprise.perftestcordapp.schemas"), rigorousMock(), MEGA_CORP.name, MEGA_CORP_KEY)
val databaseAndServices = makeTestDatabaseAndMockServices( val databaseAndServices = makeTestDatabaseAndMockServices(
listOf(MINI_CORP_KEY, MEGA_CORP_KEY, OUR_KEY), listOf(MINI_CORP_KEY, MEGA_CORP_KEY, OUR_KEY),
makeTestIdentityService(listOf(MEGA_CORP_IDENTITY, MINI_CORP_IDENTITY, DUMMY_CASH_ISSUER_IDENTITY, DUMMY_NOTARY_IDENTITY)), makeTestIdentityService(listOf(MEGA_CORP_IDENTITY, MINI_CORP_IDENTITY, DUMMY_CASH_ISSUER_IDENTITY, DUMMY_NOTARY_IDENTITY)),
@ -844,7 +844,7 @@ class CashTests {
// Double spend. // Double spend.
@Test @Test
fun chainCashDoubleSpendFailsWith() = withTestSerialization { fun chainCashDoubleSpendFailsWith() = withTestSerialization {
val mockService = MockServices(listOf("com.r3.corda.enterprise.perftestcordapp.contracts.asset"), MEGA_CORP.name, MEGA_CORP_KEY) val mockService = MockServices(listOf("com.r3.corda.enterprise.perftestcordapp.contracts.asset"), rigorousMock(), MEGA_CORP.name, MEGA_CORP_KEY)
ledger(mockService) { ledger(mockService) {
unverifiedTransaction { unverifiedTransaction {

View File

@ -39,6 +39,7 @@ import net.corda.core.utilities.toNonEmptySet
import net.corda.core.utilities.unwrap import net.corda.core.utilities.unwrap
import net.corda.node.internal.StartedNode import net.corda.node.internal.StartedNode
import net.corda.node.services.api.CheckpointStorage import net.corda.node.services.api.CheckpointStorage
import net.corda.node.services.api.IdentityServiceInternal
import net.corda.node.services.api.WritableTransactionStorage import net.corda.node.services.api.WritableTransactionStorage
import net.corda.node.services.persistence.DBTransactionStorage import net.corda.node.services.persistence.DBTransactionStorage
import net.corda.node.services.statemachine.Checkpoint import net.corda.node.services.statemachine.Checkpoint
@ -101,7 +102,8 @@ class TwoPartyTradeFlowTests(private val anonymous: Boolean) {
// we run in the unit test thread exclusively to speed things up, ensure deterministic results and // we run in the unit test thread exclusively to speed things up, ensure deterministic results and
// allow interruption half way through. // allow interruption half way through.
mockNet = MockNetwork(threadPerNode = true, cordappPackages = cordappPackages) mockNet = MockNetwork(threadPerNode = true, cordappPackages = cordappPackages)
ledger(MockServices(cordappPackages)) { val ledgerIdentityService = rigorousMock<IdentityServiceInternal>()
ledger(MockServices(cordappPackages, ledgerIdentityService, MEGA_CORP.name)) {
val notaryNode = mockNet.defaultNotaryNode val notaryNode = mockNet.defaultNotaryNode
val aliceNode = mockNet.createPartyNode(ALICE_NAME) val aliceNode = mockNet.createPartyNode(ALICE_NAME)
val bobNode = mockNet.createPartyNode(BOB_NAME) val bobNode = mockNet.createPartyNode(BOB_NAME)
@ -152,7 +154,8 @@ class TwoPartyTradeFlowTests(private val anonymous: Boolean) {
@Test(expected = InsufficientBalanceException::class) @Test(expected = InsufficientBalanceException::class)
fun `trade cash for commercial paper fails using soft locking`() { fun `trade cash for commercial paper fails using soft locking`() {
mockNet = MockNetwork(threadPerNode = true, cordappPackages = cordappPackages) mockNet = MockNetwork(threadPerNode = true, cordappPackages = cordappPackages)
ledger(MockServices(cordappPackages)) { val ledgerIdentityService = rigorousMock<IdentityServiceInternal>()
ledger(MockServices(cordappPackages, ledgerIdentityService, MEGA_CORP.name)) {
val notaryNode = mockNet.defaultNotaryNode val notaryNode = mockNet.defaultNotaryNode
val aliceNode = mockNet.createPartyNode(ALICE_NAME) val aliceNode = mockNet.createPartyNode(ALICE_NAME)
val bobNode = mockNet.createPartyNode(BOB_NAME) val bobNode = mockNet.createPartyNode(BOB_NAME)
@ -209,7 +212,8 @@ class TwoPartyTradeFlowTests(private val anonymous: Boolean) {
@Test @Test
fun `shutdown and restore`() { fun `shutdown and restore`() {
mockNet = MockNetwork(cordappPackages = cordappPackages) mockNet = MockNetwork(cordappPackages = cordappPackages)
ledger(MockServices(cordappPackages)) { val ledgerIdentityService = rigorousMock<IdentityServiceInternal>()
ledger(MockServices(cordappPackages, ledgerIdentityService, MEGA_CORP.name)) {
val notaryNode = mockNet.defaultNotaryNode val notaryNode = mockNet.defaultNotaryNode
val aliceNode = mockNet.createPartyNode(ALICE_NAME) val aliceNode = mockNet.createPartyNode(ALICE_NAME)
var bobNode = mockNet.createPartyNode(BOB_NAME) var bobNode = mockNet.createPartyNode(BOB_NAME)
@ -505,7 +509,8 @@ class TwoPartyTradeFlowTests(private val anonymous: Boolean) {
@Test @Test
fun `dependency with error on buyer side`() { fun `dependency with error on buyer side`() {
mockNet = MockNetwork(cordappPackages = cordappPackages) mockNet = MockNetwork(cordappPackages = cordappPackages)
ledger(MockServices(cordappPackages)) { val ledgerIdentityService = rigorousMock<IdentityServiceInternal>()
ledger(MockServices(cordappPackages, ledgerIdentityService, MEGA_CORP.name)) {
runWithError(true, false, "at least one cash input") runWithError(true, false, "at least one cash input")
} }
} }
@ -513,7 +518,8 @@ class TwoPartyTradeFlowTests(private val anonymous: Boolean) {
@Test @Test
fun `dependency with error on seller side`() { fun `dependency with error on seller side`() {
mockNet = MockNetwork(cordappPackages = cordappPackages) mockNet = MockNetwork(cordappPackages = cordappPackages)
ledger(MockServices(cordappPackages)) { val ledgerIdentityService = rigorousMock<IdentityServiceInternal>()
ledger(MockServices(cordappPackages, ledgerIdentityService, MEGA_CORP.name)) {
runWithError(false, true, "Issuances have a time-window") runWithError(false, true, "Issuances have a time-window")
} }
} }

View File

@ -23,7 +23,7 @@ fun <A> springDriver(
driverDirectory: Path = defaultParameters.driverDirectory, driverDirectory: Path = defaultParameters.driverDirectory,
portAllocation: PortAllocation = defaultParameters.portAllocation, portAllocation: PortAllocation = defaultParameters.portAllocation,
debugPortAllocation: PortAllocation = defaultParameters.debugPortAllocation, debugPortAllocation: PortAllocation = defaultParameters.debugPortAllocation,
systemProperties: Map<String, String> = defaultParameters.extraSystemProperties, systemProperties: Map<String, String> = defaultParameters.systemProperties,
useTestClock: Boolean = defaultParameters.useTestClock, useTestClock: Boolean = defaultParameters.useTestClock,
initialiseSerialization: Boolean = defaultParameters.initialiseSerialization, initialiseSerialization: Boolean = defaultParameters.initialiseSerialization,
startNodesInProcess: Boolean = defaultParameters.startNodesInProcess, startNodesInProcess: Boolean = defaultParameters.startNodesInProcess,

View File

@ -35,6 +35,7 @@ include 'tools:explorer:capsule'
include 'tools:demobench' include 'tools:demobench'
include 'tools:loadtest' include 'tools:loadtest'
include 'tools:graphs' include 'tools:graphs'
include 'tools:jmeter'
include 'example-code' include 'example-code'
project(':example-code').projectDir = file("$settingsDir/docs/source/example-code") project(':example-code').projectDir = file("$settingsDir/docs/source/example-code")
include 'samples:attachment-demo' include 'samples:attachment-demo'
@ -57,4 +58,5 @@ project(':hsm-tool').with {
name = 'sgx-hsm-tool' name = 'sgx-hsm-tool'
projectDir = file("$settingsDir/sgx-jvm/hsm-tool") projectDir = file("$settingsDir/sgx-jvm/hsm-tool")
} }
include 'perftestcordapp'

View File

@ -64,7 +64,7 @@ class DriverTests : IntegrationTest() {
// Make sure we're using the log4j2 config which writes to the log file // Make sure we're using the log4j2 config which writes to the log file
val logConfigFile = projectRootDir / "config" / "dev" / "log4j2.xml" val logConfigFile = projectRootDir / "config" / "dev" / "log4j2.xml"
assertThat(logConfigFile).isRegularFile() assertThat(logConfigFile).isRegularFile()
driver(isDebug = true, extraSystemProperties = mapOf("log4j.configurationFile" to logConfigFile.toString())) { driver(isDebug = true, systemProperties = mapOf("log4j.configurationFile" to logConfigFile.toString())) {
val baseDirectory = startNode(providedName = DUMMY_BANK_A.name).getOrThrow().configuration.baseDirectory val baseDirectory = startNode(providedName = DUMMY_BANK_A.name).getOrThrow().configuration.baseDirectory
val logFile = (baseDirectory / NodeStartup.LOGS_DIRECTORY_NAME).list { it.sorted().findFirst().get() } val logFile = (baseDirectory / NodeStartup.LOGS_DIRECTORY_NAME).list { it.sorted().findFirst().get() }
val debugLinesPresent = logFile.readLines { lines -> lines.anyMatch { line -> line.startsWith("[DEBUG]") } } val debugLinesPresent = logFile.readLines { lines -> lines.anyMatch { line -> line.startsWith("[DEBUG]") } }

View File

@ -6,6 +6,7 @@ mainClassName = 'com.r3.corda.jmeter.Launcher'
dependencies { dependencies {
compile project(':client:rpc') compile project(':client:rpc')
compile project(':perftestcordapp')
// https://mvnrepository.com/artifact/com.jcraft/jsch // https://mvnrepository.com/artifact/com.jcraft/jsch
compile group: 'com.jcraft', name: 'jsch', version: '0.1.54' compile group: 'com.jcraft', name: 'jsch', version: '0.1.54'

View File

@ -54,7 +54,7 @@ fun <A> verifierDriver(
driverDirectory: Path = Paths.get("build", getTimestampAsDirectoryName()), driverDirectory: Path = Paths.get("build", getTimestampAsDirectoryName()),
portAllocation: PortAllocation = PortAllocation.Incremental(10000), portAllocation: PortAllocation = PortAllocation.Incremental(10000),
debugPortAllocation: PortAllocation = PortAllocation.Incremental(5005), debugPortAllocation: PortAllocation = PortAllocation.Incremental(5005),
extraSystemProperties: Map<String, String> = emptyMap(), systemProperties: Map<String, String> = emptyMap(),
useTestClock: Boolean = false, useTestClock: Boolean = false,
startNodesInProcess: Boolean = false, startNodesInProcess: Boolean = false,
waitForNodesToFinish: Boolean = false, waitForNodesToFinish: Boolean = false,
@ -67,7 +67,7 @@ fun <A> verifierDriver(
DriverDSLImpl( DriverDSLImpl(
portAllocation = portAllocation, portAllocation = portAllocation,
debugPortAllocation = debugPortAllocation, debugPortAllocation = debugPortAllocation,
extraSystemProperties = extraSystemProperties, systemProperties = systemProperties,
driverDirectory = driverDirectory.toAbsolutePath(), driverDirectory = driverDirectory.toAbsolutePath(),
useTestClock = useTestClock, useTestClock = useTestClock,
isDebug = isDebug, isDebug = isDebug,