Ejemplo n.º 1
0
  public void test_error_validateConnection_3() throws Exception {
    dataSource.setValidationQuery(null);
    dataSource.setValidConnectionChecker(new MySqlValidConnectionChecker());

    {
      Exception error = null;
      try {
        DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
        dataSource.validateConnection(conn);
      } catch (SQLException ex) {
        error = ex;
      }
      Assert.assertNotNull(error);
    }
  }
Ejemplo n.º 2
0
  public void test_error_validateConnection_2() throws Exception {
    DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);

    conn.getConnection().close();

    {
      Exception error = null;
      try {
        dataSource.validateConnection(conn);
      } catch (SQLException ex) {
        error = ex;
      }
      Assert.assertNotNull(error);
    }
  }