mirror of
https://github.com/corda/corda.git
synced 2025-06-14 05:08:18 +00:00
CORDA-892: Make cordform test use new network bootstrapper logic (#2307)
* Make cordform test use new network bootstrapper logic * Fixing review comments * Fix issue with backwards compatibility * Fix issue with setup not being called from CordformDefinitions * Make sure node dir is created (as CordformDefinition uses it directly if setup is overridden Make sure tmp dir is created * Don't crash if node dir is already created * Stop overwriting errors
This commit is contained in:
@ -83,16 +83,20 @@ class NetworkBootstrapper {
|
||||
for (confFile in confFiles) {
|
||||
val nodeName = confFile.fileName.toString().removeSuffix(".conf")
|
||||
println("Generating directory for $nodeName")
|
||||
val nodeDir = (directory / nodeName).createDirectory()
|
||||
confFile.moveTo(nodeDir / "node.conf")
|
||||
Files.copy(cordaJar, (nodeDir / "corda.jar"))
|
||||
val nodeDir = (directory / nodeName)
|
||||
if (!nodeDir.exists()) { nodeDir.createDirectory() }
|
||||
confFile.moveTo(nodeDir / "node.conf", StandardCopyOption.REPLACE_EXISTING)
|
||||
Files.copy(cordaJar, (nodeDir / "corda.jar"), StandardCopyOption.REPLACE_EXISTING)
|
||||
}
|
||||
Files.delete(cordaJar)
|
||||
}
|
||||
|
||||
private fun extractCordaJarTo(directory: Path): Path {
|
||||
val cordaJarPath = (directory / "corda.jar")
|
||||
Thread.currentThread().contextClassLoader.getResourceAsStream("corda.jar").copyTo(cordaJarPath)
|
||||
if (!cordaJarPath.exists()) {
|
||||
println("No corda jar found in root directory. Extracting from jar")
|
||||
Thread.currentThread().contextClassLoader.getResourceAsStream("corda.jar").copyTo(cordaJarPath)
|
||||
}
|
||||
return cordaJarPath
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user