|
20 | 20 | import java.nio.charset.StandardCharsets;
|
21 | 21 | import java.nio.file.Files;
|
22 | 22 | import java.nio.file.Path;
|
23 |
| -import java.sql.Connection; |
24 | 23 | import java.util.Arrays;
|
25 | 24 | import java.util.Comparator;
|
26 | 25 | import java.util.List;
|
|
30 | 29 | import org.junit.Assert;
|
31 | 30 | import org.junit.Before;
|
32 | 31 | import org.junit.Test;
|
33 |
| -import org.springframework.jdbc.datasource.SingleConnectionDataSource; |
34 | 32 | import org.utplsql.sqldev.coverage.CodeCoverageReporter;
|
35 | 33 | import org.utplsql.sqldev.exception.GenericRuntimeException;
|
36 | 34 | import org.utplsql.sqldev.model.DatabaseTools;
|
@@ -98,19 +96,11 @@ private Path getNewestOutputFile() {
|
98 | 96 |
|
99 | 97 | @Test
|
100 | 98 | 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); |
108 | 99 | final List<String> pathList = Arrays.asList(":test_f");
|
109 | 100 | 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)); |
111 | 102 | final Thread run = reporter.runAsync();
|
112 | 103 | SystemTools.waitForThread(run, 20000);
|
113 |
| - Assert.assertTrue(DatabaseTools.isConnectionClosed(conn)); |
114 | 104 | final Path outputFile = this.getNewestOutputFile();
|
115 | 105 | Assert.assertNotNull(outputFile);
|
116 | 106 | final String content = new String(FileTools.readFile(outputFile), StandardCharsets.UTF_8);
|
|
0 commit comments