use of com.alibaba.druid.pool.DruidPooledPreparedStatement.PreparedStatementKey in project druid by alibaba.
the class PreparedStatementKeyTest method test_equals_0.
public void test_equals_0() throws Exception {
PreparedStatementKey k1 = new PreparedStatementKey("x1", "c1", MethodType.M1);
PreparedStatementKey k2 = new PreparedStatementKey("x1", "c2", MethodType.M1);
PreparedStatementKey k3 = new PreparedStatementKey("x1", "c3", MethodType.M1);
Assert.assertFalse(k1.equals(k2));
Assert.assertFalse(k1.equals(k3));
Assert.assertFalse(k2.equals(k1));
Assert.assertFalse(k2.equals(k3));
Assert.assertFalse(k3.equals(k2));
Assert.assertFalse(k3.equals(k1));
}
use of com.alibaba.druid.pool.DruidPooledPreparedStatement.PreparedStatementKey in project druid by alibaba.
the class PreparedStatementKeyTest method test_contains.
public void test_contains() throws Exception {
DruidDataSource dataSource = new DruidDataSource();
MockConnection conn = new MockConnection();
PreparedStatementKey k1 = new PreparedStatementKey("x1", "c1", MethodType.M1);
PreparedStatementPool pool = new PreparedStatementPool(new DruidConnectionHolder(dataSource, conn, 0));
MockPreparedStatement raw = new MockPreparedStatement(null, null);
pool.put(new PreparedStatementHolder(k1, raw));
Assert.assertTrue(pool.get(k1) != null);
Assert.assertTrue(pool.get(k1) != null);
}
use of com.alibaba.druid.pool.DruidPooledPreparedStatement.PreparedStatementKey in project druid by alibaba.
the class PreparedStatementKeyTest method test_equals_2.
public void test_equals_2() throws Exception {
PreparedStatementKey k1 = new PreparedStatementKey("x1", "c1", MethodType.M1);
PreparedStatementKey k2 = new PreparedStatementKey("x2", "c1", MethodType.M1);
PreparedStatementKey k3 = new PreparedStatementKey("x3", "c1", MethodType.M1);
Assert.assertFalse(k1.equals(k2));
Assert.assertFalse(k1.equals(k3));
Assert.assertFalse(k2.equals(k1));
Assert.assertFalse(k2.equals(k3));
Assert.assertFalse(k3.equals(k2));
Assert.assertFalse(k3.equals(k1));
}
use of com.alibaba.druid.pool.DruidPooledPreparedStatement.PreparedStatementKey in project druid by alibaba.
the class PreparedStatementKeyTest method test_equals_5.
public void test_equals_5() throws Exception {
PreparedStatementKey k1 = new PreparedStatementKey("x1", null, MethodType.M1);
PreparedStatementKey k2 = new PreparedStatementKey("x1", null, MethodType.M2);
PreparedStatementKey k3 = new PreparedStatementKey("x1", null, MethodType.M3);
k1.hashCode();
Assert.assertFalse(k1.equals(k2));
Assert.assertFalse(k1.equals(k3));
Assert.assertFalse(k2.equals(k1));
Assert.assertFalse(k2.equals(k3));
Assert.assertFalse(k3.equals(k2));
Assert.assertFalse(k3.equals(k1));
}
use of com.alibaba.druid.pool.DruidPooledPreparedStatement.PreparedStatementKey in project druid by alibaba.
the class PreparedStatementKeyTest method test_equals_7.
public void test_equals_7() throws Exception {
PreparedStatementKey k1 = new PreparedStatementKey("x1", null, MethodType.M1, 0, 0);
PreparedStatementKey k2 = new PreparedStatementKey("x1", null, MethodType.M1, 1, 0);
PreparedStatementKey k3 = new PreparedStatementKey("x2", null, MethodType.M1, 0, 1);
k1.hashCode();
Assert.assertFalse(k1.equals(k2));
Assert.assertFalse(k1.equals(k3));
Assert.assertFalse(k2.equals(k1));
Assert.assertFalse(k2.equals(k3));
Assert.assertFalse(k3.equals(k2));
Assert.assertFalse(k3.equals(k1));
}
Aggregations