@Test public void shouldNotRegisterTheSameDriverMultipleTimes() throws Exception { UnpooledDataSource dataSource = null; dataSource = new UnpooledDataSource("org.hsqldb.jdbcDriver", "jdbc:hsqldb:mem:multipledrivers", "sa", ""); dataSource.getConnection().close(); int before = countRegisteredDrivers(); dataSource = new UnpooledDataSource("org.hsqldb.jdbcDriver", "jdbc:hsqldb:mem:multipledrivers", "sa", ""); dataSource.getConnection().close(); assertEquals(before, countRegisteredDrivers()); }
@Override public Connection getConnection() throws SQLException { return doGetConnection(username, password); }
UnpooledDataSource implements DataSource { @Override public Connection getConnection() throws SQLException { return doGetConnection(username, password); } }
UnpooledDataSource implements DataSource { @Override public Connection getConnection() throws SQLException { return doGetConnection(username, password); } UnpooledDataSource();  UnpooledDataSource(String driver, String url, String username, String password);  UnpooledDataSource(String driver, String url, Properties driverProperties);  UnpooledDataSource(ClassLoader driverClassLoader, String driver, String url, String username, String password);  UnpooledDataSource(ClassLoader driverClassLoader, String driver, String url, Properties driverProperties); }
UnpooledDataSource implements DataSource { @Override public Connection getConnection() throws SQLException { return doGetConnection(username, password); } UnpooledDataSource();  UnpooledDataSource(String driver, String url, String username, String password);  UnpooledDataSource(String driver, String url, Properties driverProperties);  UnpooledDataSource(ClassLoader driverClassLoader, String driver, String url, String username, String password);  UnpooledDataSource(ClassLoader driverClassLoader, String driver, String url, Properties driverProperties); @Override Connection getConnection(); @Override Connection getConnection(String username, String password); @Override void setLoginTimeout(int loginTimeout); @Override int getLoginTimeout(); @Override void setLogWriter(PrintWriter logWriter); @Override PrintWriter getLogWriter(); ClassLoader getDriverClassLoader(); void setDriverClassLoader(ClassLoader driverClassLoader); Properties getDriverProperties(); void setDriverProperties(Properties driverProperties); String getDriver(); synchronized void setDriver(String driver); String getUrl(); void setUrl(String url); String getUsername(); void setUsername(String username); String getPassword(); void setPassword(String password); Boolean isAutoCommit(); void setAutoCommit(Boolean autoCommit); Integer getDefaultTransactionIsolationLevel(); void setDefaultTransactionIsolationLevel(Integer defaultTransactionIsolationLevel); @Override T unwrap(Class<T> iface); @Override boolean isWrapperFor(Class<?> iface); Logger getParentLogger(); }
UnpooledDataSource implements DataSource { @Override public Connection getConnection() throws SQLException { return doGetConnection(username, password); } UnpooledDataSource();  UnpooledDataSource(String driver, String url, String username, String password);  UnpooledDataSource(String driver, String url, Properties driverProperties);  UnpooledDataSource(ClassLoader driverClassLoader, String driver, String url, String username, String password);  UnpooledDataSource(ClassLoader driverClassLoader, String driver, String url, Properties driverProperties); @Override Connection getConnection(); @Override Connection getConnection(String username, String password); @Override void setLoginTimeout(int loginTimeout); @Override int getLoginTimeout(); @Override void setLogWriter(PrintWriter logWriter); @Override PrintWriter getLogWriter(); ClassLoader getDriverClassLoader(); void setDriverClassLoader(ClassLoader driverClassLoader); Properties getDriverProperties(); void setDriverProperties(Properties driverProperties); String getDriver(); synchronized void setDriver(String driver); String getUrl(); void setUrl(String url); String getUsername(); void setUsername(String username); String getPassword(); void setPassword(String password); Boolean isAutoCommit(); void setAutoCommit(Boolean autoCommit); Integer getDefaultTransactionIsolationLevel(); void setDefaultTransactionIsolationLevel(Integer defaultTransactionIsolationLevel); @Override T unwrap(Class<T> iface); @Override boolean isWrapperFor(Class<?> iface); Logger getParentLogger();  }