HHH-12656 - Document how contributors can run tests on different databases

This commit is contained in:
Vlad Mihalcea 2018-06-01 08:56:13 +03:00
parent b98c02c503
commit 964602557f
2 changed files with 33 additions and 0 deletions

View File

@ -128,3 +128,21 @@ Use the following command:
gradle clean compile -Pdb=pgsql
_*NOTE : If you are running tests against a JDBC driver that is not available via Maven central (generally due to license nonsense - Oracle, DB2, etc) be sure to add these drivers to your local Maven repo cache (~/.m2/repository) or (better) add it to a personal Maven repo server*_
Running database-specific tests from the IDE using "profiles"
-------------------------------------------------------------
You can run any test on any particular database that is configured in a `databases.gradle` profile.
All you have to do is run the following command:
gradlew setDataBase -Pdb=pgsql
or you can use the shortcut version:
gradlew sDB -Pdb=pgsql
You can do this from the module which you are interested in testing or from the `hibernate-orm` root folder.
Afterward, just pick any test from the IDE and run it as usual. Hibernate will pick the database configuration from the `hibernate.properties`
file that was set up by the `setDataBase` Gradle task.

View File

@ -293,7 +293,22 @@ task copyResourcesToIntelliJOutFolder {
//// Gradle plugin). For now, just compile first in order to get the logging classes.
//eclipseClasspath.dependsOn compile
/*
Use this task to set the current DB in a given module.
> gradlew sDB -Pdb=mysql
Afterward, you can run any test from the IDE against that particular DB.
*/
task setDataBase {
inputs.property( "db", db )
doLast {
processTestResources.execute()
copyResourcesToIntelliJOutFolder.execute()
println( 'Setting current database to ' + db )
}
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Report configs