@@ -134,30 +134,19 @@ public void execute() throws MojoExecutionException {
134134 Connection connection = null ;
135135 ReportWriter reportWriter = null ;
136136 try {
137- FileMapperOptions sourceMappingOptions = buildSourcesOptions ();
138- FileMapperOptions testMappingOptions = buildTestsOptions ();
139- setDbConfiguration ();
140-
141- OracleDataSource ds = new OracleDataSource ();
142- ds .setURL (url );
143- ds .setUser (user );
144- ds .setPassword (password );
145- connection = ds .getConnection ();
137+ connection = createConnection ();
146138
147139 Version utlVersion = new DefaultDatabaseInformation ().getUtPlsqlFrameworkVersion (connection );
148140 getLog ().info ("utPLSQL Version = " + utlVersion );
149141
150142 reportWriter = new ReportWriter (targetDir , utlVersion , getLog ());
151143
152144 List <Reporter > reporterList = initReporters (connection , reportWriter , ReporterFactory .createEmpty ());
145+ FileMapperOptions sourceMappingOptions = buildSourcesOptions ();
146+ FileMapperOptions testMappingOptions = buildTestsOptions ();
153147
154148 logParameters (sourceMappingOptions , testMappingOptions , reporterList );
155149
156- if (dbmsOutput ) {
157- DBHelper .enableDBMSOutput (connection );
158- getLog ().info ("Enabled dbms_output." );
159- }
160-
161150 TestRunner runner = new TestRunner ()
162151 .addPathList (paths )
163152 .addReporterList (reporterList )
@@ -180,7 +169,7 @@ public void execute() throws MojoExecutionException {
180169 runner .run (connection );
181170
182171 } catch (SomeTestsFailedException e ) {
183- if (!this . ignoreFailure ) {
172+ if (!ignoreFailure ) {
184173 throw new MojoExecutionException (e .getMessage (), e );
185174 }
186175 } catch (SQLException e ) {
@@ -201,7 +190,8 @@ public void execute() throws MojoExecutionException {
201190 }
202191 }
203192
204- private void setDbConfiguration () {
193+
194+ private Connection createConnection () throws SQLException {
205195 if (StringUtils .isEmpty (url )) {
206196 url = System .getProperty ("dbUrl" );
207197 }
@@ -211,6 +201,18 @@ private void setDbConfiguration() {
211201 if (StringUtils .isEmpty (password )) {
212202 password = System .getProperty ("dbPass" );
213203 }
204+
205+ OracleDataSource ds = new OracleDataSource ();
206+ ds .setURL (url );
207+ ds .setUser (user );
208+ ds .setPassword (password );
209+
210+ Connection connection = ds .getConnection ();
211+ if (dbmsOutput ) {
212+ DBHelper .enableDBMSOutput (connection );
213+ getLog ().info ("Enabled dbms_output." );
214+ }
215+ return connection ;
214216 }
215217
216218 FileMapperOptions buildSourcesOptions () throws MojoExecutionException {
0 commit comments