Пример #1
0
  public void test_config() throws Exception {
    Assert.assertEquals(true, dataSource.isTestOnBorrow()); // default
    Assert.assertEquals(8, dataSource.getMaxActive());

    Assert.assertEquals(1, dataSource.getProxyFilters().size());

    dataSource.init();

    Assert.assertEquals(false, dataSource.isTestOnBorrow());
    Assert.assertEquals(11, dataSource.getMaxActive());
    Assert.assertEquals("jdbc:mock:config-1", dataSource.getUrl());
    Assert.assertEquals(MockDriver.instance, dataSource.getDriver());
    Assert.assertEquals(3, dataSource.getProxyFilters().size());

    Connection conn = dataSource.getConnection();
    conn.close();
  }
  public void test_error_11() throws Exception {
    DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);

    conn.close();

    dataSource.getUrl();

    {
      Exception error = null;
      try {
        dataSource.setUrl("x");
      } catch (Exception ex) {
        error = ex;
      }
      Assert.assertNotNull(error);
    }
  }