From ffb935b4b9c3ecaf686a90985b6e2f5ecdb7e98d Mon Sep 17 00:00:00 2001 From: Sean Gilligan Date: Thu, 28 Sep 2023 14:10:02 -0700 Subject: [PATCH] omnij-rpc/build.gradle: abstract IntegrationTest, RegTest classes * Make the classes abstract * Move configuration code out of constructors and into configureEach blocks --- omnij-rpc/build.gradle | 55 +++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/omnij-rpc/build.gradle b/omnij-rpc/build.gradle index 77ad77c0..9e720de4 100644 --- a/omnij-rpc/build.gradle +++ b/omnij-rpc/build.gradle @@ -53,38 +53,37 @@ sourceSets { } } -/** Base class for integration tests - */ -class IntegrationTest extends Test { - public IntegrationTest() { - testClassesDirs = project.sourceSets.integrationTest.output.classesDirs - classpath = project.sourceSets.integrationTest.runtimeClasspath - outputs.upToDateWhen { false } - testLogging { - exceptionFormat = 'full' - displayGranularity = -1 - } - beforeSuite { descriptor -> - if (descriptor.className != null) { - logger.lifecycle("\033[1m$descriptor.name\033[0m") // bold - } - } - beforeTest { descriptor -> - logger.lifecycle(" $descriptor.name") +/** Base class for integration tests */ +abstract class IntegrationTest extends Test {} + +tasks.withType(IntegrationTest).configureEach { + testClassesDirs = project.sourceSets.integrationTest.output.classesDirs + classpath = project.sourceSets.integrationTest.runtimeClasspath + outputs.upToDateWhen { false } + testLogging { + exceptionFormat = 'full' + displayGranularity = -1 + } + beforeSuite { descriptor -> + if (descriptor.className != null) { + logger.lifecycle("\033[1m$descriptor.name\033[0m") // bold } } + beforeTest { descriptor -> + logger.lifecycle(" $descriptor.name") + } } -/** Base class for integration tests in regtest mode - */ -class RegTest extends IntegrationTest { - public RegTest() { - systemProperty 'regtest', true - systemProperty 'java.util.logging.config.file', "${project.projectDir}/src/integ/logging.properties" - systemProperties ([ 'omni.test.rpcTestUser': project.rpcTestUser, - 'omni.test.rpcTestPassword': project.rpcTestPassword, - ]) - } + +/** Base class for integration tests in regtest mode */ +abstract class RegTest extends IntegrationTest {} + +tasks.withType(RegTest).configureEach { + systemProperty 'regtest', true + systemProperty 'java.util.logging.config.file', "${project.projectDir}/src/integ/logging.properties" + systemProperties ([ 'omni.test.rpcTestUser': project.rpcTestUser, + 'omni.test.rpcTestPassword': project.rpcTestPassword, + ]) } tasks.register('integrationTest', IntegrationTest) {