HHH-8470 scripted hibernate-osgi test properties in Gradle, cleaned up

test environment
This commit is contained in:
Brett Meyer 2013-09-09 19:35:01 -04:00
parent 1fc9efb2a2
commit 08ab72dc5c
7 changed files with 64 additions and 62 deletions

View File

@ -1,5 +1,6 @@
configurations {
osgiRuntime
osgiRuntimeBnd
}
sourceSets {
@ -33,28 +34,24 @@ dependencies {
testRuntime( "org.apache.felix:org.apache.felix.main:4.0.3" )
testRuntime( "org.jboss.logmanager:jboss-logmanager:1.4.1.Final" )
// Local copies of all jars needed fur the OSGi runtime.
osgiRuntime( "org.jboss.arquillian.osgi:arquillian-osgi-bundle:1.0.3.Final" )
osgiRuntime( libraries.jpa )
osgiRuntime( "javax.enterprise:cdi-api:1.1-PFD" )
osgiRuntime( "org.jboss.spec.javax.interceptor:jboss-interceptors-api_1.2_spec:1.0.0.Alpha1" )
osgiRuntime( libraries.jta )
osgiRuntime( "commons-collections:commons-collections:3.2.1" )
osgiRuntime( "commons-pool:commons-pool:1.6" )
osgiRuntime( "commons-dbcp:commons-dbcp:1.4" )
osgiRuntime( "commons-lang:commons-lang:2.6" )
osgiRuntime( "net.sourceforge.serp:serp:1.14.1" )
osgiRuntime( "com.h2database:h2:1.3.170" )
osgiRuntime( "org.apache.servicemix.bundles:org.apache.servicemix.bundles.antlr:2.7.7_5" )
osgiRuntime( libraries.javassist )
osgiRuntime( "org.apache.servicemix.specs:org.apache.servicemix.specs.jsr303-api-1.0.0:2.2.0" )
osgiRuntime( "org.apache.servicemix.bundles:org.apache.servicemix.bundles.ant:1.8.2_2" )
osgiRuntime( "org.apache.servicemix.specs:org.apache.servicemix.specs.stax-api-1.2:2.2.0" )
osgiRuntime( "org.apache.servicemix.bundles:org.apache.servicemix.bundles.dom4j:1.6.1_5" )
osgiRuntime( libraries.commons_annotations )
osgiRuntime( libraries.jandex )
osgiRuntime( libraries.classmate )
osgiRuntime( libraries.logging )
// Local copies of all jars needed fur the OSGi runtime. Ignore the transitive dependencies.
// ORDER DEPENDENT!!!
osgiRuntime( "org.jboss.arquillian.osgi:arquillian-osgi-bundle:1.0.3.Final" ) { transitive = false }
osgiRuntime( libraries.jpa ) { transitive = false }
osgiRuntime( "org.jboss.spec.javax.interceptor:jboss-interceptors-api_1.2_spec:1.0.0.Alpha1" ) { transitive = false }
osgiRuntime( libraries.jta ) { transitive = false }
osgiRuntime( "com.h2database:h2:1.3.170" ) { transitive = false }
osgiRuntime( "org.apache.servicemix.bundles:org.apache.servicemix.bundles.antlr:2.7.7_5" ) { transitive = false }
osgiRuntime( libraries.javassist ) { transitive = false }
osgiRuntime( "org.apache.servicemix.specs:org.apache.servicemix.specs.stax-api-1.2:2.2.0" ) { transitive = false }
osgiRuntime( "org.apache.servicemix.bundles:org.apache.servicemix.bundles.dom4j:1.6.1_5" ) { transitive = false }
osgiRuntime( libraries.commons_annotations ) { transitive = false }
osgiRuntime( libraries.classmate ) { transitive = false }
osgiRuntime( libraries.logging ) { transitive = false }
// needed for BND
osgiRuntimeBnd( libraries.jandex ) { transitive = false }
osgiRuntimeBnd( "javax.enterprise:cdi-api:1.1" ) { transitive = false }
osgiRuntimeBnd( "javax.el:el-api:2.2" ) { transitive = false }
testClientBundleCompile( project( ':hibernate-core' ) )
testClientBundleCompile( project( ':hibernate-entitymanager' ) )
@ -85,18 +82,49 @@ jar {
}
task copyBnd(type: Copy) {
into "$buildDir/osgi-lib/bnd"
from "src/test/resources/bnd"
into "$buildDir/osgi-lib/bnd"
}
task runBnd(type: JavaExec){
main = "-jar"
args "$buildDir/osgi-lib/bnd/bnd-2.1.0.jar", "$buildDir/osgi-lib/bnd/cdi-api.bnd", "$buildDir/osgi-lib/bnd/el-api.bnd", "$buildDir/osgi-lib/bnd/jandex.bnd", "$buildDir/osgi-lib/bnd/serp.bnd"
args "$buildDir/osgi-lib/bnd/bnd-2.1.0.jar", "$buildDir/osgi-lib/bnd/cdi-api.bnd", "$buildDir/osgi-lib/bnd/el-api.bnd", "$buildDir/osgi-lib/bnd/jandex.bnd"
}
task copyToLib(type: Copy) {
into "$buildDir/osgi-lib"
from configurations.osgiRuntime
from configurations.osgiRuntimeBnd
into "$buildDir/osgi-lib"
}
task felixProperties << {
copy {
from "src/test/resources/felix-framework.properties-ORIGINAL"
into "$buildDir/osgi-lib"
rename { String fileName ->
fileName.replace("-ORIGINAL", "")
}
}
propertiesFile = file("$buildDir/osgi-lib/felix-framework.properties")
// append jars wrapped using BND
FileTree tree = fileTree(dir: "$buildDir/osgi-lib/bnd")
tree.exclude "*bnd*"
tree.each {File file ->
propertiesFile << " \\\nfile:target/osgi-lib/bnd/" + file.name
}
// append all jars in osgiRuntime configuration
configurations.osgiRuntime.each { File file ->
propertiesFile << " \\\nfile:target/osgi-lib/" + file.name
}
// append ORM jars
// TODO: Is there a better, dynamic way of doing this?
propertiesFile << " \\\nfile:../hibernate-core/target/libs/hibernate-core-" + hibernateTargetVersion + ".jar"
propertiesFile << " \\\nfile:../hibernate-entitymanager/target/libs/hibernate-entitymanager-" + hibernateTargetVersion + ".jar"
propertiesFile << " \\\nfile:target/libs/hibernate-osgi-" + hibernateTargetVersion + ".jar"
}
task testClientBundleJar(type: Jar) {
@ -117,6 +145,7 @@ task testClientBundleJar(type: Jar) {
runBnd.dependsOn copyToLib
runBnd.dependsOn copyBnd
test.dependsOn runBnd
felixProperties.dependsOn runBnd
test.dependsOn felixProperties
test.dependsOn testClientBundleJar
test.dependsOn jar

View File

@ -58,8 +58,8 @@
* Regardless, this is the most "realistic" type of test anyway with a *real* client bundle.
*
* IMPORTANT: There are a few maintenance points that need addressed for new versions of Hibernate and library upgrades:
* 1.) Updated library versions in hibernate-osgi.gradle and src/test/resources/felix-framework.properties. Some
* of this may be automatable with Gradle scripts.
* 1.) Updated library versions in hibernate-osgi.gradle. libraries.gradle is used wherever possible. But, there
* may be a few manual updates needed.
* 2.) If a new version of Felix is used, download and start it manually in the command line. Run
* "felix:headers 0" to obtain the list of packages exported and used by the framework. As of this writing,
* the framework has javax.transaction.* and javax.xml.stream.* in "uses" attributes. I had to remove all instances

View File

@ -4,7 +4,7 @@
<container qualifier="jboss" default="true">
<configuration>
<property name="frameworkProperties">src/test/resources/felix-framework.properties</property>
<property name="frameworkProperties">target/osgi-lib/felix-framework.properties</property>
</configuration>
</container>
</arquillian>

View File

@ -1,4 +1,4 @@
Bundle-SymbolicName: cdi-api
Bundle-Version: 1.1
Include-Resource: @../cdi-api-1.1-PFD.jar
Include-Resource: @../cdi-api-1.1.jar
-exportcontents: *

View File

@ -2,4 +2,6 @@
Bundle-Version: 1.1.0
Include-Resource: @../jandex-1.1.0.Alpha1.jar
Import-Package: org.apache.tools.ant;resolution:=optional, org.apache.tools.ant.types;resolution:=optional, *
-exportcontents: *

View File

@ -1,5 +0,0 @@
Bundle-SymbolicName: serp
Bundle-Version: 1.14.1
Include-Resource: @../serp-1.14.1.jar
-exportcontents: *