HHH-12656 - Document how contributors can run tests on different databases
This commit is contained in:
parent
b98c02c503
commit
964602557f
18
README.md
18
README.md
|
@ -128,3 +128,21 @@ Use the following command:
|
||||||
gradle clean compile -Pdb=pgsql
|
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*_
|
_*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.
|
||||||
|
|
|
@ -293,7 +293,22 @@ task copyResourcesToIntelliJOutFolder {
|
||||||
//// Gradle plugin). For now, just compile first in order to get the logging classes.
|
//// Gradle plugin). For now, just compile first in order to get the logging classes.
|
||||||
//eclipseClasspath.dependsOn compile
|
//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
|
// Report configs
|
||||||
|
|
Loading…
Reference in New Issue