mirror of
https://github.com/corda/corda.git
synced 2024-12-28 00:38:55 +00:00
Distributed notary setup fixes (#606)
* MySQL notary is clustered notary * Fix registration tool app class * Allow config file without parent * Fix `MySQLNotaryServiceTest`
This commit is contained in:
parent
47e2f5e8c9
commit
f6e14b8d4d
@ -39,7 +39,7 @@ configurations {
|
||||
|
||||
task buildRegistrationTool(type: FatCapsule, dependsOn: 'jar') {
|
||||
group = "build"
|
||||
applicationClass 'com.r3.corda.networkmanage.registration.RegistrationToolKt'
|
||||
applicationClass 'com.r3.corda.networkmanage.registration.MainKt'
|
||||
archiveName "registration-tool-${version}.jar"
|
||||
capsuleManifest {
|
||||
applicationVersion = corda_release_version
|
||||
|
@ -22,6 +22,7 @@ import net.corda.nodeapi.internal.config.SSLConfiguration
|
||||
import net.corda.nodeapi.internal.config.parseAs
|
||||
import java.net.URL
|
||||
import java.nio.file.Path
|
||||
import java.nio.file.Paths
|
||||
|
||||
fun RegistrationOption.runRegistration() {
|
||||
val config = ConfigFactory.parseFile(configFile.toFile(), ConfigParseOptions.defaults().setAllowMissing(false))
|
||||
@ -31,7 +32,9 @@ fun RegistrationOption.runRegistration() {
|
||||
val sslConfig = object : SSLConfiguration {
|
||||
override val keyStorePassword: String by lazy { config.keyStorePassword ?: readPassword("Node Keystore password:") }
|
||||
override val trustStorePassword: String by lazy { config.trustStorePassword ?: readPassword("Node TrustStore password:") }
|
||||
override val certificatesDirectory: Path = configFile.parent / "certificates"
|
||||
val parent = configFile.parent
|
||||
override val certificatesDirectory: Path = if (parent != null) parent / "certificates"
|
||||
else Paths.get("certificates")
|
||||
}
|
||||
|
||||
NetworkRegistrationHelper(sslConfig,
|
||||
|
@ -51,6 +51,7 @@ import kotlin.test.assertFailsWith
|
||||
class MySQLNotaryServiceTests : IntegrationTest() {
|
||||
companion object {
|
||||
val notaryName = CordaX500Name("MySQL Notary Service", "Zurich", "CH")
|
||||
val notaryNodeName = CordaX500Name("Notary Replica 1", "Zurich", "CH")
|
||||
@ClassRule
|
||||
@JvmField
|
||||
val databaseSchemas = IntegrationTestSchemas("node_0", "node_1", "node_2")
|
||||
@ -64,11 +65,10 @@ class MySQLNotaryServiceTests : IntegrationTest() {
|
||||
@Before
|
||||
fun before() {
|
||||
mockNet = InternalMockNetwork(cordappPackages = listOf("net.corda.testing.contracts"))
|
||||
notaryParty = DevIdentityGenerator.installKeyStoreWithNodeIdentity(mockNet.baseDirectory(mockNet.nextNodeId), notaryName)
|
||||
notaryParty = DevIdentityGenerator.generateDistributedNotarySingularIdentity(listOf(mockNet.baseDirectory(mockNet.nextNodeId)), notaryName)
|
||||
val networkParameters = NetworkParametersCopier(testNetworkParameters(listOf(NotaryInfo(notaryParty, false))))
|
||||
val notaryNodeUnstarted = createNotaryNode()
|
||||
val nodeUnstarted = mockNet.createUnstartedNode()
|
||||
|
||||
val startedNodes = listOf(notaryNodeUnstarted, nodeUnstarted).map { n ->
|
||||
networkParameters.install(mockNet.baseDirectory(n.id))
|
||||
n.start()
|
||||
@ -144,7 +144,7 @@ class MySQLNotaryServiceTests : IntegrationTest() {
|
||||
}
|
||||
return mockNet.createUnstartedNode(
|
||||
InternalMockNodeParameters(
|
||||
legalName = notaryName,
|
||||
legalName = notaryNodeName,
|
||||
entropyRoot = BigInteger.valueOf(60L),
|
||||
configOverrides = {
|
||||
val notaryConfig = NotaryConfig(validating = false, mysql = MySQLConfiguration(dataStoreProperties))
|
||||
|
@ -112,7 +112,7 @@ data class NotaryConfig(val validating: Boolean,
|
||||
"raft, bftSMaRt, custom, and mysql configs cannot be specified together"
|
||||
}
|
||||
}
|
||||
val isClusterConfig: Boolean get() = raft != null || bftSMaRt != null
|
||||
val isClusterConfig: Boolean get() = raft != null || bftSMaRt != null || mysql != null
|
||||
}
|
||||
|
||||
data class MySQLConfiguration(
|
||||
|
Loading…
Reference in New Issue
Block a user