mirror of
https://github.com/corda/corda.git
synced 2024-12-23 23:02:29 +00:00
Merge remote-tracking branch 'remotes/origin/master' into colljos-vault-code-clean-up-refactor
# Conflicts: # core/src/main/kotlin/com/r3corda/core/contracts/Structures.kt # node/src/test/kotlin/com/r3corda/node/services/NodeSchedulerServiceTest.kt Fixed conflict.
This commit is contained in:
parent
7d080c39df
commit
74e89181da
@ -72,13 +72,6 @@ class NodeSchedulerServiceTest : SingletonSerializeAsToken() {
|
|||||||
val testReference: NodeSchedulerServiceTest
|
val testReference: NodeSchedulerServiceTest
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
|
||||||
val kms = MockKeyManagementService(ALICE_KEY)
|
|
||||||
val mockMessagingService = InMemoryMessagingNetwork(false).InMemoryMessaging(false, InMemoryMessagingNetwork.Handle(0, "None"), AffinityExecutor.ServiceAffinityExecutor("test", 1), persistenceTx = { it() })
|
|
||||||
services = object : MockServiceHubInternal(overrideClock = testClock, keyManagement = kms, net = mockMessagingService), TestReference {
|
|
||||||
override val testReference = this@NodeSchedulerServiceTest
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setup() {
|
fun setup() {
|
||||||
@ -103,22 +96,22 @@ class NodeSchedulerServiceTest : SingletonSerializeAsToken() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
val kms = MockKeyManagementService(ALICE_KEY)
|
val kms = MockKeyManagementService(ALICE_KEY)
|
||||||
val mockMessagingService = InMemoryMessagingNetwork(false).InMemoryMessaging(false, InMemoryMessagingNetwork.Handle(0, "None"), AffinityExecutor.ServiceAffinityExecutor("test", 1), persistenceTx = { it() })
|
val mockMessagingService = InMemoryMessagingNetwork(false).InMemoryMessaging(false, InMemoryMessagingNetwork.Handle(0, "None"), AffinityExecutor.ServiceAffinityExecutor("test", 1), database)
|
||||||
services = object : MockServiceHubInternal(customVault = services1.vaultService, overrideClock = testClock, keyManagement = kms, net = mockMessagingService), TestReference {
|
services = object : MockServiceHubInternal(overrideClock = testClock, keyManagement = kms, net = mockMessagingService), TestReference {
|
||||||
override val testReference = this@NodeSchedulerServiceTest
|
override val testReference = this@NodeSchedulerServiceTest
|
||||||
}
|
}
|
||||||
}
|
scheduler = NodeSchedulerService(database, services, factory, schedulerGatedExecutor)
|
||||||
|
smmExecutor = AffinityExecutor.ServiceAffinityExecutor("test", 1)
|
||||||
scheduler = NodeSchedulerService(database, services, factory, schedulerGatedExecutor)
|
val mockSMM = StateMachineManager(services, listOf(services, scheduler), DBCheckpointStorage(), smmExecutor, database)
|
||||||
smmExecutor = AffinityExecutor.ServiceAffinityExecutor("test", 1)
|
mockSMM.changes.subscribe { change ->
|
||||||
val mockSMM = StateMachineManager(services, listOf(services), PerFileCheckpointStorage(fs.getPath("checkpoints")), smmExecutor, database)
|
if (change.addOrRemove == AddOrRemove.REMOVE && mockSMM.allStateMachines.isEmpty()) {
|
||||||
mockSMM.changes.subscribe { change ->
|
smmHasRemovedAllProtocols.countDown()
|
||||||
if (change.addOrRemove == AddOrRemove.REMOVE && mockSMM.allStateMachines.isEmpty()) {
|
}
|
||||||
smmHasRemovedAllProtocols.countDown()
|
|
||||||
}
|
}
|
||||||
|
mockSMM.start()
|
||||||
|
services.smm = mockSMM
|
||||||
|
scheduler.start()
|
||||||
}
|
}
|
||||||
mockSMM.start()
|
|
||||||
services.smm = mockSMM
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
@ -285,9 +278,7 @@ class NodeSchedulerServiceTest : SingletonSerializeAsToken() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun scheduleTX(instant: Instant, increment: Int = 1): ScheduledStateRef? {
|
private fun scheduleTX(instant: Instant, increment: Int = 1): ScheduledStateRef? {
|
||||||
|
|
||||||
var scheduledRef: ScheduledStateRef? = null
|
var scheduledRef: ScheduledStateRef? = null
|
||||||
|
|
||||||
databaseTransaction(database) {
|
databaseTransaction(database) {
|
||||||
apply {
|
apply {
|
||||||
val freshKey = services.keyManagementService.freshKey()
|
val freshKey = services.keyManagementService.freshKey()
|
||||||
@ -299,9 +290,10 @@ class NodeSchedulerServiceTest : SingletonSerializeAsToken() {
|
|||||||
}.toSignedTransaction()
|
}.toSignedTransaction()
|
||||||
val txHash = usefulTX.id
|
val txHash = usefulTX.id
|
||||||
|
|
||||||
services.recordTransactions(usefulTX)
|
services.recordTransactions(usefulTX)
|
||||||
scheduledRef = ScheduledStateRef(StateRef(txHash, 0), state.instant)
|
scheduledRef = ScheduledStateRef(StateRef(txHash, 0), state.instant)
|
||||||
scheduler.scheduleStateActivity(scheduledRef!!)
|
scheduler.scheduleStateActivity(scheduledRef!!)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return scheduledRef
|
return scheduledRef
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user