Skip to content

Commit

Permalink
HHH-12171 Fix tests for hibernate-orm-modules
Browse files Browse the repository at this point in the history
Apply the JPA 2.2 patch to WildFly before running integration tests
  • Loading branch information
Sanne committed Dec 15, 2017
1 parent c24dc51 commit d0267a5
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion hibernate-orm-modules/hibernate-orm-modules.gradle
Expand Up @@ -24,6 +24,7 @@ ext {

// e.g. "10" for WildFly 10.x
wildFlyMajorVersion = wildFlyVersionComponents[0];
wildFlyJPA22PatchVersion = '1.0.0.Beta1'

artifactClassifier = "wildfly-${wildFlyMajorVersion}-dist"

Expand Down Expand Up @@ -52,13 +53,15 @@ configurations {
}

wildflyDist
wildflyJPA22Patch
byteBuddy
}

dependencies {
jipijapa "org.wildfly:jipijapa-hibernate5:${wildflyVersion}"
wildflyDist "org.wildfly:wildfly-dist:${wildflyVersion}@zip"
byteBuddy libraries.byteBuddy
wildflyJPA22Patch "org.hibernate.javax.persistence:hibernate-jpa-api-2.2-wildflymodules:${wildFlyJPA22PatchVersion}:wildfly-${wildflyVersion}-patch@zip"

testCompile project( ":hibernate-core" )
testCompile project( ":hibernate-envers" )
Expand Down Expand Up @@ -179,13 +182,30 @@ task installWildFly(type: Copy) {
into wildFlyInstallDirBase
}

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 {
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
args "patch apply $buildDir/jpa22-wildfly-patch/hibernate-jpa-api-2.2-wildflymodules-${wildFlyJPA22PatchVersion}-wildfly-$wildflyVersion-patch.zip"
}
}
}

task installHibernateModule( type:Copy, dependsOn: [createModulesZip, installWildFly]) {
duplicatesStrategy DuplicatesStrategy.EXCLUDE
from zipTree( createModulesZip.archivePath )
into "${wildFlyInstallDir}/modules"
}

task prepareWildFlyForTests( dependsOn: [installWildFly, installHibernateModule] )
task prepareWildFlyForTests( dependsOn: [installWildFly, installHibernateModule, patchWildFlytoJPA22] )

test.dependsOn prepareWildFlyForTests

Expand Down

0 comments on commit d0267a5

Please sign in to comment.