Minor: Replace MockServices with a new class that's in core instead of node, old class becomes MockServiceHubInternal.

This commit is contained in:
Mike Hearn
2016-08-02 17:01:17 +02:00
parent 301d787e45
commit c2aee2d4e8
8 changed files with 15 additions and 16 deletions

View File

@ -19,7 +19,7 @@ import com.r3corda.node.services.statemachine.StateMachineManager
import com.r3corda.node.services.wallet.NodeWalletService
import java.time.Clock
open class MockServices(
open class MockServiceHubInternal(
customWallet: WalletService? = null,
val keyManagement: KeyManagementService? = null,
val net: MessagingServiceInternal? = null,

View File

@ -60,7 +60,7 @@ class NodeSchedulerServiceTest : SingletonSerializeAsToken() {
init {
val kms = MockKeyManagementService(ALICE_KEY)
val mockMessagingService = InMemoryMessagingNetwork(false).InMemoryMessaging(false, InMemoryMessagingNetwork.Handle(0, "None"))
val mockServices = object : MockServices(overrideClock = testClock, keyManagement = kms, net = mockMessagingService), TestReference {
val mockServices = object : MockServiceHubInternal(overrideClock = testClock, keyManagement = kms, net = mockMessagingService), TestReference {
override val testReference = this@NodeSchedulerServiceTest
}
services = mockServices

View File

@ -8,7 +8,7 @@ import com.r3corda.core.contracts.*
import com.r3corda.core.crypto.SecureHash
import com.r3corda.core.node.services.WalletService
import com.r3corda.core.node.services.testing.MockStorageService
import com.r3corda.core.node.services.testing.UnitTestServices
import com.r3corda.core.node.services.testing.MockServices
import com.r3corda.core.testing.*
import com.r3corda.core.utilities.BriefLogFormatter
import com.r3corda.node.services.wallet.NodeWalletService
@ -23,13 +23,13 @@ import kotlin.test.assertNull
// TODO: Move this to the cash contract tests once mock services are further split up.
class WalletWithCashTest {
lateinit var services: UnitTestServices
lateinit var services: MockServices
val wallet: WalletService get() = services.walletService
@Before
fun setUp() {
BriefLogFormatter.loggingOn(NodeWalletService::class)
services = object : UnitTestServices() {
services = object : MockServices() {
override val walletService: WalletService = NodeWalletService(this)
override fun recordTransactions(txs: Iterable<SignedTransaction>) {

View File

@ -4,7 +4,7 @@ import co.paralleluniverse.fibers.Fiber
import co.paralleluniverse.fibers.Suspendable
import com.r3corda.core.messaging.MessagingService
import com.r3corda.core.protocols.ProtocolLogic
import com.r3corda.node.services.MockServices
import com.r3corda.node.services.MockServiceHubInternal
import com.r3corda.node.services.api.Checkpoint
import com.r3corda.node.services.api.CheckpointStorage
import com.r3corda.node.services.api.MessagingServiceInternal
@ -45,7 +45,7 @@ class StateMachineManagerTests {
assertThat(protocol.lazyTime).isNotNull()
}
private fun createManager() = StateMachineManager(object : MockServices() {
private fun createManager() = StateMachineManager(object : MockServiceHubInternal() {
override val networkService: MessagingServiceInternal get() = network
}, emptyList(), checkpointStorage, AffinityExecutor.SAME_THREAD)