From 5efa0fd5b304cdfc4be0fd84be3652eedc32db03 Mon Sep 17 00:00:00 2001 From: Andrius Dagys Date: Mon, 3 Oct 2016 10:44:33 +0100 Subject: [PATCH] Advertised services now contain ServiceInfo which describes ServiceType and a service identifier. This will be used, e.g. for grouping distributed notary nodes into the same service cluster. --- .../r3corda/client/NodeMonitorClientTests.kt | 7 ++--- .../kotlin/com/r3corda/core/node/NodeInfo.kt | 4 +-- .../r3corda/core/node/services/ServiceInfo.kt | 22 +++++++++++++++ .../main/kotlin/com/r3corda/explorer/Main.kt | 3 ++- .../com/r3corda/node/driver/DriverTests.kt | 5 ++-- .../kotlin/com/r3corda/node/driver/Driver.kt | 12 ++++----- .../com/r3corda/node/internal/AbstractNode.kt | 8 +++--- .../kotlin/com/r3corda/node/internal/Node.kt | 4 +-- .../node/services/config/NodeConfiguration.kt | 10 +++---- .../network/InMemoryNetworkMapCache.kt | 2 +- .../r3corda/node/messaging/AttachmentTests.kt | 10 +++---- .../node/messaging/InMemoryMessagingTests.kt | 7 ++--- .../messaging/TwoPartyTradeProtocolTests.kt | 4 +-- .../node/services/NotaryChangeTests.kt | 5 ++-- .../node/services/NotaryServiceTests.kt | 4 +-- .../PersistentNetworkMapServiceTest.kt | 8 ++---- .../services/ValidatingNotaryServiceTests.kt | 3 ++- src/main/kotlin/com/r3corda/demos/IRSDemo.kt | 13 +++++---- .../kotlin/com/r3corda/demos/RateFixDemo.kt | 10 ++++--- .../kotlin/com/r3corda/demos/TraderDemo.kt | 6 ++--- .../com/r3corda/simulation/Simulation.kt | 27 ++++++++++--------- .../com/r3corda/testing/node/MockNode.kt | 20 +++++++------- 22 files changed, 110 insertions(+), 84 deletions(-) create mode 100644 core/src/main/kotlin/com/r3corda/core/node/services/ServiceInfo.kt diff --git a/client/src/integration-test/kotlin/com/r3corda/client/NodeMonitorClientTests.kt b/client/src/integration-test/kotlin/com/r3corda/client/NodeMonitorClientTests.kt index 77c75216cc..8d282fdd6b 100644 --- a/client/src/integration-test/kotlin/com/r3corda/client/NodeMonitorClientTests.kt +++ b/client/src/integration-test/kotlin/com/r3corda/client/NodeMonitorClientTests.kt @@ -1,6 +1,7 @@ package com.r3corda.client import com.r3corda.core.contracts.* +import com.r3corda.core.node.services.ServiceInfo import com.r3corda.core.serialization.OpaqueBytes import com.r3corda.node.driver.driver import com.r3corda.node.driver.startClient @@ -22,7 +23,7 @@ class NodeMonitorClientTests { fun cashIssueWorksEndToEnd() { driver { val aliceNodeFuture = startNode("Alice") - val notaryNodeFuture = startNode("Notary", advertisedServices = setOf(SimpleNotaryService.Type)) + val notaryNodeFuture = startNode("Notary", advertisedServices = setOf(ServiceInfo(SimpleNotaryService.Type))) val aliceNode = aliceNodeFuture.get() val notaryNode = notaryNodeFuture.get() @@ -65,7 +66,7 @@ class NodeMonitorClientTests { fun issueAndMoveWorks() { driver { val aliceNodeFuture = startNode("Alice") - val notaryNodeFuture = startNode("Notary", advertisedServices = setOf(SimpleNotaryService.Type)) + val notaryNodeFuture = startNode("Notary", advertisedServices = setOf(ServiceInfo(SimpleNotaryService.Type))) val aliceNode = aliceNodeFuture.get() val notaryNode = notaryNodeFuture.get() @@ -173,7 +174,7 @@ class NodeMonitorClientTests { fun movingCashOfDifferentIssueRefsFails() { driver { val aliceNodeFuture = startNode("Alice") - val notaryNodeFuture = startNode("Notary", advertisedServices = setOf(SimpleNotaryService.Type)) + val notaryNodeFuture = startNode("Notary", advertisedServices = setOf(ServiceInfo(SimpleNotaryService.Type))) val aliceNode = aliceNodeFuture.get() val notaryNode = notaryNodeFuture.get() diff --git a/core/src/main/kotlin/com/r3corda/core/node/NodeInfo.kt b/core/src/main/kotlin/com/r3corda/core/node/NodeInfo.kt index 56446c33c3..3e2d837db1 100644 --- a/core/src/main/kotlin/com/r3corda/core/node/NodeInfo.kt +++ b/core/src/main/kotlin/com/r3corda/core/node/NodeInfo.kt @@ -2,11 +2,11 @@ package com.r3corda.core.node import com.r3corda.core.crypto.Party import com.r3corda.core.messaging.SingleMessageRecipient -import com.r3corda.core.node.services.ServiceType +import com.r3corda.core.node.services.ServiceInfo /** * Info about a network node that acts on behalf of some form of contract party. */ data class NodeInfo(val address: SingleMessageRecipient, val identity: Party, - var advertisedServices: Set = emptySet(), + var advertisedServices: Set = emptySet(), val physicalLocation: PhysicalLocation? = null) diff --git a/core/src/main/kotlin/com/r3corda/core/node/services/ServiceInfo.kt b/core/src/main/kotlin/com/r3corda/core/node/services/ServiceInfo.kt new file mode 100644 index 0000000000..b4c821c6d1 --- /dev/null +++ b/core/src/main/kotlin/com/r3corda/core/node/services/ServiceInfo.kt @@ -0,0 +1,22 @@ +package com.r3corda.core.node.services + +/** + * A container for additional information for an advertised service. + * + * @param ServiceType the service type identifier + * @param name the service name, used for differentiating multiple services of the same type. Can also be used as a + * grouping identifier for nodes collectively running a distributed service. + */ +data class ServiceInfo(val type: ServiceType, val name: String? = null) { + companion object { + fun parse(encoded: String): ServiceInfo { + val parts = encoded.split("|") + require(parts.size > 0 && parts.size <= 2) + return ServiceInfo(object : ServiceType(parts[0]) {}, parts[1]) + } + } + + override fun toString() = if (name != null) "$type|$name" else type.toString() +} + +fun Iterable.containsType(type: ServiceType) = any { it.type == type } \ No newline at end of file diff --git a/explorer/src/main/kotlin/com/r3corda/explorer/Main.kt b/explorer/src/main/kotlin/com/r3corda/explorer/Main.kt index b72ec28630..04f3180e0d 100644 --- a/explorer/src/main/kotlin/com/r3corda/explorer/Main.kt +++ b/explorer/src/main/kotlin/com/r3corda/explorer/Main.kt @@ -8,6 +8,7 @@ import com.r3corda.client.model.Models import com.r3corda.client.model.NodeMonitorModel import com.r3corda.client.model.observer import com.r3corda.core.contracts.ClientToServiceCommand +import com.r3corda.core.node.services.ServiceInfo import com.r3corda.explorer.model.IdentityModel import com.r3corda.node.driver.PortAllocation import com.r3corda.node.driver.driver @@ -42,7 +43,7 @@ class Main : App() { val aliceNodeFuture = startNode("Alice") val bobNodeFuture = startNode("Bob") - val notaryNodeFuture = startNode("Notary", advertisedServices = setOf(SimpleNotaryService.Type)) + val notaryNodeFuture = startNode("Notary", advertisedServices = setOf(ServiceInfo(SimpleNotaryService.Type))) val aliceNode = aliceNodeFuture.get() val bobNode = bobNodeFuture.get() 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 4e5b421e1b..82bfbcb2ed 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 @@ -2,6 +2,7 @@ package com.r3corda.node.driver import com.r3corda.core.node.NodeInfo import com.r3corda.core.node.services.NetworkMapCache +import com.r3corda.core.node.services.ServiceInfo import com.r3corda.node.services.api.RegulatorService import com.r3corda.node.services.messaging.ArtemisMessagingComponent import com.r3corda.node.services.transactions.SimpleNotaryService @@ -32,8 +33,8 @@ class DriverTests { @Test fun simpleNodeStartupShutdownWorks() { val (notary, regulator) = driver { - val notary = startNode("TestNotary", setOf(SimpleNotaryService.Type)) - val regulator = startNode("Regulator", setOf(RegulatorService.Type)) + val notary = startNode("TestNotary", setOf(ServiceInfo(SimpleNotaryService.Type))) + val regulator = startNode("Regulator", setOf(ServiceInfo(RegulatorService.Type))) nodeMustBeUp(networkMapCache, notary.get(), "TestNotary") nodeMustBeUp(networkMapCache, regulator.get(), "Regulator") 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 cfce8ee824..7f41529c3d 100644 --- a/node/src/main/kotlin/com/r3corda/node/driver/Driver.kt +++ b/node/src/main/kotlin/com/r3corda/node/driver/Driver.kt @@ -6,7 +6,7 @@ import com.r3corda.core.crypto.Party import com.r3corda.core.crypto.generateKeyPair import com.r3corda.core.node.NodeInfo import com.r3corda.core.node.services.NetworkMapCache -import com.r3corda.core.node.services.ServiceType +import com.r3corda.core.node.services.ServiceInfo import com.r3corda.node.services.config.FullNodeConfiguration import com.r3corda.node.services.config.NodeConfiguration import com.r3corda.node.services.config.NodeConfigurationFromConfig @@ -56,7 +56,7 @@ interface DriverDSLExposedInterface { * @param advertisedServices The set of services to be advertised by the node. Defaults to empty set. * @return The [NodeInfo] of the started up node retrieved from the network map service. */ - fun startNode(providedName: String? = null, advertisedServices: Set = setOf()): Future + fun startNode(providedName: String? = null, advertisedServices: Set = setOf()): Future /** * Starts an [NodeMessagingClient]. @@ -286,14 +286,14 @@ class DriverDSL( addressMustNotBeBound(networkMapAddress) } - override fun startNode(providedName: String?, advertisedServices: Set): Future { + override fun startNode(providedName: String?, advertisedServices: Set): Future { val messagingAddress = portAllocation.nextHostAndPort() val apiAddress = portAllocation.nextHostAndPort() val debugPort = if (isDebug) debugPortAllocation.nextPort() else null val name = providedName ?: "${pickA(name)}-${messagingAddress.port}" val nodeDirectory = "$baseDirectory/$name" - val useNotary = advertisedServices.any { it.isSubTypeOf(NotaryService.Type) } + val useNotary = advertisedServices.any { it.type.isSubTypeOf(NotaryService.Type) } val config = NodeConfiguration.loadConfig( baseDirectoryPath = Paths.get(nodeDirectory), @@ -304,7 +304,7 @@ class DriverDSL( "artemisAddress" to messagingAddress.toString(), "webAddress" to apiAddress.toString(), "hostNotaryServiceLocally" to useNotary.toString(), - "extraAdvertisedServiceIds" to advertisedServices.map { x -> x.id }.joinToString(","), + "extraAdvertisedServiceIds" to advertisedServices.joinToString(","), "networkMapAddress" to networkMapAddress.toString() ) ) @@ -446,7 +446,7 @@ class DriverDSL( listOf("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=$debugPort") else emptyList() - + val javaArgs = listOf(path) + listOf("-Dname=${nodeConf.myLegalName}", "-javaagent:$quasarJarPath") + debugPortArg + listOf("-cp", classpath, className) + diff --git a/node/src/main/kotlin/com/r3corda/node/internal/AbstractNode.kt b/node/src/main/kotlin/com/r3corda/node/internal/AbstractNode.kt index 084bd96866..7580da60e5 100644 --- a/node/src/main/kotlin/com/r3corda/node/internal/AbstractNode.kt +++ b/node/src/main/kotlin/com/r3corda/node/internal/AbstractNode.kt @@ -71,7 +71,7 @@ import kotlin.reflect.KClass // In theory the NodeInfo for the node should be passed in, instead, however currently this is constructed by the // AbstractNode. It should be possible to generate the NodeInfo outside of AbstractNode, so it can be passed in. abstract class AbstractNode(val configuration: NodeConfiguration, val networkMapService: SingleMessageRecipient?, - val advertisedServices: Set, val platformClock: Clock) : SingletonSerializeAsToken() { + val advertisedServices: Set, val platformClock: Clock) : SingletonSerializeAsToken() { companion object { val PRIVATE_KEY_FILE_NAME = "identity-private-key" val PUBLIC_IDENTITY_FILE_NAME = "identity-public" @@ -211,7 +211,7 @@ abstract class AbstractNode(val configuration: NodeConfiguration, val networkMap // TODO: uniquenessProvider creation should be inside makeNotaryService(), but notary service initialisation // depends on smm, while smm depends on tokenizableServices, which uniquenessProvider is part of - advertisedServices.singleOrNull { it.isSubTypeOf(NotaryService.Type) }?.let { + advertisedServices.singleOrNull { it.type.isSubTypeOf(NotaryService.Type) }?.let { uniquenessProvider = makeUniquenessProvider() tokenizableServices.add(uniquenessProvider!!) } @@ -318,7 +318,7 @@ abstract class AbstractNode(val configuration: NodeConfiguration, val networkMap } private fun buildAdvertisedServices() { - val serviceTypes = info.advertisedServices + val serviceTypes = info.advertisedServices.map { it.type } if (NetworkMapService.Type in serviceTypes) makeNetworkMapService() val notaryServiceType = serviceTypes.singleOrNull { it.isSubTypeOf(NotaryService.Type) } @@ -332,7 +332,7 @@ abstract class AbstractNode(val configuration: NodeConfiguration, val networkMap * updates) if one has been supplied. */ private fun registerWithNetworkMap(): ListenableFuture { - require(networkMapService != null || NetworkMapService.Type in advertisedServices) { + require(networkMapService != null || NetworkMapService.Type in advertisedServices.map { it.type }) { "Initial network map address must indicate a node that provides a network map service" } services.networkMapCache.addNode(info) diff --git a/node/src/main/kotlin/com/r3corda/node/internal/Node.kt b/node/src/main/kotlin/com/r3corda/node/internal/Node.kt index efbc8cacb3..7e4d5f145a 100644 --- a/node/src/main/kotlin/com/r3corda/node/internal/Node.kt +++ b/node/src/main/kotlin/com/r3corda/node/internal/Node.kt @@ -4,7 +4,7 @@ import com.codahale.metrics.JmxReporter import com.google.common.net.HostAndPort import com.r3corda.core.messaging.SingleMessageRecipient import com.r3corda.core.node.ServiceHub -import com.r3corda.core.node.services.ServiceType +import com.r3corda.core.node.services.ServiceInfo import com.r3corda.core.utilities.loggerFor import com.r3corda.node.serialization.NodeClock import com.r3corda.node.services.api.MessagingServiceInternal @@ -61,7 +61,7 @@ class ConfigurationException(message: String) : Exception(message) */ class Node(val p2pAddr: HostAndPort, val webServerAddr: HostAndPort, configuration: NodeConfiguration, networkMapAddress: SingleMessageRecipient?, - advertisedServices: Set, clock: Clock = NodeClock(), + advertisedServices: Set, clock: Clock = NodeClock(), val messagingServerAddr: HostAndPort? = null) : AbstractNode(configuration, networkMapAddress, advertisedServices, clock) { companion object { /** The port that is used by default if none is specified. As you know, 31337 is the most elite number. */ 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 88815410bb..09fd6498a6 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 @@ -4,7 +4,7 @@ import com.google.common.net.HostAndPort import com.r3corda.core.crypto.X509Utilities import com.r3corda.core.div import com.r3corda.core.messaging.SingleMessageRecipient -import com.r3corda.core.node.services.ServiceType +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 @@ -157,14 +157,14 @@ class FullNodeConfiguration(conf: Config) : NodeConfiguration { val clock: Clock = NodeClock() fun createNode(): Node { - val advertisedServices = mutableSetOf() - if (hostNotaryServiceLocally) advertisedServices.add(SimpleNotaryService.Type) + val advertisedServices = mutableSetOf() + if (hostNotaryServiceLocally) advertisedServices.add(ServiceInfo(SimpleNotaryService.Type)) if (!extraAdvertisedServiceIds.isNullOrEmpty()) { for (serviceId in extraAdvertisedServiceIds.split(",")) { - advertisedServices.add(object : ServiceType(serviceId) {}) + advertisedServices.add(ServiceInfo.parse(serviceId)) } } - if (networkMapAddress == null) advertisedServices.add(NetworkMapService.Type) + if (networkMapAddress == null) advertisedServices.add(ServiceInfo(NetworkMapService.Type)) val networkMapMessageAddress: SingleMessageRecipient? = if (networkMapAddress == null) null else NodeMessagingClient.makeNetworkMapAddress(networkMapAddress) return Node(artemisAddress, webAddress, diff --git a/node/src/main/kotlin/com/r3corda/node/services/network/InMemoryNetworkMapCache.kt b/node/src/main/kotlin/com/r3corda/node/services/network/InMemoryNetworkMapCache.kt index ae3f24abc5..1084a98076 100644 --- a/node/src/main/kotlin/com/r3corda/node/services/network/InMemoryNetworkMapCache.kt +++ b/node/src/main/kotlin/com/r3corda/node/services/network/InMemoryNetworkMapCache.kt @@ -51,7 +51,7 @@ open class InMemoryNetworkMapCache : SingletonSerializeAsToken(), NetworkMapCach protected var registeredNodes = Collections.synchronizedMap(HashMap()) override fun get() = registeredNodes.map { it.value } - override fun get(serviceType: ServiceType) = registeredNodes.filterValues { it.advertisedServices.any { it.isSubTypeOf(serviceType) } }.map { it.value } + override fun get(serviceType: ServiceType) = registeredNodes.filterValues { it.advertisedServices.any { it.type.isSubTypeOf(serviceType) } }.map { it.value } override fun getRecommended(type: ServiceType, contract: Contract, vararg party: Party): NodeInfo? = get(type).firstOrNull() override fun getNodeByLegalName(name: String) = get().singleOrNull { it.identity.name == name } override fun getNodeByPublicKey(publicKey: PublicKey) = get().singleOrNull { it.identity.owningKey == publicKey } diff --git a/node/src/test/kotlin/com/r3corda/node/messaging/AttachmentTests.kt b/node/src/test/kotlin/com/r3corda/node/messaging/AttachmentTests.kt index a1fb8ef380..d4da41bda0 100644 --- a/node/src/test/kotlin/com/r3corda/node/messaging/AttachmentTests.kt +++ b/node/src/test/kotlin/com/r3corda/node/messaging/AttachmentTests.kt @@ -4,16 +4,15 @@ import com.r3corda.core.contracts.Attachment import com.r3corda.core.crypto.SecureHash import com.r3corda.core.crypto.sha256 import com.r3corda.core.messaging.SingleMessageRecipient -import com.r3corda.core.node.NodeInfo -import com.r3corda.core.node.services.ServiceType +import com.r3corda.core.node.services.ServiceInfo import com.r3corda.core.serialization.OpaqueBytes -import com.r3corda.testing.node.MockNetwork import com.r3corda.node.services.config.NodeConfiguration import com.r3corda.node.services.network.NetworkMapService import com.r3corda.node.services.persistence.NodeAttachmentService import com.r3corda.node.services.transactions.SimpleNotaryService import com.r3corda.protocols.FetchAttachmentsProtocol import com.r3corda.protocols.FetchDataProtocol +import com.r3corda.testing.node.MockNetwork import com.r3corda.testing.rootCauseExceptions import org.junit.Before import org.junit.Test @@ -21,7 +20,6 @@ import java.io.ByteArrayInputStream import java.io.ByteArrayOutputStream import java.nio.ByteBuffer import java.nio.file.Files -import java.nio.file.Path import java.nio.file.StandardOpenOption import java.security.KeyPair import java.util.jar.JarOutputStream @@ -89,7 +87,7 @@ class AttachmentTests { // Make a node that doesn't do sanity checking at load time. val n0 = network.createNode(null, -1, object : MockNetwork.Factory { override fun create(config: NodeConfiguration, network: MockNetwork, networkMapAddr: SingleMessageRecipient?, - advertisedServices: Set, id: Int, keyPair: KeyPair?): MockNetwork.MockNode { + advertisedServices: Set, id: Int, keyPair: KeyPair?): MockNetwork.MockNode { return object : MockNetwork.MockNode(config, network, networkMapAddr, advertisedServices, id, keyPair) { override fun start(): MockNetwork.MockNode { super.start() @@ -98,7 +96,7 @@ class AttachmentTests { } } } - }, true, null, null, NetworkMapService.Type, SimpleNotaryService.Type) + }, true, null, null, ServiceInfo(NetworkMapService.Type), ServiceInfo(SimpleNotaryService.Type)) val n1 = network.createNode(n0.info.address) // Insert an attachment into node zero's store directly. diff --git a/node/src/test/kotlin/com/r3corda/node/messaging/InMemoryMessagingTests.kt b/node/src/test/kotlin/com/r3corda/node/messaging/InMemoryMessagingTests.kt index 24df131e07..49f1fc36ab 100644 --- a/node/src/test/kotlin/com/r3corda/node/messaging/InMemoryMessagingTests.kt +++ b/node/src/test/kotlin/com/r3corda/node/messaging/InMemoryMessagingTests.kt @@ -6,6 +6,7 @@ import com.r3corda.core.messaging.Message import com.r3corda.core.messaging.TopicStringValidator import com.r3corda.core.messaging.createMessage import com.r3corda.core.node.services.DEFAULT_SESSION_ID +import com.r3corda.core.node.services.ServiceInfo import com.r3corda.node.services.network.NetworkMapService import com.r3corda.testing.node.MockNetwork import org.junit.Before @@ -40,7 +41,7 @@ class InMemoryMessagingTests { @Test fun basics() { - val node1 = network.createNode(advertisedServices = NetworkMapService.Type) + val node1 = network.createNode(advertisedServices = ServiceInfo(NetworkMapService.Type)) val node2 = network.createNode(networkMapAddress = node1.info.address) val node3 = network.createNode(networkMapAddress = node1.info.address) @@ -69,7 +70,7 @@ class InMemoryMessagingTests { @Test fun broadcast() { - val node1 = network.createNode(advertisedServices = NetworkMapService.Type) + val node1 = network.createNode(advertisedServices = ServiceInfo(NetworkMapService.Type)) val node2 = network.createNode(networkMapAddress = node1.info.address) val node3 = network.createNode(networkMapAddress = node1.info.address) @@ -88,7 +89,7 @@ class InMemoryMessagingTests { */ @Test fun `skip unhandled messages`() { - val node1 = network.createNode(advertisedServices = NetworkMapService.Type) + val node1 = network.createNode(advertisedServices = ServiceInfo(NetworkMapService.Type)) val node2 = network.createNode(networkMapAddress = node1.info.address) var received: Int = 0 diff --git a/node/src/test/kotlin/com/r3corda/node/messaging/TwoPartyTradeProtocolTests.kt b/node/src/test/kotlin/com/r3corda/node/messaging/TwoPartyTradeProtocolTests.kt index 86bb6b5ce0..b633dd6c3c 100644 --- a/node/src/test/kotlin/com/r3corda/node/messaging/TwoPartyTradeProtocolTests.kt +++ b/node/src/test/kotlin/com/r3corda/node/messaging/TwoPartyTradeProtocolTests.kt @@ -162,7 +162,7 @@ class TwoPartyTradeProtocolTests { // that Bob was waiting on before the reboot occurred. bobNode = net.createNode(networkMapAddr, bobAddr.id, object : MockNetwork.Factory { override fun create(config: NodeConfiguration, network: MockNetwork, networkMapAddr: SingleMessageRecipient?, - advertisedServices: Set, id: Int, keyPair: KeyPair?): MockNetwork.MockNode { + advertisedServices: Set, id: Int, keyPair: KeyPair?): MockNetwork.MockNode { return MockNetwork.MockNode(config, network, networkMapAddr, advertisedServices, bobAddr.id, BOB_KEY) } }, true, BOB.name, BOB_KEY) @@ -192,7 +192,7 @@ class TwoPartyTradeProtocolTests { // Create a node in the mock network ... return net.createNode(networkMapAddr, -1, object : MockNetwork.Factory { override fun create(config: NodeConfiguration, network: MockNetwork, networkMapAddr: SingleMessageRecipient?, - advertisedServices: Set, id: Int, keyPair: KeyPair?): MockNetwork.MockNode { + advertisedServices: Set, id: Int, keyPair: KeyPair?): MockNetwork.MockNode { return object : MockNetwork.MockNode(config, network, networkMapAddr, advertisedServices, id, keyPair) { // That constructs the storage service object in a customised way ... override fun constructStorageService( diff --git a/node/src/test/kotlin/com/r3corda/node/services/NotaryChangeTests.kt b/node/src/test/kotlin/com/r3corda/node/services/NotaryChangeTests.kt index 7d31ed4f3e..2e126891e1 100644 --- a/node/src/test/kotlin/com/r3corda/node/services/NotaryChangeTests.kt +++ b/node/src/test/kotlin/com/r3corda/node/services/NotaryChangeTests.kt @@ -3,6 +3,7 @@ package com.r3corda.node.services import com.r3corda.core.contracts.* import com.r3corda.core.crypto.Party import com.r3corda.core.crypto.generateKeyPair +import com.r3corda.core.node.services.ServiceInfo import com.r3corda.core.seconds import com.r3corda.core.utilities.DUMMY_NOTARY import com.r3corda.core.utilities.DUMMY_NOTARY_KEY @@ -35,10 +36,10 @@ class NotaryChangeTests { oldNotaryNode = net.createNode( legalName = DUMMY_NOTARY.name, keyPair = DUMMY_NOTARY_KEY, - advertisedServices = *arrayOf(NetworkMapService.Type, SimpleNotaryService.Type)) + advertisedServices = *arrayOf(ServiceInfo(NetworkMapService.Type), ServiceInfo(SimpleNotaryService.Type))) clientNodeA = net.createNode(networkMapAddress = oldNotaryNode.info.address) clientNodeB = net.createNode(networkMapAddress = oldNotaryNode.info.address) - newNotaryNode = net.createNode(networkMapAddress = oldNotaryNode.info.address, advertisedServices = SimpleNotaryService.Type) + newNotaryNode = net.createNode(networkMapAddress = oldNotaryNode.info.address, advertisedServices = ServiceInfo(SimpleNotaryService.Type)) net.runNetwork() // Clear network map registration messages } diff --git a/node/src/test/kotlin/com/r3corda/node/services/NotaryServiceTests.kt b/node/src/test/kotlin/com/r3corda/node/services/NotaryServiceTests.kt index 16951ec7b9..11be246277 100644 --- a/node/src/test/kotlin/com/r3corda/node/services/NotaryServiceTests.kt +++ b/node/src/test/kotlin/com/r3corda/node/services/NotaryServiceTests.kt @@ -2,6 +2,7 @@ package com.r3corda.node.services import com.google.common.util.concurrent.ListenableFuture import com.r3corda.core.contracts.TransactionType +import com.r3corda.core.node.services.ServiceInfo import com.r3corda.core.crypto.DigitalSignature import com.r3corda.core.seconds import com.r3corda.core.transactions.SignedTransaction @@ -32,8 +33,7 @@ class NotaryServiceTests { notaryNode = net.createNode( legalName = DUMMY_NOTARY.name, keyPair = DUMMY_NOTARY_KEY, - advertisedServices = *arrayOf(NetworkMapService.Type, SimpleNotaryService.Type) - ) + advertisedServices = *arrayOf(ServiceInfo(NetworkMapService.Type), ServiceInfo(SimpleNotaryService.Type))) clientNode = net.createNode(networkMapAddress = notaryNode.info.address, keyPair = MINI_CORP_KEY) net.runNetwork() // Clear network map registration messages } diff --git a/node/src/test/kotlin/com/r3corda/node/services/PersistentNetworkMapServiceTest.kt b/node/src/test/kotlin/com/r3corda/node/services/PersistentNetworkMapServiceTest.kt index 9b12d19f17..0206930452 100644 --- a/node/src/test/kotlin/com/r3corda/node/services/PersistentNetworkMapServiceTest.kt +++ b/node/src/test/kotlin/com/r3corda/node/services/PersistentNetworkMapServiceTest.kt @@ -2,22 +2,18 @@ package com.r3corda.node.services import com.r3corda.core.messaging.SingleMessageRecipient import com.r3corda.core.node.NodeInfo -import com.r3corda.core.node.services.ServiceType +import com.r3corda.core.node.services.ServiceInfo import com.r3corda.node.services.api.ServiceHubInternal import com.r3corda.node.services.config.NodeConfiguration import com.r3corda.node.services.network.AbstractNetworkMapService import com.r3corda.node.services.network.InMemoryNetworkMapService import com.r3corda.node.services.network.NetworkMapService import com.r3corda.node.services.network.PersistentNetworkMapService -import com.r3corda.node.utilities.configureDatabase import com.r3corda.node.utilities.databaseTransaction import com.r3corda.testing.node.MockNetwork -import com.r3corda.testing.node.makeTestDataSourceProperties import org.junit.After import org.junit.Before import org.junit.Test -import java.io.Closeable -import java.nio.file.Path import java.security.KeyPair /** @@ -59,7 +55,7 @@ class PersistentNetworkMapServiceTest : AbstractNetworkMapServiceTest() { private object NodeFactory : MockNetwork.Factory { override fun create(config: NodeConfiguration, network: MockNetwork, networkMapAddr: SingleMessageRecipient?, - advertisedServices: Set, id: Int, keyPair: KeyPair?): MockNetwork.MockNode { + advertisedServices: Set, id: Int, keyPair: KeyPair?): MockNetwork.MockNode { return object : MockNetwork.MockNode(config, network, networkMapAddr, advertisedServices, id, keyPair) { override fun makeNetworkMapService() { diff --git a/node/src/test/kotlin/com/r3corda/node/services/ValidatingNotaryServiceTests.kt b/node/src/test/kotlin/com/r3corda/node/services/ValidatingNotaryServiceTests.kt index 95ea4a41da..96250f0aca 100644 --- a/node/src/test/kotlin/com/r3corda/node/services/ValidatingNotaryServiceTests.kt +++ b/node/src/test/kotlin/com/r3corda/node/services/ValidatingNotaryServiceTests.kt @@ -6,6 +6,7 @@ import com.r3corda.core.contracts.DummyContract import com.r3corda.core.contracts.TransactionType import com.r3corda.core.crypto.DigitalSignature import com.r3corda.core.transactions.SignedTransaction +import com.r3corda.core.node.services.ServiceInfo import com.r3corda.core.utilities.DUMMY_NOTARY import com.r3corda.core.utilities.DUMMY_NOTARY_KEY import com.r3corda.node.services.network.NetworkMapService @@ -33,7 +34,7 @@ class ValidatingNotaryServiceTests { notaryNode = net.createNode( legalName = DUMMY_NOTARY.name, keyPair = DUMMY_NOTARY_KEY, - advertisedServices = *arrayOf(NetworkMapService.Type, ValidatingNotaryService.Type) + advertisedServices = *arrayOf(ServiceInfo(NetworkMapService.Type), ServiceInfo(ValidatingNotaryService.Type)) ) clientNode = net.createNode(networkMapAddress = notaryNode.info.address, keyPair = MINI_CORP_KEY) net.runNetwork() // Clear network map registration messages diff --git a/src/main/kotlin/com/r3corda/demos/IRSDemo.kt b/src/main/kotlin/com/r3corda/demos/IRSDemo.kt index 8d6167aeab..28640bd66f 100644 --- a/src/main/kotlin/com/r3corda/demos/IRSDemo.kt +++ b/src/main/kotlin/com/r3corda/demos/IRSDemo.kt @@ -8,11 +8,11 @@ import com.r3corda.core.crypto.Party import com.r3corda.core.logElapsedTime import com.r3corda.core.messaging.SingleMessageRecipient import com.r3corda.core.node.CordaPluginRegistry -import com.r3corda.core.node.NodeInfo -import com.r3corda.core.node.services.ServiceType +import com.r3corda.core.node.services.ServiceInfo import com.r3corda.core.serialization.deserialize import com.r3corda.core.utilities.LogHelper import com.r3corda.demos.api.InterestRateSwapAPI +import com.r3corda.demos.api.NodeInterestRates import com.r3corda.demos.protocols.AutoOfferProtocol import com.r3corda.demos.protocols.ExitServerProtocol import com.r3corda.demos.protocols.UpdateBusinessDayProtocol @@ -21,7 +21,6 @@ import com.r3corda.demos.utilities.putJson import com.r3corda.demos.utilities.uploadFile import com.r3corda.node.internal.AbstractNode import com.r3corda.node.internal.Node -import com.r3corda.demos.api.NodeInterestRates import com.r3corda.node.services.config.NodeConfiguration import com.r3corda.node.services.config.NodeConfigurationFromConfig import com.r3corda.node.services.messaging.NodeMessagingClient @@ -393,15 +392,15 @@ private fun createRecipient(addr: String): SingleMessageRecipient { private fun startNode(params: CliParams.RunNode, networkMap: SingleMessageRecipient): Node { val config = getNodeConfig(params) - val advertisedServices: Set + val advertisedServices: Set val networkMapId = when (params.node) { IRSDemoNode.NodeA -> { - advertisedServices = setOf(NetworkMapService.Type, SimpleNotaryService.Type) + advertisedServices = setOf(ServiceInfo(NetworkMapService.Type), ServiceInfo(SimpleNotaryService.Type)) null } IRSDemoNode.NodeB -> { - advertisedServices = setOf(NodeInterestRates.Type) + advertisedServices = setOf(ServiceInfo(NodeInterestRates.Type)) networkMap } } @@ -461,7 +460,7 @@ private fun loadConfigFile(baseDir: Path, configFile: Path, defaultLegalName: St private fun createIdentities(nodeConf: NodeConfiguration) { val mockNetwork = MockNetwork(false) - val node = MockNetwork.MockNode(nodeConf, mockNetwork, null, setOf(NetworkMapService.Type, SimpleNotaryService.Type), 0, null) + val node = MockNetwork.MockNode(nodeConf, mockNetwork, null, setOf(ServiceInfo(NetworkMapService.Type), ServiceInfo(SimpleNotaryService.Type)), 0, null) node.start() node.stop() } diff --git a/src/main/kotlin/com/r3corda/demos/RateFixDemo.kt b/src/main/kotlin/com/r3corda/demos/RateFixDemo.kt index f832324e1c..3b90583aa2 100644 --- a/src/main/kotlin/com/r3corda/demos/RateFixDemo.kt +++ b/src/main/kotlin/com/r3corda/demos/RateFixDemo.kt @@ -5,7 +5,7 @@ import com.r3corda.contracts.InterestRateSwap import com.r3corda.contracts.asset.Cash import com.r3corda.core.contracts.* import com.r3corda.core.logElapsedTime -import com.r3corda.core.node.services.ServiceType +import com.r3corda.core.node.services.ServiceInfo import com.r3corda.core.utilities.Emoji import com.r3corda.core.utilities.LogHelper import com.r3corda.demos.api.NodeInterestRates @@ -57,7 +57,7 @@ fun main(args: Array) { val rateTolerance = BigDecimal(options.valueOf(rateToleranceArg)) // Bring up node. - val advertisedServices: Set = emptySet() + val advertisedServices: Set = emptySet() val myNetAddr = HostAndPort.fromString(options.valueOf(networkAddressArg)) // TODO: create a base class that provides a default implementation @@ -77,8 +77,10 @@ fun main(args: Array) { val apiAddr = HostAndPort.fromParts(myNetAddr.hostText, myNetAddr.port + 1) - val node = logElapsedTime("Node startup") { Node(myNetAddr, apiAddr, config, networkMapAddr, - advertisedServices, DemoClock()).setup().start() } + val node = logElapsedTime("Node startup") { + Node(myNetAddr, apiAddr, config, networkMapAddr, + advertisedServices, DemoClock()).setup().start() + } node.networkMapRegistrationFuture.get() val notaryNode = node.services.networkMapCache.notaryNodes[0] val rateOracle = node.services.networkMapCache.get(InterestRateSwap.OracleType).first() diff --git a/src/main/kotlin/com/r3corda/demos/TraderDemo.kt b/src/main/kotlin/com/r3corda/demos/TraderDemo.kt index b8e3058c03..377b5d01a8 100644 --- a/src/main/kotlin/com/r3corda/demos/TraderDemo.kt +++ b/src/main/kotlin/com/r3corda/demos/TraderDemo.kt @@ -14,7 +14,7 @@ import com.r3corda.core.crypto.generateKeyPair import com.r3corda.core.days import com.r3corda.core.logElapsedTime import com.r3corda.core.node.NodeInfo -import com.r3corda.core.node.services.ServiceType +import com.r3corda.core.node.services.ServiceInfo import com.r3corda.core.protocols.ProtocolLogic import com.r3corda.core.seconds import com.r3corda.core.success @@ -126,13 +126,13 @@ fun main(args: Array) { } // Which services will this instance of the node provide to the network? - val advertisedServices: Set + val advertisedServices: Set // One of the two servers needs to run the network map and notary services. In such a trivial two-node network // the map is not very helpful, but we need one anyway. So just make the buyer side run the network map as it's // the side that sticks around waiting for the seller. val networkMapId = if (role == Role.BUYER) { - advertisedServices = setOf(NetworkMapService.Type, SimpleNotaryService.Type) + advertisedServices = setOf(ServiceInfo(NetworkMapService.Type), ServiceInfo(SimpleNotaryService.Type)) null } else { advertisedServices = emptySet() diff --git a/src/main/kotlin/com/r3corda/simulation/Simulation.kt b/src/main/kotlin/com/r3corda/simulation/Simulation.kt index 4ea21863d7..a80a06b2ce 100644 --- a/src/main/kotlin/com/r3corda/simulation/Simulation.kt +++ b/src/main/kotlin/com/r3corda/simulation/Simulation.kt @@ -7,7 +7,8 @@ import com.r3corda.core.crypto.generateKeyPair import com.r3corda.core.messaging.SingleMessageRecipient import com.r3corda.core.node.CityDatabase import com.r3corda.core.node.PhysicalLocation -import com.r3corda.core.node.services.ServiceType +import com.r3corda.core.node.services.ServiceInfo +import com.r3corda.core.node.services.containsType import com.r3corda.core.protocols.ProtocolLogic import com.r3corda.core.then import com.r3corda.core.utilities.ProgressTracker @@ -45,7 +46,7 @@ abstract class Simulation(val networkSendManuallyPumped: Boolean, // This puts together a mock network of SimulatedNodes. open class SimulatedNode(config: NodeConfiguration, mockNet: MockNetwork, networkMapAddress: SingleMessageRecipient?, - advertisedServices: Set, id: Int, keyPair: KeyPair?) : MockNetwork.MockNode(config, mockNet, networkMapAddress, advertisedServices, id, keyPair) { + advertisedServices: Set, id: Int, keyPair: KeyPair?) : MockNetwork.MockNode(config, mockNet, networkMapAddress, advertisedServices, id, keyPair) { override fun findMyLocation(): PhysicalLocation? = CityDatabase[configuration.nearestCity] } @@ -53,7 +54,7 @@ abstract class Simulation(val networkSendManuallyPumped: Boolean, var counter = 0 override fun create(config: NodeConfiguration, network: MockNetwork, networkMapAddr: SingleMessageRecipient?, - advertisedServices: Set, id: Int, keyPair: KeyPair?): MockNetwork.MockNode { + advertisedServices: Set, id: Int, keyPair: KeyPair?): MockNetwork.MockNode { val letter = 'A' + counter val city = bankLocations[counter++ % bankLocations.size] @@ -85,8 +86,8 @@ abstract class Simulation(val networkSendManuallyPumped: Boolean, object NetworkMapNodeFactory : MockNetwork.Factory { override fun create(config: NodeConfiguration, network: MockNetwork, - networkMapAddr: SingleMessageRecipient?, advertisedServices: Set, id: Int, keyPair: KeyPair?): MockNetwork.MockNode { - require(advertisedServices.contains(NetworkMapService.Type)) + networkMapAddr: SingleMessageRecipient?, advertisedServices: Set, id: Int, keyPair: KeyPair?): MockNetwork.MockNode { + require(advertisedServices.containsType(NetworkMapService.Type)) // TODO: create a base class that provides a default implementation val cfg = object : NodeConfiguration { @@ -108,8 +109,8 @@ abstract class Simulation(val networkSendManuallyPumped: Boolean, object NotaryNodeFactory : MockNetwork.Factory { override fun create(config: NodeConfiguration, network: MockNetwork, networkMapAddr: SingleMessageRecipient?, - advertisedServices: Set, id: Int, keyPair: KeyPair?): MockNetwork.MockNode { - require(advertisedServices.contains(SimpleNotaryService.Type)) + advertisedServices: Set, id: Int, keyPair: KeyPair?): MockNetwork.MockNode { + require(advertisedServices.containsType(SimpleNotaryService.Type)) // TODO: create a base class that provides a default implementation val cfg = object : NodeConfiguration { @@ -130,8 +131,8 @@ abstract class Simulation(val networkSendManuallyPumped: Boolean, object RatesOracleFactory : MockNetwork.Factory { override fun create(config: NodeConfiguration, network: MockNetwork, networkMapAddr: SingleMessageRecipient?, - advertisedServices: Set, id: Int, keyPair: KeyPair?): MockNetwork.MockNode { - require(advertisedServices.contains(NodeInterestRates.Type)) + advertisedServices: Set, id: Int, keyPair: KeyPair?): MockNetwork.MockNode { + require(advertisedServices.containsType(NodeInterestRates.Type)) // TODO: create a base class that provides a default implementation val cfg = object : NodeConfiguration { @@ -159,7 +160,7 @@ abstract class Simulation(val networkSendManuallyPumped: Boolean, object RegulatorFactory : MockNetwork.Factory { override fun create(config: NodeConfiguration, network: MockNetwork, networkMapAddr: SingleMessageRecipient?, - advertisedServices: Set, id: Int, keyPair: KeyPair?): MockNetwork.MockNode { + advertisedServices: Set, id: Int, keyPair: KeyPair?): MockNetwork.MockNode { // TODO: create a base class that provides a default implementation val cfg = object : NodeConfiguration { @@ -187,12 +188,12 @@ abstract class Simulation(val networkSendManuallyPumped: Boolean, val network = MockNetwork(networkSendManuallyPumped, runAsync) // This one must come first. val networkMap: SimulatedNode - = network.createNode(null, nodeFactory = NetworkMapNodeFactory, advertisedServices = NetworkMapService.Type) as SimulatedNode + = network.createNode(null, nodeFactory = NetworkMapNodeFactory, advertisedServices = ServiceInfo(NetworkMapService.Type)) as SimulatedNode val notary: SimulatedNode - = network.createNode(networkMap.info.address, nodeFactory = NotaryNodeFactory, advertisedServices = SimpleNotaryService.Type) as SimulatedNode + = network.createNode(networkMap.info.address, nodeFactory = NotaryNodeFactory, advertisedServices = ServiceInfo(SimpleNotaryService.Type)) as SimulatedNode val regulators: List = listOf(network.createNode(networkMap.info.address, start = false, nodeFactory = RegulatorFactory) as SimulatedNode) val ratesOracle: SimulatedNode - = network.createNode(networkMap.info.address, start = false, nodeFactory = RatesOracleFactory, advertisedServices = NodeInterestRates.Type) as SimulatedNode + = network.createNode(networkMap.info.address, start = false, nodeFactory = RatesOracleFactory, advertisedServices = ServiceInfo(NodeInterestRates.Type)) as SimulatedNode // All nodes must be in one of these two lists for the purposes of the visualiser tool. val serviceProviders: List = listOf(notary, ratesOracle, networkMap) diff --git a/test-utils/src/main/kotlin/com/r3corda/testing/node/MockNode.kt b/test-utils/src/main/kotlin/com/r3corda/testing/node/MockNode.kt index 4943d07600..0ce6009694 100644 --- a/test-utils/src/main/kotlin/com/r3corda/testing/node/MockNode.kt +++ b/test-utils/src/main/kotlin/com/r3corda/testing/node/MockNode.kt @@ -13,7 +13,7 @@ import com.r3corda.core.messaging.runOnNextMessage import com.r3corda.core.messaging.send import com.r3corda.core.node.PhysicalLocation import com.r3corda.core.node.services.KeyManagementService -import com.r3corda.core.node.services.ServiceType +import com.r3corda.core.node.services.ServiceInfo import com.r3corda.core.node.services.VaultService import com.r3corda.core.random63BitValue import com.r3corda.core.serialization.deserialize @@ -28,7 +28,9 @@ import com.r3corda.node.services.messaging.CordaRPCOps import com.r3corda.node.services.network.InMemoryNetworkMapService import com.r3corda.node.services.persistence.DBCheckpointStorage import com.r3corda.node.services.persistence.PerFileCheckpointStorage +import com.r3corda.node.services.network.NetworkMapService import com.r3corda.node.services.transactions.InMemoryUniquenessProvider +import com.r3corda.node.services.transactions.SimpleNotaryService import com.r3corda.node.utilities.databaseTransaction import com.r3corda.protocols.ServiceRequestMessage import org.slf4j.Logger @@ -73,18 +75,18 @@ class MockNetwork(private val networkSendManuallyPumped: Boolean = false, /** Allows customisation of how nodes are created. */ interface Factory { fun create(config: NodeConfiguration, network: MockNetwork, networkMapAddr: SingleMessageRecipient?, - advertisedServices: Set, id: Int, keyPair: KeyPair?): MockNode + advertisedServices: Set, id: Int, keyPair: KeyPair?): MockNode } object DefaultFactory : Factory { override fun create(config: NodeConfiguration, network: MockNetwork, networkMapAddr: SingleMessageRecipient?, - advertisedServices: Set, id: Int, keyPair: KeyPair?): MockNode { + advertisedServices: Set, id: Int, keyPair: KeyPair?): MockNode { return MockNode(config, network, networkMapAddr, advertisedServices, id, keyPair) } } open class MockNode(config: NodeConfiguration, val mockNet: MockNetwork, networkMapAddr: SingleMessageRecipient?, - advertisedServices: Set, val id: Int, val keyPair: KeyPair?) : AbstractNode(config, networkMapAddr, advertisedServices, TestClock()) { + advertisedServices: Set, val id: Int, val keyPair: KeyPair?) : AbstractNode(config, networkMapAddr, advertisedServices, TestClock()) { override val log: Logger = loggerFor() override val serverThread: com.r3corda.node.utilities.AffinityExecutor = if (mockNet.threadPerNode) @@ -179,7 +181,7 @@ class MockNetwork(private val networkSendManuallyPumped: Boolean = false, /** Returns a node, optionally created by the passed factory method. */ fun createNode(networkMapAddress: SingleMessageRecipient? = null, forcedID: Int = -1, nodeFactory: Factory = defaultFactory, start: Boolean = true, legalName: String? = null, keyPair: KeyPair? = null, - vararg advertisedServices: ServiceType): MockNode { + vararg advertisedServices: ServiceInfo): MockNode { val newNode = forcedID == -1 val id = if (newNode) counter++ else forcedID @@ -238,7 +240,7 @@ class MockNetwork(private val networkSendManuallyPumped: Boolean = false, fun createTwoNodes(nodeFactory: Factory = defaultFactory, notaryKeyPair: KeyPair? = null): Pair { require(nodes.isEmpty()) return Pair( - createNode(null, -1, nodeFactory, true, null, notaryKeyPair, com.r3corda.node.services.network.NetworkMapService.Type, com.r3corda.node.services.transactions.SimpleNotaryService.Type), + createNode(null, -1, nodeFactory, true, null, notaryKeyPair, ServiceInfo(NetworkMapService.Type), ServiceInfo(SimpleNotaryService.Type)), createNode(nodes[0].info.address, -1, nodeFactory, true, null) ) } @@ -255,9 +257,9 @@ class MockNetwork(private val networkSendManuallyPumped: Boolean = false, */ fun createSomeNodes(numPartyNodes: Int = 2, nodeFactory: Factory = defaultFactory, notaryKeyPair: KeyPair? = DUMMY_NOTARY_KEY): BasketOfNodes { require(nodes.isEmpty()) - val mapNode = createNode(null, nodeFactory = nodeFactory, advertisedServices = com.r3corda.node.services.network.NetworkMapService.Type) + val mapNode = createNode(null, nodeFactory = nodeFactory, advertisedServices = ServiceInfo(NetworkMapService.Type)) val notaryNode = createNode(mapNode.info.address, nodeFactory = nodeFactory, keyPair = notaryKeyPair, - advertisedServices = com.r3corda.node.services.transactions.SimpleNotaryService.Type) + advertisedServices = ServiceInfo(SimpleNotaryService.Type)) val nodes = ArrayList() repeat(numPartyNodes) { nodes += createPartyNode(mapNode.info.address) @@ -266,7 +268,7 @@ class MockNetwork(private val networkSendManuallyPumped: Boolean = false, } fun createNotaryNode(legalName: String? = null, keyPair: KeyPair? = null): MockNode { - return createNode(null, -1, defaultFactory, true, legalName, keyPair, com.r3corda.node.services.network.NetworkMapService.Type, com.r3corda.node.services.transactions.SimpleNotaryService.Type) + return createNode(null, -1, defaultFactory, true, legalName, keyPair, ServiceInfo(NetworkMapService.Type), ServiceInfo(SimpleNotaryService.Type)) } fun createPartyNode(networkMapAddr: SingleMessageRecipient, legalName: String? = null, keyPair: KeyPair? = null): MockNode {