mirror of
https://github.com/corda/corda.git
synced 2025-02-21 17:56:54 +00:00
Minor: rename NetworkMap -> NetworkMapService for consistency
This commit is contained in:
parent
2754546942
commit
fce799726f
@ -23,11 +23,11 @@ data class LegallyIdentifiableNode(val address: SingleMessageRecipient, val iden
|
|||||||
*
|
*
|
||||||
* This interface assumes fast, synchronous access to an in-memory map.
|
* This interface assumes fast, synchronous access to an in-memory map.
|
||||||
*/
|
*/
|
||||||
interface NetworkMap {
|
interface NetworkMapService {
|
||||||
val timestampingNodes: List<LegallyIdentifiableNode>
|
val timestampingNodes: List<LegallyIdentifiableNode>
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Move this to the test tree once a real network map is implemented and this scaffolding is no longer needed.
|
// TODO: Move this to the test tree once a real network map is implemented and this scaffolding is no longer needed.
|
||||||
class MockNetworkMap : NetworkMap {
|
class MockNetworkMapService : NetworkMapService {
|
||||||
override val timestampingNodes = Collections.synchronizedList(ArrayList<LegallyIdentifiableNode>())
|
override val timestampingNodes = Collections.synchronizedList(ArrayList<LegallyIdentifiableNode>())
|
||||||
}
|
}
|
@ -55,7 +55,7 @@ abstract class AbstractNode(val dir: Path, val configuration: NodeConfiguration,
|
|||||||
|
|
||||||
val services = object : ServiceHub {
|
val services = object : ServiceHub {
|
||||||
override val networkService: MessagingService get() = net
|
override val networkService: MessagingService get() = net
|
||||||
override val networkMapService: NetworkMap = MockNetworkMap()
|
override val networkMapService: NetworkMapService = MockNetworkMapService()
|
||||||
override val storageService: StorageService get() = storage
|
override val storageService: StorageService get() = storage
|
||||||
override val walletService: WalletService get() = wallet
|
override val walletService: WalletService get() = wallet
|
||||||
override val keyManagementService: KeyManagementService get() = keyManagement
|
override val keyManagementService: KeyManagementService get() = keyManagement
|
||||||
@ -107,7 +107,7 @@ abstract class AbstractNode(val dir: Path, val configuration: NodeConfiguration,
|
|||||||
inNodeTimestampingService = NodeTimestamperService(net, storage.myLegalIdentity, storage.myLegalIdentityKey)
|
inNodeTimestampingService = NodeTimestamperService(net, storage.myLegalIdentity, storage.myLegalIdentityKey)
|
||||||
LegallyIdentifiableNode(net.myAddress, storage.myLegalIdentity)
|
LegallyIdentifiableNode(net.myAddress, storage.myLegalIdentity)
|
||||||
}
|
}
|
||||||
(services.networkMapService as MockNetworkMap).timestampingNodes.add(tsid)
|
(services.networkMapService as MockNetworkMapService).timestampingNodes.add(tsid)
|
||||||
|
|
||||||
identity = makeIdentityService()
|
identity = makeIdentityService()
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ package core.node.services
|
|||||||
import core.*
|
import core.*
|
||||||
import core.crypto.SecureHash
|
import core.crypto.SecureHash
|
||||||
import core.messaging.MessagingService
|
import core.messaging.MessagingService
|
||||||
import core.messaging.NetworkMap
|
import core.messaging.NetworkMapService
|
||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
import java.security.KeyPair
|
import java.security.KeyPair
|
||||||
import java.security.PrivateKey
|
import java.security.PrivateKey
|
||||||
@ -154,7 +154,7 @@ interface ServiceHub {
|
|||||||
val identityService: IdentityService
|
val identityService: IdentityService
|
||||||
val storageService: StorageService
|
val storageService: StorageService
|
||||||
val networkService: MessagingService
|
val networkService: MessagingService
|
||||||
val networkMapService: NetworkMap
|
val networkMapService: NetworkMapService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a [LedgerTransaction], looks up all its dependencies in the local database, uses the identity service to map
|
* Given a [LedgerTransaction], looks up all its dependencies in the local database, uses the identity service to map
|
||||||
|
@ -10,8 +10,8 @@ package core
|
|||||||
|
|
||||||
import core.crypto.*
|
import core.crypto.*
|
||||||
import core.messaging.MessagingService
|
import core.messaging.MessagingService
|
||||||
import core.messaging.MockNetworkMap
|
import core.messaging.MockNetworkMapService
|
||||||
import core.messaging.NetworkMap
|
import core.messaging.NetworkMapService
|
||||||
import core.node.services.*
|
import core.node.services.*
|
||||||
import core.serialization.SerializedBytes
|
import core.serialization.SerializedBytes
|
||||||
import core.serialization.deserialize
|
import core.serialization.deserialize
|
||||||
@ -154,7 +154,7 @@ class MockServices(
|
|||||||
val net: MessagingService? = null,
|
val net: MessagingService? = null,
|
||||||
val identity: IdentityService? = MockIdentityService,
|
val identity: IdentityService? = MockIdentityService,
|
||||||
val storage: StorageService? = MockStorageService(),
|
val storage: StorageService? = MockStorageService(),
|
||||||
val networkMap: NetworkMap? = MockNetworkMap()
|
val networkMap: NetworkMapService? = MockNetworkMapService()
|
||||||
) : ServiceHub {
|
) : ServiceHub {
|
||||||
override val walletService: WalletService
|
override val walletService: WalletService
|
||||||
get() = wallet ?: throw UnsupportedOperationException()
|
get() = wallet ?: throw UnsupportedOperationException()
|
||||||
@ -164,7 +164,7 @@ class MockServices(
|
|||||||
get() = identity ?: throw UnsupportedOperationException()
|
get() = identity ?: throw UnsupportedOperationException()
|
||||||
override val networkService: MessagingService
|
override val networkService: MessagingService
|
||||||
get() = net ?: throw UnsupportedOperationException()
|
get() = net ?: throw UnsupportedOperationException()
|
||||||
override val networkMapService: NetworkMap
|
override val networkMapService: NetworkMapService
|
||||||
get() = networkMap ?: throw UnsupportedOperationException()
|
get() = networkMap ?: throw UnsupportedOperationException()
|
||||||
override val storageService: StorageService
|
override val storageService: StorageService
|
||||||
get() = storage ?: throw UnsupportedOperationException()
|
get() = storage ?: throw UnsupportedOperationException()
|
||||||
|
@ -58,7 +58,7 @@ class TimestamperNodeServiceTest : TestWithInMemoryNetwork() {
|
|||||||
mockServices = MockServices(net = serviceMessaging.second, storage = MockStorageService())
|
mockServices = MockServices(net = serviceMessaging.second, storage = MockStorageService())
|
||||||
|
|
||||||
val timestampingNodeID = network.setupTimestampingNode(true).first
|
val timestampingNodeID = network.setupTimestampingNode(true).first
|
||||||
(mockServices.networkMapService as MockNetworkMap).timestampingNodes.add(timestampingNodeID)
|
(mockServices.networkMapService as MockNetworkMapService).timestampingNodes.add(timestampingNodeID)
|
||||||
serverKey = timestampingNodeID.identity.owningKey
|
serverKey = timestampingNodeID.identity.owningKey
|
||||||
|
|
||||||
// And a separate one to be tested directly, to make the unit tests a bit faster.
|
// And a separate one to be tested directly, to make the unit tests a bit faster.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user