HHH-12171 - Fix tests for hibernate-orm-modules

This commit is contained in:
Steve Ebersole 2018-01-02 13:47:29 -06:00
parent 4f23cb1ffe
commit 554817baca
3 changed files with 40 additions and 39 deletions

View File

@ -55,6 +55,9 @@ allprojects {
url "http://snapshots.jboss.org/maven2/" url "http://snapshots.jboss.org/maven2/"
} }
} }
// minimize changes, at least for now (gradle uses 'build' by default)..
buildDir = "target"
} }
ext { ext {
@ -87,8 +90,6 @@ def osgiDescription() {
return "A module of the Hibernate O/RM project" return "A module of the Hibernate O/RM project"
} }
buildDir = "target"
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
subprojects { subProject -> subprojects { subProject ->
@ -106,9 +107,6 @@ subprojects { subProject ->
ext.exportPackageVersion = rootProject.osgiExportVersion ext.exportPackageVersion = rootProject.osgiExportVersion
// minimize changes, at least for now (gradle uses 'build' by default)..
buildDir = "target"
if ( subProject.name.startsWith( 'release' ) ) { if ( subProject.name.startsWith( 'release' ) ) {
return return
} }

View File

@ -228,7 +228,7 @@ processTestResources {
into file( "${buildDir}/resources/test" ) into file( "${buildDir}/resources/test" )
include 'arquillian.xml' include 'arquillian.xml'
include 'org/hibernate/test/wf/ddl/manifest.mf' include 'org/hibernate/test/wf/ddl/manifest.mf'
expand wildFlyInstallDir: "${rootProject.buildDir.absolutePath}/wildfly-${wildflyVersion}", expand wildFlyInstallDir: project( ':hibernate-orm-modules' ).wildFlyInstallDir,
hibernateMajorMinorVersion: "${rootProject.hibernateMajorMinorVersion}", hibernateMajorMinorVersion: "${rootProject.hibernateMajorMinorVersion}",
arquillianDeploymentExportDir: "${rootProject.buildDir.absolutePath}/arquillian-deployments" arquillianDeploymentExportDir: "${rootProject.buildDir.absolutePath}/arquillian-deployments"
} }

View File

@ -12,28 +12,26 @@ apply plugin: 'project-report'
apply plugin: org.hibernate.build.HibernateBuildPlugin apply plugin: org.hibernate.build.HibernateBuildPlugin
apply plugin: 'idea' apply plugin: 'idea'
buildDir = "target"
test.enabled = false
ext { ext {
// NOTE : `wildflyVersion` comes from libraries.gradle...
// Exact ORM version, e.g. "5.1.1.Final" // Exact ORM version, e.g. "5.1.1.Final"
slot = rootProject.hibernateFullVersion slot = rootProject.hibernateFullVersion
// Just the minor ORM version, e.g. "5.1"; Is used as an alias for the exact version // Just the minor ORM version, e.g. "5.1"; Is used as an alias for the exact version
minorSlot = rootProject.hibernateMajorMinorVersion minorSlot = rootProject.hibernateMajorMinorVersion
final String[] wildFlyVersionComponents = wildflyVersion.split( '\\.' ); // "10" for WildFly 10.x, "11" for 11.x, etc
wildFlyMajorVersion = wildflyVersion.split( '\\.' )[0]
// e.g. "10" for WildFly 10.x
wildFlyMajorVersion = wildFlyVersionComponents[0];
wildFlyJPA22PatchVersion = '1.0.0.Beta1' wildFlyJPA22PatchVersion = '1.0.0.Beta1'
artifactClassifier = "wildfly-${wildFlyMajorVersion}-dist" artifactClassifier = "wildfly-${wildFlyMajorVersion}-dist"
moduleXmlStagingDir = file( "$buildDir/tmp/modules" ) moduleXmlStagingDir = file( "$buildDir/tmp/modules" )
wildFlyInstallDirBase = rootProject.buildDir wildFlyInstallDirBase = "$rootProject.buildDir.absolutePath/wildfly"
wildFlyInstallDir = "${rootProject.buildDir.absolutePath}/wildfly-${wildflyVersion}" // this is just a "guess" as to the root directory inside the dist zip
// todo : Would be better to actually ask the zip
wildFlyInstallDir = "$wildFlyInstallDirBase/wildfly-${wildflyVersion}"
expandedModuleProperties = [ expandedModuleProperties = [
slot: slot, slot: slot,
@ -41,7 +39,7 @@ ext {
version: rootProject.hibernateTargetVersion, version: rootProject.hibernateTargetVersion,
wildflyVersion: wildflyVersion, wildflyVersion: wildflyVersion,
byteBuddyVersion: byteBuddyVersion byteBuddyVersion: byteBuddyVersion
]; ]
} }
mavenPom { mavenPom {
@ -175,39 +173,44 @@ build.dependsOn createModulesZip
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// tasks related to in-container (Arquillian + WF) testing // tasks related to in-container (Arquillian + WF) testing
task installWildFly(type: Copy) { task installWildFly(type: Copy, dependsOn: createModulesZip) {
description = 'Downloads the WildFly distribution and installs it into a local directory (if needed)' description = 'Downloads the WildFly distribution, installs it into a local directory and prepares it for use (in testing)'
from { from configurations.wildflyDist.collect { zipTree(it) }
configurations.wildflyDist.collect { zipTree(it) }
}
into wildFlyInstallDirBase into wildFlyInstallDirBase
final File patchFile = configurations.wildflyJPA22Patch.resolvedConfiguration.resolvedArtifacts[0].file
inputs.file( patchFile )
doFirst {
cleanInstallWildFly
} }
task patchWildFlytoJPA22(type: Copy, dependsOn: [installWildFly]) {
description = 'Patch the WildFly server to expose the JPA 2.2 API (instead of JPA 2.1)'
from configurations.wildflyJPA22Patch
into "$buildDir/jpa22-wildfly-patch"
doLast { doLast {
// until we have a version of WF supporting EE 8 (JPA 2.2), we need to patch
// the install to support JPA 2.2
exec { exec {
executable "$wildFlyInstallDirBase/wildfly-$wildflyVersion/bin/jboss-cli.sh"
//TODO find out how to reliably skip applying this patch when already applied?
//the current solution is close by making this task a 'Copy' rather than Exec,
//using the 'into' section as a marker for this being already done,
//but it's not very reliable so we need to enable 'ignoreExitValue'.
ignoreExitValue = true ignoreExitValue = true
args "patch apply $buildDir/jpa22-wildfly-patch/hibernate-jpa-api-2.2-wildflymodules-${wildFlyJPA22PatchVersion}-wildfly-$wildflyVersion-patch.zip"
} executable "$wildFlyInstallDir/bin/jboss-cli.sh"
} args "patch apply $patchFile.absolutePath"
} }
task installHibernateModule( type:Copy, dependsOn: [createModulesZip, installWildFly]) { // and then install the Hibernate
copy {
duplicatesStrategy DuplicatesStrategy.EXCLUDE duplicatesStrategy DuplicatesStrategy.EXCLUDE
from zipTree( createModulesZip.archivePath ) from zipTree( createModulesZip.archivePath )
into "${wildFlyInstallDir}/modules" into "${wildFlyInstallDir}/modules"
} }
}
}
task prepareWildFlyForTests( dependsOn: [installWildFly, installHibernateModule, patchWildFlytoJPA22] ) clean.dependsOn cleanInstallWildFly
task installHibernateModule( dependsOn: [createModulesZip, installWildFly])
task prepareWildFlyForTests( dependsOn: [installWildFly, installHibernateModule] )
test.dependsOn prepareWildFlyForTests test.dependsOn prepareWildFlyForTests