• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

link-intersystems / lis-commons / #308

03 May 2024 04:47AM UTC coverage: 90.03% (-0.04%) from 90.065%
#308

push

renelink
Moved AbstractDataSource to jdbc and added SingleConnectionDataSource.

5 of 6 new or added lines in 3 files covered. (83.33%)

7441 of 8265 relevant lines covered (90.03%)

0.9 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.86
/lis-commons-jdbc-test/src/main/java/com/link_intersystems/jdbc/test/db/AbstractDataSource.java
1
package com.link_intersystems.jdbc.test.db;
2

3
import javax.sql.DataSource;
4
import java.io.PrintWriter;
5
import java.sql.Connection;
6
import java.sql.SQLException;
7
import java.sql.SQLFeatureNotSupportedException;
8
import java.util.logging.Logger;
9

10
/**
11
 * @author René Link {@literal <rene.link@link-intersystems.com>}
12
 */
13
public abstract class AbstractDataSource implements DataSource {
1✔
14

15
    private PrintWriter out;
16
    private int loginTimeoutSeconds = 0;
1✔
17

18
    @Override
19
    public <T> T unwrap(Class<T> iface) throws SQLException {
20
        if (isWrapperFor(iface)) {
1✔
21
            return iface.cast(this);
1✔
22
        }
23
        return null;
1✔
24
    }
25

26
    @Override
27
    public boolean isWrapperFor(Class<?> iface) throws SQLException {
28
        return iface.isAssignableFrom(getClass());
1✔
29
    }
30

31
    @Override
32
    public PrintWriter getLogWriter() throws SQLException {
33
        return out;
1✔
34
    }
35

36
    @Override
37
    public void setLogWriter(PrintWriter out) throws SQLException {
38
        this.out = out;
1✔
39
    }
1✔
40

41
    @Override
42
    public void setLoginTimeout(int seconds) throws SQLException {
43
        loginTimeoutSeconds = seconds;
1✔
44
    }
1✔
45

46
    @Override
47
    public int getLoginTimeout() throws SQLException {
48
        return loginTimeoutSeconds;
1✔
49
    }
50

51
    @Override
52
    public Logger getParentLogger() throws SQLFeatureNotSupportedException {
53
        return null;
1✔
54
    }
55

56
    /**
57
     * This default implementation ignores the
58
     * username and password and delegates to {@link #getConnection()} unless
59
     * it is overridden.
60
     */
61
    @Override
62
    public Connection getConnection(String username, String password) throws SQLException {
NEW
63
        return getConnection();
×
64
    }
65
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc