mirror of
https://github.com/corda/corda.git
synced 2025-02-11 21:26:23 +00:00
Fix tests
This commit is contained in:
parent
5168c38740
commit
c263b75894
@ -5,6 +5,7 @@ import net.corda.core.flows.FlowLogic
|
||||
import net.corda.core.flows.FlowSession
|
||||
import net.corda.core.flows.InitiatingFlow
|
||||
import net.corda.core.identity.Party
|
||||
import net.corda.core.internal.PLATFORM_VERSION
|
||||
import net.corda.core.utilities.getOrThrow
|
||||
import net.corda.core.utilities.unwrap
|
||||
import net.corda.node.internal.NodeFlowManager
|
||||
@ -20,13 +21,15 @@ class FlowVersioningTest : NodeBasedTest() {
|
||||
@Test(timeout=300_000)
|
||||
fun `getFlowContext returns the platform version for core flows`() {
|
||||
val bobFlowManager = NodeFlowManager()
|
||||
val alice = startNode(ALICE_NAME, platformVersion = 2)
|
||||
val bob = startNode(BOB_NAME, platformVersion = 3, flowManager = bobFlowManager)
|
||||
val alicePlatformVersion = PLATFORM_VERSION
|
||||
val bobPlatformVersion = PLATFORM_VERSION + 1
|
||||
val alice = startNode(ALICE_NAME, platformVersion = alicePlatformVersion)
|
||||
val bob = startNode(BOB_NAME, platformVersion = bobPlatformVersion, flowManager = bobFlowManager)
|
||||
bobFlowManager.registerInitiatedCoreFlowFactory(PretendInitiatingCoreFlow::class, ::PretendInitiatedCoreFlow)
|
||||
val (alicePlatformVersionAccordingToBob, bobPlatformVersionAccordingToAlice) = alice.services.startFlow(
|
||||
PretendInitiatingCoreFlow(bob.info.singleIdentity())).resultFuture.getOrThrow()
|
||||
assertThat(alicePlatformVersionAccordingToBob).isEqualTo(2)
|
||||
assertThat(bobPlatformVersionAccordingToAlice).isEqualTo(3)
|
||||
assertThat(alicePlatformVersionAccordingToBob).isEqualTo(alicePlatformVersion)
|
||||
assertThat(bobPlatformVersionAccordingToAlice).isEqualTo(bobPlatformVersion)
|
||||
}
|
||||
|
||||
@InitiatingFlow
|
||||
|
@ -5,6 +5,7 @@ import net.corda.core.crypto.SecureHash
|
||||
import net.corda.core.identity.CordaX500Name
|
||||
import net.corda.core.internal.NamedCacheFactory
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.node.services.statemachine.MessageType
|
||||
import net.corda.node.services.statemachine.SessionId
|
||||
import net.corda.node.utilities.AppendOnlyPersistentMap
|
||||
import net.corda.nodeapi.internal.persistence.CordaPersistence
|
||||
@ -72,7 +73,7 @@ class P2PMessageDeduplicator(cacheFactory: NamedCacheFactory, private val databa
|
||||
* @return true if we have seen this message before.
|
||||
*/
|
||||
fun isDuplicateSessionInit(msg: ReceivedMessage): Boolean {
|
||||
require(msg.isSessionInit) { "Message ${msg.uniqueMessageId} was not a session-init message." }
|
||||
require(msg.uniqueMessageId.messageType == MessageType.SESSION_INIT) { "Message ${msg.uniqueMessageId} was not a session-init message." }
|
||||
|
||||
if (beingProcessedMessages.containsKey(msg.uniqueMessageId)) {
|
||||
return true
|
||||
|
Loading…
x
Reference in New Issue
Block a user