Introduced a property to be able to enable AMQP mode from command line for Gradle run (#1316)

This can be useful if we decide to create a custom TeamCity configuration that will enable us to independently run *all* tests in AMQP mode to know where we stand.
This commit is contained in:
Viktor Kolomeyko 2017-08-24 12:56:12 +01:00 committed by GitHub
parent e1547073ce
commit 4995b7a1bd
2 changed files with 15 additions and 1 deletions

View File

@ -127,6 +127,13 @@ allprojects {
tasks.withType(Test) {
// Prevent the project from creating temporary files outside of the build directory.
systemProperties['java.io.tmpdir'] = buildDir
// Ensures that "net.corda.testing.amqp.enable" is passed correctly from Gradle command line
// down to JVM executing unit test. It looks like we are running unit tests in the forked mode
// and all the "-D" parameters passed to Gradle not making it to unit test level
// TODO: Remove once we fully switched to AMQP
final AMQP_ENABLE_PROP_NAME = "net.corda.testing.amqp.enable"
systemProperty(AMQP_ENABLE_PROP_NAME, System.getProperty(AMQP_ENABLE_PROP_NAME))
}
group 'net.corda'

View File

@ -66,7 +66,14 @@ fun initialiseTestSerialization() {
registerScheme(AMQPClientSerializationScheme())
registerScheme(AMQPServerSerializationScheme())
}
(SerializationDefaults.P2P_CONTEXT as TestSerializationContext).delegate = KRYO_P2P_CONTEXT
val AMQP_ENABLE_PROP_NAME = "net.corda.testing.amqp.enable"
// TODO: Remove these "if" conditions once we fully switched to AMQP
(SerializationDefaults.P2P_CONTEXT as TestSerializationContext).delegate = if (java.lang.Boolean.getBoolean(AMQP_ENABLE_PROP_NAME)) {
AMQP_P2P_CONTEXT
} else {
KRYO_P2P_CONTEXT
}
(SerializationDefaults.RPC_SERVER_CONTEXT as TestSerializationContext).delegate = KRYO_RPC_SERVER_CONTEXT
(SerializationDefaults.RPC_CLIENT_CONTEXT as TestSerializationContext).delegate = KRYO_RPC_CLIENT_CONTEXT
(SerializationDefaults.STORAGE_CONTEXT as TestSerializationContext).delegate = KRYO_STORAGE_CONTEXT