Skip to content

Commit e73ffbc

Browse files
committed
[#2129] Set the logging properties in a separate method
This way we can reuse the method even if the tests don't extend BaseReactiveTest
1 parent 1955d45 commit e73ffbc

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

hibernate-reactive-core/src/test/java/org/hibernate/reactive/BaseReactiveTest.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,18 @@ protected void setProperties(Configuration configuration) {
9292
setDefaultProperties( configuration );
9393
}
9494

95+
/**
96+
* Set the properties related to the SQL logs.
97+
* Some tests won't extend this class, but we still want to apply the same rules for these kinds of properties.
98+
*/
99+
public static void setSqlLoggingProperties(Configuration configuration) {
100+
// Use JAVA_TOOL_OPTIONS='-Dhibernate.show_sql=true'
101+
// Keep the default to false, otherwise the log on CI becomes too big
102+
configuration.setProperty( Settings.SHOW_SQL, System.getProperty( Settings.SHOW_SQL, "false" ) );
103+
configuration.setProperty( Settings.FORMAT_SQL, System.getProperty( Settings.FORMAT_SQL, "false" ) );
104+
configuration.setProperty( Settings.HIGHLIGHT_SQL, System.getProperty( Settings.HIGHLIGHT_SQL, "true" ) );
105+
}
106+
95107
/**
96108
* Configure default properties common to most tests.
97109
*/
@@ -102,13 +114,9 @@ public static void setDefaultProperties(Configuration configuration) {
102114
configuration.setProperty( Settings.HBM2DDL_IMPORT_FILES, "/db2.sql" );
103115
doneTablespace = true;
104116
}
105-
// Use JAVA_TOOL_OPTIONS='-Dhibernate.show_sql=true'
106-
// Keep the default to false, otherwise the log on CI becomes too big
107-
configuration.setProperty( Settings.SHOW_SQL, System.getProperty( Settings.SHOW_SQL, "false" ) );
108-
configuration.setProperty( Settings.FORMAT_SQL, System.getProperty( Settings.FORMAT_SQL, "false" ) );
109-
configuration.setProperty( Settings.HIGHLIGHT_SQL, System.getProperty( Settings.HIGHLIGHT_SQL, "true" ) );
110117
configuration.setProperty( PersistentTableStrategy.DROP_ID_TABLES, "true" );
111118
configuration.setProperty( GlobalTemporaryTableStrategy.DROP_ID_TABLES, "true" );
119+
setSqlLoggingProperties( configuration );
112120
}
113121

114122
public static final SessionFactoryManager factoryManager = new SessionFactoryManager();

0 commit comments

Comments
 (0)