1212import org .utplsql .api .reporter .ReporterFactory ;
1313import org .utplsql .cli .exception .DatabaseConnectionFailed ;
1414
15+ import javax .sql .DataSource ;
1516import java .io .File ;
1617import java .sql .Connection ;
1718import java .sql .SQLException ;
@@ -35,7 +36,7 @@ public class RunCommand {
3536 required = true ,
3637 converter = ConnectionInfo .ConnectionStringConverter .class ,
3738 arity = 1 ,
38- description = "<user>/<password>@//<host>[:<port>]/<service> OR <user>/<password>@<TNSName> OR <user>/<password>@<host>:<port>:<SID>" )
39+ description = ConnectionInfo . COMMANDLINE_PARAM_DESCRIPTION )
3940 private List <ConnectionInfo > connectionInfoList = new ArrayList <>();
4041
4142 @ Parameter (
@@ -111,9 +112,6 @@ public List<String> getTestPaths() {
111112
112113 public int run () throws Exception {
113114
114- RunCommandChecker .checkOracleJDBCExists ();
115-
116-
117115 final List <Reporter > reporterList ;
118116 final List <String > testPaths = getTestPaths ();
119117
@@ -144,14 +142,13 @@ public int run() throws Exception {
144142 final ArrayList <String > finalIncludeObjectsList = includeObjectsList ;
145143 final ArrayList <String > finalExcludeObjectsList = excludeObjectsList ;
146144
147- final ConnectionInfo ci = getConnectionInfo ();
148- ci .setMaxConnections (getReporterManager ().getNumberOfReporters ()+1 );
145+ final DataSource dataSource = DataSourceProvider .getDataSource (getConnectionInfo (), getReporterManager ().getNumberOfReporters ()+1 );
149146
150147 // Do the reporters initialization, so we can use the id to run and gather results.
151- try (Connection conn = ci .getConnection ()) {
148+ try (Connection conn = dataSource .getConnection ()) {
152149
153150 // Check if orai18n exists if database version is 11g
154- RunCommandChecker .checkOracleI18nExists (ci . getOracleDatabaseVersion ( conn ) );
151+ RunCommandChecker .checkOracleI18nExists (conn );
155152
156153 // First of all do a compatibility check and fail-fast
157154 compatibilityProxy = checkFrameworkCompatibility (conn );
@@ -178,7 +175,7 @@ public int run() throws Exception {
178175
179176 // Run tests.
180177 executorService .submit (() -> {
181- try (Connection conn = ci .getConnection ()) {
178+ try (Connection conn = dataSource .getConnection ()) {
182179 TestRunner testRunner = new TestRunner ()
183180 .addPathList (testPaths )
184181 .addReporterList (reporterList )
@@ -201,7 +198,7 @@ public int run() throws Exception {
201198 });
202199
203200 // Gather each reporter results on a separate thread.
204- getReporterManager ().startReporterGatherers (executorService , ci , returnCode );
201+ getReporterManager ().startReporterGatherers (executorService , dataSource , returnCode );
205202
206203 executorService .shutdown ();
207204 executorService .awaitTermination (60 , TimeUnit .MINUTES );
0 commit comments