Skip to content

Commit

Permalink
omnij-rpc/build.gradle: abstract IntegrationTest, RegTest classes
Browse files Browse the repository at this point in the history
* Make the classes abstract
* Move configuration code out of constructors and into configureEach blocks
  • Loading branch information
msgilligan committed Sep 28, 2023
1 parent d39fb87 commit ffb935b
Showing 1 changed file with 27 additions and 28 deletions.
55 changes: 27 additions & 28 deletions omnij-rpc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit ffb935b

Please sign in to comment.