mirror of
https://github.com/corda/corda.git
synced 2024-12-19 13:08:04 +00:00
Add extension method to check for flags devModeOptions, formatting
This commit is contained in:
parent
74595c65c9
commit
0cbee046f9
@ -31,6 +31,7 @@ import net.corda.node.internal.InitiatedFlowFactory
|
||||
import net.corda.node.services.api.Checkpoint
|
||||
import net.corda.node.services.api.CheckpointStorage
|
||||
import net.corda.node.services.api.ServiceHubInternal
|
||||
import net.corda.node.services.config.isDevModeOptionsFlagSet
|
||||
import net.corda.node.services.messaging.ReceivedMessage
|
||||
import net.corda.node.services.messaging.TopicSession
|
||||
import net.corda.node.utilities.*
|
||||
@ -43,7 +44,6 @@ import rx.subjects.PublishSubject
|
||||
import java.io.NotSerializableException
|
||||
import java.util.*
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import java.util.concurrent.Executors
|
||||
import java.util.concurrent.TimeUnit.SECONDS
|
||||
import javax.annotation.concurrent.ThreadSafe
|
||||
|
||||
@ -89,7 +89,7 @@ class StateMachineManagerImpl(
|
||||
private val scheduler = FiberScheduler()
|
||||
private val mutex = ThreadBox(InnerState())
|
||||
// This thread (only enabled in dev mode) deserialises checkpoints in the background to shake out bugs in checkpoint restore.
|
||||
private val checkpointCheckerThread = if (serviceHub.configuration.devMode && serviceHub.configuration.debugOptions?.getProperty("disableCheckpointChecking") != "true") newNamedSingleThreadExecutor("CheckpointChecker") else null
|
||||
private val checkpointCheckerThread = if (serviceHub.configuration.devMode && !serviceHub.configuration.isDevModeOptionsFlagSet("disableCheckpointChecking")) newNamedSingleThreadExecutor("CheckpointChecker") else null
|
||||
|
||||
@Volatile private var unrestorableCheckpoints = false
|
||||
|
||||
|
@ -71,17 +71,17 @@ class FullNodeConfigurationTest {
|
||||
additionalNodeInfoPollingFrequencyMsec = 5.seconds.toMillis())
|
||||
|
||||
fun configDebugOptions(devMode: Boolean, debugOptions: Properties?) {
|
||||
testConfiguration.copy(devMode = devMode, debugOptions = debugOptions)
|
||||
testConfiguration.copy(devMode = devMode, devModeOptions = debugOptions)
|
||||
}
|
||||
val debugOptions = Properties()
|
||||
configDebugOptions(true, debugOptions)
|
||||
configDebugOptions(true,null)
|
||||
assertThatThrownBy{configDebugOptions(false, debugOptions)}.hasMessageMatching("Cannot use debugOptions outside of dev mode")
|
||||
assertThatThrownBy{configDebugOptions(false, debugOptions)}.hasMessageMatching( "Cannot use devModeOptions outside of dev mode" )
|
||||
configDebugOptions(false,null)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `check properties behave as expected`()
|
||||
fun `check devModeOptions flag helper`()
|
||||
{
|
||||
val testConfiguration = FullNodeConfiguration(
|
||||
baseDirectory = Paths.get("."),
|
||||
@ -106,13 +106,13 @@ class FullNodeConfigurationTest {
|
||||
additionalNodeInfoPollingFrequencyMsec = 5.seconds.toMillis())
|
||||
|
||||
fun configDebugOptions(devMode: Boolean, debugOptions: Properties?) : NodeConfiguration {
|
||||
return testConfiguration.copy(devMode = devMode, debugOptions = debugOptions)
|
||||
return testConfiguration.copy(devMode = devMode, devModeOptions = debugOptions)
|
||||
}
|
||||
val debugOptions = Properties()
|
||||
assertFalse { configDebugOptions(true, debugOptions).debugOptions?.getProperty("foo") == "bar"}
|
||||
assertFalse { configDebugOptions(true,null).debugOptions?.getProperty("foo") == "bar"}
|
||||
debugOptions.setProperty("foo", "bar")
|
||||
assert( configDebugOptions(true, debugOptions).debugOptions?.getProperty("foo") == "bar")
|
||||
assertFalse { configDebugOptions(true,null).isDevModeOptionsFlagSet("foo")}
|
||||
assertFalse { configDebugOptions(true,debugOptions).isDevModeOptionsFlagSet("foo")}
|
||||
debugOptions.setProperty("foo", "tRuE")
|
||||
assert( configDebugOptions(true, debugOptions).isDevModeOptionsFlagSet("foo"))
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user