Minor: rename NetworkMap -> NetworkMapService for consistency

This commit is contained in:
Mike Hearn 2016-03-10 17:43:10 +01:00
parent 2754546942
commit fce799726f
5 changed files with 11 additions and 11 deletions

View File

@ -23,11 +23,11 @@ data class LegallyIdentifiableNode(val address: SingleMessageRecipient, val iden
*
* This interface assumes fast, synchronous access to an in-memory map.
*/
interface NetworkMap {
interface NetworkMapService {
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.
class MockNetworkMap : NetworkMap {
class MockNetworkMapService : NetworkMapService {
override val timestampingNodes = Collections.synchronizedList(ArrayList<LegallyIdentifiableNode>())
}

View File

@ -55,7 +55,7 @@ abstract class AbstractNode(val dir: Path, val configuration: NodeConfiguration,
val services = object : ServiceHub {
override val networkService: MessagingService get() = net
override val networkMapService: NetworkMap = MockNetworkMap()
override val networkMapService: NetworkMapService = MockNetworkMapService()
override val storageService: StorageService get() = storage
override val walletService: WalletService get() = wallet
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)
LegallyIdentifiableNode(net.myAddress, storage.myLegalIdentity)
}
(services.networkMapService as MockNetworkMap).timestampingNodes.add(tsid)
(services.networkMapService as MockNetworkMapService).timestampingNodes.add(tsid)
identity = makeIdentityService()

View File

@ -11,7 +11,7 @@ package core.node.services
import core.*
import core.crypto.SecureHash
import core.messaging.MessagingService
import core.messaging.NetworkMap
import core.messaging.NetworkMapService
import java.io.InputStream
import java.security.KeyPair
import java.security.PrivateKey
@ -154,7 +154,7 @@ interface ServiceHub {
val identityService: IdentityService
val storageService: StorageService
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

View File

@ -10,8 +10,8 @@ package core
import core.crypto.*
import core.messaging.MessagingService
import core.messaging.MockNetworkMap
import core.messaging.NetworkMap
import core.messaging.MockNetworkMapService
import core.messaging.NetworkMapService
import core.node.services.*
import core.serialization.SerializedBytes
import core.serialization.deserialize
@ -154,7 +154,7 @@ class MockServices(
val net: MessagingService? = null,
val identity: IdentityService? = MockIdentityService,
val storage: StorageService? = MockStorageService(),
val networkMap: NetworkMap? = MockNetworkMap()
val networkMap: NetworkMapService? = MockNetworkMapService()
) : ServiceHub {
override val walletService: WalletService
get() = wallet ?: throw UnsupportedOperationException()
@ -164,7 +164,7 @@ class MockServices(
get() = identity ?: throw UnsupportedOperationException()
override val networkService: MessagingService
get() = net ?: throw UnsupportedOperationException()
override val networkMapService: NetworkMap
override val networkMapService: NetworkMapService
get() = networkMap ?: throw UnsupportedOperationException()
override val storageService: StorageService
get() = storage ?: throw UnsupportedOperationException()

View File

@ -58,7 +58,7 @@ class TimestamperNodeServiceTest : TestWithInMemoryNetwork() {
mockServices = MockServices(net = serviceMessaging.second, storage = MockStorageService())
val timestampingNodeID = network.setupTimestampingNode(true).first
(mockServices.networkMapService as MockNetworkMap).timestampingNodes.add(timestampingNodeID)
(mockServices.networkMapService as MockNetworkMapService).timestampingNodes.add(timestampingNodeID)
serverKey = timestampingNodeID.identity.owningKey
// And a separate one to be tested directly, to make the unit tests a bit faster.