From 1d6b8de11e51a2752fd402b90a96f14ccfc06cf0 Mon Sep 17 00:00:00 2001 From: Clinton Alexander Date: Tue, 18 Oct 2016 15:26:32 +0100 Subject: [PATCH] Added clock to the node --- .../com/r3corda/node/driver/DriverTests.kt | 16 ++++++++-------- .../kotlin/com/r3corda/node/driver/Driver.kt | 1 - .../node/services/config/NodeConfiguration.kt | 4 ++-- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/node/src/integration-test/kotlin/com/r3corda/node/driver/DriverTests.kt b/node/src/integration-test/kotlin/com/r3corda/node/driver/DriverTests.kt index 5bc4efe046..67bc924363 100644 --- a/node/src/integration-test/kotlin/com/r3corda/node/driver/DriverTests.kt +++ b/node/src/integration-test/kotlin/com/r3corda/node/driver/DriverTests.kt @@ -30,31 +30,31 @@ class DriverTests { val notary = startNode("TestNotary", setOf(ServiceInfo(SimpleNotaryService.type))) val regulator = startNode("Regulator", setOf(ServiceInfo(RegulatorService.type))) - nodeMustBeUp(notary.get(), "TestNotary") - nodeMustBeUp(regulator.get(), "Regulator") + nodeMustBeUp(notary.get().nodeInfo, "TestNotary") + nodeMustBeUp(regulator.get().nodeInfo, "Regulator") Pair(notary.get(), regulator.get()) } - nodeMustBeDown(notary) - nodeMustBeDown(regulator) + nodeMustBeDown(notary.nodeInfo) + nodeMustBeDown(regulator.nodeInfo) } @Test fun startingNodeWithNoServicesWorks() { val noService = driver { val noService = startNode("NoService") - nodeMustBeUp(noService.get(), "NoService") + nodeMustBeUp(noService.get().nodeInfo, "NoService") noService.get() } - nodeMustBeDown(noService) + nodeMustBeDown(noService.nodeInfo) } @Test fun randomFreePortAllocationWorks() { val nodeInfo = driver(portAllocation = PortAllocation.RandomFree()) { val nodeInfo = startNode("NoService") - nodeMustBeUp(nodeInfo.get(), "NoService") + nodeMustBeUp(nodeInfo.get().nodeInfo, "NoService") nodeInfo.get() } - nodeMustBeDown(nodeInfo) + nodeMustBeDown(nodeInfo.nodeInfo) } } diff --git a/node/src/main/kotlin/com/r3corda/node/driver/Driver.kt b/node/src/main/kotlin/com/r3corda/node/driver/Driver.kt index 0f37edcf02..466aa76b2d 100644 --- a/node/src/main/kotlin/com/r3corda/node/driver/Driver.kt +++ b/node/src/main/kotlin/com/r3corda/node/driver/Driver.kt @@ -331,7 +331,6 @@ open class DriverDSL( configOverrides = mapOf( "myLegalName" to networkMapName, "basedir" to Paths.get(nodeDirectory).normalize().toString(), - "clock" to clock, "artemisAddress" to networkMapAddress.toString(), "webAddress" to apiAddress.toString(), "extraAdvertisedServiceIds" to "" diff --git a/node/src/main/kotlin/com/r3corda/node/services/config/NodeConfiguration.kt b/node/src/main/kotlin/com/r3corda/node/services/config/NodeConfiguration.kt index a7b0e16b79..968504cf96 100644 --- a/node/src/main/kotlin/com/r3corda/node/services/config/NodeConfiguration.kt +++ b/node/src/main/kotlin/com/r3corda/node/services/config/NodeConfiguration.kt @@ -5,6 +5,7 @@ import com.r3corda.core.div import com.r3corda.core.messaging.SingleMessageRecipient import com.r3corda.core.node.services.ServiceInfo import com.r3corda.node.internal.Node +import com.r3corda.node.serialization.NodeClock import com.r3corda.node.services.messaging.NodeMessagingClient import com.r3corda.node.services.network.NetworkMapService import com.typesafe.config.Config @@ -31,7 +32,7 @@ interface NodeConfiguration : NodeSSLConfiguration { val devMode: Boolean } -class FullNodeConfiguration(config: Config) : NodeConfiguration { +class FullNodeConfiguration(config: Config, val clock: Clock = NodeClock()) : NodeConfiguration { override val basedir: Path by config override val myLegalName: String by config override val nearestCity: String by config @@ -47,7 +48,6 @@ class FullNodeConfiguration(config: Config) : NodeConfiguration { val webAddress: HostAndPort by config val messagingServerAddress: HostAndPort? by config.getOrElse { null } val extraAdvertisedServiceIds: String by config - val clock: Clock by config fun createNode(): Node { val advertisedServices = mutableSetOf()