mirror of
https://github.com/corda/corda.git
synced 2025-06-13 04:38:19 +00:00
Add node-api, split minimal node functionality, OutOfProcessTransactionVerifierService
This commit is contained in:
@ -0,0 +1,9 @@
|
||||
myLegalName : "Bank A"
|
||||
nearestCity : "London"
|
||||
p2pAddress : "my-corda-node:10002"
|
||||
webAddress : "localhost:10003"
|
||||
networkMapService : {
|
||||
address : "my-network-map:10000"
|
||||
legalName : "Network Map Service"
|
||||
}
|
||||
verifierType: "OutOfProcess"
|
@ -0,0 +1,3 @@
|
||||
nodeHostAndPort: "my-corda-node:10002"
|
||||
keyStorePassword : "cordacadevpass"
|
||||
trustStorePassword : "trustpass"
|
@ -0,0 +1,52 @@
|
||||
package net.corda.docs
|
||||
|
||||
import net.corda.node.services.config.ConfigHelper
|
||||
import net.corda.node.services.config.FullNodeConfiguration
|
||||
import net.corda.verifier.Verifier
|
||||
import org.junit.Test
|
||||
import java.nio.file.Path
|
||||
import java.nio.file.Paths
|
||||
import kotlin.reflect.declaredMemberProperties
|
||||
|
||||
class ExampleConfigTest {
|
||||
|
||||
private fun <A : Any> readAndCheckConfigurations(vararg configFilenames: String, loadConfig: (Path) -> A) {
|
||||
configFilenames.forEach {
|
||||
println("Checking $it")
|
||||
val configFileResource = ExampleConfigTest::class.java.classLoader.getResource(it)
|
||||
val config = loadConfig(Paths.get(configFileResource.toURI()))
|
||||
// Force the config fields as they are resolved lazily
|
||||
config.javaClass.kotlin.declaredMemberProperties.forEach { member ->
|
||||
member.get(config)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `example node_confs parses fine`() {
|
||||
readAndCheckConfigurations(
|
||||
"example-node.conf",
|
||||
"example-out-of-process-verifier-node.conf",
|
||||
"example-network-map-node.conf"
|
||||
) {
|
||||
val baseDirectory = Paths.get("some-example-base-dir")
|
||||
FullNodeConfiguration(
|
||||
baseDirectory,
|
||||
ConfigHelper.loadConfig(
|
||||
baseDirectory = baseDirectory,
|
||||
configFile = it
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `example verifier_conf parses fine`() {
|
||||
readAndCheckConfigurations(
|
||||
"example-verifier.conf"
|
||||
) {
|
||||
val baseDirectory = Paths.get("some-example-base-dir")
|
||||
Verifier.loadConfiguration(baseDirectory, it)
|
||||
}
|
||||
}
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package net.corda.docs
|
||||
|
||||
import net.corda.node.services.config.ConfigHelper
|
||||
import net.corda.node.services.config.FullNodeConfiguration
|
||||
import org.junit.Test
|
||||
import java.nio.file.Paths
|
||||
import kotlin.reflect.declaredMemberProperties
|
||||
|
||||
class ExampleNodeConfTest {
|
||||
@Test
|
||||
fun exampleNodeConfParsesFine() {
|
||||
val exampleNodeConfFilenames = arrayOf(
|
||||
"example-node.conf",
|
||||
"example-network-map-node.conf"
|
||||
)
|
||||
|
||||
exampleNodeConfFilenames.forEach {
|
||||
println("Checking $it")
|
||||
val configResource = ExampleNodeConfTest::class.java.classLoader.getResource(it)
|
||||
val baseDirectory = Paths.get("some-example-base-dir")
|
||||
val nodeConfig = FullNodeConfiguration(
|
||||
baseDirectory,
|
||||
ConfigHelper.loadConfig(
|
||||
baseDirectory = baseDirectory,
|
||||
configFile = Paths.get(configResource.toURI())
|
||||
)
|
||||
)
|
||||
// Force the config fields as they are resolved lazily
|
||||
nodeConfig.javaClass.kotlin.declaredMemberProperties.forEach { member ->
|
||||
member.get(nodeConfig)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user