Merge remote-tracking branch 'open/master' into kat-merge-27072018

Conflicts:
	core/src/main/kotlin/net/corda/core/internal/notary/NotaryServiceFlow.kt
	core/src/main/kotlin/net/corda/core/internal/notary/TrustedAuthorityNotaryService.kt
	docs/source/blob-inspector.rst
	docs/source/release-notes.rst
	docs/source/upgrade-notes.rst
	node/src/main/kotlin/net/corda/node/services/vault/NodeVaultService.kt
This commit is contained in:
Katelyn Baker
2018-07-27 16:09:26 +01:00
80 changed files with 1774 additions and 261 deletions

View File

@ -144,7 +144,7 @@ open class InternalMockNetwork(defaultParameters: MockNetworkParameters = MockNe
servicePeerAllocationStrategy: InMemoryMessagingNetwork.ServicePeerAllocationStrategy = defaultParameters.servicePeerAllocationStrategy,
val notarySpecs: List<MockNetworkNotarySpec> = defaultParameters.notarySpecs,
val testDirectory: Path = Paths.get("build", getTimestampAsDirectoryName()),
networkParameters: NetworkParameters = testNetworkParameters(),
val networkParameters: NetworkParameters = testNetworkParameters(),
val defaultFactory: (MockNodeArgs, CordappLoader?) -> MockNode = { args, cordappLoader -> cordappLoader?.let { MockNode(args, it) } ?: MockNode(args) },
val cordappsForAllNodes: Set<TestCorDapp> = emptySet()) {
init {
@ -248,6 +248,7 @@ open class InternalMockNetwork(defaultParameters: MockNetworkParameters = MockNe
// The network parameters must be serialised before starting any of the nodes
networkParametersCopier = NetworkParametersCopier(networkParameters.copy(notaries = notaryInfos))
@Suppress("LeakingThis")
// Notary nodes need a platform version >= network min platform version.
notaryNodes = createNotaries()
} catch (t: Throwable) {
stopNodes()
@ -264,10 +265,13 @@ open class InternalMockNetwork(defaultParameters: MockNetworkParameters = MockNe
@VisibleForTesting
internal open fun createNotaries(): List<TestStartedNode> {
val version = VersionInfo(networkParameters.minimumPlatformVersion, "Mock release", "Mock revision", "Mock Vendor")
return notarySpecs.map { (name, validating) ->
createNode(InternalMockNodeParameters(legalName = name, configOverrides = {
doReturn(NotaryConfig(validating)).whenever(it).notary
}))
createNode(InternalMockNodeParameters(
legalName = name,
configOverrides = { doReturn(NotaryConfig(validating)).whenever(it).notary },
version = version
))
}
}

View File

@ -15,7 +15,7 @@ internal class MutableTestCorDapp private constructor(override val name: String,
private const val jarExtension = ".jar"
private const val whitespace = " "
private const val whitespaceReplacement = "_"
private val productionPathSegments = setOf<(String) -> String>({ "out${File.separator}production${File.separator}classes" }, { fullyQualifiedName -> "main${File.separator}${fullyQualifiedName.packageToPath()}" })
private val productionPathSegments = setOf<(String) -> String>({ "out${File.separator}production${File.separator}classes" }, { fullyQualifiedName -> "main${File.separator}${fullyQualifiedName.packageToJarPath()}" })
private val excludedCordaPackages = setOf("net.corda.core", "net.corda.node")
fun filterTestCorDappClass(fullyQualifiedName: String, url: URL): Boolean {

View File

@ -7,7 +7,6 @@ import net.corda.core.internal.outputStream
import net.corda.node.internal.cordapp.createTestManifest
import net.corda.testing.driver.TestCorDapp
import org.apache.commons.io.IOUtils
import java.io.File
import java.io.OutputStream
import java.net.URI
import java.net.URL
@ -136,7 +135,7 @@ fun simplifyScanPackages(scanPackages: Iterable<String>): List<String> {
/**
* Transforms a class or package name into a path segment.
*/
internal fun String.packageToPath() = replace(".", File.separator)
internal fun String.packageToJarPath() = replace(".", "/")
private fun Iterable<JarEntryInfo>.zip(outputStream: ZipOutputStream, willResourceBeAddedBeToCorDapp: (String, URL) -> Boolean): Boolean {
@ -177,7 +176,7 @@ internal sealed class JarEntryInfo(val fullyQualifiedName: String, val url: URL)
*/
class ClassJarEntryInfo(val clazz: Class<*>) : JarEntryInfo(clazz.name, clazz.classFileURL()) {
override val entryName = "${fullyQualifiedName.packageToPath()}$fileExtensionSeparator$classFileExtension"
override val entryName = "${fullyQualifiedName.packageToJarPath()}$fileExtensionSeparator$classFileExtension"
}
/**
@ -188,7 +187,7 @@ internal sealed class JarEntryInfo(val fullyQualifiedName: String, val url: URL)
override val entryName: String
get() {
val extensionIndex = fullyQualifiedName.lastIndexOf(fileExtensionSeparator)
return "${fullyQualifiedName.substring(0 until extensionIndex).packageToPath()}${fullyQualifiedName.substring(extensionIndex)}"
return "${fullyQualifiedName.substring(0 until extensionIndex).packageToJarPath()}${fullyQualifiedName.substring(extensionIndex)}"
}
}
@ -206,7 +205,7 @@ internal sealed class JarEntryInfo(val fullyQualifiedName: String, val url: URL)
private fun Class<*>.classFileURL(): URL {
require(protectionDomain?.codeSource?.location != null) { "Invalid class $name for test CorDapp. Classes without protection domain cannot be referenced. This typically happens for Java / Kotlin types." }
return URI.create("${protectionDomain.codeSource.location}/${name.packageToPath()}$fileExtensionSeparator$classFileExtension".escaped()).toURL()
return URI.create("${protectionDomain.codeSource.location}/${name.packageToJarPath()}$fileExtensionSeparator$classFileExtension".escaped()).toURL()
}
private fun String.escaped(): String = this.replace(whitespace, whitespaceReplacement)