From 7eedcfea4e5bd183d727a2fae4766d8719fc12b9 Mon Sep 17 00:00:00 2001 From: Hardy Ferentschik Date: Tue, 26 Oct 2010 11:01:39 +0200 Subject: [PATCH] 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. --- .../hibernate-entitymanager.gradle | 50 +++++++++++++------ .../ejb/test/pack/cfgxmlpar/hibernate.cfg.xml | 13 +++-- .../defaultpar/META-INF/persistence.xml | 11 ++-- .../defaultpar_1_0/META-INF/persistence.xml | 11 ++-- .../excludehbmpar/META-INF/persistence.xml | 11 ++-- .../explicitpar/META-INF/persistence.xml | 13 +++-- .../explodedpar/META-INF/persistence.xml | 11 ++-- .../overridenpar/META-INF/persistence.xml | 2 +- .../overridenpar/overridenpar.properties | 9 ++-- .../space par/META-INF/persistence.xml | 11 ++-- .../WEB-INF/classes/META-INF/persistence.xml | 12 ++--- 11 files changed, 81 insertions(+), 73 deletions(-) diff --git a/hibernate-entitymanager/hibernate-entitymanager.gradle b/hibernate-entitymanager/hibernate-entitymanager.gradle index 4047df2c5d..aafd4754b1 100644 --- a/hibernate-entitymanager/hibernate-entitymanager.gradle +++ b/hibernate-entitymanager/hibernate-entitymanager.gradle @@ -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 diff --git a/hibernate-entitymanager/src/test/bundles/cfgxmlpar/org/hibernate/ejb/test/pack/cfgxmlpar/hibernate.cfg.xml b/hibernate-entitymanager/src/test/bundles/cfgxmlpar/org/hibernate/ejb/test/pack/cfgxmlpar/hibernate.cfg.xml index 6a38cb63b9..33f43895d4 100644 --- a/hibernate-entitymanager/src/test/bundles/cfgxmlpar/org/hibernate/ejb/test/pack/cfgxmlpar/hibernate.cfg.xml +++ b/hibernate-entitymanager/src/test/bundles/cfgxmlpar/org/hibernate/ejb/test/pack/cfgxmlpar/hibernate.cfg.xml @@ -4,12 +4,11 @@ - ${db.dialect} - ${jdbc.driver} - ${jdbc.user} - ${jdbc.pass} - ${jdbc.url} - ${jdbc.isolation} + org.hibernate.dialect.H2Dialect + org.h2.Driver + sa + + jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE true hibernate.test true @@ -20,7 +19,7 @@ org.hibernate.cache.HashtableCacheProvider - + diff --git a/hibernate-entitymanager/src/test/bundles/defaultpar/META-INF/persistence.xml b/hibernate-entitymanager/src/test/bundles/defaultpar/META-INF/persistence.xml index 028fcb0a99..02746fbe28 100644 --- a/hibernate-entitymanager/src/test/bundles/defaultpar/META-INF/persistence.xml +++ b/hibernate-entitymanager/src/test/bundles/defaultpar/META-INF/persistence.xml @@ -8,12 +8,11 @@ org.hibernate.ejb.test.pack.defaultpar.Lighter CALLBACK - - - - - - + + + + + diff --git a/hibernate-entitymanager/src/test/bundles/defaultpar_1_0/META-INF/persistence.xml b/hibernate-entitymanager/src/test/bundles/defaultpar_1_0/META-INF/persistence.xml index ddebcbbc83..b60f45ddf7 100644 --- a/hibernate-entitymanager/src/test/bundles/defaultpar_1_0/META-INF/persistence.xml +++ b/hibernate-entitymanager/src/test/bundles/defaultpar_1_0/META-INF/persistence.xml @@ -7,12 +7,11 @@ org.hibernate.ejb.test.pack.defaultpar.Lighter - - - - - - + + + + + diff --git a/hibernate-entitymanager/src/test/bundles/excludehbmpar/META-INF/persistence.xml b/hibernate-entitymanager/src/test/bundles/excludehbmpar/META-INF/persistence.xml index b1aaf3626a..1c504a5e87 100644 --- a/hibernate-entitymanager/src/test/bundles/excludehbmpar/META-INF/persistence.xml +++ b/hibernate-entitymanager/src/test/bundles/excludehbmpar/META-INF/persistence.xml @@ -7,12 +7,11 @@ META-INF/orm2.xml - - - - - - + + + + + diff --git a/hibernate-entitymanager/src/test/bundles/explicitpar/META-INF/persistence.xml b/hibernate-entitymanager/src/test/bundles/explicitpar/META-INF/persistence.xml index bc7a8ee056..129e701e6b 100644 --- a/hibernate-entitymanager/src/test/bundles/explicitpar/META-INF/persistence.xml +++ b/hibernate-entitymanager/src/test/bundles/explicitpar/META-INF/persistence.xml @@ -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"> - ${basedir}/target/packages/externaljar.jar + @buildDirName@/packages/externaljar.jar org.hibernate.ejb.test.Cat org.hibernate.ejb.test.Kitten org.hibernate.ejb.test.Distributor @@ -14,12 +14,11 @@ - - - - - - + + + + + diff --git a/hibernate-entitymanager/src/test/bundles/explodedpar/META-INF/persistence.xml b/hibernate-entitymanager/src/test/bundles/explodedpar/META-INF/persistence.xml index bdf6c57e9d..9ec12169f3 100644 --- a/hibernate-entitymanager/src/test/bundles/explodedpar/META-INF/persistence.xml +++ b/hibernate-entitymanager/src/test/bundles/explodedpar/META-INF/persistence.xml @@ -6,12 +6,11 @@ version="2.0"> - - - - - - + + + + + diff --git a/hibernate-entitymanager/src/test/bundles/overridenpar/META-INF/persistence.xml b/hibernate-entitymanager/src/test/bundles/overridenpar/META-INF/persistence.xml index 01bb33c7c8..c94273298d 100644 --- a/hibernate-entitymanager/src/test/bundles/overridenpar/META-INF/persistence.xml +++ b/hibernate-entitymanager/src/test/bundles/overridenpar/META-INF/persistence.xml @@ -6,7 +6,7 @@ java:/unreachableDS - + diff --git a/hibernate-entitymanager/src/test/bundles/overridenpar/overridenpar.properties b/hibernate-entitymanager/src/test/bundles/overridenpar/overridenpar.properties index d05eed05b0..79b6559cef 100644 --- a/hibernate-entitymanager/src/test/bundles/overridenpar/overridenpar.properties +++ b/hibernate-entitymanager/src/test/bundles/overridenpar/overridenpar.properties @@ -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} \ No newline at end of file +hibernate.connection.driver_class @jdbc.driver@ +hibernate.connection.url @jdbc.url@ +hibernate.connection.username @jdbc.user@ +hibernate.connection.password @jdbc.pass@ \ No newline at end of file diff --git a/hibernate-entitymanager/src/test/bundles/space par/META-INF/persistence.xml b/hibernate-entitymanager/src/test/bundles/space par/META-INF/persistence.xml index 90ffddb475..61a812da54 100644 --- a/hibernate-entitymanager/src/test/bundles/space par/META-INF/persistence.xml +++ b/hibernate-entitymanager/src/test/bundles/space par/META-INF/persistence.xml @@ -6,12 +6,11 @@ version="2.0"> - - - - - - + + + + + diff --git a/hibernate-entitymanager/src/test/bundles/war/WEB-INF/classes/META-INF/persistence.xml b/hibernate-entitymanager/src/test/bundles/war/WEB-INF/classes/META-INF/persistence.xml index 564df720fc..f5e942bec8 100644 --- a/hibernate-entitymanager/src/test/bundles/war/WEB-INF/classes/META-INF/persistence.xml +++ b/hibernate-entitymanager/src/test/bundles/war/WEB-INF/classes/META-INF/persistence.xml @@ -7,13 +7,11 @@ org.hibernate.ejb.test.pack.defaultpar.Lighter - - - - - - - + + + + +