Search in sources :

Example 1 with MSSQLValidConnectionChecker

use of com.alibaba.druid.pool.vendor.MSSQLValidConnectionChecker in project druid by alibaba.

the class MSSQLValidConnectionCheckerTest method test_closed.

public void test_closed() throws Exception {
    MSSQLValidConnectionChecker checker = new MSSQLValidConnectionChecker();
    MockConnection conn = new MockConnection();
    conn.close();
    Assert.assertFalse(checker.isValidConnection(conn, "select 1", 10));
}
Also used : MSSQLValidConnectionChecker(com.alibaba.druid.pool.vendor.MSSQLValidConnectionChecker) MockConnection(com.alibaba.druid.mock.MockConnection)

Example 2 with MSSQLValidConnectionChecker

use of com.alibaba.druid.pool.vendor.MSSQLValidConnectionChecker in project druid by alibaba.

the class MSSQLValidConnectionCheckerTest method test_error.

public void test_error() throws Exception {
    MSSQLValidConnectionChecker checker = new MSSQLValidConnectionChecker();
    MockConnection conn = new MockConnection();
    conn.setError(new SQLException());
    SQLException error = null;
    try {
        checker.isValidConnection(conn, "select 1", 10);
    } catch (SQLException ex) {
        error = ex;
    }
    Assert.assertNotNull(error);
    Assert.assertSame(error, conn.getError());
}
Also used : MSSQLValidConnectionChecker(com.alibaba.druid.pool.vendor.MSSQLValidConnectionChecker) SQLException(java.sql.SQLException) MockConnection(com.alibaba.druid.mock.MockConnection)

Example 3 with MSSQLValidConnectionChecker

use of com.alibaba.druid.pool.vendor.MSSQLValidConnectionChecker in project druid by alibaba.

the class MSSQLValidConnectionCheckerTest method test_0.

public void test_0() throws Exception {
    MSSQLValidConnectionChecker checker = new MSSQLValidConnectionChecker();
    MockConnection conn = new MockConnection();
    Assert.assertTrue(checker.isValidConnection(conn, "select 1", 10));
}
Also used : MSSQLValidConnectionChecker(com.alibaba.druid.pool.vendor.MSSQLValidConnectionChecker) MockConnection(com.alibaba.druid.mock.MockConnection)

Aggregations

MockConnection (com.alibaba.druid.mock.MockConnection)3 MSSQLValidConnectionChecker (com.alibaba.druid.pool.vendor.MSSQLValidConnectionChecker)3 SQLException (java.sql.SQLException)1