JDBCCertRecordStoreConnection implements CertRecordStoreConnection { @Override public int deleteExpiredX509CertRecords(int expiryTimeMins) { int affectedRows; final String caller = "deleteExpiredX509CertRecords"; if (expiryTimeMins <= 0) { return 0; } try (PreparedStatement ps = con.prepareStatement(SQL_DELETE_EXPIRED_X509_RECORDS)) { ps.setInt(1, expiryTimeMins); affectedRows = executeUpdate(ps, caller); } catch (SQLException ex) { throw sqlError(ex, caller); } return affectedRows; } JDBCCertRecordStoreConnection(Connection con); @Override void setOperationTimeout(int queryTimeout); @Override void close(); @Override X509CertRecord getX509CertRecord(String provider, String instanceId, String service); @Override boolean updateX509CertRecord(X509CertRecord certRecord); @Override boolean insertX509CertRecord(X509CertRecord certRecord); @Override boolean deleteX509CertRecord(String provider, String instanceId, String service); @Override int deleteExpiredX509CertRecords(int expiryTimeMins); @Override List<X509CertRecord> updateUnrefreshedCertificatesNotificationTimestamp(String lastNotifiedServer,
                                                                      long lastNotifiedTime,
                                                                      String provider); static final String DB_COLUMN_INSTANCE_ID; static final String DB_COLUMN_INSTANCE_PROVIDER; static final String DB_COLUMN_SERVICE; static final String DB_COLUMN_CURRENT_IP; static final String DB_COLUMN_CURRENT_SERIAL; static final String DB_COLUMN_CURRENT_TIME; static final String DB_COLUMN_PREV_IP; static final String DB_COLUMN_PREV_SERIAL; static final String DB_COLUMN_PREV_TIME; static final String DB_COLUMN_CLIENT_CERT; static final String DB_COLUMN_LAST_NOTIFIED_TIME; static final String DB_COLUMN_LAST_NOTIFIED_SERVER; static final String DB_COLUMN_EXPIRY_TIME; static final String DB_COLUMN_HOSTNAME; }
@Test public void testdeleteExpiredX509CertRecords() throws Exception { JDBCCertRecordStoreConnection jdbcConn = new JDBCCertRecordStoreConnection(mockConn); Mockito.doReturn(1).when(mockPrepStmt).executeUpdate(); jdbcConn.deleteExpiredX509CertRecords(360); Mockito.verify(mockPrepStmt, times(1)).setInt(1, 360); jdbcConn.close(); }