public void test_addListenerError() throws Exception { DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class); conn.close(); { Exception error = null; try { conn.addConnectionEventListener(null); } catch (IllegalStateException ex) { error = ex; } Assert.assertNotNull(error); } }
public void test_handleException_5() throws Exception { DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class); conn.addConnectionEventListener( new ConnectionEventListener() { @Override public void connectionClosed(ConnectionEvent event) {} @Override public void connectionErrorOccurred(ConnectionEvent event) {} }); conn.close(); { SQLException error = null; try { conn.handleException(new RuntimeException()); } catch (SQLException ex) { error = ex; } Assert.assertNotNull(error); } }
public void test_basic() throws Exception { DruidPooledConnection conn = (DruidPooledConnection) dataSource.getConnection(); conn.getTransactionInfo(); conn.getMetaData(); conn.setReadOnly(true); Assert.assertEquals(true, conn.isReadOnly()); conn.setCatalog("xxx"); Assert.assertEquals("xxx", conn.getCatalog()); conn.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); Assert.assertEquals(Connection.TRANSACTION_READ_COMMITTED, conn.getTransactionIsolation()); conn.getWarnings(); conn.clearWarnings(); conn.getTypeMap(); conn.setTypeMap(null); conn.setHoldability(ResultSet.CLOSE_CURSORS_AT_COMMIT); Assert.assertEquals(ResultSet.CLOSE_CURSORS_AT_COMMIT, conn.getHoldability()); conn.setSavepoint(); conn.setSavepoint("savepoint"); conn.rollback(); { Exception error = null; try { conn.rollback(null); } catch (SQLException e) { error = e; } Assert.assertNotNull(error); } { Exception error = null; try { conn.releaseSavepoint(null); } catch (SQLException e) { error = e; } Assert.assertNotNull(error); } conn.createBlob(); conn.createClob(); conn.createNClob(); conn.createSQLXML(); conn.isValid(200); conn.setClientInfo(new Properties()); conn.setClientInfo("xx", "11"); conn.getClientInfo("xx"); conn.getClientInfo(); conn.createArrayOf("int", new Object[0]); conn.createStruct("int", new Object[0]); conn.addConnectionEventListener(null); conn.removeConnectionEventListener(null); conn.addStatementEventListener(null); conn.removeStatementEventListener(null); conn.close(); }