mirror of
https://github.com/corda/corda.git
synced 2024-12-28 00:38:55 +00:00
Fix and re-enable perftest cordapp unit test for two party trade flow (#82)
This commit is contained in:
parent
ef7ccd3147
commit
fe5b683c1a
@ -81,13 +81,12 @@ internal fun CheckpointStorage.checkpoints(): List<Checkpoint> {
|
|||||||
*
|
*
|
||||||
* We assume that Alice and Bob already found each other via some market, and have agreed the details already.
|
* We assume that Alice and Bob already found each other via some market, and have agreed the details already.
|
||||||
*/
|
*/
|
||||||
@Ignore
|
|
||||||
@RunWith(Parameterized::class)
|
@RunWith(Parameterized::class)
|
||||||
class TwoPartyTradeFlowTests(val anonymous: Boolean) {
|
class TwoPartyTradeFlowTests(val anonymous: Boolean) {
|
||||||
companion object {
|
companion object {
|
||||||
private val cordappPackages = listOf("com.r3.corda.enterprise.perftestcordapp.contracts")
|
private val cordappPackages = listOf("com.r3.corda.enterprise.perftestcordapp.contracts")
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@Parameterized.Parameters
|
@Parameterized.Parameters(name = "Anonymous = {0}")
|
||||||
fun data(): Collection<Boolean> {
|
fun data(): Collection<Boolean> {
|
||||||
return listOf(true, false)
|
return listOf(true, false)
|
||||||
}
|
}
|
||||||
@ -111,7 +110,7 @@ class TwoPartyTradeFlowTests(val anonymous: Boolean) {
|
|||||||
// We run this in parallel threads to help catch any race conditions that may exist. The other tests
|
// We run this in parallel threads to help catch any race conditions that may exist. The other tests
|
||||||
// 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(networkSendManuallyPumped = true, cordappPackages = cordappPackages)
|
mockNet = MockNetwork(threadPerNode = true, cordappPackages = cordappPackages)
|
||||||
ledger(MockServices(cordappPackages), initialiseSerialization = false) {
|
ledger(MockServices(cordappPackages), initialiseSerialization = false) {
|
||||||
val notaryNode = mockNet.createNotaryNode()
|
val notaryNode = mockNet.createNotaryNode()
|
||||||
val aliceNode = mockNet.createPartyNode(ALICE_NAME)
|
val aliceNode = mockNet.createPartyNode(ALICE_NAME)
|
||||||
@ -161,7 +160,7 @@ class TwoPartyTradeFlowTests(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(networkSendManuallyPumped = true, cordappPackages = cordappPackages)
|
mockNet = MockNetwork(threadPerNode = true, cordappPackages = cordappPackages)
|
||||||
ledger(MockServices(cordappPackages), initialiseSerialization = false) {
|
ledger(MockServices(cordappPackages), initialiseSerialization = false) {
|
||||||
val notaryNode = mockNet.createNotaryNode()
|
val notaryNode = mockNet.createNotaryNode()
|
||||||
val aliceNode = mockNet.createPartyNode(ALICE_NAME)
|
val aliceNode = mockNet.createPartyNode(ALICE_NAME)
|
||||||
@ -226,6 +225,7 @@ class TwoPartyTradeFlowTests(val anonymous: Boolean) {
|
|||||||
aliceNode.internals.disableDBCloseOnStop()
|
aliceNode.internals.disableDBCloseOnStop()
|
||||||
bobNode.internals.disableDBCloseOnStop()
|
bobNode.internals.disableDBCloseOnStop()
|
||||||
|
|
||||||
|
val bobAddr = bobNode.network.myAddress as InMemoryMessagingNetwork.PeerHandle
|
||||||
mockNet.runNetwork() // Clear network map registration messages
|
mockNet.runNetwork() // Clear network map registration messages
|
||||||
|
|
||||||
val notary = notaryNode.services.getDefaultNotary()
|
val notary = notaryNode.services.getDefaultNotary()
|
||||||
@ -279,12 +279,7 @@ class TwoPartyTradeFlowTests(val anonymous: Boolean) {
|
|||||||
|
|
||||||
// ... bring the node back up ... the act of constructing the SMM will re-register the message handlers
|
// ... bring the node back up ... the act of constructing the SMM will re-register the message handlers
|
||||||
// that Bob was waiting on before the reboot occurred.
|
// that Bob was waiting on before the reboot occurred.
|
||||||
bobNode = mockNet.createNode(MockNodeParameters(legalName = BOB_NAME), nodeFactory = object : MockNetwork.Factory<MockNetwork.MockNode> {
|
bobNode = mockNet.createNode(MockNodeParameters(bobAddr.id, BOB_NAME))
|
||||||
override fun create(args: MockNodeArgs): MockNetwork.MockNode {
|
|
||||||
return MockNetwork.MockNode(args)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// Find the future representing the result of this state machine again.
|
// Find the future representing the result of this state machine again.
|
||||||
val bobFuture = bobNode.smm.findStateMachines(BuyerAcceptor::class.java).single().second
|
val bobFuture = bobNode.smm.findStateMachines(BuyerAcceptor::class.java).single().second
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user