From eaf9dad7c98f89a9f4762619820ceb08ef6cbd3e Mon Sep 17 00:00:00 2001 From: Chris Rankin Date: Thu, 23 Mar 2017 17:32:14 +0000 Subject: [PATCH] Remove junit-quickcheck from Corda because it is only used for testing. (#416) --- client/jackson/build.gradle | 7 +++++ core/build.gradle | 4 +-- .../net/corda/core/testing/Generators.kt | 2 +- finance/build.gradle | 14 +++++++++ .../net/corda/contracts/testing/Generators.kt | 0 .../flows/BroadcastTransactionFlowTest.kt | 2 +- node-schemas/build.gradle | 1 + node/build.gradle | 29 +++++++++---------- 8 files changed, 39 insertions(+), 20 deletions(-) rename core/src/{main => test}/kotlin/net/corda/core/testing/Generators.kt (98%) rename finance/src/{main => test}/kotlin/net/corda/contracts/testing/Generators.kt (100%) rename {core/src/test/kotlin/net/corda/core => finance/src/test/kotlin/net/corda}/flows/BroadcastTransactionFlowTest.kt (97%) diff --git a/client/jackson/build.gradle b/client/jackson/build.gradle index b92adbd7ad..8dc13ae962 100644 --- a/client/jackson/build.gradle +++ b/client/jackson/build.gradle @@ -23,5 +23,12 @@ dependencies { // This adds support for java.time types. compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" + testCompile project(':core').sourceSets.test.output testCompile "junit:junit:$junit_version" + + // TODO: Upgrade to junit-quickcheck 0.8, once it is released, + // because it depends on org.javassist:javassist instead + // of javassist:javassist. + testCompile "com.pholser:junit-quickcheck-core:$quickcheck_version" + testCompile "com.pholser:junit-quickcheck-generators:$quickcheck_version" } diff --git a/core/build.gradle b/core/build.gradle index 6c94a4a196..8c90d2d427 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -63,8 +63,8 @@ dependencies { // TODO: Upgrade to junit-quickcheck 0.8, once it is released, // because it depends on org.javassist:javassist instead // of javassist:javassist. - compile "com.pholser:junit-quickcheck-core:$quickcheck_version" - compile "com.pholser:junit-quickcheck-generators:$quickcheck_version" + testCompile "com.pholser:junit-quickcheck-core:$quickcheck_version" + testCompile "com.pholser:junit-quickcheck-generators:$quickcheck_version" // Guava: Google utilities library. compile "com.google.guava:guava:$guava_version" diff --git a/core/src/main/kotlin/net/corda/core/testing/Generators.kt b/core/src/test/kotlin/net/corda/core/testing/Generators.kt similarity index 98% rename from core/src/main/kotlin/net/corda/core/testing/Generators.kt rename to core/src/test/kotlin/net/corda/core/testing/Generators.kt index ed6bcb2fd5..0497db5388 100644 --- a/core/src/main/kotlin/net/corda/core/testing/Generators.kt +++ b/core/src/test/kotlin/net/corda/core/testing/Generators.kt @@ -65,7 +65,7 @@ class PartyAndReferenceGenerator : Generator(PartyAndReferenc class SecureHashGenerator : Generator(SecureHash::class.java) { override fun generate(random: SourceOfRandomness, status: GenerationStatus): SecureHash { - return SecureHash.Companion.sha256(random.nextBytes(16)) + return SecureHash.sha256(random.nextBytes(16)) } } diff --git a/finance/build.gradle b/finance/build.gradle index 7c12ec55df..88ced94f79 100644 --- a/finance/build.gradle +++ b/finance/build.gradle @@ -24,7 +24,14 @@ dependencies { compile project(':core') testCompile project(':test-utils') + testCompile project(':core').sourceSets.test.output testCompile "junit:junit:$junit_version" + + // TODO: Upgrade to junit-quickcheck 0.8, once it is released, + // because it depends on org.javassist:javassist instead + // of javassist:javassist. + testCompile "com.pholser:junit-quickcheck-core:$quickcheck_version" + testCompile "com.pholser:junit-quickcheck-generators:$quickcheck_version" } sourceSets { @@ -34,3 +41,10 @@ sourceSets { } } } + +configurations.testCompile { + // Excluding javassist:javassist because it clashes with Hibernate's + // transitive org.javassist:javassist dependency. + // TODO: Remove this exclusion once junit-quickcheck 0.8 is released. + exclude group: 'javassist', module: 'javassist' +} diff --git a/finance/src/main/kotlin/net/corda/contracts/testing/Generators.kt b/finance/src/test/kotlin/net/corda/contracts/testing/Generators.kt similarity index 100% rename from finance/src/main/kotlin/net/corda/contracts/testing/Generators.kt rename to finance/src/test/kotlin/net/corda/contracts/testing/Generators.kt diff --git a/core/src/test/kotlin/net/corda/core/flows/BroadcastTransactionFlowTest.kt b/finance/src/test/kotlin/net/corda/flows/BroadcastTransactionFlowTest.kt similarity index 97% rename from core/src/test/kotlin/net/corda/core/flows/BroadcastTransactionFlowTest.kt rename to finance/src/test/kotlin/net/corda/flows/BroadcastTransactionFlowTest.kt index da812439fe..49dc19751a 100644 --- a/core/src/test/kotlin/net/corda/core/flows/BroadcastTransactionFlowTest.kt +++ b/finance/src/test/kotlin/net/corda/flows/BroadcastTransactionFlowTest.kt @@ -1,4 +1,4 @@ -package net.corda.core.flows +package net.corda.flows import com.pholser.junit.quickcheck.From import com.pholser.junit.quickcheck.Property diff --git a/node-schemas/build.gradle b/node-schemas/build.gradle index afd9f84721..14d15165e7 100644 --- a/node-schemas/build.gradle +++ b/node-schemas/build.gradle @@ -44,6 +44,7 @@ sourceSets { dependencies { compile project(':core') testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version" + testCompile "junit:junit:$junit_version" // Requery: SQL based query & persistence for Kotlin kapt "io.requery:requery-processor:$requery_version" diff --git a/node/build.gradle b/node/build.gradle index f4a528bd88..cd963a119b 100644 --- a/node/build.gradle +++ b/node/build.gradle @@ -27,6 +27,17 @@ configurations { // We don't need these because we already include netty-all. exclude group: 'io.netty', module: 'netty-transport' exclude group: 'io.netty', module: 'netty-handler' + + // We want to use SLF4J's version of these bindings: jcl-over-slf4j + // Remove any transitive dependency on Apache's version. + exclude group: 'commons-logging', module: 'commons-logging' + } + + testCompile { + // Excluding javassist:javassist because it clashes with Hibernate's + // transitive org.javassist:javassist dependency. + // TODO: Remove this exclusion once junit-quickcheck 0.8 is released. + exclude group: 'javassist', module: 'javassist' } integrationTestCompile.extendsFrom testCompile @@ -58,16 +69,8 @@ sourceSets { dependencies { - // Excluding javassist:javassist (which is a transitive dependency of core) - // because it clashes with Hibernate's transitive org.javassist:javassist - // dependency. - // TODO: Remove both of these exclusions once junit-quickcheck 0.8 is released. - compile (project(':finance')) { - exclude group: 'javassist', module: 'javassist' - } - compile (project(':node-schemas')) { - exclude group: 'javassist', module: 'javassist' - } + compile project(':finance') + compile project(':node-schemas') compile project(':node-api') compile project(':client:rpc') @@ -165,12 +168,6 @@ dependencies { integrationTestCompile "junit:junit:$junit_version" } -configurations.compile { - // We want to use SLF4J's version of these binding: jcl-over-slf4j - // Remove any transitive dependency on Apache's version. - exclude group: 'commons-logging', module: 'commons-logging' -} - task integrationTest(type: Test) { testClassesDir = sourceSets.integrationTest.output.classesDir classpath = sourceSets.integrationTest.runtimeClasspath