From 4bd6fef0f92a09084b80ca53206c9c915fd29731 Mon Sep 17 00:00:00 2001 From: Andrzej Cichocki Date: Mon, 27 Nov 2017 17:55:08 +0000 Subject: [PATCH] StateMachineManager is no longer lateinit. (#2123) --- .../confidential/IdentitySyncFlowTests.kt | 6 +-- .../net/corda/core/flows/FlowsInJavaTest.java | 2 +- .../net/corda/core/flows/AttachmentTests.kt | 18 +++------ .../core/flows/CollectSignaturesFlowTests.kt | 2 +- .../net/corda/core/flows/FlowTestsUtils.kt | 4 +- .../internal/ResolveTransactionsFlowTest.kt | 4 +- .../AttachmentSerializationTest.kt | 2 +- .../net/corda/docs/CustomVaultQueryTest.kt | 2 +- .../docs/FxTransactionBuildTutorialTest.kt | 2 +- .../WorkflowTransactionBuildTutorialTest.kt | 2 +- .../services/messaging/MQSecurityTest.kt | 2 +- .../net/corda/node/internal/AbstractNode.kt | 40 ++++++++----------- .../net/corda/node/internal/StartedNode.kt | 18 ++++++++- .../node/messaging/TwoPartyTradeFlowTests.kt | 2 +- .../statemachine/FlowFrameworkTests.kt | 2 +- .../vault/VaultSoftLockManagerTest.kt | 2 +- .../corda/irs/api/NodeInterestRatesTest.kt | 4 +- .../corda/netmap/simulation/IRSSimulation.kt | 10 ++--- .../net/corda/traderdemo/TraderDemoTest.kt | 3 +- .../corda/testing/FlowStackSnapshotTest.kt | 2 +- 20 files changed, 63 insertions(+), 66 deletions(-) diff --git a/confidential-identities/src/test/kotlin/net/corda/confidential/IdentitySyncFlowTests.kt b/confidential-identities/src/test/kotlin/net/corda/confidential/IdentitySyncFlowTests.kt index 7d05154ace..51b24e8bd1 100644 --- a/confidential-identities/src/test/kotlin/net/corda/confidential/IdentitySyncFlowTests.kt +++ b/confidential-identities/src/test/kotlin/net/corda/confidential/IdentitySyncFlowTests.kt @@ -49,8 +49,7 @@ class IdentitySyncFlowTests { val alice: Party = aliceNode.info.singleIdentity() val bob: Party = bobNode.info.singleIdentity() val notary = mockNet.defaultNotaryIdentity - bobNode.internals.registerInitiatedFlow(Receive::class.java) - + bobNode.registerInitiatedFlow(Receive::class.java) // Alice issues then pays some cash to a new confidential identity that Bob doesn't know about val anonymous = true val ref = OpaqueBytes.of(0x01) @@ -80,8 +79,7 @@ class IdentitySyncFlowTests { val bob: Party = bobNode.info.singleIdentity() val charlie: Party = charlieNode.info.singleIdentity() val notary = mockNet.defaultNotaryIdentity - bobNode.internals.registerInitiatedFlow(Receive::class.java) - + bobNode.registerInitiatedFlow(Receive::class.java) // Charlie issues then pays some cash to a new confidential identity val anonymous = true val ref = OpaqueBytes.of(0x01) diff --git a/core/src/test/java/net/corda/core/flows/FlowsInJavaTest.java b/core/src/test/java/net/corda/core/flows/FlowsInJavaTest.java index 27f15c91f6..1b69fc5a6c 100644 --- a/core/src/test/java/net/corda/core/flows/FlowsInJavaTest.java +++ b/core/src/test/java/net/corda/core/flows/FlowsInJavaTest.java @@ -38,7 +38,7 @@ public class FlowsInJavaTest { @Test public void suspendableActionInsideUnwrap() throws Exception { - bobNode.getInternals().registerInitiatedFlow(SendHelloAndThenReceive.class); + bobNode.registerInitiatedFlow(SendHelloAndThenReceive.class); Future result = startFlow(aliceNode.getServices(), new SendInUnwrapFlow(bob)).getResultFuture(); mockNet.runNetwork(); assertThat(result.get()).isEqualTo("Hello"); diff --git a/core/src/test/kotlin/net/corda/core/flows/AttachmentTests.kt b/core/src/test/kotlin/net/corda/core/flows/AttachmentTests.kt index 147e135d4f..890836e35b 100644 --- a/core/src/test/kotlin/net/corda/core/flows/AttachmentTests.kt +++ b/core/src/test/kotlin/net/corda/core/flows/AttachmentTests.kt @@ -52,10 +52,8 @@ class AttachmentTests { val bobNode = mockNet.createPartyNode(BOB.name) val alice = aliceNode.info.singleIdentity() - - aliceNode.internals.registerInitiatedFlow(FetchAttachmentsResponse::class.java) - bobNode.internals.registerInitiatedFlow(FetchAttachmentsResponse::class.java) - + aliceNode.registerInitiatedFlow(FetchAttachmentsResponse::class.java) + bobNode.registerInitiatedFlow(FetchAttachmentsResponse::class.java) // Insert an attachment into node zero's store directly. val id = aliceNode.database.transaction { aliceNode.attachments.importAttachment(ByteArrayInputStream(fakeAttachment())) @@ -85,10 +83,8 @@ class AttachmentTests { fun `missing`() { val aliceNode = mockNet.createPartyNode(ALICE.name) val bobNode = mockNet.createPartyNode(BOB.name) - - aliceNode.internals.registerInitiatedFlow(FetchAttachmentsResponse::class.java) - bobNode.internals.registerInitiatedFlow(FetchAttachmentsResponse::class.java) - + aliceNode.registerInitiatedFlow(FetchAttachmentsResponse::class.java) + bobNode.registerInitiatedFlow(FetchAttachmentsResponse::class.java) // Get node one to fetch a non-existent attachment. val hash = SecureHash.randomSHA256() val alice = aliceNode.info.singleIdentity() @@ -108,10 +104,8 @@ class AttachmentTests { }) val bobNode = mockNet.createNode(MockNodeParameters(legalName = BOB.name)) val alice = aliceNode.services.myInfo.identityFromX500Name(ALICE_NAME) - - aliceNode.internals.registerInitiatedFlow(FetchAttachmentsResponse::class.java) - bobNode.internals.registerInitiatedFlow(FetchAttachmentsResponse::class.java) - + aliceNode.registerInitiatedFlow(FetchAttachmentsResponse::class.java) + bobNode.registerInitiatedFlow(FetchAttachmentsResponse::class.java) val attachment = fakeAttachment() // Insert an attachment into node zero's store directly. val id = aliceNode.database.transaction { diff --git a/core/src/test/kotlin/net/corda/core/flows/CollectSignaturesFlowTests.kt b/core/src/test/kotlin/net/corda/core/flows/CollectSignaturesFlowTests.kt index 6ad19b2e28..0c2a00331b 100644 --- a/core/src/test/kotlin/net/corda/core/flows/CollectSignaturesFlowTests.kt +++ b/core/src/test/kotlin/net/corda/core/flows/CollectSignaturesFlowTests.kt @@ -50,7 +50,7 @@ class CollectSignaturesFlowTests { private fun registerFlowOnAllNodes(flowClass: KClass>) { listOf(aliceNode, bobNode, charlieNode).forEach { - it.internals.registerInitiatedFlow(flowClass.java) + it.registerInitiatedFlow(flowClass.java) } } diff --git a/core/src/test/kotlin/net/corda/core/flows/FlowTestsUtils.kt b/core/src/test/kotlin/net/corda/core/flows/FlowTestsUtils.kt index 6b6f0492b3..4d2d12335d 100644 --- a/core/src/test/kotlin/net/corda/core/flows/FlowTestsUtils.kt +++ b/core/src/test/kotlin/net/corda/core/flows/FlowTestsUtils.kt @@ -38,14 +38,14 @@ class NoAnswer(private val closure: () -> Unit = {}) : FlowLogic() { * Allows to register a flow of type [R] against an initiating flow of type [I]. */ inline fun , reified R : FlowLogic<*>> StartedNode<*>.registerInitiatedFlow(initiatingFlowType: KClass, crossinline construct: (session: FlowSession) -> R) { - internals.internalRegisterFlowFactory(initiatingFlowType.java, InitiatedFlowFactory.Core { session -> construct(session) }, R::class.javaObjectType, true) + internalRegisterFlowFactory(initiatingFlowType.java, InitiatedFlowFactory.Core { session -> construct(session) }, R::class.javaObjectType, true) } /** * Allows to register a flow of type [Answer] against an initiating flow of type [I], returning a valure of type [R]. */ inline fun , reified R : Any> StartedNode<*>.registerAnswer(initiatingFlowType: KClass, value: R) { - internals.internalRegisterFlowFactory(initiatingFlowType.java, InitiatedFlowFactory.Core { session -> Answer(session, value) }, Answer::class.javaObjectType, true) + internalRegisterFlowFactory(initiatingFlowType.java, InitiatedFlowFactory.Core { session -> Answer(session, value) }, Answer::class.javaObjectType, true) } /** diff --git a/core/src/test/kotlin/net/corda/core/internal/ResolveTransactionsFlowTest.kt b/core/src/test/kotlin/net/corda/core/internal/ResolveTransactionsFlowTest.kt index f71470b406..b56c5add9a 100644 --- a/core/src/test/kotlin/net/corda/core/internal/ResolveTransactionsFlowTest.kt +++ b/core/src/test/kotlin/net/corda/core/internal/ResolveTransactionsFlowTest.kt @@ -42,8 +42,8 @@ class ResolveTransactionsFlowTest { notaryNode = mockNet.defaultNotaryNode megaCorpNode = mockNet.createPartyNode(MEGA_CORP.name) miniCorpNode = mockNet.createPartyNode(MINI_CORP.name) - megaCorpNode.internals.registerInitiatedFlow(TestResponseFlow::class.java) - miniCorpNode.internals.registerInitiatedFlow(TestResponseFlow::class.java) + megaCorpNode.registerInitiatedFlow(TestResponseFlow::class.java) + miniCorpNode.registerInitiatedFlow(TestResponseFlow::class.java) notary = mockNet.defaultNotaryIdentity megaCorp = megaCorpNode.info.singleIdentity() miniCorp = miniCorpNode.info.singleIdentity() diff --git a/core/src/test/kotlin/net/corda/core/serialization/AttachmentSerializationTest.kt b/core/src/test/kotlin/net/corda/core/serialization/AttachmentSerializationTest.kt index b2d9b80816..1dd630a2ff 100644 --- a/core/src/test/kotlin/net/corda/core/serialization/AttachmentSerializationTest.kt +++ b/core/src/test/kotlin/net/corda/core/serialization/AttachmentSerializationTest.kt @@ -148,7 +148,7 @@ class AttachmentSerializationTest { } private fun launchFlow(clientLogic: ClientLogic, rounds: Int, sendData: Boolean = false) { - server.internals.internalRegisterFlowFactory( + server.internalRegisterFlowFactory( ClientLogic::class.java, InitiatedFlowFactory.Core { ServerLogic(it, sendData) }, ServerLogic::class.java, diff --git a/docs/source/example-code/src/test/kotlin/net/corda/docs/CustomVaultQueryTest.kt b/docs/source/example-code/src/test/kotlin/net/corda/docs/CustomVaultQueryTest.kt index 9c850288ed..ef2acb083b 100644 --- a/docs/source/example-code/src/test/kotlin/net/corda/docs/CustomVaultQueryTest.kt +++ b/docs/source/example-code/src/test/kotlin/net/corda/docs/CustomVaultQueryTest.kt @@ -28,7 +28,7 @@ class CustomVaultQueryTest { mockNet = MockNetwork(threadPerNode = true, cordappPackages = listOf("net.corda.finance", "net.corda.docs")) nodeA = mockNet.createPartyNode() nodeB = mockNet.createPartyNode() - nodeA.internals.registerInitiatedFlow(TopupIssuerFlow.TopupIssuer::class.java) + nodeA.registerInitiatedFlow(TopupIssuerFlow.TopupIssuer::class.java) notary = mockNet.defaultNotaryIdentity } diff --git a/docs/source/example-code/src/test/kotlin/net/corda/docs/FxTransactionBuildTutorialTest.kt b/docs/source/example-code/src/test/kotlin/net/corda/docs/FxTransactionBuildTutorialTest.kt index 7fa6292568..c53fe8e175 100644 --- a/docs/source/example-code/src/test/kotlin/net/corda/docs/FxTransactionBuildTutorialTest.kt +++ b/docs/source/example-code/src/test/kotlin/net/corda/docs/FxTransactionBuildTutorialTest.kt @@ -27,7 +27,7 @@ class FxTransactionBuildTutorialTest { mockNet = MockNetwork(threadPerNode = true, cordappPackages = listOf("net.corda.finance")) nodeA = mockNet.createPartyNode() nodeB = mockNet.createPartyNode() - nodeB.internals.registerInitiatedFlow(ForeignExchangeRemoteFlow::class.java) + nodeB.registerInitiatedFlow(ForeignExchangeRemoteFlow::class.java) notary = mockNet.defaultNotaryIdentity } diff --git a/docs/source/example-code/src/test/kotlin/net/corda/docs/WorkflowTransactionBuildTutorialTest.kt b/docs/source/example-code/src/test/kotlin/net/corda/docs/WorkflowTransactionBuildTutorialTest.kt index 45553176eb..d4fb476134 100644 --- a/docs/source/example-code/src/test/kotlin/net/corda/docs/WorkflowTransactionBuildTutorialTest.kt +++ b/docs/source/example-code/src/test/kotlin/net/corda/docs/WorkflowTransactionBuildTutorialTest.kt @@ -35,7 +35,7 @@ class WorkflowTransactionBuildTutorialTest { mockNet = MockNetwork(threadPerNode = true, cordappPackages = listOf("net.corda.docs")) val aliceNode = mockNet.createPartyNode(ALICE_NAME) val bobNode = mockNet.createPartyNode(BOB_NAME) - aliceNode.internals.registerInitiatedFlow(RecordCompletionFlow::class.java) + aliceNode.registerInitiatedFlow(RecordCompletionFlow::class.java) aliceServices = aliceNode.services bobServices = bobNode.services alice = aliceNode.services.myInfo.identityFromX500Name(ALICE_NAME) diff --git a/node/src/integration-test/kotlin/net/corda/services/messaging/MQSecurityTest.kt b/node/src/integration-test/kotlin/net/corda/services/messaging/MQSecurityTest.kt index 1ddeb4497f..ecaa0032a0 100644 --- a/node/src/integration-test/kotlin/net/corda/services/messaging/MQSecurityTest.kt +++ b/node/src/integration-test/kotlin/net/corda/services/messaging/MQSecurityTest.kt @@ -213,7 +213,7 @@ abstract class MQSecurityTest : NodeBasedTest() { private fun startBobAndCommunicateWithAlice(): Party { val bob = startNode(BOB.name) - bob.internals.registerInitiatedFlow(ReceiveFlow::class.java) + bob.registerInitiatedFlow(ReceiveFlow::class.java) val bobParty = bob.info.chooseIdentity() // Perform a protocol exchange to force the peer queue to be created alice.services.startFlow(SendFlow(bobParty, 0)).resultFuture.getOrThrow() diff --git a/node/src/main/kotlin/net/corda/node/internal/AbstractNode.kt b/node/src/main/kotlin/net/corda/node/internal/AbstractNode.kt index 16d0f09f05..12ecaf9f94 100644 --- a/node/src/main/kotlin/net/corda/node/internal/AbstractNode.kt +++ b/node/src/main/kotlin/net/corda/node/internal/AbstractNode.kt @@ -124,7 +124,6 @@ abstract class AbstractNode(val configuration: NodeConfiguration, private lateinit var _services: ServiceHubInternalImpl protected var myNotaryIdentity: PartyAndCertificate? = null protected lateinit var checkpointStorage: CheckpointStorage - protected lateinit var smm: StateMachineManager private lateinit var tokenizableServices: List protected lateinit var attachments: NodeAttachmentService protected lateinit var network: MessagingService @@ -153,7 +152,7 @@ abstract class AbstractNode(val configuration: NodeConfiguration, @Volatile private var _started: StartedNode? = null /** The implementation of the [CordaRPCOps] interface used by this node. */ - open fun makeRPCOps(flowStarter: FlowStarter, database: CordaPersistence): CordaRPCOps { + open fun makeRPCOps(flowStarter: FlowStarter, database: CordaPersistence, smm: StateMachineManager): CordaRPCOps { return SecureCordaRPCOps(services, smm, database, flowStarter) } @@ -191,7 +190,7 @@ abstract class AbstractNode(val configuration: NodeConfiguration, val stateLoader = StateLoaderImpl(transactionStorage) val nodeServices = makeServices(keyPairs, schemaService, transactionStorage, stateLoader, database, info, identityService) val notaryService = makeNotaryService(nodeServices, database) - smm = makeStateMachineManager(database) + val smm = makeStateMachineManager(database) val flowStarter = FlowStarterImpl(serverThread, smm) val schedulerService = NodeSchedulerService( platformClock, @@ -208,13 +207,13 @@ abstract class AbstractNode(val configuration: NodeConfiguration, MoreExecutors.shutdownAndAwaitTermination(serverThread as ExecutorService, 50, SECONDS) } } - makeVaultObservers(schedulerService, database.hibernateConfig) - val rpcOps = makeRPCOps(flowStarter, database) + makeVaultObservers(schedulerService, database.hibernateConfig, smm) + val rpcOps = makeRPCOps(flowStarter, database, smm) startMessagingService(rpcOps) installCoreFlows() val cordaServices = installCordaServices(flowStarter) tokenizableServices = nodeServices + cordaServices + schedulerService - registerCordappFlows() + registerCordappFlows(smm) _services.rpcFlows += cordappLoader.cordapps.flatMap { it.rpcFlows } FlowLogicRefFactoryImpl.classloader = cordappLoader.appClassLoader startShell(rpcOps) @@ -397,11 +396,11 @@ abstract class AbstractNode(val configuration: NodeConfiguration, installCoreFlow(NotaryFlow.Client::class, service::createServiceFlow) } - private fun registerCordappFlows() { + private fun registerCordappFlows(smm: StateMachineManager) { cordappLoader.cordapps.flatMap { it.initiatedFlows } .forEach { try { - registerInitiatedFlowInternal(it, track = false) + registerInitiatedFlowInternal(smm, it, track = false) } catch (e: NoSuchMethodException) { log.error("${it.name}, as an initiated flow, must have a constructor with a single parameter " + "of type ${Party::class.java.name}") @@ -411,13 +410,8 @@ abstract class AbstractNode(val configuration: NodeConfiguration, } } - /** - * Use this method to register your initiated flows in your tests. This is automatically done by the node when it - * starts up for all [FlowLogic] classes it finds which are annotated with [InitiatedBy]. - * @return An [Observable] of the initiated flows started by counter-parties. - */ - fun > registerInitiatedFlow(initiatedFlowClass: Class): Observable { - return registerInitiatedFlowInternal(initiatedFlowClass, track = true) + internal fun > registerInitiatedFlow(smm: StateMachineManager, initiatedFlowClass: Class): Observable { + return registerInitiatedFlowInternal(smm, initiatedFlowClass, track = true) } // TODO remove once not needed @@ -426,7 +420,7 @@ abstract class AbstractNode(val configuration: NodeConfiguration, "It should accept a ${FlowSession::class.java.simpleName} instead" } - private fun > registerInitiatedFlowInternal(initiatedFlow: Class, track: Boolean): Observable { + private fun > registerInitiatedFlowInternal(smm: StateMachineManager, initiatedFlow: Class, track: Boolean): Observable { val constructors = initiatedFlow.declaredConstructors.associateBy { it.parameterTypes.toList() } val flowSessionCtor = constructors[listOf(FlowSession::class.java)]?.apply { isAccessible = true } val ctor: (FlowSession) -> F = if (flowSessionCtor == null) { @@ -447,16 +441,16 @@ abstract class AbstractNode(val configuration: NodeConfiguration, "${InitiatedBy::class.java.name} must point to ${classWithAnnotation.name} and not ${initiatingFlow.name}" } val flowFactory = InitiatedFlowFactory.CorDapp(version, initiatedFlow.appName, ctor) - val observable = internalRegisterFlowFactory(initiatingFlow, flowFactory, initiatedFlow, track) + val observable = internalRegisterFlowFactory(smm, initiatingFlow, flowFactory, initiatedFlow, track) log.info("Registered ${initiatingFlow.name} to initiate ${initiatedFlow.name} (version $version)") return observable } - @VisibleForTesting - fun > internalRegisterFlowFactory(initiatingFlowClass: Class>, - flowFactory: InitiatedFlowFactory, - initiatedFlowClass: Class, - track: Boolean): Observable { + internal fun > internalRegisterFlowFactory(smm: StateMachineManager, + initiatingFlowClass: Class>, + flowFactory: InitiatedFlowFactory, + initiatedFlowClass: Class, + track: Boolean): Observable { val observable = if (track) { smm.changes.filter { it is StateMachineManager.Change.Add }.map { it.logic }.ofType(initiatedFlowClass) } else { @@ -519,7 +513,7 @@ abstract class AbstractNode(val configuration: NodeConfiguration, } protected open fun makeTransactionStorage(database: CordaPersistence): WritableTransactionStorage = DBTransactionStorage() - private fun makeVaultObservers(schedulerService: SchedulerService, hibernateConfig: HibernateConfiguration) { + private fun makeVaultObservers(schedulerService: SchedulerService, hibernateConfig: HibernateConfiguration, smm: StateMachineManager) { VaultSoftLockManager.install(services.vaultService, smm) ScheduledActivityObserver.install(services.vaultService, schedulerService) HibernateObserver.install(services.vaultService.rawUpdates, hibernateConfig) diff --git a/node/src/main/kotlin/net/corda/node/internal/StartedNode.kt b/node/src/main/kotlin/net/corda/node/internal/StartedNode.kt index 88c09de5cc..5335ecd228 100644 --- a/node/src/main/kotlin/net/corda/node/internal/StartedNode.kt +++ b/node/src/main/kotlin/net/corda/node/internal/StartedNode.kt @@ -2,6 +2,8 @@ package net.corda.node.internal import net.corda.core.contracts.* import net.corda.core.flows.FlowLogic +import net.corda.core.flows.InitiatedBy +import net.corda.core.internal.VisibleForTesting import net.corda.core.messaging.CordaRPCOps import net.corda.core.node.NodeInfo import net.corda.core.node.StateLoader @@ -13,6 +15,7 @@ import net.corda.node.services.messaging.MessagingService import net.corda.node.services.persistence.NodeAttachmentService import net.corda.node.services.statemachine.StateMachineManager import net.corda.node.utilities.CordaPersistence +import rx.Observable interface StartedNode { val internals: N @@ -26,7 +29,20 @@ interface StartedNode { val rpcOps: CordaRPCOps val notaryService: NotaryService? fun dispose() = internals.stop() - fun > registerInitiatedFlow(initiatedFlowClass: Class) = internals.registerInitiatedFlow(initiatedFlowClass) + /** + * Use this method to register your initiated flows in your tests. This is automatically done by the node when it + * starts up for all [FlowLogic] classes it finds which are annotated with [InitiatedBy]. + * @return An [Observable] of the initiated flows started by counter-parties. + */ + fun > registerInitiatedFlow(initiatedFlowClass: Class) = internals.registerInitiatedFlow(smm, initiatedFlowClass) + + @VisibleForTesting + fun > internalRegisterFlowFactory(initiatingFlowClass: Class>, + flowFactory: InitiatedFlowFactory, + initiatedFlowClass: Class, + track: Boolean): Observable { + return internals.internalRegisterFlowFactory(smm, initiatingFlowClass, flowFactory, initiatedFlowClass, track) + } } class StateLoaderImpl(private val validatedTransactions: TransactionStorage) : StateLoader { diff --git a/node/src/test/kotlin/net/corda/node/messaging/TwoPartyTradeFlowTests.kt b/node/src/test/kotlin/net/corda/node/messaging/TwoPartyTradeFlowTests.kt index ac8bfbc3b0..5b17b6b368 100644 --- a/node/src/test/kotlin/net/corda/node/messaging/TwoPartyTradeFlowTests.kt +++ b/node/src/test/kotlin/net/corda/node/messaging/TwoPartyTradeFlowTests.kt @@ -519,7 +519,7 @@ class TwoPartyTradeFlowTests(private val anonymous: Boolean) { sellerNode: StartedNode, buyerNode: StartedNode, assetToSell: StateAndRef): RunResult { - val buyerFlows: Observable> = buyerNode.internals.registerInitiatedFlow(BuyerAcceptor::class.java) + val buyerFlows: Observable> = buyerNode.registerInitiatedFlow(BuyerAcceptor::class.java) val firstBuyerFiber = buyerFlows.toFuture().map { it.stateMachine } val seller = SellerInitiator(buyer, notary, assetToSell, 1000.DOLLARS, anonymous) val sellerResult = sellerNode.services.startFlow(seller).resultFuture diff --git a/node/src/test/kotlin/net/corda/node/services/statemachine/FlowFrameworkTests.kt b/node/src/test/kotlin/net/corda/node/services/statemachine/FlowFrameworkTests.kt index 4174882130..083001d9c2 100644 --- a/node/src/test/kotlin/net/corda/node/services/statemachine/FlowFrameworkTests.kt +++ b/node/src/test/kotlin/net/corda/node/services/statemachine/FlowFrameworkTests.kt @@ -672,7 +672,7 @@ class FlowFrameworkTests { initiatingFlowClass: KClass>, initiatedFlowVersion: Int = 1, noinline flowFactory: (FlowSession) -> P): CordaFuture

{ - val observable = internals.internalRegisterFlowFactory( + val observable = internalRegisterFlowFactory( initiatingFlowClass.java, InitiatedFlowFactory.CorDapp(initiatedFlowVersion, "", flowFactory), P::class.java, diff --git a/node/src/test/kotlin/net/corda/node/services/vault/VaultSoftLockManagerTest.kt b/node/src/test/kotlin/net/corda/node/services/vault/VaultSoftLockManagerTest.kt index 3647a62d2b..c6fd88d4ae 100644 --- a/node/src/test/kotlin/net/corda/node/services/vault/VaultSoftLockManagerTest.kt +++ b/node/src/test/kotlin/net/corda/node/services/vault/VaultSoftLockManagerTest.kt @@ -66,7 +66,7 @@ class NodePair(private val mockNet: MockNetwork) { private set fun communicate(clientLogic: AbstractClientLogic, rebootClient: Boolean): FlowStateMachine { - server.internals.internalRegisterFlowFactory(AbstractClientLogic::class.java, InitiatedFlowFactory.Core { ServerLogic(it, serverRunning) }, ServerLogic::class.java, false) + server.internalRegisterFlowFactory(AbstractClientLogic::class.java, InitiatedFlowFactory.Core { ServerLogic(it, serverRunning) }, ServerLogic::class.java, false) client.services.startFlow(clientLogic) while (!serverRunning.get()) mockNet.runNetwork(1) if (rebootClient) { diff --git a/samples/irs-demo/cordapp/src/test/kotlin/net/corda/irs/api/NodeInterestRatesTest.kt b/samples/irs-demo/cordapp/src/test/kotlin/net/corda/irs/api/NodeInterestRatesTest.kt index de27d5517e..27318e4598 100644 --- a/samples/irs-demo/cordapp/src/test/kotlin/net/corda/irs/api/NodeInterestRatesTest.kt +++ b/samples/irs-demo/cordapp/src/test/kotlin/net/corda/irs/api/NodeInterestRatesTest.kt @@ -209,8 +209,8 @@ class NodeInterestRatesTest { val mockNet = MockNetwork(cordappPackages = listOf("net.corda.finance.contracts", "net.corda.irs")) val aliceNode = mockNet.createPartyNode(ALICE_NAME) val oracleNode = mockNet.createNode(MockNodeParameters(legalName = BOB_NAME)).apply { - internals.registerInitiatedFlow(NodeInterestRates.FixQueryHandler::class.java) - internals.registerInitiatedFlow(NodeInterestRates.FixSignHandler::class.java) + registerInitiatedFlow(NodeInterestRates.FixQueryHandler::class.java) + registerInitiatedFlow(NodeInterestRates.FixSignHandler::class.java) database.transaction { services.cordaService(NodeInterestRates.Oracle::class.java).knownFixes = TEST_DATA } diff --git a/samples/network-visualiser/src/main/kotlin/net/corda/netmap/simulation/IRSSimulation.kt b/samples/network-visualiser/src/main/kotlin/net/corda/netmap/simulation/IRSSimulation.kt index 41a0bc7710..21ac207f72 100644 --- a/samples/network-visualiser/src/main/kotlin/net/corda/netmap/simulation/IRSSimulation.kt +++ b/samples/network-visualiser/src/main/kotlin/net/corda/netmap/simulation/IRSSimulation.kt @@ -136,10 +136,8 @@ class IRSSimulation(networkSendManuallyPumped: Boolean, runAsync: Boolean, laten .replace("oracleXXX", RatesOracleNode.RATES_SERVICE_NAME.toString())) irs.fixedLeg.fixedRatePayer = node1.info.chooseIdentity() irs.floatingLeg.floatingRatePayer = node2.info.chooseIdentity() - - node1.internals.registerInitiatedFlow(FixingFlow.Fixer::class.java) - node2.internals.registerInitiatedFlow(FixingFlow.Fixer::class.java) - + node1.registerInitiatedFlow(FixingFlow.Fixer::class.java) + node2.registerInitiatedFlow(FixingFlow.Fixer::class.java) @InitiatingFlow class StartDealFlow(val otherParty: Party, val payload: AutoOffer) : FlowLogic() { @@ -152,9 +150,7 @@ class IRSSimulation(networkSendManuallyPumped: Boolean, runAsync: Boolean, laten @InitiatedBy(StartDealFlow::class) class AcceptDealFlow(otherSession: FlowSession) : Acceptor(otherSession) - - val acceptDealFlows: Observable = node2.internals.registerInitiatedFlow(AcceptDealFlow::class.java) - + val acceptDealFlows: Observable = node2.registerInitiatedFlow(AcceptDealFlow::class.java) val acceptorTxFuture = acceptDealFlows.toFuture().toCompletableFuture().thenCompose { uncheckedCast, FlowStateMachine>(it.stateMachine).resultFuture.toCompletableFuture() } diff --git a/samples/trader-demo/src/integration-test/kotlin/net/corda/traderdemo/TraderDemoTest.kt b/samples/trader-demo/src/integration-test/kotlin/net/corda/traderdemo/TraderDemoTest.kt index b741356548..af253af527 100644 --- a/samples/trader-demo/src/integration-test/kotlin/net/corda/traderdemo/TraderDemoTest.kt +++ b/samples/trader-demo/src/integration-test/kotlin/net/corda/traderdemo/TraderDemoTest.kt @@ -38,8 +38,7 @@ class TraderDemoTest { startNode(providedName = DUMMY_BANK_B.name, rpcUsers = listOf(demoUser)), startNode(providedName = BOC.name, rpcUsers = listOf(bankUser)) ).map { (it.getOrThrow() as NodeHandle.InProcess).node } - - nodeA.internals.registerInitiatedFlow(BuyerFlow::class.java) + nodeA.registerInitiatedFlow(BuyerFlow::class.java) val (nodeARpc, nodeBRpc) = listOf(nodeA, nodeB).map { val client = CordaRPCClient(it.internals.configuration.rpcAddress!!) client.start(demoUser.username, demoUser.password).proxy diff --git a/testing/node-driver/src/integration-test/kotlin/net/corda/testing/FlowStackSnapshotTest.kt b/testing/node-driver/src/integration-test/kotlin/net/corda/testing/FlowStackSnapshotTest.kt index e824c782f9..f33897854c 100644 --- a/testing/node-driver/src/integration-test/kotlin/net/corda/testing/FlowStackSnapshotTest.kt +++ b/testing/node-driver/src/integration-test/kotlin/net/corda/testing/FlowStackSnapshotTest.kt @@ -291,7 +291,7 @@ class FlowStackSnapshotTest { fun `flowStackSnapshot object is serializable`() { val mockNet = MockNetwork(threadPerNode = true) val node = mockNet.createPartyNode() - node.internals.registerInitiatedFlow(DummyFlow::class.java) + node.registerInitiatedFlow(DummyFlow::class.java) node.services.startFlow(FlowStackSnapshotSerializationTestingFlow()).resultFuture.get() val thrown = try { mockNet.stopNodes()