Fix tests

This commit is contained in:
Tudor Malene 2018-06-04 11:58:41 +01:00 committed by tudor.malene@gmail.com
parent 0ecacb894e
commit 29da4b02a6
3 changed files with 27 additions and 21 deletions

View File

@ -719,7 +719,15 @@ abstract class AbstractNode(val configuration: NodeConfiguration,
networkParameters: NetworkParameters): MutableList<Any> {
checkpointStorage = DBCheckpointStorage()
verifyCheckpointsCompatible(checkpointStorage, cordappProvider.cordapps, versionInfo.platformVersion)
try {
verifyCheckpointsCompatible(checkpointStorage, cordappProvider.cordapps, versionInfo.platformVersion)
} catch (e: CheckpointIncompatibleException) {
if (configuration.devMode) {
Node.printWarning(e.message)
} else {
throw e
}
}
val keyManagementService = makeKeyManagementService(identityService, keyPairs, database)
_services = ServiceHubInternalImpl(

View File

@ -145,12 +145,8 @@ open class NodeStartup(val args: Array<String>) {
logger.error(e.message)
return false
} catch (e: CheckpointIncompatibleException) {
if (conf.devMode) {
Node.printWarning(e.message)
} else {
logger.error(e.message)
return false
}
logger.error(e.message)
return false
} catch (e: Exception) {
if (e is Errors.NativeIoException && e.message?.contains("Address already in use") == true) {
logger.error("One of the ports required by the Corda node is already in use.")

View File

@ -184,7 +184,8 @@ class CordappLoader private constructor(private val cordappJarPaths: List<Restri
.asSequence()
// This is to only scan classes from test folders.
.filter { url ->
listOf("main", "production/classes").none { url.toString().contains("$it/$resource") } || listOf("net.corda.core", "net.corda.node", "net.corda.finance").none { scanPackage.startsWith(it) } }
listOf("main", "production/classes").none { url.toString().contains("$it/$resource") } || listOf("net.corda.core", "net.corda.node", "net.corda.finance").none { scanPackage.startsWith(it) }
}
.map { url ->
if (url.protocol == "jar") {
// When running tests from gradle this may be a corda module jar, so restrict to scanPackage:
@ -249,19 +250,20 @@ class CordappLoader private constructor(private val cordappJarPaths: List<Restri
val name = url.toPath().fileName.toString().removeSuffix(".jar")
val info = url.openStream().let(::JarInputStream).use { it.manifest }.toCordappInfo(name)
val scanResult = scanCordapp(it)
CordappImpl(findContractClassNames(scanResult),
findInitiatedFlows(scanResult),
findRPCFlows(scanResult),
findServiceFlows(scanResult),
findSchedulableFlows(scanResult),
findServices(scanResult),
findPlugins(it),
findSerializers(scanResult),
findCustomSchemas(scanResult),
findAllFlows(scanResult),
it.url,
info,
getJarHash(it.url)
CordappImpl(contractClassNames = findContractClassNames(scanResult),
initiatedFlows = findInitiatedFlows(scanResult),
rpcFlows = findRPCFlows(scanResult),
serviceFlows = findServiceFlows(scanResult),
schedulableFlows = findSchedulableFlows(scanResult),
services = findServices(scanResult),
serializationWhitelists = findPlugins(it),
serializationCustomSerializers = findSerializers(scanResult),
customSchemas = findCustomSchemas(scanResult),
allFlows = findAllFlows(scanResult),
jarPath = it.url,
info = info,
jarHash = getJarHash(it.url),
name = name
)
}
}