mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-18 00:55:16 +00:00
Added test to check that the change handles the various possible scenarios. Test requires build time instrumentation. (cherry picked from commit e7475f12b0eafd37c7134b6643e0ade36b9716a0)
127 lines
4.2 KiB
Groovy
Executable File
127 lines
4.2 KiB
Groovy
Executable File
import org.apache.tools.ant.filters.ReplaceTokens
|
|
|
|
apply plugin: 'hibernate-matrix-testing'
|
|
|
|
configurations {
|
|
hibernateJpaModelGenTool {
|
|
description = "Dependencies for running the Hibernate JPA Metamodel Generator AnnotationProcessor tool"
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
compile( project(':hibernate-core') )
|
|
compile( libraries.dom4j )
|
|
compile( libraries.commons_annotations )
|
|
compile( libraries.jpa )
|
|
compile( libraries.jta )
|
|
compile( libraries.javassist )
|
|
|
|
provided( "javax.enterprise:cdi-api:1.1-PFD" )
|
|
|
|
testCompile( project(':hibernate-testing') )
|
|
testCompile( libraries.shrinkwrap_api )
|
|
testCompile( libraries.shrinkwrap )
|
|
testCompile( libraries.validation )
|
|
testCompile( "org.jboss.weld:weld-core:2.0.0.Beta6" )
|
|
testCompile( "org.jboss.weld.arquillian.container:arquillian-weld-ee-embedded-1.1:1.1.2.Final" )
|
|
testCompile( libraries.mockito )
|
|
|
|
testRuntime( libraries.validator )
|
|
testRuntime( "org.jboss.spec.javax.ejb:jboss-ejb-api_3.2_spec:1.0.0.Alpha2" )
|
|
// testRuntime( "org.glassfish.web:el-impl:2.1.2-b04" )
|
|
|
|
// for testing stored procedure support
|
|
testCompile( libraries.derby )
|
|
|
|
testCompile( 'joda-time:joda-time:2.3' )
|
|
|
|
hibernateJpaModelGenTool( project( ':hibernate-jpamodelgen' ) )
|
|
}
|
|
|
|
public String pomName() {
|
|
return 'Hibernate JPA Support'
|
|
}
|
|
|
|
public String pomDescription() {
|
|
return 'Hibernate O/RM implementation of the JPA specification'
|
|
}
|
|
|
|
public String osgiDescription() {
|
|
return pomDescription()
|
|
}
|
|
|
|
jar {
|
|
manifest {
|
|
// A cdi-api OSGi bundle does not currently exist. For now, explicitly
|
|
// ignore its packages. This will only cause issues if an app tries
|
|
// to use the BeanManagerListenerFactory functionality.
|
|
// NOTE: The "!" negates the package, keeping it out of Import-Package
|
|
// and including it in Ignore-Package. Also note that '*' does not mean
|
|
// <Import-Package>*</ImportPackage> will occur. This is simply a
|
|
// BND instruction -- the auto-discovery of imported packages still
|
|
// occurs.
|
|
instructionFirst 'Import-Package',
|
|
'!javax.enterprise*',
|
|
'javax.enterprise.context.spi;resolution:=optional',
|
|
'javax.enterprise.inject.spi;resolution:=optional',
|
|
// TODO: Shouldn't have to explicitly list the JPA packages, but
|
|
// the plugin generates them with [1.0,2) versions.
|
|
'javax.persistence;version="2.1.0"',
|
|
'javax.persistence.criteria;version="2.1.0"',
|
|
'javax.persistence.metamodel;version="2.1.0"',
|
|
'javax.persistence.spi;version="2.1.0"'
|
|
}
|
|
}
|
|
|
|
addMetaGenProcessor( sourceSets.test )
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Process 'bundle resources' for the packaging tests
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
task copyBundleResources (type: Copy) {
|
|
ext.bundlesTargetDir = file( "${buildDir}/bundles" )
|
|
from file('src/test/bundles')
|
|
into bundlesTargetDir
|
|
filter(ReplaceTokens, tokens: [
|
|
buildDirName: buildDir.absolutePath,
|
|
'db.dialect': 'org.hibernate.dialect.H2Dialect',
|
|
'jdbc.driver': 'org.h2.Driver',
|
|
'jdbc.user': 'sa',
|
|
'jdbc.pass': '',
|
|
'jdbc.url': 'jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE',
|
|
]);
|
|
doFirst {
|
|
bundlesTargetDir.mkdirs()
|
|
}
|
|
}
|
|
processTestResources.dependsOn copyBundleResources
|
|
|
|
// create an artifact configuration composed of the test classes so that envers can access hem test classes
|
|
task testJar(type: Jar, dependsOn: testClasses) {
|
|
classifier = 'test'
|
|
from sourceSets.test.output
|
|
}
|
|
|
|
configurations {
|
|
tests
|
|
}
|
|
|
|
artifacts {
|
|
tests testJar
|
|
}
|
|
|
|
task instrument(dependsOn: compileTestJava) << {
|
|
ant.taskdef(name: 'hibInstrument',
|
|
classname: 'org.hibernate.tool.instrument.javassist.InstrumentTask',
|
|
classpath: configurations.testCompile.asPath)
|
|
ant.hibInstrument(verbose: 'true'){
|
|
fileset(dir:"$buildDir/classes/test/org/hibernate/jpa/test/callbacks/"){
|
|
include(name: "EntityWithLazyProperty.class")
|
|
}
|
|
}
|
|
println("hibernate instrumentation")
|
|
}
|
|
|
|
test.dependsOn instrument
|