Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 22610ee

Browse files
no dedicated connection required anymore
1 parent e280483 commit 22610ee

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

sqldev/src/test/java/org/utplsql/sqldev/test/coverage/CodeCoverageReporterTest.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import java.nio.charset.StandardCharsets;
2121
import java.nio.file.Files;
2222
import java.nio.file.Path;
23-
import java.sql.Connection;
2423
import java.util.Arrays;
2524
import java.util.Comparator;
2625
import java.util.List;
@@ -30,7 +29,6 @@
3029
import org.junit.Assert;
3130
import org.junit.Before;
3231
import org.junit.Test;
33-
import org.springframework.jdbc.datasource.SingleConnectionDataSource;
3432
import org.utplsql.sqldev.coverage.CodeCoverageReporter;
3533
import org.utplsql.sqldev.exception.GenericRuntimeException;
3634
import org.utplsql.sqldev.model.DatabaseTools;
@@ -98,19 +96,11 @@ private Path getNewestOutputFile() {
9896

9997
@Test
10098
public void produceReportAndCloseConnection() {
101-
// create temporary dataSource, closed by reporter
102-
SingleConnectionDataSource ds = new SingleConnectionDataSource();
103-
ds.setDriverClassName("oracle.jdbc.OracleDriver");
104-
ds.setUrl(dataSource.getUrl());
105-
ds.setUsername(dataSource.getUsername());
106-
ds.setPassword(dataSource.getPassword());
107-
final Connection conn = DatabaseTools.getConnection(ds);
10899
final List<String> pathList = Arrays.asList(":test_f");
109100
final List<String> includeObjectList = Arrays.asList("f");
110-
final CodeCoverageReporter reporter = new CodeCoverageReporter(pathList, includeObjectList, conn);
101+
final CodeCoverageReporter reporter = new CodeCoverageReporter(pathList, includeObjectList, DatabaseTools.getConnection(dataSource));
111102
final Thread run = reporter.runAsync();
112103
SystemTools.waitForThread(run, 20000);
113-
Assert.assertTrue(DatabaseTools.isConnectionClosed(conn));
114104
final Path outputFile = this.getNewestOutputFile();
115105
Assert.assertNotNull(outputFile);
116106
final String content = new String(FileTools.readFile(outputFile), StandardCharsets.UTF_8);

0 commit comments

Comments
 (0)