Merge pull request #624 from corda/merges/drainingmode-integration-tests-27-03-2018

This commit is contained in:
szymonsztuka 2018-03-27 16:57:39 +01:00 committed by GitHub
commit a86178c8a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 13 deletions

View File

@ -40,10 +40,10 @@ object MessageSchemaV1 : MappedSchema(
@Entity @Entity
@Table(name = "messages") @Table(name = "messages")
class PersistentMessage( class PersistentMessage(
@Column(name = "by") @Column(name = "message_by")
var by: String, var by: String,
@Column(name = "value") @Column(name = "message_value")
var value: String var value: String
) : PersistentState() ) : PersistentState()
} }

View File

@ -25,6 +25,8 @@ import net.corda.core.transactions.TransactionBuilder
import net.corda.core.utilities.getOrThrow import net.corda.core.utilities.getOrThrow
import net.corda.core.utilities.unwrap import net.corda.core.utilities.unwrap
import net.corda.node.services.Permissions.Companion.all import net.corda.node.services.Permissions.Companion.all
import net.corda.testing.core.ALICE_NAME
import net.corda.testing.core.BOB_NAME
import net.corda.testing.core.singleIdentity import net.corda.testing.core.singleIdentity
import net.corda.testing.driver.DriverParameters import net.corda.testing.driver.DriverParameters
import net.corda.testing.driver.PortAllocation import net.corda.testing.driver.PortAllocation
@ -62,8 +64,8 @@ class FlowsDrainingModeContentionTest {
driver(DriverParameters(isDebug = true, startNodesInProcess = true, portAllocation = portAllocation, extraCordappPackagesToScan = listOf(MessageState::class.packageName))) { driver(DriverParameters(isDebug = true, startNodesInProcess = true, portAllocation = portAllocation, extraCordappPackagesToScan = listOf(MessageState::class.packageName))) {
val nodeA = startNode(rpcUsers = users).getOrThrow() val nodeA = startNode(providedName = ALICE_NAME, rpcUsers = users).getOrThrow()
val nodeB = startNode(rpcUsers = users).getOrThrow() val nodeB = startNode(providedName = BOB_NAME, rpcUsers = users).getOrThrow()
defaultNotaryNode.getOrThrow() defaultNotaryNode.getOrThrow()
val nodeARpcInfo = RpcInfo(nodeA.rpcAddress, user.username, user.password) val nodeARpcInfo = RpcInfo(nodeA.rpcAddress, user.username, user.password)

View File

@ -11,12 +11,8 @@
package net.corda.node.modes.draining package net.corda.node.modes.draining
import co.paralleluniverse.fibers.Suspendable import co.paralleluniverse.fibers.Suspendable
import net.corda.core.flows.FlowLogic
import net.corda.core.flows.FlowSession
import net.corda.core.flows.InitiatedBy
import net.corda.core.flows.InitiatingFlow
import net.corda.core.flows.StartableByRPC
import net.corda.client.rpc.internal.drainAndShutdown import net.corda.client.rpc.internal.drainAndShutdown
import net.corda.core.flows.*
import net.corda.core.identity.Party import net.corda.core.identity.Party
import net.corda.core.internal.concurrent.map import net.corda.core.internal.concurrent.map
import net.corda.core.messaging.startFlow import net.corda.core.messaging.startFlow
@ -73,9 +69,10 @@ class P2PFlowsDrainingModeTest : IntegrationTest() {
@Test @Test
fun `flows draining mode suspends consumption of initial session messages`() { fun `flows draining mode suspends consumption of initial session messages`() {
driver(DriverParameters(isDebug = true, startNodesInProcess = true, portAllocation = portAllocation)) { driver(DriverParameters(isDebug = true, startNodesInProcess = false, portAllocation = portAllocation)) {
val initiatedNode = startNode(providedName = ALICE_NAME).getOrThrow() val initiatedNode = startNode(providedName = ALICE_NAME).getOrThrow()
val initiating = startNode(rpcUsers = users, providedName = BOB_NAME).getOrThrow().rpc val initiating = startNode(providedName = BOB_NAME, rpcUsers = users).getOrThrow().rpc
val counterParty = initiatedNode.nodeInfo.singleIdentity() val counterParty = initiatedNode.nodeInfo.singleIdentity()
val initiated = initiatedNode.rpc val initiated = initiatedNode.rpc
@ -106,8 +103,8 @@ class P2PFlowsDrainingModeTest : IntegrationTest() {
driver(DriverParameters(isDebug = true, startNodesInProcess = true, portAllocation = portAllocation)) { driver(DriverParameters(isDebug = true, startNodesInProcess = true, portAllocation = portAllocation)) {
val nodeA = startNode(rpcUsers = users).getOrThrow() val nodeA = startNode(providedName = ALICE_NAME, rpcUsers = users).getOrThrow()
val nodeB = startNode(rpcUsers = users).getOrThrow() val nodeB = startNode(providedName = BOB_NAME, rpcUsers = users).getOrThrow()
var successful = false var successful = false
val latch = CountDownLatch(1) val latch = CountDownLatch(1)
nodeB.rpc.setFlowsDrainingModeEnabled(true) nodeB.rpc.setFlowsDrainingModeEnabled(true)