File tree Expand file tree Collapse file tree 6 files changed +16
-44
lines changed
gradle/plugin/src/functionalTest/java/org/hibernate/tool Expand file tree Collapse file tree 6 files changed +16
-44
lines changed Original file line number Diff line number Diff line change @@ -41,14 +41,6 @@ private void verifyDatabase() throws Exception {
4141 assertEquals ("foo" , resultSet .getString (2 ));
4242 }
4343
44- private void editGradleBuildFile () throws Exception {
45- StringBuffer gradleBuildFileContents = new StringBuffer (
46- new String (Files .readAllBytes (getGradleBuildFile ().toPath ())));
47- addHibernateToolsPluginLine (gradleBuildFileContents );
48- addH2DatabaseDependencyLine (gradleBuildFileContents );
49- Files .writeString (getGradleBuildFile ().toPath (), gradleBuildFileContents .toString ());
50- }
51-
5244 private void editGradlePropertiesFile () throws Exception {
5345 // The Hibernate Tools Gradle plugin does not support the configuration cache.
5446 // As this is enabled by default when initializing a new Gradle project, the setting needs to be commented out
Original file line number Diff line number Diff line change @@ -41,15 +41,6 @@ private void verifyDatabase() throws Exception {
4141 assertEquals ("foo" , resultSet .getString (2 ));
4242 }
4343
44- private void editGradleBuildFile () throws Exception {
45- StringBuffer gradleBuildFileContents = new StringBuffer (
46- new String (Files .readAllBytes (getGradleBuildFile ().toPath ())));
47- addHibernateToolsPluginLine (gradleBuildFileContents );
48- addH2DatabaseDependencyLine (gradleBuildFileContents );
49- addHibernateToolsExtension (gradleBuildFileContents );
50- Files .writeString (getGradleBuildFile ().toPath (), gradleBuildFileContents .toString ());
51- }
52-
5344 private void editGradlePropertiesFile () throws Exception {
5445 // The Hibernate Tools Gradle plugin does not support the configuration cache.
5546 // As this is enabled by default when initializing a new Gradle project, the setting needs to be commented out
@@ -111,7 +102,7 @@ private void verifyProject() throws Exception {
111102 assertTrue (generatedPersonJavaFileContents .contains ("public class Person " ));
112103 }
113104
114- private void addHibernateToolsExtension (StringBuffer gradleBuildFileContents ) {
105+ protected void addHibernateToolsExtension (StringBuffer gradleBuildFileContents ) {
115106 int pos = gradleBuildFileContents .indexOf ("dependencies {" );
116107 pos = gradleBuildFileContents .indexOf ("}" , pos );
117108 StringBuffer hibernateToolsExtension = new StringBuffer ();
Original file line number Diff line number Diff line change @@ -31,15 +31,6 @@ public void testTutorial() throws Exception {
3131 verifyProject ();
3232 }
3333
34- private void editGradleBuildFile () throws Exception {
35- StringBuffer gradleBuildFileContents = new StringBuffer (
36- new String (Files .readAllBytes (getGradleBuildFile ().toPath ())));
37- addHibernateToolsPluginLine (gradleBuildFileContents );
38- addH2DatabaseDependencyLine (gradleBuildFileContents );
39- addHibernateToolsExtension (gradleBuildFileContents );
40- Files .writeString (getGradleBuildFile ().toPath (), gradleBuildFileContents .toString ());
41- }
42-
4334 private void editGradlePropertiesFile () throws Exception {
4435 // The Hibernate Tools Gradle plugin does not support the configuration cache.
4536 // As this is enabled by default when initializing a new Gradle project, the setting needs to be commented out
@@ -111,7 +102,7 @@ private void verifyProject() throws Exception {
111102 assertTrue (generatedItemJavaFileContents .contains ("public class Item " ));
112103 }
113104
114- private void addHibernateToolsExtension (StringBuffer gradleBuildFileContents ) {
105+ protected void addHibernateToolsExtension (StringBuffer gradleBuildFileContents ) {
115106 int pos = gradleBuildFileContents .indexOf ("dependencies {" );
116107 pos = gradleBuildFileContents .indexOf ("}" , pos );
117108 StringBuffer hibernateToolsExtension = new StringBuffer ();
Original file line number Diff line number Diff line change @@ -31,14 +31,6 @@ public void testTutorial() throws Exception {
3131 verifyProject ();
3232 }
3333
34- private void editGradleBuildFile () throws Exception {
35- StringBuffer gradleBuildFileContents = new StringBuffer (
36- new String (Files .readAllBytes (getGradleBuildFile ().toPath ())));
37- addHibernateToolsPluginLine (gradleBuildFileContents );
38- addH2DatabaseDependencyLine (gradleBuildFileContents );
39- Files .writeString (getGradleBuildFile ().toPath (), gradleBuildFileContents .toString ());
40- }
41-
4234 private void editGradlePropertiesFile () throws Exception {
4335 // The Hibernate Tools Gradle plugin does not support the configuration cache.
4436 // As this is enabled by default when initializing a new Gradle project, the setting needs to be commented out
Original file line number Diff line number Diff line change @@ -41,14 +41,6 @@ private void verifyDatabase() throws Exception {
4141 assertEquals ("foo" , resultSet .getString (2 ));
4242 }
4343
44- private void editGradleBuildFile () throws Exception {
45- StringBuffer gradleBuildFileContents = new StringBuffer (
46- new String (Files .readAllBytes (getGradleBuildFile ().toPath ())));
47- addHibernateToolsPluginLine (gradleBuildFileContents );
48- addH2DatabaseDependencyLine (gradleBuildFileContents );
49- Files .writeString (getGradleBuildFile ().toPath (), gradleBuildFileContents .toString ());
50- }
51-
5244 private void editGradlePropertiesFile () throws Exception {
5345 // The Hibernate Tools Gradle plugin does not support the configuration cache.
5446 // As this is enabled by default when initializing a new Gradle project, the setting needs to be commented out
Original file line number Diff line number Diff line change 44import static org .junit .jupiter .api .Assertions .assertTrue ;
55
66import java .io .File ;
7+ import java .nio .file .Files ;
78import java .util .List ;
89
910import org .junit .jupiter .api .io .TempDir ;
@@ -51,6 +52,15 @@ protected void createGradleProject() throws Exception {
5152 assertFalse (getDatabaseFile ().exists ());
5253 }
5354
55+ protected void editGradleBuildFile () throws Exception {
56+ StringBuffer gradleBuildFileContents = new StringBuffer (
57+ new String (Files .readAllBytes (getGradleBuildFile ().toPath ())));
58+ addHibernateToolsPluginLine (gradleBuildFileContents );
59+ addH2DatabaseDependencyLine (gradleBuildFileContents );
60+ addHibernateToolsExtension (gradleBuildFileContents );
61+ Files .writeString (getGradleBuildFile ().toPath (), gradleBuildFileContents .toString ());
62+ }
63+
5464 protected String constructH2DatabaseDependencyLine () {
5565 return " implementation 'com.h2database:h2:" + System .getenv ("H2_VERSION" ) + "'" ;
5666 }
@@ -76,4 +86,8 @@ protected void addHibernateToolsPluginLine(StringBuffer gradleBuildFileContents)
7686 gradleBuildFileContents .insert (pos , constructHibernateToolsPluginLine () + "\n " );
7787 }
7888
89+ protected void addHibernateToolsExtension (StringBuffer gradleBuildFileContents ) {
90+
91+ }
92+
7993}
You can’t perform that action at this time.
0 commit comments