Merge remote-tracking branch 'remotes/opensource/master' into merges/drainingmode-integration-tests-27-03-2018

# Conflicts:
#	node/src/integration-test/kotlin/net/corda/node/modes/draining/P2PFlowsDrainingModeTest.kt
This commit is contained in:
szymonsztuka 2018-03-27 14:11:36 +01:00
commit 097233478a
3 changed files with 15 additions and 14 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
@ -24,7 +20,9 @@ import net.corda.core.utilities.getOrThrow
import net.corda.core.utilities.loggerFor import net.corda.core.utilities.loggerFor
import net.corda.core.utilities.unwrap import net.corda.core.utilities.unwrap
import net.corda.node.services.Permissions import net.corda.node.services.Permissions
import net.corda.testing.core.* import net.corda.testing.core.ALICE_NAME
import net.corda.testing.core.BOB_NAME
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
import net.corda.testing.driver.driver import net.corda.testing.driver.driver
@ -73,9 +71,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 +105,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)