HHH-12231 Use the org.wildfly.build.provision Gradle plugin to fetch WildFly instances for integration testing

This commit is contained in:
Sanne Grinovero 2018-01-20 23:05:40 +00:00
parent b5e3b59136
commit a185c3a33d
1 changed files with 13 additions and 17 deletions

View File

@ -7,6 +7,10 @@ import org.apache.tools.ant.filters.ReplaceTokens
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/ */
plugins {
id "org.wildfly.build.provision" version "0.0.2"
}
apply from: rootProject.file( 'gradle/base-information.gradle' ) apply from: rootProject.file( 'gradle/base-information.gradle' )
apply plugin: 'java' apply plugin: 'java'
apply from: rootProject.file( 'gradle/libraries.gradle' ) apply from: rootProject.file( 'gradle/libraries.gradle' )
@ -60,14 +64,16 @@ configurations {
transitive = false transitive = false
} }
wildflyDist
wildflyJPA22Patch wildflyJPA22Patch
byteBuddy byteBuddy
} }
provision {
destinationDir = file("$project.wildFlyInstallDir")
}
dependencies { dependencies {
jipijapa "org.wildfly:jipijapa-hibernate5:${wildflyVersion}" jipijapa "org.wildfly:jipijapa-hibernate5:${wildflyVersion}"
wildflyDist "org.wildfly:wildfly-dist:${wildflyVersion}@zip"
byteBuddy libraries.byteBuddy byteBuddy libraries.byteBuddy
wildflyJPA22Patch "org.hibernate.javax.persistence:hibernate-jpa-api-2.2-wildflymodules:${wildFlyJPA22PatchVersion}:wildfly-${wildflyVersion}-patch@zip" wildflyJPA22Patch "org.hibernate.javax.persistence:hibernate-jpa-api-2.2-wildflymodules:${wildFlyJPA22PatchVersion}:wildfly-${wildflyVersion}-patch@zip"
@ -158,21 +164,13 @@ task release( dependsOn: createModulesZip )
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// tasks related to in-container (Arquillian + WF) testing // tasks related to in-container (Arquillian + WF) testing
task installWildFly(type: Copy, dependsOn: createModulesZip) { task installWildFly( dependsOn: [createModulesZip, provision] ) {
description = 'Downloads the WildFly distribution, installs it into a local directory and prepares it for use (in testing)' description = 'Downloads the WildFly distribution, installs it into a local directory, includes present version of Hibernate ORM, JPA 2.2 : ready for integration tests'
from configurations.wildflyDist.collect { zipTree(it) }
into wildFlyInstallDirBase
final File patchFile = configurations.wildflyJPA22Patch.resolvedConfiguration.resolvedArtifacts[0].file final File patchFile = configurations.wildflyJPA22Patch.resolvedConfiguration.resolvedArtifacts[0].file
inputs.file( patchFile ) inputs.file( patchFile )
doFirst {
cleanInstallWildFly
}
doLast { doLast {
// until we have a version of WF supporting EE 8 (JPA 2.2), we need to patch // until we have a version of WF supporting EE 8 (JPA 2.2), we need to patch
// the install to support JPA 2.2 // the install to support JPA 2.2
@ -182,10 +180,10 @@ task installWildFly(type: Copy, dependsOn: createModulesZip) {
ignoreExitValue = true ignoreExitValue = true
executable "$project.wildFlyInstallDir/bin/jboss-cli." + executableExtension executable "$project.wildFlyInstallDir/bin/jboss-cli." + executableExtension
args "patch apply $patchFile.absolutePath" args "patch apply $patchFile.absolutePath --override-all"
} }
// and then install the Hibernate // and then install the Hibernate ORM modules from the current build
copy { copy {
duplicatesStrategy DuplicatesStrategy.EXCLUDE duplicatesStrategy DuplicatesStrategy.EXCLUDE
from zipTree( createModulesZip.archivePath ) from zipTree( createModulesZip.archivePath )
@ -194,11 +192,9 @@ task installWildFly(type: Copy, dependsOn: createModulesZip) {
} }
} }
clean.dependsOn cleanInstallWildFly
task installHibernateModule( dependsOn: [createModulesZip, installWildFly]) task installHibernateModule( dependsOn: [createModulesZip, installWildFly])
task prepareWildFlyForTests( dependsOn: [installWildFly, installHibernateModule] ) task prepareWildFlyForTests( dependsOn: [installHibernateModule] )
test.dependsOn prepareWildFlyForTests test.dependsOn prepareWildFlyForTests