@Test public void testEquals() throws Exception { JdbcPooledConnectionImpl con = createConnection(); String url = "jdbc:derby:memory:" + GUID.safeUUID() + ";create=true"; con.setConnectUrl(url); assertTrue(con.equals(con)); assertFalse(con.equals(null)); assertFalse(con.equals(new Object())); JdbcPooledConnectionImpl con2 = createConnection(); con2.setConnectUrl(url); assertFalse(con.equals(con2)); }
@Override public boolean equals(Object other) { if (other == null) return false; if (other == this) return true; if (other instanceof PluggableJdbcPooledConnection) { PluggableJdbcPooledConnection conn = (PluggableJdbcPooledConnection) other; return new EqualsBuilder().append(conn.getConnectUrl(), this.getConnectUrl()).append(conn.getDriverImp(), this.getDriverImp()) .append(conn.getAlwaysValidateConnection(), this.getAlwaysValidateConnection()) .append(conn.getDebugMode(), this.getDebugMode()).append(conn.getTestStatement(), this.getTestStatement()) .append(conn.getAutoCommit(), this.getAutoCommit()).append(conn.getConnectionProperties(), this.getConnectionProperties()) .append(conn.getBuilder(), this.getBuilder()).append(conn.getPoolProperties(), this.getPoolProperties()).isEquals(); } return false; }
PluggableJdbcPooledConnection extends JdbcPooledConnectionImpl { @Override public boolean equals(Object other) { if (other == null) return false; if (other == this) return true; if (other instanceof PluggableJdbcPooledConnection) { PluggableJdbcPooledConnection conn = (PluggableJdbcPooledConnection) other; return new EqualsBuilder().append(conn.getConnectUrl(), this.getConnectUrl()).append(conn.getDriverImp(), this.getDriverImp()) .append(conn.getAlwaysValidateConnection(), this.getAlwaysValidateConnection()) .append(conn.getDebugMode(), this.getDebugMode()).append(conn.getTestStatement(), this.getTestStatement()) .append(conn.getAutoCommit(), this.getAutoCommit()).append(conn.getConnectionProperties(), this.getConnectionProperties()) .append(conn.getBuilder(), this.getBuilder()).append(conn.getPoolProperties(), this.getPoolProperties()).isEquals(); } return false; } }
PluggableJdbcPooledConnection extends JdbcPooledConnectionImpl { @Override public boolean equals(Object other) { if (other == null) return false; if (other == this) return true; if (other instanceof PluggableJdbcPooledConnection) { PluggableJdbcPooledConnection conn = (PluggableJdbcPooledConnection) other; return new EqualsBuilder().append(conn.getConnectUrl(), this.getConnectUrl()).append(conn.getDriverImp(), this.getDriverImp()) .append(conn.getAlwaysValidateConnection(), this.getAlwaysValidateConnection()) .append(conn.getDebugMode(), this.getDebugMode()).append(conn.getTestStatement(), this.getTestStatement()) .append(conn.getAutoCommit(), this.getAutoCommit()).append(conn.getConnectionProperties(), this.getConnectionProperties()) .append(conn.getBuilder(), this.getBuilder()).append(conn.getPoolProperties(), this.getPoolProperties()).isEquals(); } return false; } PluggableJdbcPooledConnection(); }
PluggableJdbcPooledConnection extends JdbcPooledConnectionImpl { @Override public boolean equals(Object other) { if (other == null) return false; if (other == this) return true; if (other instanceof PluggableJdbcPooledConnection) { PluggableJdbcPooledConnection conn = (PluggableJdbcPooledConnection) other; return new EqualsBuilder().append(conn.getConnectUrl(), this.getConnectUrl()).append(conn.getDriverImp(), this.getDriverImp()) .append(conn.getAlwaysValidateConnection(), this.getAlwaysValidateConnection()) .append(conn.getDebugMode(), this.getDebugMode()).append(conn.getTestStatement(), this.getTestStatement()) .append(conn.getAutoCommit(), this.getAutoCommit()).append(conn.getConnectionProperties(), this.getConnectionProperties()) .append(conn.getBuilder(), this.getBuilder()).append(conn.getPoolProperties(), this.getPoolProperties()).isEquals(); } return false; } PluggableJdbcPooledConnection(); @Override boolean equals(Object other); @Override int hashCode(); ConnectionPoolBuilder getBuilder(); void setBuilder(ConnectionPoolBuilder builder); PluggableJdbcPooledConnection withBuilder(ConnectionPoolBuilder builder); KeyValuePairSet getPoolProperties(); void setPoolProperties(KeyValuePairSet kvps); KeyValuePairSet poolProperties(); PluggableJdbcPooledConnection withPoolProperties(KeyValuePairSet values); }
PluggableJdbcPooledConnection extends JdbcPooledConnectionImpl { @Override public boolean equals(Object other) { if (other == null) return false; if (other == this) return true; if (other instanceof PluggableJdbcPooledConnection) { PluggableJdbcPooledConnection conn = (PluggableJdbcPooledConnection) other; return new EqualsBuilder().append(conn.getConnectUrl(), this.getConnectUrl()).append(conn.getDriverImp(), this.getDriverImp()) .append(conn.getAlwaysValidateConnection(), this.getAlwaysValidateConnection()) .append(conn.getDebugMode(), this.getDebugMode()).append(conn.getTestStatement(), this.getTestStatement()) .append(conn.getAutoCommit(), this.getAutoCommit()).append(conn.getConnectionProperties(), this.getConnectionProperties()) .append(conn.getBuilder(), this.getBuilder()).append(conn.getPoolProperties(), this.getPoolProperties()).isEquals(); } return false; } PluggableJdbcPooledConnection(); @Override boolean equals(Object other); @Override int hashCode(); ConnectionPoolBuilder getBuilder(); void setBuilder(ConnectionPoolBuilder builder); PluggableJdbcPooledConnection withBuilder(ConnectionPoolBuilder builder); KeyValuePairSet getPoolProperties(); void setPoolProperties(KeyValuePairSet kvps); KeyValuePairSet poolProperties(); PluggableJdbcPooledConnection withPoolProperties(KeyValuePairSet values);  }