Fix CDI tests failing due to migrating to JPA 2.2

This commit is contained in:
Vlad Mihalcea 2017-12-12 14:56:48 +02:00 committed by Steve Ebersole
parent da8e13c453
commit a94faa9280
4 changed files with 93 additions and 1 deletions

View File

@ -239,6 +239,13 @@ processTestResources {
test.dependsOn ":hibernate-orm-modules:prepareWildFlyForTests"
test {
doFirst {
copy {
file("${rootProject.buildDir.absolutePath}/wildfly-${wildflyVersion}/modules/system/layers/base/javax/persistence/api/main/module.xml").delete()
from "${projectDir}/../hibernate-orm-modules/src/test/resources/wildfly/module.xml"
into "${rootProject.buildDir.absolutePath}/wildfly-${wildflyVersion}/modules/system/layers/base/javax/persistence/api/main"
}
}
systemProperty "file.encoding", "utf-8"
beforeTest { descriptor ->
//println "Starting test: " + descriptor

View File

@ -53,12 +53,14 @@ configurations {
wildflyDist
byteBuddy
jpa
}
dependencies {
jipijapa "org.wildfly:jipijapa-hibernate5:${wildflyVersion}"
wildflyDist "org.wildfly:wildfly-dist:${wildflyVersion}@zip"
byteBuddy libraries.byteBuddy
jpa libraries.jpa
testCompile project( ":hibernate-core" )
testCompile project( ":hibernate-envers" )
@ -185,7 +187,12 @@ task installHibernateModule( type:Copy, dependsOn: [createModulesZip, installWil
into "${wildFlyInstallDir}/modules"
}
task prepareWildFlyForTests( dependsOn: [installWildFly, installHibernateModule] )
task copyJpaLib(type: Copy) {
into "$wildFlyInstallDir/modules/system/layers/base/javax/persistence/api/main"
from configurations.jpa
}
task prepareWildFlyForTests( dependsOn: [installWildFly, installHibernateModule, copyJpaLib] )
test.dependsOn prepareWildFlyForTests
@ -193,4 +200,14 @@ processTestResources {
expand( wildFlyInstallDir: wildFlyInstallDir, arquillianDeploymentExportDir: "${rootProject.buildDir.absolutePath}/arquillian-deployments" )
}
test {
doFirst {
copy {
file("$wildFlyInstallDir/modules/system/layers/base/javax/persistence/api/main/module.xml").delete()
from "${projectDir}/src/test/resources/wildfly/module.xml"
into "$wildFlyInstallDir/modules/system/layers/base/javax/persistence/api/main"
}
}
}

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ JBoss, Home of Professional Open Source.
~ Copyright 2010, Red Hat, Inc., and individual contributors
~ as indicated by the @author tags. See the copyright.txt file in the
~ distribution for a full listing of individual contributors.
~
~ This is free software; you can redistribute it and/or modify it
~ under the terms of the GNU Lesser General Public License as
~ published by the Free Software Foundation; either version 2.1 of
~ the License, or (at your option) any later version.
~
~ This software is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
~ Lesser General Public License for more details.
~
~ You should have received a copy of the GNU Lesser General Public
~ License along with this software; if not, write to the Free
~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->
<module xmlns="urn:jboss:module:1.5" name="javax.persistence.api">
<dependencies>
<!-- PersistenceUnitInfo needs javax.sql.DataSource -->
<module name="javax.api" export="true"/>
</dependencies>
<resources>
<resource-root path="javax.persistence-api-2.2.jar"/>
</resources>
</module>

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ JBoss, Home of Professional Open Source.
~ Copyright 2010, Red Hat, Inc., and individual contributors
~ as indicated by the @author tags. See the copyright.txt file in the
~ distribution for a full listing of individual contributors.
~
~ This is free software; you can redistribute it and/or modify it
~ under the terms of the GNU Lesser General Public License as
~ published by the Free Software Foundation; either version 2.1 of
~ the License, or (at your option) any later version.
~
~ This software is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
~ Lesser General Public License for more details.
~
~ You should have received a copy of the GNU Lesser General Public
~ License along with this software; if not, write to the Free
~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->
<module xmlns="urn:jboss:module:1.5" name="javax.persistence.api">
<dependencies>
<!-- PersistenceUnitInfo needs javax.sql.DataSource -->
<module name="javax.api" export="true"/>
</dependencies>
<resources>
<resource-root path="javax.persistence-api-2.2.jar"/>
</resources>
</module>