HHH-5693 Update the filtered resource files to use @@ as token for filtering

Tokens use now the @property@ syntax instead of ${property}, because underneath
ant filtering is used. Also remove hibernate.connection.isolation property which
is irrelevant for these tests.
Update gradle build script to use filtering when copying the bundle resources.
The script also adds a new compilation task for just compiling the metamodel.
Seems to be needed for Mac.
This commit is contained in:
Hardy Ferentschik 2010-10-26 11:01:39 +02:00
parent dde0e64495
commit 7eedcfea4e
11 changed files with 81 additions and 73 deletions

View File

@ -1,9 +1,7 @@
import org.apache.tools.ant.filters.*
apply plugin: 'java'
// todo : there are test failures due to issues with how 'bundles' are handled.
// My guess is using TCCL as the tests try to is not valid in Gradle.
// not needed if we rename the directories to match the sourceSet name
sourceSets {
test {
@ -35,27 +33,47 @@ dependencies {
procTargetDirName = buildDirName + "/generated-src/jpamodelgen"
procTargetDir = dir( procTargetDirName )
compileJava {
task generateMetaModel(type: Compile) {
classpath = compileTestJava.classpath
source = compileTestJava.source
destinationDir = compileTestJava.destinationDir
configure( options ) {
compilerArgs = ["-proc:only", "-s", "$procTargetDir.dir.absolutePath"]
}
}
generateMetaModel.dependsOn procTargetDir
compileTestJava {
configure( options ) {
compilerArgs = [ "-s", "$procTargetDir.dir.absolutePath" ]
}
source += files(procTargetDir.dir)
}
compileJava.dependsOn procTargetDir
compileTestJava.dependsOn generateMetaModel
bundlesTargetDirName = "$buildDirName/bundles"
bundlesTargetDir = dir( bundlesTargetDirName )
task processBundleResources {
copy {
from 'src/test/bundles'
into bundlesTargetDir.dir
}
task copyBundleResources (type: Copy) {
bundlesTargetDirName = "$buildDirName/bundles"
bundlesTargetDir = dir( bundlesTargetDirName )
from file('src/test/bundles')
into bundlesTargetDir.dir
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',
])
}
processBundleResources.dependsOn bundlesTargetDir
//copyBundleResources.dependsOn hibernateProperties
processTestResources.dependsOn copyBundleResources
ideaModule {
testSourceDirs.add( file( procTargetDirName ) )
}
ideaModule.dependsOn procTargetDir
// TODO : temporarily disable the tests until the shrinkwrap stuff is straightened out.
test.enabled = false

View File

@ -4,12 +4,11 @@
<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">${db.dialect}</property>
<property name="hibernate.connection.driver_class">${jdbc.driver}</property>
<property name="hibernate.connection.username">${jdbc.user}</property>
<property name="hibernate.connection.password">${jdbc.pass}</property>
<property name="hibernate.connection.url">${jdbc.url}</property>
<property name="hibernate.connection.isolation">${jdbc.isolation}</property>
<property name="hibernate.dialect">org.hibernate.dialect.H2Dialect</property>
<property name="hibernate.connection.driver_class">org.h2.Driver</property>
<property name="hibernate.connection.username">sa</property>
<property name="hibernate.connection.password"></property>
<property name="hibernate.connection.url">jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE</property>
<property name="hibernate.cache.use_query_cache">true</property>
<property name="hibernate.cache.region_prefix">hibernate.test</property>
<property name="hibernate.jdbc.use_streams_for_binary">true</property>
@ -20,7 +19,7 @@
<property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
<mapping class="org.hibernate.ejb.test.Item"/>
<mapping class="org.hibernate.ejb.test.Cat"/>
<mapping class="org.hibernate.ejb.test.Kitten"/>
<mapping class="org.hibernate.ejb.test.Kitten"/>
<mapping class="org.hibernate.ejb.test.Distributor"/>
<class-cache class="org.hibernate.ejb.test.Item" usage="read-write"/>
<collection-cache collection="org.hibernate.ejb.test.Item.distributors" usage="read-write" region="RegionName"/>

View File

@ -8,12 +8,11 @@
<class>org.hibernate.ejb.test.pack.defaultpar.Lighter</class>
<validation-mode>CALLBACK</validation-mode>
<properties>
<property name="hibernate.dialect" value="${db.dialect}"/>
<property name="hibernate.connection.driver_class" value="${jdbc.driver}"/>
<property name="hibernate.connection.username" value="${jdbc.user}"/>
<property name="hibernate.connection.password" value="${jdbc.pass}"/>
<property name="hibernate.connection.url" value="${jdbc.url}"/>
<property name="hibernate.connection.isolation" value="${jdbc.isolation}"/>
<property name="hibernate.dialect" value="@db.dialect@"/>
<property name="hibernate.connection.driver_class" value="@jdbc.driver@"/>
<property name="hibernate.connection.username" value="@jdbc.user@"/>
<property name="hibernate.connection.password" value="@jdbc.pass@"/>
<property name="hibernate.connection.url" value="@jdbc.url@"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
</properties>

View File

@ -7,12 +7,11 @@
<persistence-unit name="defaultpar_1_0">
<class>org.hibernate.ejb.test.pack.defaultpar.Lighter</class>
<properties>
<property name="hibernate.dialect" value="${db.dialect}"/>
<property name="hibernate.connection.driver_class" value="${jdbc.driver}"/>
<property name="hibernate.connection.username" value="${jdbc.user}"/>
<property name="hibernate.connection.password" value="${jdbc.pass}"/>
<property name="hibernate.connection.url" value="${jdbc.url}"/>
<property name="hibernate.connection.isolation" value="${jdbc.isolation}"/>
<property name="hibernate.dialect" value="@db.dialect@"/>
<property name="hibernate.connection.driver_class" value="@jdbc.driver@"/>
<property name="hibernate.connection.username" value="@jdbc.user@"/>
<property name="hibernate.connection.password" value="@jdbc.pass@"/>
<property name="hibernate.connection.url" value="@jdbc.url@"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
</properties>

View File

@ -7,12 +7,11 @@
<persistence-unit name="excludehbmpar" transaction-type="RESOURCE_LOCAL">
<mapping-file>META-INF/orm2.xml</mapping-file>
<properties>
<property name="hibernate.dialect" value="${db.dialect}"/>
<property name="hibernate.connection.driver_class" value="${jdbc.driver}"/>
<property name="hibernate.connection.username" value="${jdbc.user}"/>
<property name="hibernate.connection.password" value="${jdbc.pass}"/>
<property name="hibernate.connection.url" value="${jdbc.url}"/>
<property name="hibernate.connection.isolation" value="${jdbc.isolation}"/>
<property name="hibernate.dialect" value="@db.dialect@"/>
<property name="hibernate.connection.driver_class" value="@jdbc.driver@"/>
<property name="hibernate.connection.username" value="@jdbc.user@"/>
<property name="hibernate.connection.password" value="@jdbc.pass@"/>
<property name="hibernate.connection.url" value="@jdbc.url@"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
<property name="hibernate.archive.autodetection" value="class"/>

View File

@ -4,7 +4,7 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="manager1" transaction-type="RESOURCE_LOCAL">
<jar-file>${basedir}/target/packages/externaljar.jar</jar-file>
<jar-file>@buildDirName@/packages/externaljar.jar</jar-file>
<class>org.hibernate.ejb.test.Cat</class>
<class>org.hibernate.ejb.test.Kitten</class>
<class>org.hibernate.ejb.test.Distributor</class>
@ -14,12 +14,11 @@
<!-- custom scanner test -->
<property name="hibernate.ejb.resource_scanner" value="org.hibernate.ejb.test.packaging.CustomScanner"/>
<property name="hibernate.dialect" value="${db.dialect}"/>
<property name="hibernate.connection.driver_class" value="${jdbc.driver}"/>
<property name="hibernate.connection.username" value="${jdbc.user}"/>
<property name="hibernate.connection.password" value="${jdbc.pass}"/>
<property name="hibernate.connection.url" value="${jdbc.url}"/>
<property name="hibernate.connection.isolation" value="${jdbc.isolation}"/>
<property name="hibernate.dialect" value="@db.dialect@"/>
<property name="hibernate.connection.driver_class" value="@jdbc.driver@"/>
<property name="hibernate.connection.username" value="@jdbc.user@"/>
<property name="hibernate.connection.password" value="@jdbc.pass@"/>
<property name="hibernate.connection.url" value="@jdbc.url@"/>
<property name="hibernate.cache.use_query_cache" value="true"/>
<property name="hibernate.cache.region_prefix" value="hibernate.test"/>
<property name="hibernate.jdbc.use_streams_for_binary" value="true"/>

View File

@ -6,12 +6,11 @@
version="2.0">
<persistence-unit name="explodedpar" transaction-type="RESOURCE_LOCAL">
<properties>
<property name="hibernate.dialect" value="${db.dialect}"/>
<property name="hibernate.connection.driver_class" value="${jdbc.driver}"/>
<property name="hibernate.connection.username" value="${jdbc.user}"/>
<property name="hibernate.connection.password" value="${jdbc.pass}"/>
<property name="hibernate.connection.url" value="${jdbc.url}"/>
<property name="hibernate.connection.isolation" value="${jdbc.isolation}"/>
<property name="hibernate.dialect" value="@db.dialect@"/>
<property name="hibernate.connection.driver_class" value="@jdbc.driver@"/>
<property name="hibernate.connection.username" value="@jdbc.user@"/>
<property name="hibernate.connection.password" value="@jdbc.pass@"/>
<property name="hibernate.connection.url" value="@jdbc.url@"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
</properties>

View File

@ -6,7 +6,7 @@
<persistence-unit name="overridenpar">
<jta-data-source>java:/unreachableDS</jta-data-source>
<properties>
<property name="hibernate.dialect" value="${db.dialect}"/>
<property name="hibernate.dialect" value="@db.dialect@"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
</properties>

View File

@ -1,5 +1,4 @@
hibernate.connection.driver_class ${jdbc.driver}
hibernate.connection.url ${jdbc.url}
hibernate.connection.username ${jdbc.user}
hibernate.connection.password ${jdbc.pass}
hibernate.connection.isolation ${jdbc.isolation}
hibernate.connection.driver_class @jdbc.driver@
hibernate.connection.url @jdbc.url@
hibernate.connection.username @jdbc.user@
hibernate.connection.password @jdbc.pass@

View File

@ -6,12 +6,11 @@
version="2.0">
<persistence-unit name="space par">
<properties>
<property name="hibernate.dialect" value="${db.dialect}"/>
<property name="hibernate.connection.driver_class" value="${jdbc.driver}"/>
<property name="hibernate.connection.username" value="${jdbc.user}"/>
<property name="hibernate.connection.password" value="${jdbc.pass}"/>
<property name="hibernate.connection.url" value="${jdbc.url}"/>
<property name="hibernate.connection.isolation" value="${jdbc.isolation}"/>
<property name="hibernate.dialect" value="@db.dialect@"/>
<property name="hibernate.connection.driver_class" value="@jdbc.driver@"/>
<property name="hibernate.connection.username" value="@jdbc.user@"/>
<property name="hibernate.connection.password" value="@jdbc.pass@"/>
<property name="hibernate.connection.url" value="@jdbc.url@"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
</properties>

View File

@ -7,13 +7,11 @@
<persistence-unit name="defaultpar">
<class>org.hibernate.ejb.test.pack.defaultpar.Lighter</class>
<properties>
<property name="hibernate.dialect" value="${db.dialect}"/>
<property name="hibernate.connection.driver_class" value="${jdbc.driver}"/>
<property name="hibernate.connection.username" value="${jdbc.user}"/>
<property name="hibernate.connection.password" value="${jdbc.pass}"/>
<property name="hibernate.connection.url" value="${jdbc.url}"/>
<property name="hibernate.connection.isolation" value="${jdbc.isolation}"/>
<property name="hibernate.dialect" value="@db.dialect@"/>
<property name="hibernate.connection.driver_class" value="@jdbc.driver@"/>
<property name="hibernate.connection.username" value="@jdbc.user@"/>
<property name="hibernate.connection.password" value="@jdbc.pass@"/>
<property name="hibernate.connection.url" value="@jdbc.url@"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
</properties>