CORDA-540: AMQP specific fixes in "node-api" project (#1765)

This commit is contained in:
Viktor Kolomeyko
2017-10-03 15:07:34 +01:00
committed by GitHub
parent e6e3c29d74
commit e2bb14da8e
7 changed files with 19 additions and 17 deletions

View File

@ -146,13 +146,15 @@ fun getTestPartyAndCertificate(name: CordaX500Name, publicKey: PublicKey, trustR
return getTestPartyAndCertificate(Party(name, publicKey), trustRoot)
}
inline fun <reified T : Any> kryoSpecific(reason: String, function: () -> Unit) = if(!AMQP_ENABLED) {
@Suppress("unused")
inline fun <reified T : Any> T.kryoSpecific(reason: String, function: () -> Unit) = if(!AMQP_ENABLED) {
function()
} else {
loggerFor<T>().info("Ignoring Kryo specific test, reason: $reason" )
}
inline fun <reified T : Any> amqpSpecific(reason: String, function: () -> Unit) = if(AMQP_ENABLED) {
@Suppress("unused")
inline fun <reified T : Any> T.amqpSpecific(reason: String, function: () -> Unit) = if(AMQP_ENABLED) {
function()
} else {
loggerFor<T>().info("Ignoring AMQP specific test, reason: $reason" )
@ -169,15 +171,15 @@ fun ServiceHub.getDefaultNotary(): Party = networkMapCache.notaryIdentities.firs
/**
* Set the package to scan for cordapps - this overrides the default behaviour of scanning the cordapps directory
* @param packageName A package name that you wish to scan for cordapps
* @param packageNames A package name that you wish to scan for cordapps
*/
fun setCordappPackages(vararg packageNames: String) {
CordappLoader.testPackages = packageNames.toList()
}
/**
* Unsets the default overriding behaviour of [setCordappPackage]
* Unsets the default overriding behaviour of [setCordappPackages]
*/
fun unsetCordappPackages() {
CordappLoader.testPackages = emptyList()
}
}