1
1
package org .utplsql .api ;
2
2
3
+ import org .slf4j .Logger ;
4
+ import org .slf4j .LoggerFactory ;
3
5
import org .utplsql .api .compatibility .CompatibilityProxy ;
4
6
import org .utplsql .api .db .DatabaseInformation ;
5
7
import org .utplsql .api .db .DefaultDatabaseInformation ;
24
26
*/
25
27
public class TestRunner {
26
28
29
+ private static final Logger logger = LoggerFactory .getLogger (TestRunner .class );
30
+
27
31
private final TestRunnerOptions options = new TestRunnerOptions ();
28
32
private CompatibilityProxy compatibilityProxy ;
29
33
private ReporterFactory reporterFactory ;
@@ -122,9 +126,13 @@ private void delayedAddReporters() {
122
126
123
127
public void run (Connection conn ) throws SQLException {
124
128
129
+ logger .info ("TestRunner initialized" );
130
+
125
131
DatabaseInformation databaseInformation = new DefaultDatabaseInformation ();
126
132
127
133
compatibilityProxy = new CompatibilityProxy (conn , options .skipCompatibilityCheck , databaseInformation );
134
+ logger .info ("Running on utPLSQL {}" , compatibilityProxy .getDatabaseVersion ());
135
+
128
136
if ( reporterFactory == null )
129
137
reporterFactory = ReporterFactory .createDefault (compatibilityProxy );
130
138
@@ -133,6 +141,7 @@ public void run(Connection conn) throws SQLException {
133
141
// First of all check version compatibility
134
142
compatibilityProxy .failOnNotCompatible ();
135
143
144
+ logger .info ("Initializing reporters" );
136
145
for (Reporter r : options .reporterList )
137
146
validateReporter (conn , r );
138
147
@@ -141,12 +150,14 @@ public void run(Connection conn) throws SQLException {
141
150
}
142
151
143
152
if (options .reporterList .isEmpty ()) {
153
+ logger .info ("No reporter given so choosing ut_documentation_reporter" );
144
154
options .reporterList .add (new DocumentationReporter ().init (conn ));
145
155
}
146
156
147
- DBHelper .enableDBMSOutput (conn );
148
157
try (TestRunnerStatement testRunnerStatement = compatibilityProxy .getTestRunnerStatement (options , conn )) {
158
+ logger .info ("Running tests" );
149
159
testRunnerStatement .execute ();
160
+ logger .info ("Running tests finished." );
150
161
} catch (SQLException e ) {
151
162
if (e .getErrorCode () == SomeTestsFailedException .ERROR_CODE ) {
152
163
throw new SomeTestsFailedException (e .getMessage (), e );
@@ -157,8 +168,6 @@ else if (e.getErrorCode() == UtPLSQLNotInstalledException.ERROR_CODE) {
157
168
else {
158
169
throw e ;
159
170
}
160
- } finally {
161
- DBHelper .disableDBMSOutput (conn );
162
171
}
163
172
}
164
173
0 commit comments